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

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

Issue 641583002: Rename wholeSubtree to adjacent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 250988215f7eec346be477df3f55375af0de70d8..6405565ad3c7c00445657a053b6e6f99b81504f4 100644
--- a/Source/core/css/RuleFeature.cpp
+++ b/Source/core/css/RuleFeature.cpp
@@ -263,21 +263,14 @@ const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec
}
}
- switch (current->relation()) {
- case CSSSelector::SubSelector:
- break;
- case CSSSelector::ShadowPseudo:
- case CSSSelector::ShadowDeep:
+ if (current->relation() == CSSSelector::SubSelector)
+ continue;
+
+ if (current->isShadowSelector())
features.treeBoundaryCrossing = true;
chrishtr 2014/10/10 16:26:02 Can be written as: features.treeBundaryCrossing =
rune 2014/10/10 20:00:35 Done.
- return current->tagHistory();
- case CSSSelector::DirectAdjacent:
- case CSSSelector::IndirectAdjacent:
- features.wholeSubtree = true;
- return current->tagHistory();
- case CSSSelector::Descendant:
- case CSSSelector::Child:
- return current->tagHistory();
- }
+
+ features.adjacent = current->isAdjacentSelector();
+ return current->tagHistory();
Mike West 2014/10/08 12:24:00 This is a huge improvement in readability. Kudos.
}
return 0;
}
@@ -291,7 +284,8 @@ const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec
// ContainerNode::checkForChildrenAdjacentRuleChanges.
//
// As we encounter a descendant type of combinator, the features only need to be checked
-// against descendants in the same subtree only. Hence wholeSubtree is reset to false.
+// against descendants in the same subtree only. features.adjacent is set to false, and
+// we start adding features instead of calling setWholeSubtreeInvalid.
void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, InvalidationSetFeatures& features)
{
@@ -299,7 +293,7 @@ void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelector(*current)) {
if (features.treeBoundaryCrossing)
invalidationSet->setTreeBoundaryCrossing();
- if (features.wholeSubtree) {
+ if (features.adjacent) {
invalidationSet->setWholeSubtreeInvalid();
} else {
if (!features.id.isEmpty())
@@ -322,23 +316,12 @@ void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
addFeaturesToInvalidationSets(*selector, features);
}
}
- switch (current->relation()) {
- case CSSSelector::SubSelector:
- break;
- case CSSSelector::ShadowPseudo:
- case CSSSelector::ShadowDeep:
+
+ if (current->isShadowSelector())
features.treeBoundaryCrossing = true;
- features.wholeSubtree = false;
- break;
- case CSSSelector::Descendant:
- case CSSSelector::Child:
- features.wholeSubtree = false;
- break;
- case CSSSelector::DirectAdjacent:
- case CSSSelector::IndirectAdjacent:
- features.wholeSubtree = true;
- break;
- }
+
+ if (current->relation() != CSSSelector::SubSelector)
+ features.adjacent = current->isAdjacentSelector();
Mike West 2014/10/08 12:24:00 This is even better. :)
}
}
« 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