Commit b087bb81 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

[PE] Invalidate sticky constraints on composited scroll.

This ensures that property tree state for the sticky elements are updated
properly, to subsequently be used in hit testing and paint.

Bug:827224

Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: If6fbfbe49b6b08046d40ecb2da636ee1f22cb486
Reviewed-on: https://chromium-review.googlesource.com/994462
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548120}
parent c5588d5e
......@@ -2122,6 +2122,11 @@ void PaintLayerScrollableArea::UpdateCompositingLayersAfterScroll() {
kCompositingUpdateAfterGeometryChange);
}
// Sticky constraints and paint property nodes need to be updated
// to the new sticky locations.
if (HasStickyDescendants())
InvalidateAllStickyConstraints();
// If we have fixed elements and we scroll the root layer in RLS we might
// change compositing since the fixed elements might now overlap a
// composited layer.
......
......@@ -901,6 +901,37 @@ TEST_F(PaintLayerScrollableAreaTest, HitTestOverlayScrollbars) {
EXPECT_EQ(hit_result.GetScrollbar(), scrollable_area->HorizontalScrollbar());
}
TEST_F(PaintLayerScrollableAreaTest, CompositedStickyDescendant) {
SetBodyInnerHTML(R"HTML(
<div id=scroller style="overflow: scroll; width: 500px; height: 300px;
will-change: transform">
<div id=sticky style="top: 0px; position: sticky; background: green">
</div>
<div style="width: 10px; height: 700px; background: lightblue"></div>
</div>
)HTML");
auto* scroller =
ToLayoutBoxModelObject(GetLayoutObjectByElementId("scroller"));
auto* scrollable_area = scroller->GetScrollableArea();
EXPECT_EQ(kPaintsIntoOwnBacking, scroller->Layer()->GetCompositingState());
auto* sticky = ToLayoutBoxModelObject(GetLayoutObjectByElementId("sticky"));
EXPECT_EQ(FloatSize(0, 0), sticky->FirstFragment()
.LocalBorderBoxProperties()
.Transform()
->Matrix()
.To2DTranslation());
scrollable_area->SetScrollOffset(ScrollOffset(0, 50), kUserScroll);
GetDocument().View()->UpdateAllLifecyclePhases();
EXPECT_EQ(FloatSize(0, 50), sticky->FirstFragment()
.LocalBorderBoxProperties()
.Transform()
->Matrix()
.To2DTranslation());
}
class NonRLSPaintLayerScrollableAreaTest
: public PaintLayerScrollableAreaTest,
private ScopedRootLayerScrollingForTest {
......
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