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 453479c8ce684b202d19f90d1ff2e7c511924bf1..db5fa17e453f15b34e8499e989ab087bbcc3568d 100644 |
--- a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp |
+++ b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp |
@@ -43,22 +43,23 @@ |
void StyleInvalidator::scheduleInvalidationSetsForElement(const InvalidationLists& invalidationLists, Element& element) |
{ |
ASSERT(element.inActiveDocument()); |
+ if (element.styleChangeType() >= SubtreeStyleChange) |
+ return; |
+ |
bool requiresDescendantInvalidation = false; |
- if (element.styleChangeType() < SubtreeStyleChange) { |
- for (auto& invalidationSet : invalidationLists.descendants) { |
- if (invalidationSet->wholeSubtreeInvalid()) { |
- element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator)); |
- requiresDescendantInvalidation = false; |
- break; |
- } |
- |
- if (invalidationSet->invalidatesSelf()) |
- element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator)); |
- |
- if (!invalidationSet->isEmpty()) |
- requiresDescendantInvalidation = true; |
- } |
+ for (auto& invalidationSet : invalidationLists.descendants) { |
+ if (invalidationSet->wholeSubtreeInvalid()) { |
+ element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator)); |
+ clearInvalidation(element); |
+ return; |
+ } |
+ |
+ if (invalidationSet->invalidatesSelf()) |
+ element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator)); |
+ |
+ if (!invalidationSet->isEmpty()) |
+ requiresDescendantInvalidation = true; |
} |
if (invalidationLists.siblings.isEmpty() && !requiresDescendantInvalidation) |