Commit cf2f18ca authored by Seokho Song's avatar Seokho Song Committed by Commit Bot

ComputeBackgroundPaintLocationIfComposited will check parent's 3D context


ScrollableArea with Preserves3D context should be painted in  PaintInGraphicsLayer. But currently, it doesn't.

Therefore, In this patch,
ComputeBackgroundPaintLocationIfComposited will check parent's Preserves3D styles and if it is, The function returns  kBackgroundPaintInGraphicsLayer.

Change-Id: I7fb2b283e0992b8825e95e08ef718bd0e056858c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434016
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815167}
parent 5115f824
......@@ -198,6 +198,14 @@ LayoutBoxModelObject::ComputeBackgroundPaintLocationIfComposited() const {
}
return kBackgroundPaintInGraphicsLayer;
}
// It can't paint in the scrolling contents because it has different 3d
// context than the scrolling contents.
if (!StyleRef().Preserves3D() && Parent() &&
Parent()->StyleRef().Preserves3D()) {
return kBackgroundPaintInGraphicsLayer;
}
return paint_location;
}
......
......@@ -994,6 +994,28 @@ TEST_P(PaintLayerScrollableAreaTest,
EXPECT_NE(nullptr, properties->ScrollTranslation());
}
TEST_P(PaintLayerScrollableAreaTest, ScrollWith3DPreserveParent) {
SetBodyInnerHTML(R"HTML(
<style>
#scroller {
overflow-y: scroll;
height: 200px;
width: 200px;
background: white;
}
</style>
<div style='transform-style: preserve-3d;'>
<div id='scroller'>
<div style='height: 2000px;'></div>
</div>
</div>
)HTML");
auto* scroller = ToLayoutBox(GetLayoutObjectByElementId("scroller"));
EXPECT_EQ(kBackgroundPaintInGraphicsLayer,
scroller->ComputeBackgroundPaintLocationIfComposited());
}
TEST_P(PaintLayerScrollableAreaTest,
ScrollWithLocalAttachmentBackgroundInMainLayer) {
SetBodyInnerHTML(R"HTML(
......
......@@ -73,9 +73,6 @@ crbug.com/887140 virtual/hdr/video-canvas-alpha.html [ Failure ]
# Tested by paint/background/root-element-background-transparency.html for now.
external/wpt/css/compositing/root-element-background-transparency.html [ Failure ]
# PaintPropertyTreeBuilder bug.
crbug.com/1116358 external/wpt/css/css-transforms/scrolalble-scroll-3d-transform-z.html [ Failure ]
# ====== Synchronous, budgeted HTML parser tests from here ======
### virtual/synchronous_html_parser/http/tests/preload/
......
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