Stop marking containers if overflow recalc flag is present
Basically we can avoid marking all the ancestors
in LayoutObject::MarkContainerChainForOverflowRecalcIfNeeded()
if the overflow recalc flags are already set.
BUG=941180
Change-Id: Ic8480a8d7a9fd7a2b7f35ff9ffb4ae10742098e6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028228
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Manuel Rego <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#738875}
diff --git a/third_party/blink/renderer/core/layout/layout_object.cc b/third_party/blink/renderer/core/layout/layout_object.cc
index 0b2658e..a04b22cd 100644
--- a/third_party/blink/renderer/core/layout/layout_object.cc
+++ b/third_party/blink/renderer/core/layout/layout_object.cc
@@ -2011,9 +2011,18 @@
? object->Parent()
: object->Container();
if (object) {
- if (mark_container_chain_layout_overflow_recalc)
+ bool no_changes = true;
+ if (mark_container_chain_layout_overflow_recalc &&
+ !object->SelfNeedsLayoutOverflowRecalc()) {
object->SetChildNeedsLayoutOverflowRecalc();
- object->MarkSelfPaintingLayerForVisualOverflowRecalc();
+ no_changes = false;
+ }
+ if (!object->SelfPaintingLayerNeedsVisualOverflowRecalc()) {
+ object->MarkSelfPaintingLayerForVisualOverflowRecalc();
+ no_changes = false;
+ }
+ if (no_changes)
+ return;
}
} while (object);