Commit 4f8f3e21 authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

content-visibility: Fix DCHECK in graphics layer update.

This patch ensures that the DCHECK doesn't trigger when checking that
the dirty bits have been cleared on the graphics layer updater.

This follows the same pattern as the update, skipping checks on locked
children.

R=chrishtr@chromium.org

Change-Id: I81ae6a6ca4279472dd3433db9f23b2295fd52ddb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2452849Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814364}
parent c2797a43
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h" #include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/geometry/dom_rect.h" #include "third_party/blink/renderer/core/geometry/dom_rect.h"
#include "third_party/blink/renderer/core/html/html_template_element.h" #include "third_party/blink/renderer/core/html/html_template_element.h"
#include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h"
#include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h" #include "third_party/blink/renderer/core/paint/compositing/paint_layer_compositor.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/computed_style.h"
...@@ -2970,4 +2971,52 @@ TEST_F(DisplayLockContextLegacyRenderingTest, ...@@ -2970,4 +2971,52 @@ TEST_F(DisplayLockContextLegacyRenderingTest,
UpdateAllLifecyclePhasesForTest(); UpdateAllLifecyclePhasesForTest();
} }
TEST_F(DisplayLockContextTest, GraphicsLayerBitsNotCheckedInLockedSubtree) {
ResizeAndFocus();
GetDocument().GetSettings()->SetPreferCompositingToLCDTextEnabled(true);
SetHtmlInnerHTML(R"HTML(
<style>
div {
width: 100px;
height: 100px;
contain: style layout;
will-change: transform;
}
.locked {
content-visibility: hidden;
}
</style>
<div id=container>
<div>
<div id=target></div>
</div>
</div>
)HTML");
// Check if the result is correct if we update the contents.
auto* container = GetDocument().getElementById("container");
auto* target = GetDocument().getElementById("target");
auto* target_box = ToLayoutBoxModelObject(target->GetLayoutObject());
ASSERT_TRUE(target_box);
EXPECT_TRUE(target_box->Layer());
EXPECT_TRUE(target_box->HasSelfPaintingLayer());
auto* target_layer = target_box->Layer();
ASSERT_TRUE(target_layer->HasCompositedLayerMapping());
container->classList().Add("locked");
target_layer->GetCompositedLayerMapping()->SetNeedsGraphicsLayerUpdate(
kGraphicsLayerUpdateLocal);
// This should not DCHECK.
UpdateAllLifecyclePhasesForTest();
EXPECT_TRUE(
target_layer->GetCompositedLayerMapping()->NeedsGraphicsLayerUpdate());
container->classList().Remove("locked");
UpdateAllLifecyclePhasesForTest();
EXPECT_FALSE(
target_layer->GetCompositedLayerMapping()->NeedsGraphicsLayerUpdate());
}
} // namespace blink } // namespace blink
...@@ -175,8 +175,11 @@ void GraphicsLayerUpdater::AssertNeedsToUpdateGraphicsLayerBitsCleared( ...@@ -175,8 +175,11 @@ void GraphicsLayerUpdater::AssertNeedsToUpdateGraphicsLayerBitsCleared(
->AssertNeedsToUpdateGraphicsLayerBitsCleared(); ->AssertNeedsToUpdateGraphicsLayerBitsCleared();
} }
for (PaintLayer* child = layer.FirstChild(); child; PaintLayer* first_child =
child = child->NextSibling()) layer.GetLayoutObject().ChildPrePaintBlockedByDisplayLock()
? nullptr
: layer.FirstChild();
for (PaintLayer* child = first_child; child; child = child->NextSibling())
AssertNeedsToUpdateGraphicsLayerBitsCleared(*child); AssertNeedsToUpdateGraphicsLayerBitsCleared(*child);
} }
......
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