Commit 605cc1f4 authored by Sahel Sharify's avatar Sahel Sharify Committed by Commit Bot

Viewport contents rect should exclude scrollbar size.

the scrollbars are attached to the visual viewport but created by (and have space saved by) the
frame view. So we need to exclude them from the container rect but also from the contents rect
because we don't want to be able to scroll into the region saved for scrollbars.

Bug: 855074
Test: All/PaintPropertyTreeUpdateTest.ViewportContentsAndContainerRectsDoNotIncludeScrollbar/*
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I4ea231f1a656f35094a2c388076bc2fdd61086da
Reviewed-on: https://chromium-review.googlesource.com/1183526
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584827}
parent 90d1f5a1
......@@ -129,7 +129,8 @@ void VisualViewport::UpdatePaintPropertyNodes(
{
ScrollPaintPropertyNode::State state;
state.container_rect = IntRect(IntPoint(), ExcludeScrollbars(size_));
state.contents_rect = IntRect(IntPoint(), ContentsSize());
state.contents_rect =
IntRect(IntPoint(), ExcludeScrollbars(ContentsSize()));
state.user_scrollable_horizontal =
UserInputScrollable(kHorizontalScrollbar);
......
......@@ -270,7 +270,7 @@ TEST_P(PaintPropertyTreeUpdateTest,
->HasBackgroundAttachmentFixedDescendants());
// TODO(bokan): Viewport property node generation has been disabled
// temporarily with the flag off to diagnose https//crbug.com/868927.
// temporarily with the flag off to diagnose https://crbug.com/868927.
if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
EXPECT_EQ(visual_viewport.GetScrollNode(), overflow_b->GetLayoutObject()
->FirstFragment()
......@@ -803,6 +803,32 @@ TEST_P(PaintPropertyTreeUpdateTest, ScrollBoundsChange) {
EXPECT_EQ(IntRect(0, 0, 200, 300), scroll_node->ContentsRect());
}
// The scrollbars are attached to the visual viewport but created by (and have
// space saved by) the frame view. So we need to exclude them from the container
// rect but also from the contents rect because we don't want to be able to
// scroll into the region saved for scrollbars.
TEST_P(PaintPropertyTreeUpdateTest,
ViewportContentsAndContainerRectsDoNotIncludeScrollbar) {
SetBodyInnerHTML(R"HTML(
<style>
::-webkit-scrollbar {width: 20px; height: 20px}
body {height: 10000px; width: 10000px; margin: 0;}
</style>
)HTML");
VisualViewport& visual_viewport =
GetDocument().GetPage()->GetVisualViewport();
// TODO(bokan): Viewport property node generation has been disabled
// temporarily with the flag off to diagnose https://crbug.com/868927.
if (RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
EXPECT_EQ(IntRect(0, 0, 780, 580),
visual_viewport.GetScrollNode()->ContainerRect());
EXPECT_EQ(IntRect(0, 0, 780, 580),
visual_viewport.GetScrollNode()->ContentsRect());
}
}
TEST_P(PaintPropertyTreeUpdateTest, ScrollbarWidthChange) {
SetBodyInnerHTML(R"HTML(
<style>::-webkit-scrollbar {width: 20px; height: 20px}</style>
......
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