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

Unified Diff: cc/trees/layer_tree_impl_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-gfx: . Created 5 years, 3 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_impl_unittest.cc
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 3b4bcae3cd13f1d76e474e04968181d2edd0ff52..6614f9b91cbd5d5ead70dbd46fde4950020a606a 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -67,24 +67,24 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayer) {
ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
// Hit testing for a point outside the layer should return a null pointer.
- gfx::Point test_point(101, 101);
+ gfx::PointF test_point(101.f, 101.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(-1, -1);
+ test_point = gfx::PointF(-1.f, -1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer.
- test_point = gfx::Point(1, 1);
+ test_point = gfx::PointF(1.f, 1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
- test_point = gfx::Point(99, 99);
+ test_point = gfx::PointF(99.f, 99.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -125,7 +125,7 @@ TEST_F(LayerTreeImplTest, UpdateViewportAndHitTest) {
gfx::Size new_bounds(50, 50);
host_impl->SetViewportSize(new_bounds);
- gfx::Point test_point(51, 51);
+ gfx::PointF test_point(51.f, 51.f);
host_impl->active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_EQ(
gfx::RectF(gfx::SizeF(new_bounds)),
@@ -166,25 +166,25 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleLayerAndHud) {
ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size());
// Hit testing for a point inside HUD, but outside root should return null
- gfx::Point test_point(101, 101);
+ gfx::PointF test_point(101.f, 101.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(-1, -1);
+ test_point = gfx::PointF(-1.f, -1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
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);
+ test_point = gfx::PointF(1.f, 1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
- test_point = gfx::Point(99, 99);
+ test_point = gfx::PointF(99.f, 99.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -222,37 +222,37 @@ TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) {
// Hit testing any point should not hit the layer. If the invertible matrix is
// 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);
+ gfx::PointF test_point(1.f, 1.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(10, 10);
+ test_point = gfx::PointF(10.f, 10.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(10, 30);
+ test_point = gfx::PointF(10.f, 30.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(50, 50);
+ test_point = gfx::PointF(50.f, 50.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(67, 48);
+ test_point = gfx::PointF(67.f, 48.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(99, 99);
+ test_point = gfx::PointF(99.f, 99.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(-1, -1);
+ test_point = gfx::PointF(-1.f, -1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
@@ -281,26 +281,26 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePositionedLayer) {
ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
// Hit testing for a point outside the layer should return a null pointer.
- gfx::Point test_point(49, 49);
+ gfx::PointF test_point(49.f, 49.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
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);
+ test_point = gfx::PointF(101.f, 101.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer.
- test_point = gfx::Point(51, 51);
+ test_point = gfx::PointF(51.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
- test_point = gfx::Point(99, 99);
+ test_point = gfx::PointF(99.f, 99.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -335,18 +335,18 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) {
// Hit testing for points outside the layer.
// 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);
+ gfx::PointF test_point(99.f, 99.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(1, 1);
+ test_point = gfx::PointF(1.f, 1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer.
- test_point = gfx::Point(1, 50);
+ test_point = gfx::PointF(1.f, 50.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -354,12 +354,12 @@ TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) {
// Hit testing the corners that would overlap the unclipped layer, but are
// outside the clipped region.
- test_point = gfx::Point(50, -1);
+ test_point = gfx::PointF(50.f, -1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_FALSE(result_layer);
- test_point = gfx::Point(-1, 50);
+ test_point = gfx::PointF(-1.f, 50.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_FALSE(result_layer);
@@ -399,24 +399,24 @@ TEST_F(LayerTreeImplTest, HitTestingForSinglePerspectiveLayer) {
// Hit testing for points outside the layer.
// 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);
+ gfx::PointF test_point(24.f, 24.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(76, 76);
+ test_point = gfx::PointF(76.f, 76.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the root layer.
- test_point = gfx::Point(26, 26);
+ test_point = gfx::PointF(26.f, 26.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
- test_point = gfx::Point(74, 74);
+ test_point = gfx::PointF(74.f, 74.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -469,26 +469,26 @@ TEST_F(LayerTreeImplTest, HitTestingForSimpleClippedLayer) {
// Hit testing for a point outside the layer should return a null pointer.
// Despite the child layer being very large, it should be clipped to the root
// layer's bounds.
- gfx::Point test_point(24, 24);
+ gfx::PointF test_point(24.f, 24.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
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);
+ test_point = gfx::PointF(76.f, 76.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the child layer.
- test_point = gfx::Point(26, 26);
+ test_point = gfx::PointF(26.f, 26.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
- test_point = gfx::Point(74, 74);
+ test_point = gfx::PointF(74.f, 74.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -570,13 +570,13 @@ TEST_F(LayerTreeImplTest, 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);
+ gfx::PointF test_point(11.f, 89.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// Closer inwards from the bottom left will overlap the layer.
- test_point = gfx::Point(25, 75);
+ test_point = gfx::PointF(25.f, 75.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -587,13 +587,13 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
// blindly uses visible content rect without considering how parent may clip
// the layer, then hit testing would accidentally think that the point
// successfully hits the layer.
- test_point = gfx::Point(4, 50);
+ test_point = gfx::PointF(4.f, 50.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// (11, 50) is inside the layer and within the clipped area.
- test_point = gfx::Point(11, 50);
+ test_point = gfx::PointF(11.f, 50.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -601,14 +601,14 @@ TEST_F(LayerTreeImplTest, HitTestingForMultiClippedRotatedLayer) {
// 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);
+ test_point = gfx::PointF(51.f, 49.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// Around the middle, just to the left and down, should successfully hit the
// layer.
- test_point = gfx::Point(49, 51);
+ test_point = gfx::PointF(49.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -663,24 +663,24 @@ TEST_F(LayerTreeImplTest, HitTestingForNonClippingIntermediateLayer) {
ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id());
// Hit testing for a point outside the layer should return a null pointer.
- gfx::Point test_point(69, 69);
+ gfx::PointF test_point(69.f, 69.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(91, 91);
+ test_point = gfx::PointF(91.f, 91.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
EXPECT_FALSE(result_layer);
// Hit testing for a point inside should return the child layer.
- test_point = gfx::Point(71, 71);
+ test_point = gfx::PointF(71.f, 71.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
- test_point = gfx::Point(89, 89);
+ test_point = gfx::PointF(89.f, 89.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -763,7 +763,7 @@ TEST_F(LayerTreeImplTest, 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);
+ gfx::PointF test_point = gfx::PointF(1.f, 1.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -771,14 +771,14 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
// At (15, 15), child1 and root are the only layers. child1 is expected to be
// on top.
- test_point = gfx::Point(15, 15);
+ test_point = gfx::PointF(15.f, 15.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
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);
+ test_point = gfx::PointF(51.f, 20.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -786,7 +786,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
// At (80, 51), child2 and grand_child1 overlap. child2 is expected to be on
// top.
- test_point = gfx::Point(80, 51);
+ test_point = gfx::PointF(80.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -794,7 +794,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
// 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);
+ test_point = gfx::PointF(51.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -802,7 +802,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayers) {
// At (20, 51), child1 and grand_child1 overlap. grand_child1 is expected to
// be on top.
- test_point = gfx::Point(20, 51);
+ test_point = gfx::PointF(20.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -886,7 +886,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
// 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);
+ gfx::PointF test_point = gfx::PointF(1.f, 1.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -894,7 +894,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
// At (15, 15), child1 and root are the only layers. child1 is expected to be
// on top.
- test_point = gfx::Point(15, 15);
+ test_point = gfx::PointF(15.f, 15.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -902,7 +902,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
// At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
// (because 3 is transformed to the back).
- test_point = gfx::Point(51, 20);
+ test_point = gfx::PointF(51.f, 20.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -910,7 +910,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
// 3 Would have been on top if it hadn't been transformed to the background.
// Make sure that it isn't hit.
- test_point = gfx::Point(80, 51);
+ test_point = gfx::PointF(80.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -918,7 +918,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
// 3 Would have been on top if it hadn't been transformed to the background.
// Make sure that it isn't hit.
- test_point = gfx::Point(51, 51);
+ test_point = gfx::PointF(51.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -926,7 +926,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayersAtVaryingDepths) {
// At (20, 51), child1 and grand_child1 overlap. grand_child1 is expected to
// be on top.
- test_point = gfx::Point(20, 51);
+ test_point = gfx::PointF(20.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -974,7 +974,7 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsClipParents) {
host_impl().active_tree()->SetRootLayer(root.Pass());
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
- gfx::Point test_point = gfx::Point(12, 52);
+ gfx::PointF test_point(12.f, 52.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -1034,7 +1034,7 @@ TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
host_impl().active_tree()->SetRootLayer(root.Pass());
host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
- gfx::Point test_point = gfx::Point(12, 52);
+ gfx::PointF test_point(12.f, 52.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
// The |test_point| should have been clipped away by |child|, the scroll
@@ -1132,7 +1132,7 @@ TEST_F(LayerTreeImplTest, 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);
+ gfx::PointF test_point(1.f, 1.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -1140,14 +1140,14 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
// At (15, 15), child1 and root are the only layers. child1 is expected to be
// on top.
- test_point = gfx::Point(15, 15);
+ test_point = gfx::PointF(15.f, 15.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
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);
+ test_point = gfx::PointF(51.f, 20.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -1155,7 +1155,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
// At (80, 51), child2 and grand_child1 overlap. child2 is expected to be on
// top.
- test_point = gfx::Point(80, 51);
+ test_point = gfx::PointF(80.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -1163,7 +1163,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
// 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);
+ test_point = gfx::PointF(51.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -1171,7 +1171,7 @@ TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
// At (20, 51), child1 and grand_child1 overlap. grand_child1 is expected to
// be on top.
- test_point = gfx::Point(20, 51);
+ test_point = gfx::PointF(20.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
ASSERT_TRUE(result_layer);
@@ -1201,7 +1201,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
// Hit checking for any point should return a null pointer for a layer without
// any touch event handler regions.
- gfx::Point test_point(11, 11);
+ gfx::PointF test_point(11.f, 11.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1210,13 +1210,13 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
host_impl().active_tree()->root_layer()->SetTouchEventHandlerRegion(
touch_handler_region);
// Hit checking for a point outside the layer should return a null pointer.
- test_point = gfx::Point(101, 101);
+ test_point = gfx::PointF(101.f, 101.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(-1, -1);
+ test_point = gfx::PointF(-1.f, -1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1224,13 +1224,13 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
// Hit checking for a point inside the layer, but outside the touch handler
// region should return a null pointer.
- test_point = gfx::Point(1, 1);
+ test_point = gfx::PointF(1.f, 1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(99, 99);
+ test_point = gfx::PointF(99.f, 99.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1238,14 +1238,14 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSingleLayer) {
// Hit checking for a point inside the touch event handler region should
// return the root layer.
- test_point = gfx::Point(11, 11);
+ test_point = gfx::PointF(11.f, 11.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
- test_point = gfx::Point(59, 59);
+ test_point = gfx::PointF(59.f, 59.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1289,43 +1289,43 @@ TEST_F(LayerTreeImplTest,
// layer. If the invertible matrix is 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);
+ gfx::PointF test_point(1.f, 1.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(10, 10);
+ test_point = gfx::PointF(10.f, 10.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(10, 30);
+ test_point = gfx::PointF(10.f, 30.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(50, 50);
+ test_point = gfx::PointF(50.f, 50.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(67, 48);
+ test_point = gfx::PointF(67.f, 48.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(99, 99);
+ test_point = gfx::PointF(99.f, 99.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(-1, -1);
+ test_point = gfx::PointF(-1.f, -1.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1426,7 +1426,7 @@ TEST_F(LayerTreeImplTest,
ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
// Hit checking for a point outside the layer should return a null pointer.
- gfx::Point test_point(49, 49);
+ gfx::PointF test_point(49.f, 49.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1434,7 +1434,7 @@ TEST_F(LayerTreeImplTest,
// Even though the layer has a touch handler region containing (101, 101), it
// should not be visible there since the root render surface would clamp it.
- test_point = gfx::Point(101, 101);
+ test_point = gfx::PointF(101.f, 101.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1442,7 +1442,7 @@ TEST_F(LayerTreeImplTest,
// Hit checking for a point inside the layer, but outside the touch handler
// region should return a null pointer.
- test_point = gfx::Point(51, 51);
+ test_point = gfx::PointF(51.f, 51.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1450,14 +1450,14 @@ TEST_F(LayerTreeImplTest,
// Hit checking for a point inside the touch event handler region should
// return the root layer.
- test_point = gfx::Point(61, 61);
+ test_point = gfx::PointF(61.f, 61.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
- test_point = gfx::Point(99, 99);
+ test_point = gfx::PointF(99.f, 99.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1531,7 +1531,7 @@ TEST_F(LayerTreeImplTest,
// Hit checking for a point inside the layer, but outside the touch handler
// region should return a null pointer.
- test_point = gfx::Point(26, 26);
+ test_point = gfx::PointF(26.f, 26.f);
test_point =
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
@@ -1539,7 +1539,7 @@ TEST_F(LayerTreeImplTest,
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(34, 34);
+ test_point = gfx::PointF(34.f, 34.f);
test_point =
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
@@ -1547,7 +1547,7 @@ TEST_F(LayerTreeImplTest,
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(65, 65);
+ test_point = gfx::PointF(65.f, 65.f);
test_point =
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
@@ -1555,7 +1555,7 @@ TEST_F(LayerTreeImplTest,
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(74, 74);
+ test_point = gfx::PointF(74.f, 74.f);
test_point =
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
@@ -1565,7 +1565,7 @@ TEST_F(LayerTreeImplTest,
// Hit checking for a point inside the touch event handler region should
// return the root layer.
- test_point = gfx::Point(35, 35);
+ test_point = gfx::PointF(35.f, 35.f);
test_point =
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
@@ -1574,7 +1574,7 @@ TEST_F(LayerTreeImplTest,
ASSERT_TRUE(result_layer);
EXPECT_EQ(12345, result_layer->id());
- test_point = gfx::Point(64, 64);
+ test_point = gfx::PointF(64.f, 64.f);
test_point =
gfx::ScalePoint(test_point, device_scale_factor * page_scale_factor);
result_layer =
@@ -1632,7 +1632,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
// Hit checking for a point outside the layer should return a null pointer.
// Despite the child layer being very large, it should be clipped to the root
// layer's bounds.
- gfx::Point test_point(24, 24);
+ gfx::PointF test_point(24.f, 24.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1640,13 +1640,13 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
// Hit checking for a point inside the layer, but outside the touch handler
// region should return a null pointer.
- test_point = gfx::Point(35, 35);
+ test_point = gfx::PointF(35.f, 35.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
EXPECT_FALSE(result_layer);
- test_point = gfx::Point(74, 74);
+ test_point = gfx::PointF(74.f, 74.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1654,14 +1654,14 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerRegionsForSimpleClippedLayer) {
// Hit checking for a point inside the touch event handler region should
// return the root layer.
- test_point = gfx::Point(25, 25);
+ test_point = gfx::PointF(25.f, 25.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(456, result_layer->id());
- test_point = gfx::Point(34, 34);
+ test_point = gfx::PointF(34.f, 34.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1716,7 +1716,7 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
ASSERT_EQ(123, root_layer()->render_surface()->layer_list().at(0)->id());
ASSERT_EQ(1234, root_layer()->render_surface()->layer_list().at(1)->id());
- gfx::Point test_point(35, 35);
+ gfx::PointF test_point(35.f, 35.f);
LayerImpl* result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1736,14 +1736,14 @@ TEST_F(LayerTreeImplTest, HitCheckingTouchHandlerOverlappingRegions) {
// opaque to hit testing).
EXPECT_TRUE(result_layer);
- test_point = gfx::Point(35, 15);
+ test_point = gfx::PointF(35.f, 15.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
ASSERT_TRUE(result_layer);
EXPECT_EQ(123, result_layer->id());
- test_point = gfx::Point(35, 65);
+ test_point = gfx::PointF(35.f, 65.f);
result_layer =
host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
test_point);
@@ -1774,13 +1774,13 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
LayerSelection input;
input.start.type = SELECTION_BOUND_LEFT;
- input.start.edge_top = gfx::PointF(10, 10);
- input.start.edge_bottom = gfx::PointF(10, 20);
+ input.start.edge_top = gfx::Point(10, 10);
+ input.start.edge_bottom = gfx::Point(10, 20);
input.start.layer_id = root_layer_id;
input.end.type = SELECTION_BOUND_RIGHT;
- input.end.edge_top = gfx::PointF(50, 10);
- input.end.edge_bottom = gfx::PointF(50, 30);
+ input.end.edge_top = gfx::Point(50, 10);
+ input.end.edge_bottom = gfx::Point(50, 30);
input.end.layer_id = root_layer_id;
ViewportSelection output;
@@ -1794,12 +1794,12 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
host_impl().active_tree()->RegisterSelection(input);
host_impl().active_tree()->GetViewportSelection(&output);
EXPECT_EQ(input.start.type, output.start.type);
- EXPECT_EQ(input.start.edge_bottom, output.start.edge_bottom);
- EXPECT_EQ(input.start.edge_top, output.start.edge_top);
+ EXPECT_EQ(gfx::PointF(input.start.edge_bottom), output.start.edge_bottom);
+ EXPECT_EQ(gfx::PointF(input.start.edge_top), output.start.edge_top);
EXPECT_TRUE(output.start.visible);
EXPECT_EQ(input.end.type, output.end.type);
- EXPECT_EQ(input.end.edge_bottom, output.end.edge_bottom);
- EXPECT_EQ(input.end.edge_top, output.end.edge_top);
+ EXPECT_EQ(gfx::PointF(input.end.edge_bottom), output.end.edge_bottom);
+ EXPECT_EQ(gfx::PointF(input.end.edge_top), output.end.edge_top);
EXPECT_TRUE(output.end.visible);
EXPECT_EQ(input.is_editable, output.is_editable);
EXPECT_EQ(input.is_empty_text_form_control,
@@ -1808,8 +1808,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
// Insertion bounds should produce identical left and right bounds.
LayerSelection insertion_input;
insertion_input.start.type = SELECTION_BOUND_CENTER;
- insertion_input.start.edge_top = gfx::PointF(15, 10);
- insertion_input.start.edge_bottom = gfx::PointF(15, 30);
+ insertion_input.start.edge_top = gfx::Point(15, 10);
+ insertion_input.start.edge_bottom = gfx::Point(15, 30);
insertion_input.start.layer_id = root_layer_id;
insertion_input.is_editable = true;
insertion_input.is_empty_text_form_control = true;
@@ -1817,8 +1817,9 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForSingleLayer) {
host_impl().active_tree()->RegisterSelection(insertion_input);
host_impl().active_tree()->GetViewportSelection(&output);
EXPECT_EQ(insertion_input.start.type, output.start.type);
- EXPECT_EQ(insertion_input.start.edge_bottom, output.start.edge_bottom);
- EXPECT_EQ(insertion_input.start.edge_top, output.start.edge_top);
+ EXPECT_EQ(gfx::PointF(insertion_input.start.edge_bottom),
+ output.start.edge_bottom);
+ EXPECT_EQ(gfx::PointF(insertion_input.start.edge_top), output.start.edge_top);
EXPECT_EQ(insertion_input.is_editable, output.is_editable);
EXPECT_EQ(insertion_input.is_empty_text_form_control,
output.is_empty_text_form_control);
@@ -1874,13 +1875,13 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
LayerSelection input;
input.start.type = SELECTION_BOUND_LEFT;
- input.start.edge_top = gfx::PointF(25, 10);
- input.start.edge_bottom = gfx::PointF(25, 30);
+ input.start.edge_top = gfx::Point(25, 10);
+ input.start.edge_bottom = gfx::Point(25, 30);
input.start.layer_id = clipped_layer_id;
input.end.type = SELECTION_BOUND_RIGHT;
- input.end.edge_top = gfx::PointF(75, 10);
- input.end.edge_bottom = gfx::PointF(75, 30);
+ input.end.edge_top = gfx::Point(75, 10);
+ input.end.edge_bottom = gfx::Point(75, 30);
input.end.layer_id = clipped_layer_id;
host_impl().active_tree()->RegisterSelection(input);
@@ -1888,16 +1889,16 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
ViewportSelection output;
host_impl().active_tree()->GetViewportSelection(&output);
EXPECT_EQ(input.start.type, output.start.type);
- gfx::PointF expected_output_start_top = input.start.edge_top;
- gfx::PointF expected_output_edge_botom = input.start.edge_bottom;
+ auto expected_output_start_top = gfx::PointF(input.start.edge_top);
+ auto expected_output_edge_botom = gfx::PointF(input.start.edge_bottom);
expected_output_start_top.Offset(clipping_offset.x(), clipping_offset.y());
expected_output_edge_botom.Offset(clipping_offset.x(), clipping_offset.y());
EXPECT_EQ(expected_output_start_top, output.start.edge_top);
EXPECT_EQ(expected_output_edge_botom, output.start.edge_bottom);
EXPECT_TRUE(output.start.visible);
EXPECT_EQ(input.end.type, output.end.type);
- gfx::PointF expected_output_end_top = input.end.edge_top;
- gfx::PointF expected_output_end_bottom = input.end.edge_bottom;
+ auto expected_output_end_top = gfx::PointF(input.end.edge_top);
+ auto expected_output_end_bottom = gfx::PointF(input.end.edge_bottom);
expected_output_end_bottom.Offset(clipping_offset.x(), clipping_offset.y());
expected_output_end_top.Offset(clipping_offset.x(), clipping_offset.y());
EXPECT_EQ(expected_output_end_top, output.end.edge_top);
@@ -1905,21 +1906,21 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForPartialOccludedLayers) {
EXPECT_FALSE(output.end.visible);
// Handles outside the viewport bounds should be marked invisible.
- input.start.edge_top = gfx::PointF(-25, 0);
- input.start.edge_bottom = gfx::PointF(-25, 20);
+ input.start.edge_top = gfx::Point(-25, 0);
+ input.start.edge_bottom = gfx::Point(-25, 20);
host_impl().active_tree()->RegisterSelection(input);
host_impl().active_tree()->GetViewportSelection(&output);
EXPECT_FALSE(output.start.visible);
- input.start.edge_top = gfx::PointF(0, -25);
- input.start.edge_bottom = gfx::PointF(0, -5);
+ input.start.edge_top = gfx::Point(0, -25);
+ input.start.edge_bottom = gfx::Point(0, -5);
host_impl().active_tree()->RegisterSelection(input);
host_impl().active_tree()->GetViewportSelection(&output);
EXPECT_FALSE(output.start.visible);
// If the handle bottom is partially visible, the handle is marked visible.
- input.start.edge_top = gfx::PointF(0, -20);
- input.start.edge_bottom = gfx::PointF(0, 1);
+ input.start.edge_top = gfx::Point(0, -20);
+ input.start.edge_bottom = gfx::Point(0, 1);
host_impl().active_tree()->RegisterSelection(input);
host_impl().active_tree()->GetViewportSelection(&output);
EXPECT_TRUE(output.start.visible);
@@ -1972,13 +1973,13 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
LayerSelection input;
input.start.type = SELECTION_BOUND_LEFT;
- input.start.edge_top = gfx::PointF(10, 10);
- input.start.edge_bottom = gfx::PointF(10, 30);
+ input.start.edge_top = gfx::Point(10, 10);
+ input.start.edge_bottom = gfx::Point(10, 30);
input.start.layer_id = root_layer_id;
input.end.type = SELECTION_BOUND_RIGHT;
- input.end.edge_top = gfx::PointF(0, 0);
- input.end.edge_bottom = gfx::PointF(0, 20);
+ input.end.edge_top = gfx::Point(0, 0);
+ input.end.edge_bottom = gfx::Point(0, 20);
input.end.layer_id = sub_layer_id;
host_impl().active_tree()->RegisterSelection(input);
@@ -1987,8 +1988,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
ViewportSelection output;
host_impl().active_tree()->GetViewportSelection(&output);
EXPECT_EQ(input.start.type, output.start.type);
- gfx::PointF expected_output_start_top = input.start.edge_top;
- gfx::PointF expected_output_edge_bottom = input.start.edge_bottom;
+ auto expected_output_start_top = gfx::PointF(input.start.edge_top);
+ auto expected_output_edge_bottom = gfx::PointF(input.start.edge_bottom);
expected_output_start_top.Scale(page_scale_factor);
expected_output_edge_bottom.Scale(page_scale_factor);
EXPECT_EQ(expected_output_start_top, output.start.edge_top);
@@ -1996,8 +1997,8 @@ TEST_F(LayerTreeImplTest, SelectionBoundsForScaledLayers) {
EXPECT_TRUE(output.start.visible);
EXPECT_EQ(input.end.type, output.end.type);
- gfx::PointF expected_output_end_top = input.end.edge_top;
- gfx::PointF expected_output_end_bottom = input.end.edge_bottom;
+ auto expected_output_end_top = gfx::PointF(input.end.edge_top);
+ auto expected_output_end_bottom = gfx::PointF(input.end.edge_bottom);
expected_output_end_top.Offset(sub_layer_offset.x(), sub_layer_offset.y());
expected_output_end_bottom.Offset(sub_layer_offset.x(), sub_layer_offset.y());
expected_output_end_top.Scale(page_scale_factor);
@@ -2050,13 +2051,13 @@ TEST_F(LayerTreeImplTest, SelectionBoundsWithLargeTransforms) {
LayerSelection input;
input.start.type = SELECTION_BOUND_LEFT;
- input.start.edge_top = gfx::PointF(10, 10);
- input.start.edge_bottom = gfx::PointF(10, 20);
+ input.start.edge_top = gfx::Point(10, 10);
+ input.start.edge_bottom = gfx::Point(10, 20);
input.start.layer_id = grand_child_id;
input.end.type = SELECTION_BOUND_RIGHT;
- input.end.edge_top = gfx::PointF(50, 10);
- input.end.edge_bottom = gfx::PointF(50, 30);
+ input.end.edge_top = gfx::Point(50, 10);
+ input.end.edge_bottom = gfx::Point(50, 30);
input.end.layer_id = grand_child_id;
host_impl().active_tree()->RegisterSelection(input);

Powered by Google App Engine
This is Rietveld 408576698