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

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

Issue 286903024: Skip child ShadowRoots when invalidation does not have boundary crossing rules (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Move checks per review Created 6 years, 7 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') | Source/core/css/invalidation/DescendantInvalidationSet.h » ('j') | 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 6adb2dc6fcfdb6c2da48c0f0d9dc3528d7449be8..398617cce869c69683dc59e9130fb3a7568afb5a 100644
--- a/Source/core/css/RuleFeature.cpp
+++ b/Source/core/css/RuleFeature.cpp
@@ -207,13 +207,8 @@ RuleFeatureSet::InvalidationSetMode RuleFeatureSet::updateInvalidationSets(const
return mode;
InvalidationSetFeatures features;
- const CSSSelector* current = extractInvalidationSetFeatures(selector, features);
- if (current) {
- bool wholeSubtree = current->relation() == CSSSelector::DirectAdjacent || current->relation() == CSSSelector::IndirectAdjacent;
- current = current->tagHistory();
- if (current)
- addFeaturesToInvalidationSets(*current, features, wholeSubtree);
- }
+ if (const CSSSelector* current = extractInvalidationSetFeatures(selector, features))
+ addFeaturesToInvalidationSets(*current, features);
return AddFeatures;
}
@@ -231,17 +226,26 @@ const CSSSelector* RuleFeatureSet::extractInvalidationSetFeatures(const CSSSelec
}
}
+ if (lastSelector->relation() == CSSSelector::ShadowPseudo || lastSelector->relation() == CSSSelector::ShadowDeep)
chrishtr 2014/05/29 21:43:43 Changing these to a switch statement would be a li
+ features.treeBoundaryCrossing = true;
+ else if (lastSelector->relation() == CSSSelector::DirectAdjacent || lastSelector->relation() == CSSSelector::IndirectAdjacent)
+ features.wholeSubtree = true;
+
if (lastSelector->relation() != CSSSelector::SubSelector)
break;
}
- return lastSelector;
+ if (lastSelector)
+ return lastSelector->tagHistory();
+ return 0;
}
-void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, const InvalidationSetFeatures& features, bool wholeSubtree)
+void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, InvalidationSetFeatures& features)
{
for (const CSSSelector* current = &selector; current; current = current->tagHistory()) {
if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelector(*current)) {
- if (wholeSubtree) {
+ if (features.treeBoundaryCrossing)
+ invalidationSet->setTreeBoundaryCrossing();
+ if (features.wholeSubtree) {
invalidationSet->setWholeSubtreeInvalid();
} else {
if (!features.id.isEmpty())
@@ -256,28 +260,29 @@ void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector,
invalidationSet->setCustomPseudoInvalid();
}
} else if (current->pseudoType() == CSSSelector::PseudoHost || current->pseudoType() == CSSSelector::PseudoAny) {
+ if (current->pseudoType() == CSSSelector::PseudoHost)
+ features.treeBoundaryCrossing = true;
if (const CSSSelectorList* selectorList = current->selectorList()) {
for (const CSSSelector* selector = selectorList->first(); selector; selector = CSSSelectorList::next(*selector))
- addFeaturesToInvalidationSets(*selector, features, wholeSubtree);
+ addFeaturesToInvalidationSets(*selector, features);
}
}
switch (current->relation()) {
case CSSSelector::Descendant:
case CSSSelector::Child:
+ features.wholeSubtree = false;
+ break;
case CSSSelector::ShadowPseudo:
case CSSSelector::ShadowDeep:
- wholeSubtree = false;
+ features.treeBoundaryCrossing = true;
+ features.wholeSubtree = false;
break;
case CSSSelector::DirectAdjacent:
case CSSSelector::IndirectAdjacent:
- wholeSubtree = true;
+ features.wholeSubtree = true;
break;
case CSSSelector::SubSelector:
break;
- default:
- // All combinators should be handled above.
- ASSERT_NOT_REACHED();
- break;
}
}
}
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | Source/core/css/invalidation/DescendantInvalidationSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698