Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 910373002: [Android] Disable pull-to-refresh with overflow:hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass overflow:hidden via metadata Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_impl_unittest.cc
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc
index 23e90e11134d4e6fc405418ddd0e1a7b463c2306..2cd3d0753fe4b6f648bd11a90b7a324fd2b1ceea 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -1844,6 +1844,8 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
EXPECT_EQ(gfx::SizeF(100.f, 100.f), metadata.root_layer_size);
EXPECT_EQ(0.5f, metadata.min_page_scale_factor);
EXPECT_EQ(4.f, metadata.max_page_scale_factor);
+ EXPECT_FALSE(metadata.root_overflow_x_hidden);
+ EXPECT_FALSE(metadata.root_overflow_y_hidden);
}
// Scrolling should update metadata immediately.
@@ -1862,6 +1864,24 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) {
EXPECT_EQ(gfx::Vector2dF(0.f, 10.f), metadata.root_scroll_offset);
}
+ // Root "overflow: hidden" properties should be reflected.
+ {
+ host_impl_->active_tree()
+ ->InnerViewportScrollLayer()
+ ->set_user_scrollable_horizontal(false);
+ CompositorFrameMetadata metadata =
+ host_impl_->MakeCompositorFrameMetadata();
+ EXPECT_TRUE(metadata.root_overflow_x_hidden);
+ EXPECT_FALSE(metadata.root_overflow_y_hidden);
+
+ host_impl_->active_tree()
+ ->InnerViewportScrollLayer()
+ ->set_user_scrollable_vertical(false);
+ metadata = host_impl_->MakeCompositorFrameMetadata();
+ EXPECT_TRUE(metadata.root_overflow_x_hidden);
+ EXPECT_TRUE(metadata.root_overflow_y_hidden);
+ }
+
// Page scale should update metadata correctly (shrinking only the viewport).
host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture);
host_impl_->PinchGestureBegin();
@@ -7950,6 +7970,55 @@ TEST_F(LayerTreeHostImplVirtualViewportTest,
}
}
+TEST_F(LayerTreeHostImplVirtualViewportTest,
+ NoOverscrollWhenRootMarkedNonUserScrollable) {
+ gfx::Size content_size = gfx::Size(100, 160);
+ gfx::Size outer_viewport = gfx::Size(50, 80);
+ gfx::Size inner_viewport = gfx::Size(25, 40);
+
+ SetupVirtualViewportLayers(content_size, outer_viewport, inner_viewport);
+
+ LayerImpl* outer_scroll = host_impl_->OuterViewportScrollLayer();
+ outer_scroll->set_user_scrollable_vertical(false);
+
+ InputHandlerScrollResult scroll_result;
+ DrawFrame();
+ EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
+
+ // In-bounds scrolling does not affect overscroll.
+ EXPECT_EQ(InputHandler::ScrollStarted,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
+ scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 10));
+ EXPECT_TRUE(scroll_result.did_scroll);
+ EXPECT_FALSE(scroll_result.did_overscroll_root);
+ EXPECT_EQ(gfx::Vector2dF(), scroll_result.unused_scroll_delta);
+ EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
+
+ // As the outer viewport is marked as non-scrollable on the y-axis,
+ // overscroll reporting should be suppressed, and indicated as such.
+ scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 50));
+ EXPECT_TRUE(scroll_result.did_scroll);
+ EXPECT_FALSE(scroll_result.did_overscroll_root);
+ EXPECT_EQ(gfx::Vector2dF(), scroll_result.unused_scroll_delta);
+ EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
+
+ // Repeated overscrolls should also be suppressed.
+ scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, 50));
+ EXPECT_FALSE(scroll_result.did_scroll);
+ EXPECT_FALSE(scroll_result.did_overscroll_root);
+ EXPECT_EQ(gfx::Vector2dF(), scroll_result.unused_scroll_delta);
+ EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
+
+ // Scrolling the inner viewport back up should be possible.
+ scroll_result = host_impl_->ScrollBy(gfx::Point(), gfx::Vector2d(0, -10));
+ EXPECT_TRUE(scroll_result.did_scroll);
+ EXPECT_FALSE(scroll_result.did_overscroll_root);
+ EXPECT_EQ(gfx::Vector2dF(), scroll_result.unused_scroll_delta);
+ EXPECT_EQ(gfx::Vector2dF(), host_impl_->accumulated_root_overscroll());
+
+ host_impl_->ScrollEnd();
+}
+
class LayerTreeHostImplWithImplicitLimitsTest : public LayerTreeHostImplTest {
public:
void SetUp() override {

Powered by Google App Engine
This is Rietveld 408576698