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

Unified Diff: cc/trees/layer_tree_host_impl_unittest.cc

Issue 238803005: Scroll on main if impl-hit testing isn't guaranteed to be correct (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding some breaks. Created 6 years, 8 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') | content/renderer/input/input_handler_proxy.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 93bc83106b434ba36079a756f89cd15fb272d59d..04d377ed11bd1b94184e93ae116cd5eaa37e2390 100644
--- a/cc/trees/layer_tree_host_impl_unittest.cc
+++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -5951,6 +5951,79 @@ TEST_F(LayerTreeHostImplTest, WheelFlingShouldBubble) {
}
}
+TEST_F(LayerTreeHostImplTest, ScrollUnknownNotOnAncestorChain) {
+ // If we ray cast a scroller that is not on the first layer's ancestor chain,
+ // we should return ScrollUnknown.
+ gfx::Size content_size(100, 100);
+ SetupScrollAndContentsLayers(content_size);
+
+ int scroll_layer_id = 2;
+ LayerImpl* scroll_layer =
+ host_impl_->active_tree()->LayerById(scroll_layer_id);
+ scroll_layer->SetDrawsContent(true);
+
+ int page_scale_layer_id = 5;
+ LayerImpl* page_scale_layer =
+ host_impl_->active_tree()->LayerById(page_scale_layer_id);
+
+ int occluder_layer_id = 6;
+ scoped_ptr<LayerImpl> occluder_layer =
+ LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id);
+ occluder_layer->SetDrawsContent(true);
+ occluder_layer->SetBounds(content_size);
+ occluder_layer->SetContentBounds(content_size);
+ occluder_layer->SetPosition(gfx::PointF());
+ occluder_layer->SetAnchorPoint(gfx::PointF());
+
+ // The parent of the occluder is *above* the scroller.
+ page_scale_layer->AddChild(occluder_layer.Pass());
+
+ DrawFrame();
+
+ EXPECT_EQ(InputHandler::ScrollUnknown,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+}
+
+TEST_F(LayerTreeHostImplTest, ScrollUnknownScrollAncestorMismatch) {
+ // If we ray cast a scroller this is on the first layer's ancestor chain, but
+ // is not the first scroller we encounter when walking up from the layer, we
+ // should also return ScrollUnknown.
+ gfx::Size content_size(100, 100);
+ SetupScrollAndContentsLayers(content_size);
+
+ int scroll_layer_id = 2;
+ LayerImpl* scroll_layer =
+ host_impl_->active_tree()->LayerById(scroll_layer_id);
+ scroll_layer->SetDrawsContent(true);
+
+ int occluder_layer_id = 6;
+ scoped_ptr<LayerImpl> occluder_layer =
+ LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id);
+ occluder_layer->SetDrawsContent(true);
+ occluder_layer->SetBounds(content_size);
+ occluder_layer->SetContentBounds(content_size);
+ occluder_layer->SetPosition(gfx::PointF());
+ occluder_layer->SetAnchorPoint(gfx::PointF());
+
+ int child_scroll_clip_layer_id = 7;
+ scoped_ptr<LayerImpl> child_scroll_clip =
+ LayerImpl::Create(host_impl_->active_tree(), child_scroll_clip_layer_id);
+
+ int child_scroll_layer_id = 8;
+ scoped_ptr<LayerImpl> child_scroll = CreateScrollableLayer(
+ child_scroll_layer_id, content_size, child_scroll_clip.get());
+
+ child_scroll->SetDrawsContent(false);
+
+ child_scroll->AddChild(occluder_layer.Pass());
+ scroll_layer->AddChild(child_scroll.Pass());
+
+ DrawFrame();
+
+ EXPECT_EQ(InputHandler::ScrollUnknown,
+ host_impl_->ScrollBegin(gfx::Point(), InputHandler::Wheel));
+}
+
// Make sure LatencyInfo carried by LatencyInfoSwapPromise are passed
// to CompositorFrameMetadata after SwapBuffers();
TEST_F(LayerTreeHostImplTest, LatencyInfoPassedToCompositorFrameMetadata) {
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | content/renderer/input/input_handler_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698