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

Unified Diff: cc/trees/layer_tree_impl_unittest.cc

Issue 1843813002: Fix issue with hit testing on the layer tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl_unittest.cc
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 8cf4f0142556bfd3bc9480bce12313d13a9eb23f..8781d2fc702467d59c20d8d50f2ee84d741d35b6 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -2385,5 +2385,56 @@ TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) {
EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties());
}
+TEST_F(LayerTreeImplTest, HitTestingCorrectLayerWheelListener) {
+ host_impl().active_tree()->set_event_listener_properties(
+ EventListenerClass::kMouseWheel, EventListenerProperties::kBlocking);
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
+ scoped_ptr<LayerImpl> left_child =
+ LayerImpl::Create(host_impl().active_tree(), 2);
+ scoped_ptr<LayerImpl> right_child =
+ LayerImpl::Create(host_impl().active_tree(), 3);
+
+ gfx::Point3F transform_origin;
+ gfx::PointF position;
+ gfx::Size bounds(100, 100);
+ {
+ gfx::Transform translate_z;
+ translate_z.Translate3d(0, 0, 10);
+ SetLayerPropertiesForTesting(root.get(), translate_z, transform_origin,
+ position, bounds, false, false, true);
+ root->SetDrawsContent(true);
+ }
+ {
+ gfx::Transform translate_z;
+ translate_z.Translate3d(0, 0, 10);
+ SetLayerPropertiesForTesting(left_child.get(), translate_z,
+ transform_origin, position, bounds, false,
+ false, false);
+ left_child->SetDrawsContent(true);
+ }
+ {
+ gfx::Transform translate_z;
+ translate_z.Translate3d(0, 0, 10);
+ SetLayerPropertiesForTesting(right_child.get(), translate_z,
+ transform_origin, position, bounds, false,
+ false, false);
+ }
+
+ root->AddChild(std::move(left_child));
+ root->AddChild(std::move(right_child));
+
+ host_impl().SetViewportSize(root->bounds());
+ host_impl().active_tree()->SetRootLayer(std::move(root));
+ host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
+ CHECK_EQ(1u, RenderSurfaceLayerList().size());
+
+ gfx::PointF test_point = gfx::PointF(1.f, 1.f);
+ LayerImpl* result_layer =
+ host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
+
+ CHECK(result_layer);
+ EXPECT_EQ(2, result_layer->id());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698