void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRules, CSSStyleSheet* parentStyleSheet, unsigned sheetIndex) { bool isDocumentScope = treeScope().rootNode().isDocumentNode(); if (authorRules.deepCombinatorOrShadowPseudoRules().isEmpty() && (isDocumentScope || (authorRules.contentPseudoElementRules().isEmpty() && authorRules.slottedPseudoElementRules().isEmpty()))) return; if (!authorRules.deepCombinatorOrShadowPseudoRules().isEmpty()) m_hasDeepOrShadowSelector = true; OwnPtrWillBeRawPtr<RuleSet> ruleSetForScope = RuleSet::create(); addRules(ruleSetForScope.get(), authorRules.deepCombinatorOrShadowPseudoRules()); if (!isDocumentScope) { addRules(ruleSetForScope.get(), authorRules.contentPseudoElementRules()); addRules(ruleSetForScope.get(), authorRules.slottedPseudoElementRules()); } if (!m_treeBoundaryCrossingRuleSet) { m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRuleSubSet()); treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(treeScope().rootNode()); } m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope.release())); }