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

Unified Diff: Source/core/css/invalidation/StyleInvalidator.cpp

Issue 1349543004: CSS: Avoid invalidating style when only descendants need updating (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: invalidatesSelf Created 5 years, 3 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/invalidation/InvalidationSet.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/invalidation/StyleInvalidator.cpp
diff --git a/Source/core/css/invalidation/StyleInvalidator.cpp b/Source/core/css/invalidation/StyleInvalidator.cpp
index 517a78403201a0eaa2aec12b3f7efd0916fb8b23..f35d30bee26f77a0f33070c8827d67bf0049f1c8 100644
--- a/Source/core/css/invalidation/StyleInvalidator.cpp
+++ b/Source/core/css/invalidation/StyleInvalidator.cpp
@@ -50,10 +50,11 @@ void StyleInvalidator::scheduleInvalidation(PassRefPtrWillBeRawPtr<InvalidationS
clearInvalidation(element);
return;
}
- if (invalidationSet->isEmpty()) {
+ if (invalidationSet->invalidatesSelf())
element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator));
+
+ if (invalidationSet->isEmpty())
return;
- }
InvalidationList& list = ensurePendingInvalidationList(element);
list.append(invalidationSet);
@@ -128,6 +129,7 @@ ALWAYS_INLINE bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element
recursionData.setWholeSubtreeInvalid();
return false;
}
+ bool thisElementNeedsStyleRecalc = recursionData.matchesCurrentInvalidationSets(element);
if (element.needsStyleInvalidation()) {
if (InvalidationList* invalidationList = m_pendingInvalidationMap.get(&element)) {
for (const auto& invalidationSet : *invalidationList)
@@ -138,11 +140,9 @@ ALWAYS_INLINE bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element
TRACE_EVENT_SCOPE_THREAD,
"data", InspectorStyleInvalidatorInvalidateEvent::invalidationList(element, *invalidationList));
}
- return true;
}
}
-
- return recursionData.matchesCurrentInvalidationSets(element);
+ return thisElementNeedsStyleRecalc;
}
bool StyleInvalidator::invalidateChildren(Element& element, StyleInvalidator::RecursionData& recursionData)
« no previous file with comments | « Source/core/css/invalidation/InvalidationSet.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698