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