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

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

Issue 206043009: Setup parent stylesheet for tree boundary crossing rules. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 140773fb2dee03c3e1d0285b002a1039cccfd8ae..fc0612d5060e4cdb2806ead062a2a77149b81467 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -246,21 +246,21 @@ void StyleResolver::resetRuleFeatures()
m_needCollectFeatures = true;
}
-void StyleResolver::addTreeBoundaryCrossingRules(const WillBeHeapVector<MinimalRuleData>& rules, ContainerNode* scope)
+void StyleResolver::addTreeBoundaryCrossingRules(const WillBeHeapVector<MinimalRuleData>& rules, ContainerNode* scope, CSSStyleSheet* parentStyleSheet)
{
for (unsigned i = 0; i < rules.size(); ++i) {
const MinimalRuleData& info = rules[i];
- m_treeBoundaryCrossingRules.addRule(info.m_rule, info.m_selectorIndex, scope, info.m_flags);
+ m_treeBoundaryCrossingRules.addRule(info.m_rule, info.m_selectorIndex, scope, parentStyleSheet, info.m_flags);
}
}
-void StyleResolver::processScopedRules(const RuleSet& authorRules, const KURL& sheetBaseURL, ContainerNode* scope)
+void StyleResolver::processScopedRules(const RuleSet& authorRules, CSSStyleSheet* parentStyleSheet, ContainerNode* scope)
{
const WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes> > keyframesRules = authorRules.keyframesRules();
for (unsigned i = 0; i < keyframesRules.size(); ++i)
ensureScopedStyleResolver(scope)->addKeyframeStyle(keyframesRules[i]);
- addTreeBoundaryCrossingRules(authorRules.treeBoundaryCrossingRules(), scope);
+ addTreeBoundaryCrossingRules(authorRules.treeBoundaryCrossingRules(), scope, parentStyleSheet);
// FIXME(BUG 72461): We don't add @font-face rules of scoped style sheets for the moment.
if (!scope || scope->isDocumentNode()) {
@@ -270,7 +270,7 @@ void StyleResolver::processScopedRules(const RuleSet& authorRules, const KURL& s
if (fontFaceRules.size())
invalidateMatchedPropertiesCache();
} else {
- addTreeBoundaryCrossingRules(authorRules.shadowDistributedRules(), scope);
+ addTreeBoundaryCrossingRules(authorRules.shadowDistributedRules(), scope, parentStyleSheet);
}
}
@@ -282,7 +282,7 @@ void StyleResolver::resetAuthorStyle(const ContainerNode* scopingNode)
if (!resolver)
return;
- treeBoundaryCrossingRules().reset(scopingNode);
+ m_treeBoundaryCrossingRules.reset(scopingNode);
resolver->resetAuthorStyle();
resetRuleFeatures();
@@ -420,7 +420,7 @@ inline void StyleResolver::collectTreeBoundaryCrossingRules(Element* element, El
continue;
}
- RuleSet* ruleSet = m_treeBoundaryCrossingRules.ruleSetScopedBy(scopingNode);
+ TreeBoundaryCrossingRules::CSSStyleSheetRuleSubSet* styleSheetsRuleSubSets = m_treeBoundaryCrossingRules.ruleSetScopedBy(scopingNode);
unsigned boundaryBehavior = SelectorChecker::ScopeContainsLastMatchedElement;
bool isInnerTreeScope = element->treeScope().isInclusiveAncestorOf(scopingNode->treeScope());
@@ -433,8 +433,10 @@ inline void StyleResolver::collectTreeBoundaryCrossingRules(Element* element, El
}
CascadeOrder cascadeOrder = isInnerTreeScope ? innerCascadeOrder : outerCascadeOrder;
-
- collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, scopingNode), ruleRange, static_cast<SelectorChecker::BehaviorAtBoundary>(boundaryBehavior), ignoreCascadeScope, cascadeOrder);
+ for (TreeBoundaryCrossingRules::CSSStyleSheetRuleSubSet::iterator it = styleSheetsRuleSubSets->begin(); it != styleSheetsRuleSubSets->end(); ++it) {
+ RuleSet* ruleSet = it->value.get();
+ collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, scopingNode, it->key), ruleRange, static_cast<SelectorChecker::BehaviorAtBoundary>(boundaryBehavior), ignoreCascadeScope, cascadeOrder);
+ }
++innerCascadeOrder;
--outerCascadeOrder;
}
« Source/core/css/resolver/MatchRequest.h ('K') | « Source/core/css/resolver/StyleResolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698