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(); |
} |
} |