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

Unified Diff: Source/core/css/RuleFeature.cpp

Issue 462593002: Support invalidation sets for negated selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@tmp-upstream
Patch Set: Rebased Created 6 years, 4 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/RuleFeature.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/RuleFeature.cpp
diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp
index 0a91ffe656f8e63d530c024d6851e5b166ae762c..23e821930aa27db742e350dcc2bac6983686346a 100644
--- a/Source/core/css/RuleFeature.cpp
+++ b/Source/core/css/RuleFeature.cpp
@@ -132,9 +132,12 @@ RuleFeatureSet::InvalidationSetMode RuleFeatureSet::invalidationSetModeForSelect
// We have found an invalidation set feature in the rightmost compound selector.
foundIdent = true;
}
- } else if (component->pseudoType() == CSSSelector::PseudoHost || component->pseudoType() == CSSSelector::PseudoAny) {
+ } else if (component->pseudoType() == CSSSelector::PseudoNot
+ || component->pseudoType() == CSSSelector::PseudoHost
+ || component->pseudoType() == CSSSelector::PseudoAny) {
if (const CSSSelectorList* selectorList = component->selectorList()) {
- bool foundUniversal = false;
+ // Features inside :not() are not added to the feature set, so consider it a universal selector.
+ bool foundUniversal = component->pseudoType() == CSSSelector::PseudoNot;
for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(*selector)) {
// 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
@@ -229,21 +232,22 @@ RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const
return mode;
InvalidationSetFeatures features;
- if (const CSSSelector* current = extractInvalidationSetFeatures(selector, features))
+ if (const CSSSelector* current = extractInvalidationSetFeatures(selector, features, false))
addFeaturesToInvalidationSets(*current, features);
return AddFeatures;
}
-const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelector& selector, InvalidationSetFeatures& features)
+const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelector& selector, InvalidationSetFeatures& features, bool negated)
{
for (const CSSSelector* current = &selector; current; current = current->tagHistory()) {
- extractInvalidationSetFeature(*current, features);
+ if (!negated)
+ extractInvalidationSetFeature(*current, features);
// Initialize the entry in the invalidation set map, if supported.
invalidationSetForSelector(*current);
- if (current->pseudoType() == CSSSelector::PseudoHost || current->pseudoType() == CSSSelector::PseudoAny) {
+ if (current->pseudoType() == CSSSelector::PseudoHost || current->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelector::PseudoNot) {
if (const CSSSelectorList* selectorList = current->selectorList()) {
for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(*selector))
- extractInvalidationSetFeatures(*selector, features);
+ extractInvalidationSetFeatures(*selector, features, current->pseudoType() == CSSSelector::PseudoNot);
}
}
@@ -297,10 +301,11 @@ void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
if (features.customPseudoElement)
invalidationSet->setCustomPseudoInvalid();
}
- } else if (current->pseudoType() == CSSSelector::PseudoHost || current->pseudoType() == CSSSelector::PseudoAny) {
+ } else {
if (current->pseudoType() == CSSSelector::PseudoHost)
features.treeBoundaryCrossing = true;
if (const CSSSelectorList* selectorList = current->selectorList()) {
+ ASSERT(current->pseudoType() == CSSSelector::PseudoHost || current->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelector::PseudoNot);
for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(*selector))
addFeaturesToInvalidationSets(*selector, features);
}
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698