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 925993108a384d217951602c1ccae3945ff3af7a..09e34e74328d0f55a140d7d8bf3eb7663b32509a 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -6270,6 +6270,42 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) { |
} |
} |
+TEST_F(LayerTreeHostImplTest, OverscrollOnMainThread) { |
+ InputHandlerScrollResult scroll_result; |
+ LayerTreeSettings settings = DefaultSettings(); |
+ CreateHostImpl(settings, CreateOutputSurface()); |
+ |
+ LayerImpl* scroll_layer = SetupScrollAndContentsLayers(gfx::Size(50, 50)); |
+ scroll_layer->set_main_thread_scrolling_reasons( |
+ MainThreadScrollingReason::kThreadedScrollingDisabled); |
+ |
+ LayerImpl* clip_layer = |
+ scroll_layer->test_properties()->parent->test_properties()->parent; |
+ clip_layer->SetBounds(gfx::Size(50, 50)); |
+ host_impl_->active_tree()->BuildPropertyTreesForTesting(); |
+ host_impl_->SetViewportSize(gfx::Size(50, 50)); |
+ host_impl_->active_tree()->PushPageScaleFromMainThread(1.f, 0.5f, 4.f); |
+ DrawFrame(); |
+ |
+ // Overscroll initiated outside layers will be handled by the main thread. |
+ EXPECT_EQ(nullptr, host_impl_->active_tree()->FindLayerThatIsHitByPoint( |
+ gfx::PointF(0, 60))); |
+ EXPECT_EQ(InputHandler::SCROLL_ON_MAIN_THREAD, |
+ host_impl_ |
+ ->ScrollBegin(BeginState(gfx::Point(0, 60)).get(), |
+ InputHandler::WHEEL) |
+ .thread); |
+ |
+ // Overscroll initiated inside layers will be handled by the main thread. |
+ EXPECT_NE(nullptr, host_impl_->active_tree()->FindLayerThatIsHitByPoint( |
+ gfx::PointF(0, 0))); |
+ EXPECT_EQ( |
+ InputHandler::SCROLL_ON_MAIN_THREAD, |
+ host_impl_ |
+ ->ScrollBegin(BeginState(gfx::Point(0, 0)).get(), InputHandler::WHEEL) |
+ .thread); |
+} |
+ |
class BlendStateCheckLayer : public LayerImpl { |
public: |
static std::unique_ptr<LayerImpl> Create( |