Commit 08bc2093 authored by Manuel Rego Casasnovas's avatar Manuel Rego Casasnovas Committed by Commit Bot

Improve performance in MarkContainerChainForOverflowRecalcIfNeeded()

The methods to check and set the visual overflow recalc flags
were both doing similar checks, so we were duplicating those calls.
In this change we somehow inline the code of that methods
so we avoid repeating those operations.

This is intended to improve performance in
perf_tests/shadow_dom/v1-small-deep-distribution.html.

BUG=1051342,941180

Change-Id: Ica18dd6d07b9f8bca9c35c9db438fbc09bb4a53c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2062430
Commit-Queue: Manuel Rego <rego@igalia.com>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742546}
parent 6ed9c742
......@@ -2011,18 +2011,26 @@ void LayoutObject::MarkContainerChainForOverflowRecalcIfNeeded(
? object->Parent()
: object->Container();
if (object) {
bool no_changes = true;
if (mark_container_chain_layout_overflow_recalc &&
!object->SelfNeedsLayoutOverflowRecalc()) {
object->SetChildNeedsLayoutOverflowRecalc();
no_changes = false;
bool already_needs_layout_overflow_recalc = false;
if (mark_container_chain_layout_overflow_recalc) {
already_needs_layout_overflow_recalc =
object->SelfNeedsLayoutOverflowRecalc();
if (!already_needs_layout_overflow_recalc)
object->SetChildNeedsLayoutOverflowRecalc();
}
if (!object->SelfPaintingLayerNeedsVisualOverflowRecalc()) {
object->MarkSelfPaintingLayerForVisualOverflowRecalc();
no_changes = false;
if (object->HasLayer()) {
auto* box_model_object = ToLayoutBoxModelObject(object);
if (box_model_object->HasSelfPaintingLayer()) {
auto* layer = box_model_object->Layer();
if (layer->NeedsVisualOverflowRecalc()) {
if (already_needs_layout_overflow_recalc)
return;
} else {
layer->SetNeedsVisualOverflowRecalc();
}
}
}
if (no_changes)
return;
}
} while (object);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment