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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 2118773002: Respect main thread scrolling reasons for fallback to root layer scrolling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reviewer comments. Created 4 years, 5 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 925993108a384d217951602c1ccae3945ff3af7a..f41560a3482a5188cd8520d298b663737453838b 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -6270,6 +6270,78 @@ TEST_F(LayerTreeHostImplTest, NoOverscrollWhenNotAtEdge) {
}
}
+TEST_F(LayerTreeHostImplTest, OverscrollOnMainThread) {
+ InputHandlerScrollResult scroll_result;
+ LayerTreeSettings settings = DefaultSettings();
+ CreateHostImpl(settings, CreateOutputSurface());
+
+ const gfx::Size content_size(50, 50);
+ const gfx::Size viewport_size(50, 50);
+ CreateBasicVirtualViewportLayers(viewport_size, content_size);
+
+ LayerImpl* scroll_layer =
+ host_impl_->active_tree()->InnerViewportScrollLayer();
+ scroll_layer->set_main_thread_scrolling_reasons(
+ MainThreadScrollingReason::kThreadedScrollingDisabled);
+ host_impl_->active_tree()->BuildPropertyTreesForTesting();
+
+ 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);
+}
+
+TEST_F(LayerTreeHostImplTest, OverscrollOnImplThread) {
+ InputHandlerScrollResult scroll_result;
+ LayerTreeSettings settings = DefaultSettings();
+ CreateHostImpl(settings, CreateOutputSurface());
+
+ const gfx::Size content_size(50, 50);
+ const gfx::Size viewport_size(50, 50);
+ CreateBasicVirtualViewportLayers(viewport_size, content_size);
+
+ // By default, no main thread scrolling reasons should exist.
+ LayerImpl* scroll_layer =
+ host_impl_->active_tree()->InnerViewportScrollLayer();
+ EXPECT_EQ(MainThreadScrollingReason::kNotScrollingOnMain,
+ scroll_layer->main_thread_scrolling_reasons());
+
+ DrawFrame();
+
+ // Overscroll initiated outside layers will be handled by the impl thread.
+ EXPECT_EQ(nullptr, host_impl_->active_tree()->FindLayerThatIsHitByPoint(
+ gfx::PointF(0, 60)));
+ EXPECT_EQ(InputHandler::SCROLL_ON_IMPL_THREAD,
+ host_impl_
+ ->ScrollBegin(BeginState(gfx::Point(0, 60)).get(),
+ InputHandler::WHEEL)
+ .thread);
+
+ // Overscroll initiated inside layers will be handled by the impl thread.
+ EXPECT_NE(nullptr, host_impl_->active_tree()->FindLayerThatIsHitByPoint(
+ gfx::PointF(0, 0)));
+ EXPECT_EQ(
+ InputHandler::SCROLL_ON_IMPL_THREAD,
+ host_impl_
+ ->ScrollBegin(BeginState(gfx::Point(0, 0)).get(), InputHandler::WHEEL)
+ .thread);
+}
+
class BlendStateCheckLayer : public LayerImpl {
public:
static std::unique_ptr<LayerImpl> Create(
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698