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

Unified Diff: cc/trees/layer_tree_impl_unittest.cc

Issue 328753002: Clean up PointIsClippedBySurfaceOrClipRect (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 6 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
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « 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 8db2b9567c4ec679ebd77751b54fdcd326c7d3ec..2b0bd875bf6fc96609016f625f5f6fdb73d3c6ff 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -1117,6 +1117,78 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
EXPECT_EQ(4, result_layer->id());
}
+TEST_F(LayerTreeImplTest, HitTestingNotDrawnClippedLayersWithHandlers) {
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
+ gfx::Transform identity_matrix;
+ gfx::Point3F transform_origin;
+ gfx::PointF position;
+ gfx::Size bounds(100, 100);
+ SetLayerPropertiesForTesting(root.get(),
+ identity_matrix,
+ transform_origin,
+ position,
+ bounds,
+ true,
+ false);
+ root->SetDrawsContent(true);
+ {
+ scoped_ptr<LayerImpl> child1 =
+ LayerImpl::Create(host_impl().active_tree(), 2);
+ scoped_ptr<LayerImpl> grand_child1 =
+ LayerImpl::Create(host_impl().active_tree(), 4);
+
+ position = gfx::PointF(10.f, 10.f);
+ bounds = gfx::Size(50, 50);
+ SetLayerPropertiesForTesting(child1.get(),
+ identity_matrix,
+ transform_origin,
+ position,
+ bounds,
+ true,
+ false);
+ child1->SetDrawsContent(true);
+ child1->SetMasksToBounds(true);
+
+ position = gfx::PointF(0.f, 40.f);
+ bounds = gfx::Size(100, 50);
+ SetLayerPropertiesForTesting(grand_child1.get(),
+ identity_matrix,
+ transform_origin,
+ position,
+ bounds,
+ true,
+ false);
+ grand_child1->SetDrawsContent(true);
+ grand_child1->SetForceRenderSurface(true);
+
+ child1->AddChild(grand_child1.Pass());
+ root->AddChild(child1.Pass());
+ }
+
+ LayerImpl* child1 = root->children()[0];
+ LayerImpl* grand_child1 = child1->children()[0];
+
+ child1->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50));
+ grand_child1->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50));
+
+ host_impl().SetViewportSize(root->bounds());
+ host_impl().active_tree()->SetRootLayer(root.Pass());
+ host_impl().active_tree()->UpdateDrawProperties();
+
+ // This is meant to simulate the destruction of the render target. In
+ // reality this would leave a stale pointer, but to ensure that the test
+ // crashes without the appropriate guards, we force it to be NULL here.
+ child1->draw_properties().render_target = NULL;
+ child1->SetHideLayerAndSubtree(true);
+ host_impl().active_tree()->UpdateDrawProperties();
+
+ gfx::Point test_point = gfx::Point(11, 51);
+ LayerImpl* result_layer =
+ host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
+ ASSERT_TRUE(result_layer);
+ EXPECT_EQ(4, result_layer->id());
danakj 2014/06/11 22:15:06 Mmh, you're touch-interacting with grandchild1, bu
Ian Vollick 2014/06/11 23:50:37 It is weird, but yeah, it was intentional. We stil
danakj 2014/06/12 00:21:23 Well, hm. Isn't the invariant that you have a vali
+}
+
TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
//
// The geometry is set up similarly to the previous case, but
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698