Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index 012967caef11cc8d3c2409116e47e70469253ebb..c051a646d3a1a35bf175d1d397e8389ced5b0518 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) |
vsevik
2014/03/26 08:33:44
Looks like this could be moved to TreeBoundaryCros
lushnikov
2014/03/26 14:04:36
Done.
|
{ |
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(); |
@@ -400,46 +400,6 @@ StyleResolver::~StyleResolver() |
m_viewportStyleResolver->clearDocument(); |
} |
-inline void StyleResolver::collectTreeBoundaryCrossingRules(Element* element, ElementRuleCollector& collector, bool includeEmptyRules) |
vsevik
2014/03/26 08:33:44
I am not sure if it is OK that this method is not
|
-{ |
- if (m_treeBoundaryCrossingRules.isEmpty()) |
- return; |
- |
- RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); |
- |
- // When comparing rules declared in outer treescopes, outer's rules win. |
- CascadeOrder outerCascadeOrder = m_treeBoundaryCrossingRules.size() + m_treeBoundaryCrossingRules.size(); |
- // When comparing rules declared in inner treescopes, inner's rules win. |
- CascadeOrder innerCascadeOrder = m_treeBoundaryCrossingRules.size(); |
- |
- for (DocumentOrderedList::iterator it = m_treeBoundaryCrossingRules.begin(); it != m_treeBoundaryCrossingRules.end(); ++it) { |
- const ContainerNode* scopingNode = toContainerNode(*it); |
- |
- if (ShadowRoot* shadowRoot = scopingNode->containingShadowRoot()) { |
- if (!shadowRoot->isActiveForStyling()) |
- continue; |
- } |
- |
- RuleSet* ruleSet = m_treeBoundaryCrossingRules.ruleSetScopedBy(scopingNode); |
- unsigned boundaryBehavior = SelectorChecker::ScopeContainsLastMatchedElement; |
- bool isInnerTreeScope = element->treeScope().isInclusiveAncestorOf(scopingNode->treeScope()); |
- |
- // If a given scoping node is a shadow root and a given element is in a descendant tree of tree hosted by |
- // the scoping node's shadow host, we should use ScopeIsShadowHost. |
- if (scopingNode && scopingNode->isShadowRoot()) { |
- if (element->isInDescendantTreeOf(toShadowRoot(scopingNode)->host())) |
- boundaryBehavior |= SelectorChecker::ScopeIsShadowHost; |
- scopingNode = toShadowRoot(scopingNode)->host(); |
- } |
- |
- CascadeOrder cascadeOrder = isInnerTreeScope ? innerCascadeOrder : outerCascadeOrder; |
- |
- collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, scopingNode), ruleRange, static_cast<SelectorChecker::BehaviorAtBoundary>(boundaryBehavior), ignoreCascadeScope, cascadeOrder); |
- ++innerCascadeOrder; |
- --outerCascadeOrder; |
- } |
-} |
- |
static inline bool applyAuthorStylesOf(const Element* element) |
{ |
return element->treeScope().applyAuthorStyles() || (element->shadow() && element->shadow()->applyAuthorStyles()); |
@@ -463,7 +423,7 @@ void StyleResolver::matchAuthorRulesForShadowHost(Element* element, ElementRuleC |
for (unsigned i = 0; i < resolvers.size(); ++i) |
resolvers.at(i)->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, cascadeScope++, --cascadeOrder); |
- collectTreeBoundaryCrossingRules(element, collector, includeEmptyRules); |
+ m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collector, includeEmptyRules); |
collector.sortAndTransferMatchedRules(); |
} |
@@ -475,7 +435,7 @@ void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col |
bool applyAuthorStyles = applyAuthorStylesOf(element); |
if (m_styleTree.hasOnlyScopedResolverForDocument()) { |
m_styleTree.scopedStyleResolverForDocument()->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, ignoreCascadeScope); |
- collectTreeBoundaryCrossingRules(element, collector, includeEmptyRules); |
+ m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collector, includeEmptyRules); |
collector.sortAndTransferMatchedRules(); |
return; |
} |
@@ -501,7 +461,7 @@ void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col |
resolver->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, cascadeScope++, resolver->treeScope() == element->treeScope() && resolver->scopingNode().isShadowRoot() ? 0 : cascadeOrder); |
} |
- collectTreeBoundaryCrossingRules(element, collector, includeEmptyRules); |
+ m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collector, includeEmptyRules); |
collector.sortAndTransferMatchedRules(); |
} |