| Index: Source/core/css/resolver/StyleResolver.cpp
|
| diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
|
| index 0b7fed403e24beea4efa5379bc0cbf167b76ec87..c8a5cd329c379284e01d86334357e3c1076005a1 100644
|
| --- a/Source/core/css/resolver/StyleResolver.cpp
|
| +++ b/Source/core/css/resolver/StyleResolver.cpp
|
| @@ -379,21 +379,12 @@
|
| }
|
| }
|
|
|
| -void StyleResolver::matchElementScopeRules(const Element& element, ScopedStyleResolver* elementScopeResolver, ElementRuleCollector& collector, bool includeEmptyRules)
|
| -{
|
| - if (elementScopeResolver) {
|
| - collector.clearMatchedRules();
|
| - elementScopeResolver->collectMatchingAuthorRules(collector, includeEmptyRules);
|
| - elementScopeResolver->collectMatchingTreeBoundaryCrossingRules(collector, includeEmptyRules);
|
| - collector.sortAndTransferMatchedRules();
|
| - }
|
| -
|
| - if (element.isStyledElement() && element.inlineStyle() && !collector.isCollectingForPseudoElement()) {
|
| - // Inline style is immutable as long as there is no CSSOM wrapper.
|
| - bool isInlineStyleCacheable = !element.inlineStyle()->isMutable();
|
| - collector.addElementStyleProperties(element.inlineStyle(), isInlineStyleCacheable);
|
| - }
|
| -
|
| +void StyleResolver::matchElementScopeRules(ScopedStyleResolver& elementScopeResolver, ElementRuleCollector& collector, bool includeEmptyRules)
|
| +{
|
| + collector.clearMatchedRules();
|
| + elementScopeResolver.collectMatchingAuthorRules(collector, includeEmptyRules);
|
| + elementScopeResolver.collectMatchingTreeBoundaryCrossingRules(collector, includeEmptyRules);
|
| + collector.sortAndTransferMatchedRules();
|
| collector.finishAddingAuthorRulesForTreeScope();
|
| }
|
|
|
| @@ -406,7 +397,7 @@
|
| // scope, only tree-boundary-crossing rules may match.
|
|
|
| ScopedStyleResolver* elementScopeResolver = scopedResolverFor(element);
|
| - bool matchElementScopeDone = !elementScopeResolver && !element.inlineStyle();
|
| + bool matchElementScopeDone = !elementScopeResolver;
|
|
|
| for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCrossingScopes.rend(); ++it) {
|
| const TreeScope& scope = (*it)->treeScope();
|
| @@ -422,7 +413,7 @@
|
| // to a scope which appears before the element's scope in the tree-of-trees order.
|
| // Try to match all rules from the element's scope.
|
|
|
| - matchElementScopeRules(element, elementScopeResolver, collector, includeEmptyRules);
|
| + matchElementScopeRules(*elementScopeResolver, collector, includeEmptyRules);
|
| if (resolver == elementScopeResolver) {
|
| // Boundary-crossing rules already collected in matchElementScopeRules.
|
| continue;
|
| @@ -436,7 +427,7 @@
|
| }
|
|
|
| if (!matchElementScopeDone)
|
| - matchElementScopeRules(element, elementScopeResolver, collector, includeEmptyRules);
|
| + matchElementScopeRules(*elementScopeResolver, collector, includeEmptyRules);
|
| }
|
|
|
| void StyleResolver::matchAuthorRules(const Element& element, ElementRuleCollector& collector, bool includeEmptyRules)
|
| @@ -498,6 +489,18 @@
|
| matchAuthorRules(*state.element(), collector, false);
|
|
|
| if (state.element()->isStyledElement()) {
|
| + // TODO(rune@opera.com): Adding style attribute rules here is probably too late
|
| + // when you have shadow piercing combinators. When we don't have piercing combinators,
|
| + // the style attribute always belong to the outermost scope whose rules apply to
|
| + // the element. Thus, applying inline style here is correct. Fixing this for piercing
|
| + // combinators means moving the code below into matchElementScopeRules and _not_
|
| + // invoking it for pseudo style requests.
|
| + if (state.element()->inlineStyle()) {
|
| + // Inline style is immutable as long as there is no CSSOM wrapper.
|
| + bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMutable();
|
| + collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable);
|
| + }
|
| +
|
| // Now check SMIL animation override style.
|
| if (includeSMILProperties && state.element()->isSVGElement())
|
| collector.addElementStyleProperties(toSVGElement(state.element())->animatedSMILStyleProperties(), false /* isCacheable */);
|
|
|