| 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" |
| 11 #include "cc/test/fake_layer_tree_host_impl.h" | 11 #include "cc/test/fake_layer_tree_host_impl.h" |
| 12 #include "cc/test/fake_output_surface.h" | 12 #include "cc/test/fake_output_surface.h" |
| 13 #include "cc/test/geometry_test_utils.h" | 13 #include "cc/test/geometry_test_utils.h" |
| 14 #include "cc/test/layer_tree_host_common_test.h" | 14 #include "cc/test/layer_tree_host_common_test.h" |
| 15 #include "cc/test/test_shared_bitmap_manager.h" | 15 #include "cc/test/test_shared_bitmap_manager.h" |
| 16 #include "cc/test/test_task_graph_runner.h" | 16 #include "cc/test/test_task_graph_runner.h" |
| 17 #include "cc/trees/clip_node.h" |
| 17 #include "cc/trees/draw_property_utils.h" | 18 #include "cc/trees/draw_property_utils.h" |
| 18 #include "cc/trees/layer_tree_host_impl.h" | 19 #include "cc/trees/layer_tree_host_impl.h" |
| 19 #include "ui/gfx/geometry/size_conversions.h" | 20 #include "ui/gfx/geometry/size_conversions.h" |
| 20 | 21 |
| 21 namespace cc { | 22 namespace cc { |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 class LayerTreeImplTest : public LayerTreeHostCommonTest { | 25 class LayerTreeImplTest : public LayerTreeHostCommonTest { |
| 25 public: | 26 public: |
| 26 LayerTreeImplTest() : output_surface_(FakeOutputSurface::Create3d()) { | 27 LayerTreeImplTest() : output_surface_(FakeOutputSurface::Create3d()) { |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 EXPECT_FALSE(result_layer); | 441 EXPECT_FALSE(result_layer); |
| 441 | 442 |
| 442 test_point = gfx::PointF(140.f, 140.f); | 443 test_point = gfx::PointF(140.f, 140.f); |
| 443 result_layer = | 444 result_layer = |
| 444 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 445 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 445 ASSERT_TRUE(result_layer); | 446 ASSERT_TRUE(result_layer); |
| 446 EXPECT_EQ(5, result_layer->id()); | 447 EXPECT_EQ(5, result_layer->id()); |
| 447 | 448 |
| 448 ClipTree& clip_tree = host_impl().active_tree()->property_trees()->clip_tree; | 449 ClipTree& clip_tree = host_impl().active_tree()->property_trees()->clip_tree; |
| 449 ClipNode* clip_node = clip_tree.Node(result_layer->clip_tree_index()); | 450 ClipNode* clip_node = clip_tree.Node(result_layer->clip_tree_index()); |
| 450 EXPECT_NE(clip_node->data.transform_id, clip_node->data.target_id); | 451 EXPECT_NE(clip_node->transform_id, clip_node->target_id); |
| 451 } | 452 } |
| 452 | 453 |
| 453 TEST_F(LayerTreeImplTest, HitTestingSiblings) { | 454 TEST_F(LayerTreeImplTest, HitTestingSiblings) { |
| 454 // This tests hit testing when the test point hits only one of the siblings. | 455 // This tests hit testing when the test point hits only one of the siblings. |
| 455 gfx::Transform identity_matrix; | 456 gfx::Transform identity_matrix; |
| 456 std::unique_ptr<LayerImpl> root = | 457 std::unique_ptr<LayerImpl> root = |
| 457 LayerImpl::Create(host_impl().active_tree(), 1); | 458 LayerImpl::Create(host_impl().active_tree(), 1); |
| 458 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), | 459 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), |
| 459 gfx::PointF(), gfx::Size(100, 100), true, false, | 460 gfx::PointF(), gfx::Size(100, 100), true, false, |
| 460 true); | 461 true); |
| (...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 gfx::PointF test_point = gfx::PointF(1.f, 1.f); | 2567 gfx::PointF test_point = gfx::PointF(1.f, 1.f); |
| 2567 LayerImpl* result_layer = | 2568 LayerImpl* result_layer = |
| 2568 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 2569 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 2569 | 2570 |
| 2570 CHECK(result_layer); | 2571 CHECK(result_layer); |
| 2571 EXPECT_EQ(2, result_layer->id()); | 2572 EXPECT_EQ(2, result_layer->id()); |
| 2572 } | 2573 } |
| 2573 | 2574 |
| 2574 } // namespace | 2575 } // namespace |
| 2575 } // namespace cc | 2576 } // namespace cc |
| OLD | NEW |