Chromium Code Reviews

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

Issue 365063005: Invalidation set features recognized left of adjacent. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added more tests Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: Source/core/css/RuleFeature.cpp
diff --git a/Source/core/css/RuleFeature.cpp b/Source/core/css/RuleFeature.cpp
index 26aea450ff0eeee0dc418e2384698ddb8d7683e9..75af986dfdf2af2346bf9c8d28c999733361c3c0 100644
--- a/Source/core/css/RuleFeature.cpp
+++ b/Source/core/css/RuleFeature.cpp
@@ -119,44 +119,30 @@ void RuleFeature::trace(Visitor* visitor)
// This method is somewhat conservative in what it accepts.
RuleFeatureSet::InvalidationSetMode RuleFeatureSet::invalidationSetModeForSelector(const CSSSelector& selector)
{
- bool foundDescendantRelation = false;
+ bool foundCombinator = false;
bool foundIdent = false;
for (const CSSSelector* component = &selector; component; component = component->tagHistory()) {
if (component->match() == CSSSelector::Class || component->match() == CSSSelector::Id
|| (component->match() == CSSSelector::Tag && component->tagQName().localName() != starAtom)
|| component->isAttributeSelector() || component->isCustomPseudoElement()) {
- if (!foundDescendantRelation)
+ if (!foundCombinator)
foundIdent = true;
} else if (component->pseudoType() == CSSSelector::PseudoHost || component->pseudoType() == CSSSelector::PseudoAny) {
if (const CSSSelectorList* selectorList = component->selectorList()) {
for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(*selector)) {
InvalidationSetMode hostMode = invalidationSetModeForSelector(*selector);
if (hostMode == UseSubtreeStyleChange)
- return foundDescendantRelation ? UseLocalStyleChange : UseSubtreeStyleChange;
- if (!foundDescendantRelation && hostMode == AddFeatures)
+ return foundCombinator ? UseLocalStyleChange : UseSubtreeStyleChange;
+ if (!foundCombinator && hostMode == AddFeatures)
foundIdent = true;
}
}
} else if (!isSkippableComponentForInvalidation(*component)) {
- return foundDescendantRelation ? UseLocalStyleChange : UseSubtreeStyleChange;
- }
- switch (component->relation()) {
- case CSSSelector::Descendant:
- case CSSSelector::Child:
- case CSSSelector::ShadowPseudo:
- case CSSSelector::ShadowDeep:
- foundDescendantRelation = true;
- // Fall through!
- case CSSSelector::SubSelector:
- case CSSSelector::DirectAdjacent:
- case CSSSelector::IndirectAdjacent:
- continue;
- default:
- // All combinators should be handled above.
- ASSERT_NOT_REACHED();
- return UseLocalStyleChange;
+ return foundCombinator ? UseLocalStyleChange : UseSubtreeStyleChange;
}
+ if (component->relation() != CSSSelector::SubSelector)
+ foundCombinator = true;
}
return foundIdent ? AddFeatures : UseLocalStyleChange;
}

Powered by Google App Engine