本文整理汇总了C++中ContainerNode::shadowRoot方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerNode::shadowRoot方法的具体用法?C++ ContainerNode::shadowRoot怎么用?C++ ContainerNode::shadowRoot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerNode
的用法示例。
在下文中一共展示了ContainerNode::shadowRoot方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: notifyDescendantInsertedIntoTree
static void notifyDescendantInsertedIntoTree(ContainerNode& insertionPoint, ContainerNode& node, NodeVector& postInsertionNotificationTargets)
{
for (Node* child = node.firstChild(); child; child = child->nextSibling()) {
if (is<ContainerNode>(*child))
notifyNodeInsertedIntoTree(insertionPoint, downcast<ContainerNode>(*child), postInsertionNotificationTargets);
}
if (ShadowRoot* root = node.shadowRoot())
notifyNodeInsertedIntoTree(insertionPoint, *root, postInsertionNotificationTargets);
}
示例2: ASSERT
ComposedTreeIterator::ComposedTreeIterator(ContainerNode& root, Node& current)
: m_rootIsInShadowTree(root.isInShadowTree())
{
ASSERT(!is<ShadowRoot>(root));
ASSERT(!is<ShadowRoot>(current));
bool mayNeedShadowStack = root.shadowRoot() || (¤t != &root && current.parentNode() != &root);
if (mayNeedShadowStack)
initializeContextStack(root, current);
else
m_contextStack.uncheckedAppend(Context(root, current));
}
示例3: if
EventPath::EventPath(Node& originalTarget, Event& event)
: m_event(event)
{
bool isMouseOrFocusEvent = event.isMouseEvent() || event.isFocusEvent();
#if ENABLE(TOUCH_EVENTS)
bool isTouchEvent = event.isTouchEvent();
#endif
Node* node = nodeOrHostIfPseudoElement(&originalTarget);
Node* target = node ? eventTargetRespectingTargetRules(*node) : nullptr;
while (node) {
while (node) {
EventTarget* currentTarget = eventTargetRespectingTargetRules(*node);
if (isMouseOrFocusEvent)
m_path.append(std::make_unique<MouseOrFocusEventContext>(node, currentTarget, target));
#if ENABLE(TOUCH_EVENTS)
else if (isTouchEvent)
m_path.append(std::make_unique<TouchEventContext>(node, currentTarget, target));
#endif
else
m_path.append(std::make_unique<EventContext>(node, currentTarget, target));
if (is<ShadowRoot>(*node))
break;
ContainerNode* parent = node->parentNode();
if (!parent)
return;
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
if (ShadowRoot* shadowRootOfParent = parent->shadowRoot()) {
if (auto* assignedSlot = shadowRootOfParent->findAssignedSlot(*node)) {
// node is assigned to a slot. Continue dispatching the event at this slot.
parent = assignedSlot;
}
}
#endif
node = parent;
}
bool exitingShadowTreeOfTarget = &target->treeScope() == &node->treeScope();
ShadowRoot& shadowRoot = downcast<ShadowRoot>(*node);
if (!shouldEventCrossShadowBoundary(event, shadowRoot, originalTarget))
return;
node = shadowRoot.host();
if (exitingShadowTreeOfTarget)
target = eventTargetRespectingTargetRules(*node);
}
}
示例4: if
EventPath::EventPath(Node& originalTarget, Event& event)
: m_event(event)
{
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
Vector<EventTarget*, 16> targetStack;
#endif
bool isMouseOrFocusEvent = event.isMouseEvent() || event.isFocusEvent();
#if ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)
bool isTouchEvent = event.isTouchEvent();
#endif
EventTarget* target = nullptr;
Node* node = nodeOrHostIfPseudoElement(&originalTarget);
while (node) {
if (!target)
target = eventTargetRespectingTargetRules(*node);
ContainerNode* parent;
for (; node; node = parent) {
EventTarget* currentTarget = eventTargetRespectingTargetRules(*node);
if (isMouseOrFocusEvent)
m_path.append(std::make_unique<MouseOrFocusEventContext>(node, currentTarget, target));
#if ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)
else if (isTouchEvent)
m_path.append(std::make_unique<TouchEventContext>(node, currentTarget, target));
#endif
else
m_path.append(std::make_unique<EventContext>(node, currentTarget, target));
if (is<ShadowRoot>(*node))
break;
parent = node->parentNode();
if (!parent)
return;
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
if (ShadowRoot* shadowRootOfParent = parent->shadowRoot()) {
if (auto* assignedSlot = shadowRootOfParent->findAssignedSlot(*node)) {
// node is assigned to a slot. Continue dispatching the event at this slot.
targetStack.append(target);
parent = assignedSlot;
target = assignedSlot;
}
}
#endif
node = parent;
}
ShadowRoot& shadowRoot = downcast<ShadowRoot>(*node);
// At a shadow root. Continue dispatching the event at the shadow host.
#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
if (!targetStack.isEmpty()) {
// Move target back to a descendant of the shadow host if the event did not originate in this shadow tree or its inner shadow trees.
target = targetStack.last();
targetStack.removeLast();
ASSERT(shadowRoot.host()->contains(target->toNode()));
} else
#endif
target = nullptr;
if (!shouldEventCrossShadowBoundary(event, shadowRoot, originalTarget))
return;
node = shadowRoot.host();
}
}
示例5: if
NodeRenderingContext::NodeRenderingContext(Node* node)
: m_phase(AttachingNotInTree)
, m_node(node)
, m_parentNodeForRenderingAndStyle(0)
, m_visualParentShadow(0)
, m_insertionPoint(0)
, m_style(0)
, m_parentFlowRenderer(0)
{
ContainerNode* parent = m_node->parentOrHostNode();
if (!parent)
return;
if (parent->isShadowRoot() && toShadowRoot(parent)->isYoungest()) {
m_phase = AttachingShadowChild;
m_parentNodeForRenderingAndStyle = toShadowRoot(parent)->host();
return;
}
if (parent->isElementNode() || parent->isShadowRoot()) {
if (parent->isElementNode())
m_visualParentShadow = toElement(parent)->shadow();
else if (parent->isShadowRoot())
m_visualParentShadow = toShadowRoot(parent)->owner();
if (m_visualParentShadow) {
if ((m_insertionPoint = m_visualParentShadow->insertionPointFor(m_node))) {
if (m_insertionPoint->shadowRoot()->isUsedForRendering()) {
m_phase = AttachingDistributed;
m_parentNodeForRenderingAndStyle = NodeRenderingContext(m_insertionPoint).parentNodeForRenderingAndStyle();
return;
}
}
m_phase = AttachingNotDistributed;
m_parentNodeForRenderingAndStyle = parent;
return;
}
if (isShadowBoundary(parent)) {
if (!parent->shadowRoot()->isUsedForRendering()) {
m_phase = AttachingNotDistributed;
m_parentNodeForRenderingAndStyle = parent;
return;
}
if (toInsertionPoint(parent)->hasDistribution())
m_phase = AttachingNotFallbacked;
else
m_phase = AttachingFallbacked;
if (toInsertionPoint(parent)->isActive())
m_parentNodeForRenderingAndStyle = NodeRenderingContext(parent).parentNodeForRenderingAndStyle();
else
m_parentNodeForRenderingAndStyle = parent;
return;
}
}
m_phase = AttachingStraight;
m_parentNodeForRenderingAndStyle = parent;
}