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

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

Issue 2703643003: Schedule a type selector invalidation set for RuleSet invalidations. (Closed)
Patch Set: Corrected expectation text. Created 3 years, 10 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 | « third_party/WebKit/Source/core/css/RuleFeature.h ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/RuleFeature.cpp
diff --git a/third_party/WebKit/Source/core/css/RuleFeature.cpp b/third_party/WebKit/Source/core/css/RuleFeature.cpp
index 08019325975e25d31b277e4d5add573c176e9c9f..ec4bba5004290332d40f28f73d7f983534890f93 100644
--- a/third_party/WebKit/Source/core/css/RuleFeature.cpp
+++ b/third_party/WebKit/Source/core/css/RuleFeature.cpp
@@ -467,8 +467,7 @@ void RuleFeatureSet::updateInvalidationSets(const RuleData& ruleData) {
const CSSSelector* nextCompound =
lastInCompound ? lastInCompound->tagHistory() : &ruleData.selector();
if (!nextCompound) {
- if (!features.hasFeaturesForRuleSetInvalidation)
- m_metadata.needsFullRecalcForRuleSetInvalidation = true;
+ updateRuleSetInvalidation(features);
return;
}
if (lastInCompound)
@@ -476,9 +475,17 @@ void RuleFeatureSet::updateInvalidationSets(const RuleData& ruleData) {
siblingFeatures, features);
addFeaturesToInvalidationSets(*nextCompound, siblingFeatures, features);
+ updateRuleSetInvalidation(features);
+}
- if (!features.hasFeaturesForRuleSetInvalidation)
- m_metadata.needsFullRecalcForRuleSetInvalidation = true;
+void RuleFeatureSet::updateRuleSetInvalidation(
+ const InvalidationSetFeatures& features) {
+ if (!features.hasFeaturesForRuleSetInvalidation) {
+ if (features.forceSubtree || features.tagNames.isEmpty())
+ m_metadata.needsFullRecalcForRuleSetInvalidation = true;
+ else
+ addTagNamesToTypeRuleInvalidationSet(features.tagNames);
+ }
}
void RuleFeatureSet::updateInvalidationSetsForContentAttribute(
@@ -608,7 +615,7 @@ const CSSSelector* RuleFeatureSet::extractInvalidationSetFeaturesFromCompound(
if (!simpleSelector->tagHistory() ||
simpleSelector->relation() != CSSSelector::SubSelector) {
features.hasFeaturesForRuleSetInvalidation =
- features.hasTagIdClassOrAttribute();
+ features.hasIdClassOrAttribute();
return simpleSelector;
}
}
@@ -1160,6 +1167,14 @@ void RuleFeatureSet::addFeaturesToUniversalSiblingInvalidationSet(
descendantFeatures);
}
+void RuleFeatureSet::addTagNamesToTypeRuleInvalidationSet(
+ const Vector<AtomicString>& tagNames) {
+ DCHECK(!tagNames.isEmpty());
+ ensureTypeRuleInvalidationSet();
+ for (auto tagName : tagNames)
+ m_typeRuleInvalidationSet->addTagName(tagName);
+}
+
DEFINE_TRACE(RuleFeatureSet) {
visitor->trace(m_siblingRules);
visitor->trace(m_uncommonAttributeRules);
@@ -1190,9 +1205,8 @@ bool RuleFeatureSet::InvalidationSetFeatures::hasFeatures() const {
!tagNames.isEmpty() || customPseudoElement;
}
-bool RuleFeatureSet::InvalidationSetFeatures::hasTagIdClassOrAttribute() const {
- return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty() ||
- !tagNames.isEmpty();
+bool RuleFeatureSet::InvalidationSetFeatures::hasIdClassOrAttribute() const {
+ return !classes.isEmpty() || !attributes.isEmpty() || !ids.isEmpty();
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/css/RuleFeature.h ('k') | third_party/WebKit/Source/core/dom/StyleEngine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698