| 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())
|
|
|