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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 266913021: Hit test on the layer tree rather than the RSLL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index a1210c4fc7bd0af6afc3613b6c947d005630a11e..20dc900bb44814bc63216193a5a53d1c32f70d14 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -4140,22 +4140,6 @@ TEST_F(LayerTreeHostCommonTest,
}
-TEST_F(LayerTreeHostCommonTest, HitTestingForEmptyLayerList) {
- // Hit testing on an empty render_surface_layer_list should return a null
- // pointer.
- LayerImplList render_surface_layer_list;
-
- gfx::Point test_point(0, 0);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
- EXPECT_FALSE(result_layer);
-
- test_point = gfx::Point(10, 20);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
- EXPECT_FALSE(result_layer);
-}
-
TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayer) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
@@ -4188,25 +4172,25 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayer) {
// Hit testing for a point outside the layer should return a null pointer.
gfx::Point test_point(101, 101);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(-1, -1);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer.
test_point = gfx::Point(1, 1);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
test_point = gfx::Point(99, 99);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -4259,26 +4243,26 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayerAndHud) {
// Hit testing for a point inside HUD, but outside root should return null
gfx::Point test_point(101, 101);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(-1, -1);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer, never the HUD
// layer.
test_point = gfx::Point(1, 1);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
test_point = gfx::Point(99, 99);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -4325,38 +4309,38 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForUninvertibleTransform) {
// accidentally ignored and treated like an identity, then the hit testing
// will incorrectly hit the layer when it shouldn't.
gfx::Point test_point(1, 1);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(10, 10);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(10, 30);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(50, 50);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(67, 48);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(99, 99);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(-1, -1);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
}
@@ -4394,27 +4378,27 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePositionedLayer) {
// Hit testing for a point outside the layer should return a null pointer.
gfx::Point test_point(49, 49);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Even though the layer exists at (101, 101), it should not be visible there
// since the root render surface would clamp it.
test_point = gfx::Point(101, 101);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer.
test_point = gfx::Point(51, 51);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
test_point = gfx::Point(99, 99);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -4457,32 +4441,32 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSingleRotatedLayer) {
// These corners would have been inside the un-transformed layer, but they
// should not hit the correctly transformed layer.
gfx::Point test_point(99, 99);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(1, 1);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer.
test_point = gfx::Point(1, 50);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
// Hit testing the corners that would overlap the unclipped layer, but are
// outside the clipped region.
test_point = gfx::Point(50, -1);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_FALSE(result_layer);
test_point = gfx::Point(-1, 50);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_FALSE(result_layer);
}
@@ -4531,25 +4515,25 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSinglePerspectiveLayer) {
// These corners would have been inside the un-transformed layer, but they
// should not hit the correctly transformed layer.
gfx::Point test_point(24, 24);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(76, 76);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer.
test_point = gfx::Point(26, 26);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
test_point = gfx::Point(74, 74);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -4620,30 +4604,30 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSingleLayerWithScaledContents) {
// Hit testing for a point outside the layer should return a null pointer (the
// root layer does not draw content, so it will not be hit tested either).
gfx::Point test_point(101, 101);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(24, 24);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(76, 76);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the test layer.
test_point = gfx::Point(26, 26);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
test_point = gfx::Point(74, 74);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -4713,27 +4697,27 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForSimpleClippedLayer) {
// Despite the child layer being very large, it should be clipped to the root
// layer's bounds.
gfx::Point test_point(24, 24);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Even though the layer exists at (101, 101), it should not be visible there
// since the clipping_layer would clamp it.
test_point = gfx::Point(76, 76);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the child layer.
test_point = gfx::Point(26, 26);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
test_point = gfx::Point(74, 74);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
}
@@ -4853,14 +4837,14 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForMultiClippedRotatedLayer) {
// (11, 89) is close to the the bottom left corner within the clip, but it is
// not inside the layer.
gfx::Point test_point(11, 89);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Closer inwards from the bottom left will overlap the layer.
test_point = gfx::Point(25, 75);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(2468, result_layer->id());
@@ -4870,29 +4854,29 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForMultiClippedRotatedLayer) {
// the layer, then hit testing would accidentally think that the point
// successfully hits the layer.
test_point = gfx::Point(4, 50);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// (11, 50) is inside the layer and within the clipped area.
test_point = gfx::Point(11, 50);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(2468, result_layer->id());
// Around the middle, just to the right and up, would have hit the layer
// except that that area should be clipped away by the parent.
test_point = gfx::Point(51, 49);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Around the middle, just to the left and down, should successfully hit the
// layer.
test_point = gfx::Point(49, 51);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(2468, result_layer->id());
}
@@ -4964,25 +4948,25 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForNonClippingIntermediateLayer) {
// Hit testing for a point outside the layer should return a null pointer.
gfx::Point test_point(69, 69);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(91, 91);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the child layer.
test_point = gfx::Point(71, 71);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
test_point = gfx::Point(89, 89);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
}
@@ -5086,47 +5070,47 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayers) {
// Nothing overlaps the root_layer at (1, 1), so hit testing there should find
// the root layer.
gfx::Point test_point = gfx::Point(1, 1);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(1, result_layer->id());
// At (15, 15), child1 and root are the only layers. child1 is expected to be
// on top.
test_point = gfx::Point(15, 15);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(2, result_layer->id());
// At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
test_point = gfx::Point(51, 20);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(3, result_layer->id());
// At (80, 51), child2 and grand_child1 overlap. child2 is expected to be on
// top.
test_point = gfx::Point(80, 51);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(3, result_layer->id());
// At (51, 51), all layers overlap each other. child2 is expected to be on top
// of all other layers.
test_point = gfx::Point(51, 51);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(3, result_layer->id());
// At (20, 51), child1 and grand_child1 overlap. grand_child1 is expected to
// be on top.
test_point = gfx::Point(20, 51);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(4, result_layer->id());
}
@@ -5244,47 +5228,47 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForMultipleLayerLists) {
// Nothing overlaps the root_layer at (1, 1), so hit testing there should find
// the root layer.
gfx::Point test_point = gfx::Point(1, 1);
- LayerImpl* result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(1, result_layer->id());
// At (15, 15), child1 and root are the only layers. child1 is expected to be
// on top.
test_point = gfx::Point(15, 15);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(2, result_layer->id());
// At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
test_point = gfx::Point(51, 20);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(3, result_layer->id());
// At (80, 51), child2 and grand_child1 overlap. child2 is expected to be on
// top.
test_point = gfx::Point(80, 51);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(3, result_layer->id());
// At (51, 51), all layers overlap each other. child2 is expected to be on top
// of all other layers.
test_point = gfx::Point(51, 51);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(3, result_layer->id());
// At (20, 51), child1 and grand_child1 overlap. grand_child1 is expected to
// be on top.
test_point = gfx::Point(20, 51);
- result_layer = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(4, result_layer->id());
}
@@ -5385,45 +5369,26 @@ TEST_F(LayerTreeHostCommonTest, HitTestingForEmptyLayers) {
// 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 = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ LayerImpl* result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
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 = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
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 = LayerTreeHostCommon::FindLayerThatIsHitByPoint(
- test_point, render_surface_layer_list);
+ result_layer =
+ LayerTreeHostCommon::FindLayerThatIsHitByPoint(test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(4, result_layer->id());
}
-TEST_F(LayerTreeHostCommonTest,
- HitCheckingTouchHandlerRegionsForEmptyLayerList) {
- // Hit checking on an empty render_surface_layer_list should return a null
- // pointer.
- LayerImplList render_surface_layer_list;
-
- gfx::Point test_point(0, 0);
- LayerImpl* result_layer =
- LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
- EXPECT_FALSE(result_layer);
-
- test_point = gfx::Point(10, 20);
- result_layer =
- LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
- EXPECT_FALSE(result_layer);
-}
-
TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
FakeImplProxy proxy;
TestSharedBitmapManager shared_bitmap_manager;
@@ -5460,7 +5425,7 @@ TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
gfx::Point test_point(11, 11);
LayerImpl* result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
root->SetTouchEventHandlerRegion(touch_handler_region);
@@ -5468,13 +5433,13 @@ TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
test_point = gfx::Point(101, 101);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(-1, -1);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the layer, but outside the touch handler
@@ -5482,13 +5447,13 @@ TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
test_point = gfx::Point(1, 1);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(99, 99);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the touch event handler region should
@@ -5496,14 +5461,14 @@ TEST_F(LayerTreeHostCommonTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
test_point = gfx::Point(11, 11);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
test_point = gfx::Point(59, 59);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -5556,43 +5521,43 @@ TEST_F(LayerTreeHostCommonTest,
gfx::Point test_point(1, 1);
LayerImpl* result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(10, 10);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(10, 30);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(50, 50);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(67, 48);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(99, 99);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(-1, -1);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
}
@@ -5635,7 +5600,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::Point test_point(49, 49);
LayerImpl* result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Even though the layer has a touch handler region containing (101, 101), it
@@ -5643,7 +5608,7 @@ TEST_F(LayerTreeHostCommonTest,
test_point = gfx::Point(101, 101);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the layer, but outside the touch handler
@@ -5651,7 +5616,7 @@ TEST_F(LayerTreeHostCommonTest,
test_point = gfx::Point(51, 51);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the touch event handler region should
@@ -5659,14 +5624,14 @@ TEST_F(LayerTreeHostCommonTest,
test_point = gfx::Point(61, 61);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
test_point = gfx::Point(99, 99);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -5741,7 +5706,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::Point test_point(76, 76);
LayerImpl* result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the layer, but outside the touch handler
@@ -5749,25 +5714,25 @@ TEST_F(LayerTreeHostCommonTest,
test_point = gfx::Point(26, 26);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(34, 34);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(65, 65);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(74, 74);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the touch event handler region should
@@ -5775,14 +5740,14 @@ TEST_F(LayerTreeHostCommonTest,
test_point = gfx::Point(35, 35);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
test_point = gfx::Point(64, 64);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -5858,7 +5823,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
LayerImpl* result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the layer, but outside the touch handler
@@ -5868,7 +5833,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(34, 34);
@@ -5876,7 +5841,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(65, 65);
@@ -5884,7 +5849,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(74, 74);
@@ -5892,7 +5857,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the touch event handler region should
@@ -5902,7 +5867,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
@@ -5911,7 +5876,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
}
@@ -5986,7 +5951,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::Point test_point(24, 24);
LayerImpl* result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the layer, but outside the touch handler
@@ -5994,13 +5959,13 @@ TEST_F(LayerTreeHostCommonTest,
test_point = gfx::Point(35, 35);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
test_point = gfx::Point(74, 74);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
// Hit checking for a point inside the touch event handler region should
@@ -6008,14 +5973,14 @@ TEST_F(LayerTreeHostCommonTest,
test_point = gfx::Point(25, 25);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
test_point = gfx::Point(34, 34);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
}
@@ -6088,7 +6053,7 @@ TEST_F(LayerTreeHostCommonTest,
gfx::Point test_point(35, 35);
LayerImpl* result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
// We should have passed through the no-touch layer and found the layer
// behind it.
@@ -6097,7 +6062,7 @@ TEST_F(LayerTreeHostCommonTest,
host_impl.active_tree()->LayerById(1234)->SetContentsOpaque(true);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
// Even with an opaque layer in the middle, we should still find the layer
// with
@@ -6108,14 +6073,14 @@ TEST_F(LayerTreeHostCommonTest,
test_point = gfx::Point(35, 15);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
ASSERT_TRUE(result_layer);
EXPECT_EQ(123, result_layer->id());
test_point = gfx::Point(35, 65);
result_layer =
LayerTreeHostCommon::FindLayerThatIsHitByPointInTouchHandlerRegion(
- test_point, render_surface_layer_list);
+ test_point, root.get());
EXPECT_FALSE(result_layer);
}

Powered by Google App Engine
This is Rietveld 408576698