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_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 host_impl().SetViewportSize(root->bounds()); | 913 host_impl().SetViewportSize(root->bounds()); |
914 host_impl().active_tree()->SetRootLayer(root.Pass()); | 914 host_impl().active_tree()->SetRootLayer(root.Pass()); |
915 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 915 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
916 | 916 |
917 // Sanity check the scenario we just created. | 917 // Sanity check the scenario we just created. |
918 ASSERT_TRUE(child1); | 918 ASSERT_TRUE(child1); |
919 ASSERT_TRUE(child2); | 919 ASSERT_TRUE(child2); |
920 ASSERT_TRUE(grand_child1); | 920 ASSERT_TRUE(grand_child1); |
921 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 921 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
922 | 922 |
| 923 RenderSurfaceImpl* root_render_surface = |
| 924 host_impl().active_tree()->root_layer()->render_surface(); |
| 925 ASSERT_EQ(4u, root_render_surface->layer_list().size()); |
| 926 ASSERT_EQ(3, root_render_surface->layer_list().at(0)->id()); |
| 927 ASSERT_EQ(1, root_render_surface->layer_list().at(1)->id()); |
| 928 ASSERT_EQ(2, root_render_surface->layer_list().at(2)->id()); |
| 929 ASSERT_EQ(4, root_render_surface->layer_list().at(3)->id()); |
| 930 |
923 // Nothing overlaps the root_layer at (1, 1), so hit testing there should find | 931 // Nothing overlaps the root_layer at (1, 1), so hit testing there should find |
924 // the root layer. | 932 // the root layer. |
925 gfx::Point test_point = gfx::Point(1, 1); | 933 gfx::Point test_point = gfx::Point(1, 1); |
926 LayerImpl* result_layer = | 934 LayerImpl* result_layer = |
927 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 935 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
928 ASSERT_TRUE(result_layer); | 936 ASSERT_TRUE(result_layer); |
929 EXPECT_EQ(1, result_layer->id()); | 937 EXPECT_EQ(1, result_layer->id()); |
930 | 938 |
931 // At (15, 15), child1 and root are the only layers. child1 is expected to be | 939 // At (15, 15), child1 and root are the only layers. child1 is expected to be |
932 // on top. | 940 // on top. |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2157 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
2150 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2158 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
2151 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2159 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
2152 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2160 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
2153 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2161 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
2154 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2162 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
2155 } | 2163 } |
2156 | 2164 |
2157 } // namespace | 2165 } // namespace |
2158 } // namespace cc | 2166 } // namespace cc |
OLD | NEW |