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 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 position = gfx::PointF(); | 570 position = gfx::PointF(); |
571 bounds = gfx::Size(100, 100); | 571 bounds = gfx::Size(100, 100); |
572 SetLayerPropertiesForTesting(rotated_leaf.get(), rotated_leaf_transform, | 572 SetLayerPropertiesForTesting(rotated_leaf.get(), rotated_leaf_transform, |
573 transform_origin, position, bounds, true, | 573 transform_origin, position, bounds, true, |
574 false, false); | 574 false, false); |
575 rotated_leaf->SetDrawsContent(true); | 575 rotated_leaf->SetDrawsContent(true); |
576 | 576 |
577 grand_child->AddChild(std::move(rotated_leaf)); | 577 grand_child->AddChild(std::move(rotated_leaf)); |
578 child->AddChild(std::move(grand_child)); | 578 child->AddChild(std::move(grand_child)); |
579 root->AddChild(std::move(child)); | 579 root->AddChild(std::move(child)); |
580 | |
581 ExecuteCalculateDrawProperties(root.get()); | |
582 } | 580 } |
583 | 581 |
584 host_impl().SetViewportSize(root->bounds()); | 582 host_impl().SetViewportSize(root->bounds()); |
585 host_impl().active_tree()->SetRootLayer(std::move(root)); | 583 host_impl().active_tree()->SetRootLayer(std::move(root)); |
586 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 584 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 585 |
587 // (11, 89) is close to the the bottom left corner within the clip, but it is | 586 // (11, 89) is close to the the bottom left corner within the clip, but it is |
588 // not inside the layer. | 587 // not inside the layer. |
589 gfx::PointF test_point(11.f, 89.f); | 588 gfx::PointF test_point(11.f, 89.f); |
590 LayerImpl* result_layer = | 589 LayerImpl* result_layer = |
591 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 590 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
592 EXPECT_FALSE(result_layer); | 591 EXPECT_FALSE(result_layer); |
593 | 592 |
594 // Closer inwards from the bottom left will overlap the layer. | 593 // Closer inwards from the bottom left will overlap the layer. |
595 test_point = gfx::PointF(25.f, 75.f); | 594 test_point = gfx::PointF(25.f, 75.f); |
596 result_layer = | 595 result_layer = |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 position = gfx::PointF(0.f, 40.f); | 746 position = gfx::PointF(0.f, 40.f); |
748 bounds = gfx::Size(100, 50); | 747 bounds = gfx::Size(100, 50); |
749 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, | 748 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, |
750 transform_origin, position, bounds, true, | 749 transform_origin, position, bounds, true, |
751 false, false); | 750 false, false); |
752 grand_child1->SetDrawsContent(true); | 751 grand_child1->SetDrawsContent(true); |
753 | 752 |
754 child1->AddChild(std::move(grand_child1)); | 753 child1->AddChild(std::move(grand_child1)); |
755 root->AddChild(std::move(child1)); | 754 root->AddChild(std::move(child1)); |
756 root->AddChild(std::move(child2)); | 755 root->AddChild(std::move(child2)); |
757 | |
758 ExecuteCalculateDrawProperties(root.get()); | |
759 } | 756 } |
760 | 757 |
761 LayerImpl* child1 = root->children()[0].get(); | 758 LayerImpl* child1 = root->children()[0].get(); |
762 LayerImpl* child2 = root->children()[1].get(); | 759 LayerImpl* child2 = root->children()[1].get(); |
763 LayerImpl* grand_child1 = child1->children()[0].get(); | 760 LayerImpl* grand_child1 = child1->children()[0].get(); |
764 | 761 |
765 host_impl().SetViewportSize(root->bounds()); | 762 host_impl().SetViewportSize(root->bounds()); |
766 host_impl().active_tree()->SetRootLayer(std::move(root)); | 763 host_impl().active_tree()->SetRootLayer(std::move(root)); |
767 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 764 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
768 | 765 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 LayerImpl::Create(host_impl().active_tree(), 3); | 1182 LayerImpl::Create(host_impl().active_tree(), 3); |
1186 scoped_ptr<LayerImpl> grand_child1 = | 1183 scoped_ptr<LayerImpl> grand_child1 = |
1187 LayerImpl::Create(host_impl().active_tree(), 4); | 1184 LayerImpl::Create(host_impl().active_tree(), 4); |
1188 | 1185 |
1189 position = gfx::PointF(10.f, 10.f); | 1186 position = gfx::PointF(10.f, 10.f); |
1190 bounds = gfx::Size(50, 50); | 1187 bounds = gfx::Size(50, 50); |
1191 SetLayerPropertiesForTesting(child1.get(), identity_matrix, | 1188 SetLayerPropertiesForTesting(child1.get(), identity_matrix, |
1192 transform_origin, position, bounds, true, | 1189 transform_origin, position, bounds, true, |
1193 false, false); | 1190 false, false); |
1194 child1->SetDrawsContent(true); | 1191 child1->SetDrawsContent(true); |
1195 child1->SetForceRenderSurface(true); | 1192 child1->SetHasRenderSurface(true); |
1196 | 1193 |
1197 position = gfx::PointF(50.f, 10.f); | 1194 position = gfx::PointF(50.f, 10.f); |
1198 bounds = gfx::Size(50, 50); | 1195 bounds = gfx::Size(50, 50); |
1199 SetLayerPropertiesForTesting(child2.get(), identity_matrix, | 1196 SetLayerPropertiesForTesting(child2.get(), identity_matrix, |
1200 transform_origin, position, bounds, true, | 1197 transform_origin, position, bounds, true, |
1201 false, false); | 1198 false, false); |
1202 child2->SetDrawsContent(true); | 1199 child2->SetDrawsContent(true); |
1203 child2->SetForceRenderSurface(true); | 1200 child2->SetHasRenderSurface(true); |
1204 | 1201 |
1205 // Remember that grand_child is positioned with respect to its parent (i.e. | 1202 // Remember that grand_child is positioned with respect to its parent (i.e. |
1206 // child1). In screen space, the intended position is (10, 50), with size | 1203 // child1). In screen space, the intended position is (10, 50), with size |
1207 // 100 x 50. | 1204 // 100 x 50. |
1208 position = gfx::PointF(0.f, 40.f); | 1205 position = gfx::PointF(0.f, 40.f); |
1209 bounds = gfx::Size(100, 50); | 1206 bounds = gfx::Size(100, 50); |
1210 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, | 1207 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, |
1211 transform_origin, position, bounds, true, | 1208 transform_origin, position, bounds, true, |
1212 false, false); | 1209 false, false); |
1213 grand_child1->SetDrawsContent(true); | 1210 grand_child1->SetDrawsContent(true); |
1214 grand_child1->SetForceRenderSurface(true); | 1211 grand_child1->SetHasRenderSurface(true); |
1215 | 1212 |
1216 child1->AddChild(std::move(grand_child1)); | 1213 child1->AddChild(std::move(grand_child1)); |
1217 root->AddChild(std::move(child1)); | 1214 root->AddChild(std::move(child1)); |
1218 root->AddChild(std::move(child2)); | 1215 root->AddChild(std::move(child2)); |
1219 | |
1220 ExecuteCalculateDrawProperties(root.get()); | |
1221 } | 1216 } |
1222 | 1217 |
1223 LayerImpl* child1 = root->children()[0].get(); | 1218 LayerImpl* child1 = root->children()[0].get(); |
1224 LayerImpl* child2 = root->children()[1].get(); | 1219 LayerImpl* child2 = root->children()[1].get(); |
1225 LayerImpl* grand_child1 = child1->children()[0].get(); | 1220 LayerImpl* grand_child1 = child1->children()[0].get(); |
1226 | 1221 |
1227 host_impl().SetViewportSize(root->bounds()); | 1222 host_impl().SetViewportSize(root->bounds()); |
1228 host_impl().active_tree()->SetRootLayer(std::move(root)); | 1223 host_impl().active_tree()->SetRootLayer(std::move(root)); |
1229 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1224 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
1230 | 1225 |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2237 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2232 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
2238 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2233 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
2239 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2234 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
2240 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2235 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
2241 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2236 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
2242 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2237 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
2243 } | 2238 } |
2244 | 2239 |
2245 } // namespace | 2240 } // namespace |
2246 } // namespace cc | 2241 } // namespace cc |
OLD | NEW |