Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Unified Diff: Source/core/css/resolver/ScopedStyleResolver.cpp

Issue 1134173002: Get rid of TreeBoundaryCrossingRules. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missing important UA rules. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.h ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()));
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.h ('k') | Source/core/css/resolver/StyleResolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698