Commit 1ae2a0ff authored by Steve Kobes's avatar Steve Kobes Committed by Commit Bot

RLS: Add sticky elements to LFV::viewport_constrained_objects_.

The code to do this was behind an "if (!RLS)" block, which was added by
http://crrev.com/437671, but we need it with RLS also.  Otherwise, non-
composited sticky elements don't force main-thread scrolling, and jitter
as the compositor tries to scroll them.

This fix causes a test to reveal an existing bug in LayoutGeometryMap
(see crbug.com/821216).

Bug: 820921
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I0227b994fcabb84b3edbaa4c73943667a88b1ea5
Reviewed-on: https://chromium-review.googlesource.com/959567
Commit-Queue: Steve Kobes <skobes@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543244}
parent f67c1dd8
...@@ -3389,3 +3389,8 @@ crbug.com/819778 [ Linux ] external/wpt/css/cssom-view/interfaces.html [ Pass Ti ...@@ -3389,3 +3389,8 @@ crbug.com/819778 [ Linux ] external/wpt/css/cssom-view/interfaces.html [ Pass Ti
# Sheriff 2018-03-08 # Sheriff 2018-03-08
crbug.com/731518 [ Win Linux Mac ] webaudio/DynamicsCompressor/dynamicscompressor-clear-internal-state.html [ Failure Pass ] crbug.com/731518 [ Win Linux Mac ] webaudio/DynamicsCompressor/dynamicscompressor-clear-internal-state.html [ Failure Pass ]
# LayoutGeometryMap DCHECK with nested sticky and scroll offset
crbug.com/821216 compositing/overflow/mixed-composited-nested-sticky.html [ Crash Pass ]
crbug.com/821216 virtual/prefer_compositing_to_lcd_text/compositing/overflow/mixed-composited-nested-sticky.html [ Crash Pass ]
crbug.com/821216 virtual/disable-spv175/compositing/overflow/mixed-composited-nested-sticky.html [ Crash Pass ]
...@@ -1120,6 +1120,18 @@ TEST_P(ScrollingCoordinatorTest, ...@@ -1120,6 +1120,18 @@ TEST_P(ScrollingCoordinatorTest,
} }
} }
TEST_P(ScrollingCoordinatorTest, StickyTriggersMainThreadScroll) {
GetWebView()->GetSettings()->SetPreferCompositingToLCDTextEnabled(false);
LoadHTML(
"<body style='height: 1200px'>"
"<div style='position: sticky; top: 0'>sticky</div>");
ForceFullCompositingUpdate();
ScrollableArea* viewport = GetFrame()->View()->LayoutViewportScrollableArea();
WebLayer* scroll_layer = viewport->LayerForScrolling()->PlatformLayer();
ASSERT_EQ(MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects,
scroll_layer->MainThreadScrollingReasons());
}
class NonCompositedMainThreadScrollingReasonTest class NonCompositedMainThreadScrollingReasonTest
: public ScrollingCoordinatorTest { : public ScrollingCoordinatorTest {
static const uint32_t kLCDTextRelatedReasons = static const uint32_t kLCDTextRelatedReasons =
......
...@@ -47,28 +47,26 @@ void CompositingInputsUpdater::UpdateRecursive(PaintLayer* layer, ...@@ -47,28 +47,26 @@ void CompositingInputsUpdater::UpdateRecursive(PaintLayer* layer,
layer->UpdateAncestorOverflowLayer(info.last_overflow_clip_layer); layer->UpdateAncestorOverflowLayer(info.last_overflow_clip_layer);
if (info.last_overflow_clip_layer && layer->NeedsCompositingInputsUpdate() && if (info.last_overflow_clip_layer && layer->NeedsCompositingInputsUpdate() &&
style.HasStickyConstrainedPosition()) { style.HasStickyConstrainedPosition()) {
if (!RuntimeEnabledFeatures::RootLayerScrollingEnabled()) { if (info.last_overflow_clip_layer != previous_overflow_layer) {
if (info.last_overflow_clip_layer != previous_overflow_layer) { // Old ancestor scroller should no longer have these constraints.
// Old ancestor scroller should no longer have these constraints. DCHECK(!previous_overflow_layer ||
DCHECK(!previous_overflow_layer || !previous_overflow_layer->GetScrollableArea() ||
!previous_overflow_layer->GetScrollableArea() || !previous_overflow_layer->GetScrollableArea()
!previous_overflow_layer->GetScrollableArea() ->GetStickyConstraintsMap()
->GetStickyConstraintsMap() .Contains(layer));
.Contains(layer));
// If our ancestor scroller has changed and the previous one was the
// If our ancestor scroller has changed and the previous one was the // root layer, we are no longer viewport constrained.
// root layer, we are no longer viewport constrained. if (previous_overflow_layer && previous_overflow_layer->IsRootLayer()) {
if (previous_overflow_layer && previous_overflow_layer->IsRootLayer()) { layout_object.View()->GetFrameView()->RemoveViewportConstrainedObject(
layout_object.View()->GetFrameView()->RemoveViewportConstrainedObject(
layout_object);
}
}
if (info.last_overflow_clip_layer->IsRootLayer()) {
layout_object.View()->GetFrameView()->AddViewportConstrainedObject(
layout_object); layout_object);
} }
} }
if (info.last_overflow_clip_layer->IsRootLayer()) {
layout_object.View()->GetFrameView()->AddViewportConstrainedObject(
layout_object);
}
layout_object.UpdateStickyPositionConstraints(); layout_object.UpdateStickyPositionConstraints();
// Sticky position constraints and ancestor overflow scroller affect // Sticky position constraints and ancestor overflow scroller affect
......
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