Commit 23a3b485 authored by Xianzhu Wang's avatar Xianzhu Wang Committed by Commit Bot

Add a test for crbug.com/1142725

Bug: 1142725
Change-Id: I804ec0ae9c3f35649aed04a17af3645a01c32e2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527886Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825844}
parent 567a3080
...@@ -119,4 +119,33 @@ TEST_F(PaintLayerCompositorTest, CompositingInputsUpdateStopsContainStrict) { ...@@ -119,4 +119,33 @@ TEST_F(PaintLayerCompositorTest, CompositingInputsUpdateStopsContainStrict) {
EXPECT_FALSE(target->NeedsCompositingInputsUpdate()); EXPECT_FALSE(target->NeedsCompositingInputsUpdate());
} }
TEST_F(PaintLayerCompositorTest, SubframeRebuildGraphicsLayers) {
GetDocument().SetBaseURLOverride(KURL("http://test.com"));
SetBodyInnerHTML("<iframe src='http://test.com'></iframe>");
SetChildFrameHTML(
"<div id='target' style='will-change: opacity; opacity: 0.5'></div>");
UpdateAllLifecyclePhasesForTest();
auto* child_layout_view = ChildDocument().GetLayoutView();
auto* child_root_graphics_layer =
child_layout_view->Layer()->GraphicsLayerBacking(child_layout_view);
ASSERT_TRUE(child_root_graphics_layer);
EXPECT_EQ(GetLayoutView().Layer()->GraphicsLayerBacking(),
child_root_graphics_layer->Parent());
// This simulates that the subframe rebuilds GraphicsLayer tree, while the
// main frame doesn't have any compositing flags set. The root GraphicsLayer
// of the subframe should be hooked up in the GraphicsLayer tree correctly.
child_root_graphics_layer->RemoveFromParent();
child_layout_view->Compositor()->SetNeedsCompositingUpdate(
kCompositingUpdateRebuildTree);
GetLayoutView().Compositor()->UpdateAssignmentsIfNeededRecursive(
DocumentLifecycle::kCompositingAssignmentsClean);
ASSERT_EQ(
child_root_graphics_layer,
child_layout_view->Layer()->GraphicsLayerBacking(child_layout_view));
EXPECT_EQ(GetLayoutView().Layer()->GraphicsLayerBacking(),
child_root_graphics_layer->Parent());
}
} // namespace blink } // namespace blink
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