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

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

Issue 2059163002: Schedule sibling invalidation sets for sibling insert/remove. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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/css/invalidation/StyleInvalidator.cpp
diff --git a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
index a6a9e97eb93c60761f4b17c731b2198ff525dcb3..7a19138c8213271b8f4d9676d13de203d8611f81 100644
--- a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
+++ b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
@@ -88,6 +88,46 @@ void StyleInvalidator::scheduleInvalidationSetsForElement(const InvalidationList
}
}
+void StyleInvalidator::rescheduleSiblingInvalidationSetsForRemovedElement(Element& elementFrom, Element& elementTo, bool invalidateElementTo)
+{
+ PendingInvalidations* pendingInvalidationsFrom = m_pendingInvalidationMap.get(&elementFrom);
+ if (!pendingInvalidationsFrom || pendingInvalidationsFrom->siblings().isEmpty())
+ return;
+
+ scheduleDescendantsFromSiblingSets(elementTo, pendingInvalidationsFrom->siblings());
+ ensurePendingInvalidations(elementTo).siblings().appendVector(pendingInvalidationsFrom->siblings());
+ elementTo.setNeedsStyleInvalidation();
+}
+
+void StyleInvalidator::scheduleDescendantsFromSiblingSets(Element& element, const InvalidationSetVector& siblingSets)
+{
+ bool needsStyleInvalidation = false;
+ PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(element);
+ for (const auto& invalidationSet : siblingSets) {
+ if (!invalidationSet->invalidatesElement(element))
+ continue;
+
+ if (invalidationSet->invalidatesSelf())
+ element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator));
+
+ DescendantInvalidationSet* descendants = toSiblingInvalidationSet(*invalidationSet).siblingDescendants();
+ if (!descendants)
+ continue;
+
+ if (descendants->wholeSubtreeInvalid()) {
+ element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator));
+ continue;
+ }
+ if (descendants->isEmpty())
+ continue;
+
+ pendingInvalidations.descendants().append(descendants);
+ needsStyleInvalidation = true;
+ }
+ if (needsStyleInvalidation)
+ element.setNeedsStyleInvalidation();
+}
+
void StyleInvalidator::clearInvalidation(Element& element)
{
if (!element.needsStyleInvalidation())

Powered by Google App Engine
This is Rietveld 408576698