Index: Source/core/css/resolver/ScopedStyleResolver.cpp |
diff --git a/Source/core/css/resolver/ScopedStyleResolver.cpp b/Source/core/css/resolver/ScopedStyleResolver.cpp |
index 268f13c70fe8d60b21fc0b7a5e0db2983e8c4178..b5c3ad333bac1d9ebc1fd33ff30e5a3582165d42 100644 |
--- a/Source/core/css/resolver/ScopedStyleResolver.cpp |
+++ b/Source/core/css/resolver/ScopedStyleResolver.cpp |
@@ -46,6 +46,12 @@ |
namespace blink { |
+ScopedStyleResolver::~ScopedStyleResolver() |
+{ |
+ if (m_treeBoundaryCrossingRuleSet) |
+ treeScope().document().styleEngine().removeTreeBoundaryCrossingScope(); |
+} |
+ |
TreeScope* ScopedStyleResolver::treeScopeFor(Document& document, const CSSStyleSheet* sheet) |
{ |
ASSERT(sheet); |
@@ -131,6 +137,7 @@ void ScopedStyleResolver::resetAuthorStyle() |
m_authorStyleSheets.clear(); |
m_keyframesRuleMap.clear(); |
m_treeBoundaryCrossingRuleSet = nullptr; |
+ treeScope().document().styleEngine().removeTreeBoundaryCrossingScope(); |
} |
StyleRuleKeyframes* ScopedStyleResolver::keyframeStylesForAnimation(const StringImpl* animationName) |
@@ -160,36 +167,44 @@ void ScopedStyleResolver::addKeyframeStyle(PassRefPtrWillBeRawPtr<StyleRuleKeyfr |
} |
} |
-void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) |
+void ScopedStyleResolver::collectMatchingAuthorRules(ElementRuleCollector& collector, bool includeEmptyRules) |
{ |
ASSERT(!collector.scopeContainsLastMatchedElement()); |
collector.setScopeContainsLastMatchedElement(true); |
for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
ASSERT(m_authorStyleSheets[i]->ownerNode()); |
MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); |
- collector.collectMatchingRules(matchRequest, cascadeOrder); |
+ collector.collectMatchingRules(matchRequest); |
} |
collector.setScopeContainsLastMatchedElement(false); |
} |
-void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) |
+void ScopedStyleResolver::collectMatchingShadowHostRules(ElementRuleCollector& collector, bool includeEmptyRules) |
{ |
ASSERT(!collector.scopeContainsLastMatchedElement()); |
collector.setScopeContainsLastMatchedElement(true); |
for (size_t i = 0; i < m_authorStyleSheets.size(); ++i) { |
ASSERT(m_authorStyleSheets[i]->ownerNode()); |
MatchRequest matchRequest(&m_authorStyleSheets[i]->contents()->ruleSet(), includeEmptyRules, &m_scope->rootNode(), m_authorStyleSheets[i], i); |
- collector.collectMatchingShadowHostRules(matchRequest, cascadeOrder); |
+ collector.collectMatchingShadowHostRules(matchRequest); |
} |
collector.setScopeContainsLastMatchedElement(false); |
} |
-void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector& collector, bool includeEmptyRules, CascadeOrder cascadeOrder) |
+void ScopedStyleResolver::collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector& collector, bool includeEmptyRules) |
{ |
+ if (!m_treeBoundaryCrossingRuleSet) |
+ return; |
+ |
+ ASSERT(!collector.scopeContainsLastMatchedElement()); |
+ collector.setScopeContainsLastMatchedElement(true); |
+ |
for (const auto& rules : *m_treeBoundaryCrossingRuleSet) { |
MatchRequest request(rules->m_ruleSet.get(), includeEmptyRules, &treeScope().rootNode(), rules->m_parentStyleSheet, rules->m_parentIndex); |
- collector.collectMatchingRules(request, cascadeOrder, true); |
+ collector.collectMatchingRules(request, true); |
} |
+ |
+ collector.setScopeContainsLastMatchedElement(false); |
} |
void ScopedStyleResolver::matchPageRules(PageRuleCollector& collector) |
@@ -240,7 +255,7 @@ void ScopedStyleResolver::addTreeBoundaryCrossingRules(const RuleSet& authorRule |
if (!m_treeBoundaryCrossingRuleSet) { |
m_treeBoundaryCrossingRuleSet = adoptPtrWillBeNoop(new CSSStyleSheetRuleSubSet()); |
- treeScope().document().styleResolver()->addTreeBoundaryCrossingScope(treeScope().rootNode()); |
+ treeScope().document().styleEngine().addTreeBoundaryCrossingScope(); |
} |
m_treeBoundaryCrossingRuleSet->append(RuleSubSet::create(parentStyleSheet, sheetIndex, ruleSetForScope.release())); |