Commit 5ac37d8c authored by David Bokan's avatar David Bokan Committed by Commit Bot

Make scroll bounds include subpixel accumulation

Bug: 801381
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: I27e9f0ac5d372400bc2c72e7904a3908fc546454
Reviewed-on: https://chromium-review.googlesource.com/887647Reviewed-by: default avatarTien-Ren Chen <trchen@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532919}
parent 5732f0bc
...@@ -1654,8 +1654,13 @@ void CompositedLayerMapping::UpdateScrollingLayerGeometry( ...@@ -1654,8 +1654,13 @@ void CompositedLayerMapping::UpdateScrollingLayerGeometry(
bool overflow_clip_rect_offset_changed = bool overflow_clip_rect_offset_changed =
old_scrolling_layer_offset != scrolling_layer_->OffsetFromLayoutObject(); old_scrolling_layer_offset != scrolling_layer_->OffsetFromLayoutObject();
IntSize scroll_size(layout_box.PixelSnappedScrollWidth(), IntSize scroll_size =
layout_box.PixelSnappedScrollHeight()); PixelSnappedIntRect(
LayoutRect(
LayoutPoint(owning_layer_.SubpixelAccumulation()),
LayoutSize(layout_box.ScrollWidth(), layout_box.ScrollHeight())))
.Size();
if (overflow_clip_rect_offset_changed) if (overflow_clip_rect_offset_changed)
scrolling_contents_layer_->SetNeedsDisplay(); scrolling_contents_layer_->SetNeedsDisplay();
......
...@@ -2475,4 +2475,47 @@ TEST_P(CompositedLayerMappingTest, ForegroundLayerSizing) { ...@@ -2475,4 +2475,47 @@ TEST_P(CompositedLayerMappingTest, ForegroundLayerSizing) {
EXPECT_EQ(FloatSize(100, 100), mapping->ForegroundLayer()->Size()); EXPECT_EQ(FloatSize(100, 100), mapping->ForegroundLayer()->Size());
} }
TEST_P(CompositedLayerMappingTest, ScrollLayerSizingSubpixelAccumulation) {
// This test verifies that when subpixel accumulation causes snapping it
// applies to both the scrolling and scrolling contents layers. Verify that
// the mapping doesn't have any vertical scrolling introduced as a result of
// the snapping behavior. https://crbug.com/801381.
GetDocument().GetFrame()->GetSettings()->SetPreferCompositingToLCDTextEnabled(
true);
// The values below are chosen so that the subpixel accumulation causes the
// pixel snapped height to be increased relative to snapping without it.
SetBodyInnerHTML(R"HTML(
<!DOCTYPE html>
<style>
body {
margin: 0;
}
#scroller {
position: relative;
top: 0.5625px;
width: 200px;
height: 200.8125px;
overflow: auto;
}
#space {
width: 1000px;
height: 200.8125px;
}
</style>
<div id="scroller">
<div id="space"></div>
</div>
)HTML");
GetDocument().View()->UpdateAllLifecyclePhases();
auto* mapping = ToLayoutBoxModelObject(GetLayoutObjectByElementId("scroller"))
->Layer()
->GetCompositedLayerMapping();
ASSERT_TRUE(mapping);
ASSERT_TRUE(mapping->ScrollingLayer());
ASSERT_TRUE(mapping->ScrollingContentsLayer());
EXPECT_EQ(mapping->ScrollingLayer()->Size().Height(),
mapping->ScrollingContentsLayer()->Size().Height());
}
} // 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