Index: Source/core/css/RuleFeature.cpp |
diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp |
index 75af986dfdf2af2346bf9c8d28c999733361c3c0..4f2a14b482c99e83407c64b7a97c0c9e44176ba6 100644 |
--- a/Source/core/css/RuleFeature.cpp |
+++ b/Source/core/css/RuleFeature.cpp |
@@ -126,16 +126,37 @@ RuleFeatureSet::InvalidationSetMode RuleFeatureSet::invalidationSetModeForSelect |
if (component->match() == CSSSelector::Class || component->match() == CSSSelector::Id |
|| (component->match() == CSSSelector::Tag && component->tagQName().localName() != starAtom) |
|| component->isAttributeSelector() || component->isCustomPseudoElement()) { |
- if (!foundCombinator) |
+ if (!foundCombinator) { |
+ // We have found an invalidation set feature in the rightmost compound selector. |
foundIdent = true; |
+ } |
} else if (component->pseudoType() == CSSSelector::PseudoHost || component->pseudoType() == CSSSelector::PseudoAny) { |
if (const CSSSelectorList* selectorList = component->selectorList()) { |
+ bool foundUniversal = false; |
for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(*selector)) { |
- InvalidationSetMode hostMode = invalidationSetModeForSelector(*selector); |
- if (hostMode == UseSubtreeStyleChange) |
+ // Find the invalidation set mode for each of the selectors in the selector list |
+ // of a :not(), :host(), etc. For instance, ".x :-webkit-any(.a, .b)" yields an |
+ // AddFeatures mode for both ".a" and ".b". ":-webkit-any(.a, *)" yields AddFeatures |
+ // for ".a", but UseSubtreeStyleChange for "*". One sub-selector without invalidation |
+ // set features is sufficient to cause the selector to be a universal selector as far |
+ // the invalidation set is concerned. |
+ InvalidationSetMode subSelectorMode = invalidationSetModeForSelector(*selector); |
+ |
+ // The sub-selector contained something unskippable, fall back to whole subtree |
+ // recalcs in collectFeaturesFromSelector. |
+ if (subSelectorMode == UseSubtreeStyleChange) |
return foundCombinator ? UseLocalStyleChange : UseSubtreeStyleChange; |
chrishtr
2014/07/11 18:14:08
Please explain in the comment why it is sometimes
rune
2014/07/11 21:02:57
I have to investigate why the _UseSubtreeStyleChan
rune
2014/07/11 21:49:37
Done.
|
- if (!foundCombinator && hostMode == AddFeatures) |
- foundIdent = true; |
+ |
+ // We found no features in the sub-selector, only skippable ones (foundIdent was |
+ // false at the end of this method). That is a universal selector as far as the |
+ // invalidation set is concerned. |
+ if (subSelectorMode == UseLocalStyleChange) |
+ foundUniversal = true; |
+ } |
+ if (!foundUniversal && !foundCombinator) { |
+ // All sub-selectors contained invalidation set features and |
+ // we are in the rightmost compound selector. |
+ foundIdent = true; |
} |
} |
} else if (!isSkippableComponentForInvalidation(*component)) { |