| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/heads_up_display_layer_impl.h" | 7 #include "cc/layers/heads_up_display_layer_impl.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | 9 #include "cc/layers/solid_color_scrollbar_layer_impl.h" |
| 10 #include "cc/test/fake_impl_task_runner_provider.h" | 10 #include "cc/test/fake_impl_task_runner_provider.h" |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1331 LayerImpl::Create(host_impl().active_tree(), 3); | 1331 LayerImpl::Create(host_impl().active_tree(), 3); |
| 1332 std::unique_ptr<LayerImpl> grand_child1 = | 1332 std::unique_ptr<LayerImpl> grand_child1 = |
| 1333 LayerImpl::Create(host_impl().active_tree(), 4); | 1333 LayerImpl::Create(host_impl().active_tree(), 4); |
| 1334 | 1334 |
| 1335 position = gfx::PointF(10.f, 10.f); | 1335 position = gfx::PointF(10.f, 10.f); |
| 1336 bounds = gfx::Size(50, 50); | 1336 bounds = gfx::Size(50, 50); |
| 1337 SetLayerPropertiesForTesting(child1.get(), identity_matrix, | 1337 SetLayerPropertiesForTesting(child1.get(), identity_matrix, |
| 1338 transform_origin, position, bounds, true, | 1338 transform_origin, position, bounds, true, |
| 1339 false, false); | 1339 false, false); |
| 1340 child1->SetDrawsContent(true); | 1340 child1->SetDrawsContent(true); |
| 1341 child1->SetForceRenderSurface(true); | 1341 child1->test_properties()->force_render_surface = true; |
| 1342 | 1342 |
| 1343 position = gfx::PointF(50.f, 10.f); | 1343 position = gfx::PointF(50.f, 10.f); |
| 1344 bounds = gfx::Size(50, 50); | 1344 bounds = gfx::Size(50, 50); |
| 1345 SetLayerPropertiesForTesting(child2.get(), identity_matrix, | 1345 SetLayerPropertiesForTesting(child2.get(), identity_matrix, |
| 1346 transform_origin, position, bounds, true, | 1346 transform_origin, position, bounds, true, |
| 1347 false, false); | 1347 false, false); |
| 1348 child2->SetDrawsContent(true); | 1348 child2->SetDrawsContent(true); |
| 1349 child2->SetForceRenderSurface(true); | 1349 child2->test_properties()->force_render_surface = true; |
| 1350 | 1350 |
| 1351 // Remember that grand_child is positioned with respect to its parent (i.e. | 1351 // Remember that grand_child is positioned with respect to its parent (i.e. |
| 1352 // child1). In screen space, the intended position is (10, 50), with size | 1352 // child1). In screen space, the intended position is (10, 50), with size |
| 1353 // 100 x 50. | 1353 // 100 x 50. |
| 1354 position = gfx::PointF(0.f, 40.f); | 1354 position = gfx::PointF(0.f, 40.f); |
| 1355 bounds = gfx::Size(100, 50); | 1355 bounds = gfx::Size(100, 50); |
| 1356 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, | 1356 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, |
| 1357 transform_origin, position, bounds, true, | 1357 transform_origin, position, bounds, true, |
| 1358 false, false); | 1358 false, false); |
| 1359 grand_child1->SetDrawsContent(true); | 1359 grand_child1->SetDrawsContent(true); |
| 1360 grand_child1->SetForceRenderSurface(true); | 1360 grand_child1->test_properties()->force_render_surface = true; |
| 1361 | 1361 |
| 1362 child1->AddChild(std::move(grand_child1)); | 1362 child1->AddChild(std::move(grand_child1)); |
| 1363 root->AddChild(std::move(child1)); | 1363 root->AddChild(std::move(child1)); |
| 1364 root->AddChild(std::move(child2)); | 1364 root->AddChild(std::move(child2)); |
| 1365 host_impl().active_tree()->SetRootLayer(std::move(root)); | 1365 host_impl().active_tree()->SetRootLayer(std::move(root)); |
| 1366 | 1366 |
| 1367 ExecuteCalculateDrawProperties(root_layer); | 1367 ExecuteCalculateDrawProperties(root_layer); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 LayerImpl* child1 = root_layer->children()[0]; | 1370 LayerImpl* child1 = root_layer->children()[0]; |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2453 gfx::PointF test_point = gfx::PointF(1.f, 1.f); | 2453 gfx::PointF test_point = gfx::PointF(1.f, 1.f); |
| 2454 LayerImpl* result_layer = | 2454 LayerImpl* result_layer = |
| 2455 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 2455 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 2456 | 2456 |
| 2457 CHECK(result_layer); | 2457 CHECK(result_layer); |
| 2458 EXPECT_EQ(2, result_layer->id()); | 2458 EXPECT_EQ(2, result_layer->id()); |
| 2459 } | 2459 } |
| 2460 | 2460 |
| 2461 } // namespace | 2461 } // namespace |
| 2462 } // namespace cc | 2462 } // namespace cc |
| OLD | NEW |