本文整理汇总了C++中ShadowRoot::hostElement方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadowRoot::hostElement方法的具体用法?C++ ShadowRoot::hostElement怎么用?C++ ShadowRoot::hostElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadowRoot
的用法示例。
在下文中一共展示了ShadowRoot::hostElement方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shouldEventCrossShadowBoundary
static inline bool shouldEventCrossShadowBoundary(Event& event, ShadowRoot& shadowRoot, EventTarget& target)
{
Node* targetNode = target.toNode();
#if ENABLE(FULLSCREEN_API) && ENABLE(VIDEO)
// Video-only full screen is a mode where we use the shadow DOM as an implementation
// detail that should not be detectable by the web content.
if (targetNode) {
if (Element* element = targetNode->document().webkitCurrentFullScreenElement()) {
// FIXME: We assume that if the full screen element is a media element that it's
// the video-only full screen. Both here and elsewhere. But that is probably wrong.
if (element->isMediaElement() && shadowRoot.hostElement() == element)
return false;
}
}
#endif
// WebKit never allowed selectstart event to cross the the shadow DOM boundary.
// Changing this breaks existing sites.
// See https://bugs.webkit.org/show_bug.cgi?id=52195 for details.
const AtomicString& eventType = event.type();
bool targetIsInShadowRoot = targetNode && targetNode->treeScope().rootNode() == &shadowRoot;
return !targetIsInShadowRoot
|| !(eventType == eventNames().abortEvent
|| eventType == eventNames().changeEvent
|| eventType == eventNames().errorEvent
|| eventType == eventNames().loadEvent
|| eventType == eventNames().resetEvent
|| eventType == eventNames().resizeEvent
|| eventType == eventNames().scrollEvent
|| eventType == eventNames().selectEvent
|| eventType == eventNames().selectstartEvent);
}
示例2: removedFrom
void InsertionPoint::removedFrom(ContainerNode* insertionPoint)
{
ShadowRoot* root = containingShadowRoot();
if (!root)
root = insertionPoint->containingShadowRoot();
if (root && root->hostElement()) {
root->invalidateDistribution();
root->distributor().invalidateInsertionPointList();
}
// Since this insertion point is no longer visible from the shadow subtree, it need to clean itself up.
clearDistribution();
HTMLElement::removedFrom(insertionPoint);
}