本文整理汇总了C++中ContainerNode::parentOrShadowHostNode方法的典型用法代码示例。如果您正苦于以下问题:C++ ContainerNode::parentOrShadowHostNode方法的具体用法?C++ ContainerNode::parentOrShadowHostNode怎么用?C++ ContainerNode::parentOrShadowHostNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContainerNode
的用法示例。
在下文中一共展示了ContainerNode::parentOrShadowHostNode方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: depthCrossingShadowBoundaries
static unsigned depthCrossingShadowBoundaries(Node* node)
{
unsigned depth = 0;
for (ContainerNode* parent = node->parentOrShadowHostNode(); parent; parent = parent->parentOrShadowHostNode())
++depth;
return depth;
}
示例2: setupScopedStylesTree
void ScopedStyleTree::setupScopedStylesTree(ScopedStyleResolver* target)
{
ASSERT(target);
const ContainerNode& scopingNode = target->scopingNode();
// Since StyleResolver creates RuleSets according to styles' document
// order, a parent of the given ScopedRuleData has been already
// prepared.
for (ContainerNode* node = scopingNode.parentOrShadowHostNode(); node; node = node->parentOrShadowHostNode()) {
if (ScopedStyleResolver* scopedResolver = scopedStyleResolverFor(*node)) {
target->setParent(scopedResolver);
break;
}
if (node->isDocumentNode()) {
bool dummy;
ScopedStyleResolver* scopedResolver = addScopedStyleResolver(*node, dummy);
target->setParent(scopedResolver);
setupScopedStylesTree(scopedResolver);
break;
}
}
if (m_buildInDocumentOrder)
return;
// Reparent all nodes whose scoping node is contained by target's one.
for (HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::iterator it = m_authorStyles.begin(); it != m_authorStyles.end(); ++it) {
if (it->value == target)
continue;
ASSERT(it->key->inDocument());
if (it->value->parent() == target->parent() && scopingNode.containsIncludingShadowDOM(it->key))
it->value->setParent(target);
}
}
示例3: canLoadFrame
bool SubframeLoadingDisabler::canLoadFrame(HTMLFrameOwnerElement& owner)
{
for (ContainerNode* node = &owner; node; node = node->parentOrShadowHostNode()) {
if (disabledSubtreeRoots().contains(node))
return false;
}
return true;
}
示例4: popStyleCache
void ScopedStyleTree::popStyleCache(const ContainerNode& scopingNode)
{
if (!cacheIsValid(&scopingNode))
return;
if (m_cache.scopedResolver && m_cache.scopedResolver->scopingNode() == scopingNode)
m_cache.scopedResolver = m_cache.scopedResolver->parent();
m_cache.nodeForScopedStyles = scopingNode.parentOrShadowHostNode();
}
示例5: clearContentFrame
void HTMLFrameOwnerElement::clearContentFrame()
{
if (!m_contentFrame)
return;
m_contentFrame = 0;
for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode())
node->decrementConnectedSubframeCount();
}
示例6: setContentFrame
void HTMLFrameOwnerElement::setContentFrame(Frame& frame)
{
// Make sure we will not end up with two frames referencing the same owner element.
ASSERT(!m_contentFrame || m_contentFrame->ownerElement() != this);
// Disconnected frames should not be allowed to load.
ASSERT(inDocument());
m_contentFrame = &frame;
for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode())
node->incrementConnectedSubframeCount();
}
示例7: ownerSVGElement
SVGSVGElement* SVGElement::ownerSVGElement() const
{
ContainerNode* n = parentOrShadowHostNode();
while (n) {
if (n->hasTagName(SVGNames::svgTag))
return toSVGSVGElement(n);
n = n->parentOrShadowHostNode();
}
return 0;
}
示例8: ownerSVGElement
SVGSVGElement* SVGElement::ownerSVGElement() const
{
ContainerNode* n = parentOrShadowHostNode();
while (n) {
if (isSVGSVGElement(*n))
return toSVGSVGElement(n);
n = n->parentOrShadowHostNode();
}
return nullptr;
}
示例9: ownerSVGElement
SVGSVGElement* SVGElement::ownerSVGElement() const
{
ContainerNode* node = parentOrShadowHostNode();
while (node) {
if (is<SVGSVGElement>(*node))
return downcast<SVGSVGElement>(node);
node = node->parentOrShadowHostNode();
}
return nullptr;
}
示例10: viewportElement
SVGElement* SVGElement::viewportElement() const
{
// This function needs shadow tree support - as RenderSVGContainer uses this function
// to determine the "overflow" property. <use> on <symbol> wouldn't work otherwhise.
ContainerNode* n = parentOrShadowHostNode();
while (n) {
if (n->hasTagName(SVGNames::svgTag) || isSVGImageElement(n) || n->hasTagName(SVGNames::symbolTag))
return toSVGElement(n);
n = n->parentOrShadowHostNode();
}
return 0;
}
示例11: viewportElement
SVGElement* SVGElement::viewportElement() const
{
// This function needs shadow tree support - as LayoutSVGContainer uses this function
// to determine the "overflow" property. <use> on <symbol> wouldn't work otherwhise.
ContainerNode* n = parentOrShadowHostNode();
while (n) {
if (isSVGSVGElement(*n) || isSVGImageElement(*n) || isSVGSymbolElement(*n))
return toSVGElement(n);
n = n->parentOrShadowHostNode();
}
return nullptr;
}
示例12: viewportElement
SVGElement* SVGElement::viewportElement() const
{
// This function needs shadow tree support - as RenderSVGContainer uses this function
// to determine the "overflow" property. <use> on <symbol> wouldn't work otherwhise.
ContainerNode* node = parentOrShadowHostNode();
while (node) {
if (is<SVGSVGElement>(*node) || is<SVGImageElement>(*node) || node->hasTagName(SVGNames::symbolTag))
return downcast<SVGElement>(node);
node = node->parentOrShadowHostNode();
}
return nullptr;
}
示例13: setUpFullyClippedStack
void FullyClippedStateStack::setUpFullyClippedStack(Node* node)
{
// Put the nodes in a vector so we can iterate in reverse order.
WillBeHeapVector<RawPtrWillBeMember<ContainerNode>, 100> ancestry;
for (ContainerNode* parent = node->parentOrShadowHostNode(); parent; parent = parent->parentOrShadowHostNode())
ancestry.append(parent);
// Call pushFullyClippedState on each node starting with the earliest ancestor.
size_t ancestrySize = ancestry.size();
for (size_t i = 0; i < ancestrySize; ++i)
pushFullyClippedState(ancestry[ancestrySize - i - 1]);
pushFullyClippedState(node);
ASSERT(size() == 1 + depthCrossingShadowBoundaries(node));
}
示例14: getEventListeners
void EventListenerInfo::getEventListeners(EventTarget* target, WillBeHeapVector<EventListenerInfo>& eventInformation, bool includeAncestors)
{
// The Node's Ancestors including self.
WillBeHeapVector<RawPtrWillBeMember<EventTarget>> ancestors;
ancestors.append(target);
if (includeAncestors) {
Node* node = target->toNode();
for (ContainerNode* ancestor = node ? node->parentOrShadowHostNode() : nullptr; ancestor; ancestor = ancestor->parentOrShadowHostNode())
ancestors.append(ancestor);
}
// Nodes and their Listeners for the concerned event types (order is top to bottom)
for (size_t i = ancestors.size(); i; --i) {
EventTarget* ancestor = ancestors[i - 1];
Vector<AtomicString> eventTypes = ancestor->eventTypes();
for (size_t j = 0; j < eventTypes.size(); ++j) {
AtomicString& type = eventTypes[j];
EventListenerVector* listeners = ancestor->getEventListeners(type);
if (!listeners)
continue;
EventListenerVector filteredListeners;
filteredListeners.reserveCapacity(listeners->size());
for (size_t k = 0; k < listeners->size(); ++k) {
if (listeners->at(k).listener->type() == EventListener::JSEventListenerType)
filteredListeners.append(listeners->at(k));
}
if (!filteredListeners.isEmpty())
eventInformation.append(EventListenerInfo(ancestor, type, filteredListeners));
}
}
}