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

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2683373003: RuleSet invalidations on single feature only, including tags. (Closed)
Patch Set: Trace type ruleset invalidation 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
Index: third_party/WebKit/Source/core/dom/StyleEngine.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
index 6a5d1cee16dcd80a5e82f980cc0b12abbbd8b548..6e45ea566bc69d899b8ce3824dfbc8432eb114c6 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -820,27 +820,39 @@ void StyleEngine::scheduleRuleSetInvalidationsForElement(
InvalidationLists invalidationLists;
for (const auto& ruleSet : ruleSets) {
- if (!id.isNull())
- ruleSet->features().collectInvalidationSetsForId(invalidationLists,
- element, id);
+ if (!id.isNull()) {
+ ruleSet->features().collectInvalidationSetsForId(
+ invalidationLists, element, id,
+ RuleFeatureSet::InvalidationSetFilter::RuleSetInvalidation);
+ }
if (classNames) {
unsigned classNameCount = classNames->size();
- for (size_t i = 0; i < classNameCount; i++)
+ for (size_t i = 0; i < classNameCount; i++) {
ruleSet->features().collectInvalidationSetsForClass(
- invalidationLists, element, (*classNames)[i]);
+ invalidationLists, element, (*classNames)[i],
+ RuleFeatureSet::InvalidationSetFilter::RuleSetInvalidation);
+ }
}
- for (const Attribute& attribute : element.attributes())
+ for (const Attribute& attribute : element.attributes()) {
ruleSet->features().collectInvalidationSetsForAttribute(
- invalidationLists, element, attribute.name());
- if (ruleSet->tagRules(element.localNameForSelectorMatching()))
- element.setNeedsStyleRecalc(LocalStyleChange,
- StyleChangeReasonForTracing::create(
- StyleChangeReason::StyleSheetChange));
+ invalidationLists, element, attribute.name(),
+ RuleFeatureSet::InvalidationSetFilter::RuleSetInvalidation);
+ }
}
m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists,
element);
}
+void StyleEngine::scheduleTypeRuleSetInvalidations(
+ ContainerNode& node,
+ const HeapHashSet<Member<RuleSet>>& ruleSets) {
+ InvalidationLists invalidationLists;
+ for (const auto& ruleSet : ruleSets)
+ ruleSet->features().collectTypeRuleInvalidationSet(invalidationLists, node);
+ DCHECK(invalidationLists.siblings.isEmpty());
+ m_styleInvalidator.scheduleInvalidationSetsForNode(invalidationLists, node);
+}
+
void StyleEngine::invalidateSlottedElements(HTMLSlotElement& slot) {
for (auto& node : slot.getDistributedNodes()) {
if (node->isElementNode())
@@ -863,6 +875,8 @@ void StyleEngine::scheduleInvalidationsForRuleSets(
TRACE_EVENT0("blink,blink_style",
"StyleEngine::scheduleInvalidationsForRuleSets");
+ scheduleTypeRuleSetInvalidations(treeScope.rootNode(), ruleSets);
+
bool invalidateSlotted = false;
if (treeScope.rootNode().isShadowRoot()) {
Element& host = toShadowRoot(treeScope.rootNode()).host();
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/dom/StyleEngineTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698