From 8d96434f9b5e6dca2ee4b6417bf7392b3c2a7b70 Mon Sep 17 00:00:00 2001 From: "vollick@chromium.org" Date: Thu, 15 May 2014 18:22:27 +0000 Subject: Remove hit-testing-only RSLL entries As of https://codereview.chromium.org/266913021/ we no longer hit test via the RSLL; we walk the tree instead. This means we can remove the machinery added to allow hidden layers to appear in the RSLL for hit testing purposes. This is essentially a revert of https://codereview.chromium.org/25712004 R=danakj@chromium.org BUG=None Review URL: https://codereview.chromium.org/289973003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270742 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/trees/layer_tree_impl_unittest.cc | 104 ----------------------------------- 1 file changed, 104 deletions(-) (limited to '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 b27a06e..4a8259e 100644 --- a/cc/trees/layer_tree_impl_unittest.cc +++ b/cc/trees/layer_tree_impl_unittest.cc @@ -1185,110 +1185,6 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) { EXPECT_EQ(4, result_layer->id()); } -TEST_F(LayerTreeImplTest, HitTestingForEmptyLayers) { - // Layer 1 - root - scoped_ptr root = LayerImpl::Create(host_impl().active_tree(), 1); - gfx::Transform identity_matrix; - gfx::PointF anchor; - gfx::PointF position; - gfx::Size bounds(100, 100); - SetLayerPropertiesForTesting( - root.get(), identity_matrix, anchor, position, bounds, true, false); - root->SetDrawsContent(true); - - { - // Layer 2 - empty: drawsContent=false - gfx::PointF position(10.f, 10.f); - gfx::Size bounds(30, 30); - scoped_ptr empty_layer = - LayerImpl::Create(host_impl().active_tree(), 2); - SetLayerPropertiesForTesting(empty_layer.get(), - identity_matrix, - anchor, - position, - bounds, - true, - false); - - empty_layer->SetDrawsContent(false); - root->AddChild(empty_layer.Pass()); - } - - { - // Layer 3 - empty, but has touch handler - gfx::PointF position(10.f, 60.f); - gfx::Size bounds(30, 30); - scoped_ptr test_layer = - LayerImpl::Create(host_impl().active_tree(), 3); - SetLayerPropertiesForTesting(test_layer.get(), - identity_matrix, - anchor, - position, - bounds, - true, - false); - - test_layer->SetDrawsContent(false); - Region touch_handler_region(gfx::Rect(10, 10, 10, 10)); - test_layer->SetTouchEventHandlerRegion(touch_handler_region); - root->AddChild(test_layer.Pass()); - } - - { - // Layer 4 - empty, but has mousewheel handler - gfx::PointF position(60.f, 60.f); - gfx::Size bounds(30, 30); - scoped_ptr test_layer = - LayerImpl::Create(host_impl().active_tree(), 4); - SetLayerPropertiesForTesting(test_layer.get(), - identity_matrix, - anchor, - position, - bounds, - true, - false); - - test_layer->SetDrawsContent(false); - test_layer->SetHaveWheelEventHandlers(true); - root->AddChild(test_layer.Pass()); - } - - host_impl().SetViewportSize(root->bounds()); - host_impl().active_tree()->SetRootLayer(root.Pass()); - host_impl().active_tree()->UpdateDrawProperties(); - - // Verify that the root layer and empty layers with touch/wheel handlers - // (but not the empty layer without a touch handler) are in the RSSL. - ASSERT_EQ(1u, RenderSurfaceLayerList().size()); - EXPECT_EQ(1, RenderSurfaceLayerList()[0]->id()); - ASSERT_EQ(3u, root_layer()->render_surface()->layer_list().size()); - EXPECT_EQ(1, root_layer()->render_surface()->layer_list().at(0)->id()); - EXPECT_EQ(3, root_layer()->render_surface()->layer_list().at(1)->id()); - EXPECT_EQ(4, root_layer()->render_surface()->layer_list().at(2)->id()); - - // Hit testing for a point inside the empty no-handlers layer should return - // the root layer. - gfx::Point test_point = gfx::Point(15, 15); - LayerImpl* result_layer = - host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); - ASSERT_TRUE(result_layer); - EXPECT_EQ(1, result_layer->id()); - - // Hit testing for a point inside the touch handler layer should return it. - test_point = gfx::Point(15, 75); - result_layer = - host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); - ASSERT_TRUE(result_layer); - EXPECT_EQ(3, result_layer->id()); - - // Hit testing for a point inside the mousewheel layer should return it. - test_point = gfx::Point(75, 75); - result_layer = - host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); - ASSERT_TRUE(result_layer); - EXPECT_EQ(4, result_layer->id()); -} - TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) { scoped_ptr root = LayerImpl::Create(host_impl().active_tree(), 12345); -- cgit v1.1