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

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

Issue 652703002: Separate method for adding features to an invalidation set. (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 7c3a7e66b2f47c30a4bfc2965421141da4493ae6..69ea193992b9bec69ff3659e3801a1fd1dbc4775 100644
--- a/Source/core/css/RuleFeature.cpp
+++ b/Source/core/css/RuleFeature.cpp
@@ -284,26 +284,31 @@ const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec
// against descendants in the same subtree only. features.adjacent is set to false, and
// we start adding features instead of calling setWholeSubtreeInvalid.
+void RuleFeatureSet::addFeaturesToInvalidationSet(DescendantInvalidationSet& invalidationSet, const InvalidationSetFeatures& features)
+{
+ if (features.treeBoundaryCrossing)
+ invalidationSet.setTreeBoundaryCrossing();
+ if (features.adjacent) {
+ invalidationSet.setWholeSubtreeInvalid();
+ return;
+ }
+ if (!features.id.isEmpty())
+ invalidationSet.addId(features.id);
+ if (!features.tagName.isEmpty())
+ invalidationSet.addTagName(features.tagName);
+ for (const auto& className : features.classes)
+ invalidationSet.addClass(className);
+ for (const auto& attribute : features.attributes)
+ invalidationSet.addAttribute(attribute);
+ if (features.customPseudoElement)
+ invalidationSet.setCustomPseudoInvalid();
+}
+
void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, InvalidationSetFeatures& features)
{
for (const CSSSelector* current = &selector; current; current = current->tagHistory()) {
if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelector(*current)) {
- if (features.treeBoundaryCrossing)
- invalidationSet->setTreeBoundaryCrossing();
- if (features.adjacent) {
- invalidationSet->setWholeSubtreeInvalid();
- } else {
- if (!features.id.isEmpty())
- invalidationSet->addId(features.id);
- if (!features.tagName.isEmpty())
- invalidationSet->addTagName(features.tagName);
- for (const auto& className : features.classes)
- invalidationSet->addClass(className);
- for (const auto& attribute : features.attributes)
- invalidationSet->addAttribute(attribute);
- if (features.customPseudoElement)
- invalidationSet->setCustomPseudoInvalid();
- }
+ addFeaturesToInvalidationSet(*invalidationSet, features);
} else {
if (current->pseudoType() == CSSSelector::PseudoHost)
features.treeBoundaryCrossing = true;
@@ -314,11 +319,13 @@ void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
}
}
+ if (current->relation() == CSSSelector::SubSelector)
chrishtr 2014/10/13 15:44:31 Why is this continue needed here? Is it because we
rune 2014/10/13 21:42:57 Yes, without this "continue", we'd have to check f
chrishtr 2014/10/13 22:00:25 Let me put it in a different way: what would be th
rune 2014/10/13 22:08:09 Something like: // No combinator to update flags
+ continue;
+
if (current->isShadowSelector())
chrishtr 2014/10/13 15:44:31 Is isShadowSelector() checked in?
rune 2014/10/13 21:42:57 I don't understand.
chrishtr 2014/10/13 22:00:25 Nevermind. I tried codesearching for this method e
features.treeBoundaryCrossing = true;
- if (current->relation() != CSSSelector::SubSelector)
- features.adjacent = current->isAdjacentSelector();
+ features.adjacent = current->isAdjacentSelector();
}
}
« 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