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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 22567004: Ignore should-scroll-on-main-thread if main frame is not scrollable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 72a72b4552545cac9efb7fe390d349c8ddda55d7..206bbc376a7ecced5299838d60fe16ef86857d99 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -602,6 +602,27 @@ TEST_F(LayerTreeHostImplTest, NoFlingWhenScrollingOnMain) {
host_impl_->FlingScrollBegin());
}
+TEST_F(LayerTreeHostImplTest, IgnoreScrollOnMainThreadIfRootNotScrollable) {
+ SetupScrollAndContentsLayers(gfx::Size(100, 100));
+ host_impl_->SetViewportSize(gfx::Size(50, 50));
+ InitializeRendererAndDrawFrame();
+ LayerImpl* root = host_impl_->active_tree()->root_layer();
+
+ root->SetShouldScrollOnMainThread(true);
+ root->SetScrollable(true);
+ root->SetMaxScrollOffset(gfx::Vector2d(10, 10));
+
+ // Makes no different if this is a wheel input event or a gesture.
+ EXPECT_EQ(InputHandler::ScrollOnMainThread,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+
+ // The root is no longer scrollable, so 'should scroll on main thread should
+ // no longer apply'. NB -- we are scrolling a descendant of the root.
+ root->SetMaxScrollOffset(gfx::Vector2d());
+ EXPECT_EQ(InputHandler::ScrollStarted,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+}
+
TEST_F(LayerTreeHostImplTest, ShouldScrollOnMainThread) {
SetupScrollAndContentsLayers(gfx::Size(100, 100));
host_impl_->SetViewportSize(gfx::Size(50, 50));
@@ -615,7 +636,6 @@ TEST_F(LayerTreeHostImplTest, ShouldScrollOnMainThread) {
EXPECT_EQ(InputHandler::ScrollOnMainThread,
host_impl_->ScrollBegin(gfx::Point(), InputHandler::Gesture));
}
-
TEST_F(LayerTreeHostImplTest, NonFastScrollableRegionBasic) {
SetupScrollAndContentsLayers(gfx::Size(200, 200));
host_impl_->SetViewportSize(gfx::Size(100, 100));
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698