Node* ComposedShadowTreeWalker::traverseChild(const Node* node, TraversalDirection direction) const { ASSERT(node); if (canCrossUpperBoundary()) { ElementShadow* shadow = shadowFor(node); return shadow ? traverseLightChildren(shadow->shadowRoot(), direction) : traverseLightChildren(node, direction); } if (isShadowHost(node)) return 0; return traverseLightChildren(node, direction); }
void StyleScopeResolver::matchHostRules(const Element* element, Vector<RuleSet*>& matchedRules) { if (m_atHostRules.isEmpty()) return; ElementShadow* shadow = element->shadow(); if (!shadow) return; // FIXME(99827): https://bugs.webkit.org/show_bug.cgi?id=99827 // add a new flag to ElementShadow and cache whether any @host @-rules are // applied to the element or not. So we can quickly exit this method // by using the flag. if (ShadowRoot* shadowRoot = shadow->shadowRoot()) { if (RuleSet* ruleSet = atHostRuleSetFor(shadowRoot)) matchedRules.append(ruleSet); } }
bool StyleScopeResolver::styleSharingCandidateMatchesHostRules(const Element* element) { if (m_atHostRules.isEmpty()) return false; ElementShadow* shadow = element->shadow(); if (!shadow) return false; // FIXME(99827): https://bugs.webkit.org/show_bug.cgi?id=99827 // add a new flag to ElementShadow and cache whether any@host @-rules are // applied to the element or not. So we can avoid always traversing // shadow roots. if (ShadowRoot* shadowRoot = shadow->shadowRoot()) { if (atHostRuleSetFor(shadowRoot)) return true; } return false; }