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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "cc/animation/mutable_properties.h" | 8 #include "cc/animation/mutable_properties.h" |
9 #include "cc/layers/heads_up_display_layer_impl.h" | 9 #include "cc/layers/heads_up_display_layer_impl.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 LayerImpl::Create(host_impl().active_tree(), root_id); | 67 LayerImpl::Create(host_impl().active_tree(), root_id); |
68 std::unique_ptr<LayerImpl> left_child = | 68 std::unique_ptr<LayerImpl> left_child = |
69 LayerImpl::Create(host_impl().active_tree(), left_child_id); | 69 LayerImpl::Create(host_impl().active_tree(), left_child_id); |
70 std::unique_ptr<LayerImpl> right_child = | 70 std::unique_ptr<LayerImpl> right_child = |
71 LayerImpl::Create(host_impl().active_tree(), right_child_id); | 71 LayerImpl::Create(host_impl().active_tree(), right_child_id); |
72 | 72 |
73 gfx::Size bounds(100, 100); | 73 gfx::Size bounds(100, 100); |
74 { | 74 { |
75 gfx::Transform translate_z; | 75 gfx::Transform translate_z; |
76 translate_z.Translate3d(0, 0, root_depth); | 76 translate_z.Translate3d(0, 0, root_depth); |
77 root->SetTransform(translate_z); | 77 root->test_properties()->transform = translate_z; |
78 root->SetBounds(bounds); | 78 root->SetBounds(bounds); |
79 root->SetDrawsContent(true); | 79 root->SetDrawsContent(true); |
80 root->Set3dSortingContextId(root_sorting_context); | 80 root->Set3dSortingContextId(root_sorting_context); |
81 } | 81 } |
82 { | 82 { |
83 gfx::Transform translate_z; | 83 gfx::Transform translate_z; |
84 translate_z.Translate3d(0, 0, left_child_depth); | 84 translate_z.Translate3d(0, 0, left_child_depth); |
85 left_child->SetTransform(translate_z); | 85 left_child->test_properties()->transform = translate_z; |
86 left_child->SetBounds(bounds); | 86 left_child->SetBounds(bounds); |
87 left_child->SetDrawsContent(true); | 87 left_child->SetDrawsContent(true); |
88 left_child->Set3dSortingContextId(left_child_sorting_context); | 88 left_child->Set3dSortingContextId(left_child_sorting_context); |
89 left_child->test_properties()->should_flatten_transform = false; | 89 left_child->test_properties()->should_flatten_transform = false; |
90 } | 90 } |
91 { | 91 { |
92 gfx::Transform translate_z; | 92 gfx::Transform translate_z; |
93 translate_z.Translate3d(0, 0, right_child_depth); | 93 translate_z.Translate3d(0, 0, right_child_depth); |
94 right_child->SetTransform(translate_z); | 94 right_child->test_properties()->transform = translate_z; |
95 right_child->SetBounds(bounds); | 95 right_child->SetBounds(bounds); |
96 right_child->SetDrawsContent(true); | 96 right_child->SetDrawsContent(true); |
97 right_child->Set3dSortingContextId(right_child_sorting_context); | 97 right_child->Set3dSortingContextId(right_child_sorting_context); |
98 } | 98 } |
99 | 99 |
100 root->test_properties()->AddChild(std::move(left_child)); | 100 root->test_properties()->AddChild(std::move(left_child)); |
101 root->test_properties()->AddChild(std::move(right_child)); | 101 root->test_properties()->AddChild(std::move(right_child)); |
102 | 102 |
103 host_impl().SetViewportSize(root->bounds()); | 103 host_impl().SetViewportSize(root->bounds()); |
104 host_impl().active_tree()->SetRootLayerForTesting(std::move(root)); | 104 host_impl().active_tree()->SetRootLayerForTesting(std::move(root)); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 228 |
229 TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) { | 229 TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) { |
230 gfx::Transform uninvertible_transform; | 230 gfx::Transform uninvertible_transform; |
231 uninvertible_transform.matrix().set(0, 0, 0.0); | 231 uninvertible_transform.matrix().set(0, 0, 0.0); |
232 uninvertible_transform.matrix().set(1, 1, 0.0); | 232 uninvertible_transform.matrix().set(1, 1, 0.0); |
233 uninvertible_transform.matrix().set(2, 2, 0.0); | 233 uninvertible_transform.matrix().set(2, 2, 0.0); |
234 uninvertible_transform.matrix().set(3, 3, 0.0); | 234 uninvertible_transform.matrix().set(3, 3, 0.0); |
235 ASSERT_FALSE(uninvertible_transform.IsInvertible()); | 235 ASSERT_FALSE(uninvertible_transform.IsInvertible()); |
236 | 236 |
237 LayerImpl* root = root_layer(); | 237 LayerImpl* root = root_layer(); |
238 root->SetTransform(uninvertible_transform); | 238 root->test_properties()->transform = uninvertible_transform; |
239 root->SetBounds(gfx::Size(100, 100)); | 239 root->SetBounds(gfx::Size(100, 100)); |
240 root->SetDrawsContent(true); | 240 root->SetDrawsContent(true); |
241 | 241 |
242 host_impl().SetViewportSize(root->bounds()); | 242 host_impl().SetViewportSize(root->bounds()); |
243 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 243 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
244 // Sanity check the scenario we just created. | 244 // Sanity check the scenario we just created. |
245 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 245 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
246 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 246 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
247 ASSERT_FALSE(root_layer()->ScreenSpaceTransform().IsInvertible()); | 247 ASSERT_FALSE(root_layer()->ScreenSpaceTransform().IsInvertible()); |
248 | 248 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 EXPECT_EQ(root->id(), result_layer->id()); | 327 EXPECT_EQ(root->id(), result_layer->id()); |
328 } | 328 } |
329 | 329 |
330 TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) { | 330 TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) { |
331 gfx::Transform rotation45_degrees_about_center; | 331 gfx::Transform rotation45_degrees_about_center; |
332 rotation45_degrees_about_center.Translate(50.0, 50.0); | 332 rotation45_degrees_about_center.Translate(50.0, 50.0); |
333 rotation45_degrees_about_center.RotateAboutZAxis(45.0); | 333 rotation45_degrees_about_center.RotateAboutZAxis(45.0); |
334 rotation45_degrees_about_center.Translate(-50.0, -50.0); | 334 rotation45_degrees_about_center.Translate(-50.0, -50.0); |
335 | 335 |
336 LayerImpl* root = root_layer(); | 336 LayerImpl* root = root_layer(); |
337 root->SetTransform(rotation45_degrees_about_center); | 337 root->test_properties()->transform = rotation45_degrees_about_center; |
338 root->SetBounds(gfx::Size(100, 100)); | 338 root->SetBounds(gfx::Size(100, 100)); |
339 root->SetDrawsContent(true); | 339 root->SetDrawsContent(true); |
340 | 340 |
341 host_impl().SetViewportSize(root->bounds()); | 341 host_impl().SetViewportSize(root->bounds()); |
342 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 342 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
343 | 343 |
344 // Sanity check the scenario we just created. | 344 // Sanity check the scenario we just created. |
345 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 345 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
346 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 346 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
347 | 347 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 TEST_F(LayerTreeImplTest, HitTestingClipNodeDifferentTransformAndTargetIds) { | 381 TEST_F(LayerTreeImplTest, HitTestingClipNodeDifferentTransformAndTargetIds) { |
382 // Tests hit testing on a layer whose clip node has different transform and | 382 // Tests hit testing on a layer whose clip node has different transform and |
383 // target id. | 383 // target id. |
384 LayerImpl* root = root_layer(); | 384 LayerImpl* root = root_layer(); |
385 root->SetBounds(gfx::Size(500, 500)); | 385 root->SetBounds(gfx::Size(500, 500)); |
386 | 386 |
387 gfx::Transform translation; | 387 gfx::Transform translation; |
388 translation.Translate(100, 100); | 388 translation.Translate(100, 100); |
389 std::unique_ptr<LayerImpl> render_surface = | 389 std::unique_ptr<LayerImpl> render_surface = |
390 LayerImpl::Create(host_impl().active_tree(), 2); | 390 LayerImpl::Create(host_impl().active_tree(), 2); |
391 render_surface->SetTransform(translation); | 391 render_surface->test_properties()->transform = translation; |
392 render_surface->SetBounds(gfx::Size(100, 100)); | 392 render_surface->SetBounds(gfx::Size(100, 100)); |
393 render_surface->test_properties()->force_render_surface = true; | 393 render_surface->test_properties()->force_render_surface = true; |
394 | 394 |
395 gfx::Transform scale_matrix; | 395 gfx::Transform scale_matrix; |
396 scale_matrix.Scale(2, 2); | 396 scale_matrix.Scale(2, 2); |
397 std::unique_ptr<LayerImpl> scale = | 397 std::unique_ptr<LayerImpl> scale = |
398 LayerImpl::Create(host_impl().active_tree(), 3); | 398 LayerImpl::Create(host_impl().active_tree(), 3); |
399 scale->SetTransform(scale_matrix); | 399 scale->test_properties()->transform = scale_matrix; |
400 scale->SetBounds(gfx::Size(50, 50)); | 400 scale->SetBounds(gfx::Size(50, 50)); |
401 | 401 |
402 std::unique_ptr<LayerImpl> clip = | 402 std::unique_ptr<LayerImpl> clip = |
403 LayerImpl::Create(host_impl().active_tree(), 4); | 403 LayerImpl::Create(host_impl().active_tree(), 4); |
404 clip->SetBounds(gfx::Size(25, 25)); | 404 clip->SetBounds(gfx::Size(25, 25)); |
405 clip->SetMasksToBounds(true); | 405 clip->SetMasksToBounds(true); |
406 | 406 |
407 std::unique_ptr<LayerImpl> test = | 407 std::unique_ptr<LayerImpl> test = |
408 LayerImpl::Create(host_impl().active_tree(), 5); | 408 LayerImpl::Create(host_impl().active_tree(), 5); |
409 test->SetBounds(gfx::Size(100, 100)); | 409 test->SetBounds(gfx::Size(100, 100)); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 // perspective_projection_about_center * translation_by_z is designed so that | 498 // perspective_projection_about_center * translation_by_z is designed so that |
499 // the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). | 499 // the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). |
500 gfx::Transform perspective_projection_about_center; | 500 gfx::Transform perspective_projection_about_center; |
501 perspective_projection_about_center.Translate(50.0, 50.0); | 501 perspective_projection_about_center.Translate(50.0, 50.0); |
502 perspective_projection_about_center.ApplyPerspectiveDepth(1.0); | 502 perspective_projection_about_center.ApplyPerspectiveDepth(1.0); |
503 perspective_projection_about_center.Translate(-50.0, -50.0); | 503 perspective_projection_about_center.Translate(-50.0, -50.0); |
504 gfx::Transform translation_by_z; | 504 gfx::Transform translation_by_z; |
505 translation_by_z.Translate3d(0.0, 0.0, -1.0); | 505 translation_by_z.Translate3d(0.0, 0.0, -1.0); |
506 | 506 |
507 LayerImpl* root = root_layer(); | 507 LayerImpl* root = root_layer(); |
508 root->SetTransform(perspective_projection_about_center * translation_by_z); | 508 root->test_properties()->transform = |
| 509 (perspective_projection_about_center * translation_by_z); |
509 root->SetBounds(gfx::Size(100, 100)); | 510 root->SetBounds(gfx::Size(100, 100)); |
510 root->SetDrawsContent(true); | 511 root->SetDrawsContent(true); |
511 | 512 |
512 host_impl().SetViewportSize(root->bounds()); | 513 host_impl().SetViewportSize(root->bounds()); |
513 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 514 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
514 | 515 |
515 // Sanity check the scenario we just created. | 516 // Sanity check the scenario we just created. |
516 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 517 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
517 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 518 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
518 | 519 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 child->SetBounds(gfx::Size(80, 80)); | 632 child->SetBounds(gfx::Size(80, 80)); |
632 child->SetMasksToBounds(true); | 633 child->SetMasksToBounds(true); |
633 | 634 |
634 gfx::Transform rotation45_degrees_about_corner; | 635 gfx::Transform rotation45_degrees_about_corner; |
635 rotation45_degrees_about_corner.RotateAboutZAxis(45.0); | 636 rotation45_degrees_about_corner.RotateAboutZAxis(45.0); |
636 | 637 |
637 // This is positioned with respect to its parent which is already at | 638 // This is positioned with respect to its parent which is already at |
638 // position (10, 10). | 639 // position (10, 10). |
639 // The size is to ensure it covers at least sqrt(2) * 100. | 640 // The size is to ensure it covers at least sqrt(2) * 100. |
640 grand_child->SetBounds(gfx::Size(200, 200)); | 641 grand_child->SetBounds(gfx::Size(200, 200)); |
641 grand_child->SetTransform(rotation45_degrees_about_corner); | 642 grand_child->test_properties()->transform = rotation45_degrees_about_corner; |
642 grand_child->SetMasksToBounds(true); | 643 grand_child->SetMasksToBounds(true); |
643 | 644 |
644 // Rotates about the center of the layer | 645 // Rotates about the center of the layer |
645 gfx::Transform rotated_leaf_transform; | 646 gfx::Transform rotated_leaf_transform; |
646 rotated_leaf_transform.Translate( | 647 rotated_leaf_transform.Translate( |
647 -10.0, -10.0); // cancel out the grand_parent's position | 648 -10.0, -10.0); // cancel out the grand_parent's position |
648 rotated_leaf_transform.RotateAboutZAxis( | 649 rotated_leaf_transform.RotateAboutZAxis( |
649 -45.0); // cancel out the corner 45-degree rotation of the parent. | 650 -45.0); // cancel out the corner 45-degree rotation of the parent. |
650 rotated_leaf_transform.Translate(50.0, 50.0); | 651 rotated_leaf_transform.Translate(50.0, 50.0); |
651 rotated_leaf_transform.RotateAboutZAxis(45.0); | 652 rotated_leaf_transform.RotateAboutZAxis(45.0); |
652 rotated_leaf_transform.Translate(-50.0, -50.0); | 653 rotated_leaf_transform.Translate(-50.0, -50.0); |
653 rotated_leaf->SetBounds(gfx::Size(100, 100)); | 654 rotated_leaf->SetBounds(gfx::Size(100, 100)); |
654 rotated_leaf->SetTransform(rotated_leaf_transform); | 655 rotated_leaf->test_properties()->transform = rotated_leaf_transform; |
655 rotated_leaf->SetDrawsContent(true); | 656 rotated_leaf->SetDrawsContent(true); |
656 | 657 |
657 grand_child->test_properties()->AddChild(std::move(rotated_leaf)); | 658 grand_child->test_properties()->AddChild(std::move(rotated_leaf)); |
658 child->test_properties()->AddChild(std::move(grand_child)); | 659 child->test_properties()->AddChild(std::move(grand_child)); |
659 root->test_properties()->AddChild(std::move(child)); | 660 root->test_properties()->AddChild(std::move(child)); |
660 | 661 |
661 ExecuteCalculateDrawProperties(root); | 662 ExecuteCalculateDrawProperties(root); |
662 } | 663 } |
663 | 664 |
664 host_impl().SetViewportSize(root->bounds()); | 665 host_impl().SetViewportSize(root->bounds()); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 child1->SetPosition(gfx::PointF(10.f, 10.f)); | 942 child1->SetPosition(gfx::PointF(10.f, 10.f)); |
942 child1->SetBounds(gfx::Size(50, 50)); | 943 child1->SetBounds(gfx::Size(50, 50)); |
943 child1->SetDrawsContent(true); | 944 child1->SetDrawsContent(true); |
944 child1->test_properties()->should_flatten_transform = false; | 945 child1->test_properties()->should_flatten_transform = false; |
945 child1->Set3dSortingContextId(1); | 946 child1->Set3dSortingContextId(1); |
946 | 947 |
947 child2->SetPosition(gfx::PointF(50.f, 10.f)); | 948 child2->SetPosition(gfx::PointF(50.f, 10.f)); |
948 child2->SetBounds(gfx::Size(50, 50)); | 949 child2->SetBounds(gfx::Size(50, 50)); |
949 gfx::Transform translate_z; | 950 gfx::Transform translate_z; |
950 translate_z.Translate3d(0, 0, 10.f); | 951 translate_z.Translate3d(0, 0, 10.f); |
951 child2->SetTransform(translate_z); | 952 child2->test_properties()->transform = translate_z; |
952 child2->SetDrawsContent(true); | 953 child2->SetDrawsContent(true); |
953 child2->test_properties()->should_flatten_transform = false; | 954 child2->test_properties()->should_flatten_transform = false; |
954 child2->Set3dSortingContextId(1); | 955 child2->Set3dSortingContextId(1); |
955 | 956 |
956 // Remember that grand_child is positioned with respect to its parent (i.e. | 957 // Remember that grand_child is positioned with respect to its parent (i.e. |
957 // child1). In screen space, the intended position is (10, 50), with size | 958 // child1). In screen space, the intended position is (10, 50), with size |
958 // 100 x 50. | 959 // 100 x 50. |
959 grand_child1->SetPosition(gfx::PointF(0.f, 40.f)); | 960 grand_child1->SetPosition(gfx::PointF(0.f, 40.f)); |
960 grand_child1->SetBounds(gfx::Size(100, 50)); | 961 grand_child1->SetBounds(gfx::Size(100, 50)); |
961 grand_child1->SetDrawsContent(true); | 962 grand_child1->SetDrawsContent(true); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 gfx::Transform uninvertible_transform; | 1311 gfx::Transform uninvertible_transform; |
1311 uninvertible_transform.matrix().set(0, 0, 0.0); | 1312 uninvertible_transform.matrix().set(0, 0, 0.0); |
1312 uninvertible_transform.matrix().set(1, 1, 0.0); | 1313 uninvertible_transform.matrix().set(1, 1, 0.0); |
1313 uninvertible_transform.matrix().set(2, 2, 0.0); | 1314 uninvertible_transform.matrix().set(2, 2, 0.0); |
1314 uninvertible_transform.matrix().set(3, 3, 0.0); | 1315 uninvertible_transform.matrix().set(3, 3, 0.0); |
1315 ASSERT_FALSE(uninvertible_transform.IsInvertible()); | 1316 ASSERT_FALSE(uninvertible_transform.IsInvertible()); |
1316 | 1317 |
1317 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); | 1318 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); |
1318 | 1319 |
1319 LayerImpl* root = root_layer(); | 1320 LayerImpl* root = root_layer(); |
1320 root->SetTransform(uninvertible_transform); | 1321 root->test_properties()->transform = uninvertible_transform; |
1321 root->SetBounds(gfx::Size(100, 100)); | 1322 root->SetBounds(gfx::Size(100, 100)); |
1322 root->SetDrawsContent(true); | 1323 root->SetDrawsContent(true); |
1323 root->SetTouchEventHandlerRegion(touch_handler_region); | 1324 root->SetTouchEventHandlerRegion(touch_handler_region); |
1324 | 1325 |
1325 host_impl().SetViewportSize(root->bounds()); | 1326 host_impl().SetViewportSize(root->bounds()); |
1326 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1327 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
1327 | 1328 |
1328 // Sanity check the scenario we just created. | 1329 // Sanity check the scenario we just created. |
1329 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1330 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
1330 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); | 1331 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 int child_id = 2; | 2148 int child_id = 2; |
2148 int grand_child_id = 3; | 2149 int grand_child_id = 3; |
2149 | 2150 |
2150 gfx::Transform large_transform; | 2151 gfx::Transform large_transform; |
2151 large_transform.Scale(SkDoubleToMScalar(1e37), SkDoubleToMScalar(1e37)); | 2152 large_transform.Scale(SkDoubleToMScalar(1e37), SkDoubleToMScalar(1e37)); |
2152 large_transform.RotateAboutYAxis(30); | 2153 large_transform.RotateAboutYAxis(30); |
2153 | 2154 |
2154 { | 2155 { |
2155 std::unique_ptr<LayerImpl> child = | 2156 std::unique_ptr<LayerImpl> child = |
2156 LayerImpl::Create(host_impl().active_tree(), child_id); | 2157 LayerImpl::Create(host_impl().active_tree(), child_id); |
2157 child->SetTransform(large_transform); | 2158 child->test_properties()->transform = large_transform; |
2158 child->SetBounds(gfx::Size(100, 100)); | 2159 child->SetBounds(gfx::Size(100, 100)); |
2159 | 2160 |
2160 std::unique_ptr<LayerImpl> grand_child = | 2161 std::unique_ptr<LayerImpl> grand_child = |
2161 LayerImpl::Create(host_impl().active_tree(), grand_child_id); | 2162 LayerImpl::Create(host_impl().active_tree(), grand_child_id); |
2162 grand_child->SetTransform(large_transform); | 2163 grand_child->test_properties()->transform = large_transform; |
2163 grand_child->SetBounds(gfx::Size(100, 100)); | 2164 grand_child->SetBounds(gfx::Size(100, 100)); |
2164 grand_child->SetDrawsContent(true); | 2165 grand_child->SetDrawsContent(true); |
2165 | 2166 |
2166 child->test_properties()->AddChild(std::move(grand_child)); | 2167 child->test_properties()->AddChild(std::move(grand_child)); |
2167 root->test_properties()->AddChild(std::move(child)); | 2168 root->test_properties()->AddChild(std::move(child)); |
2168 } | 2169 } |
2169 | 2170 |
2170 host_impl().SetViewportSize(root->bounds()); | 2171 host_impl().SetViewportSize(root->bounds()); |
2171 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2172 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
2172 | 2173 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 | 2230 |
2230 LayerImpl* root = root_layer(); | 2231 LayerImpl* root = root_layer(); |
2231 std::unique_ptr<LayerImpl> left_child = | 2232 std::unique_ptr<LayerImpl> left_child = |
2232 LayerImpl::Create(host_impl().active_tree(), 2); | 2233 LayerImpl::Create(host_impl().active_tree(), 2); |
2233 std::unique_ptr<LayerImpl> right_child = | 2234 std::unique_ptr<LayerImpl> right_child = |
2234 LayerImpl::Create(host_impl().active_tree(), 3); | 2235 LayerImpl::Create(host_impl().active_tree(), 3); |
2235 | 2236 |
2236 { | 2237 { |
2237 gfx::Transform translate_z; | 2238 gfx::Transform translate_z; |
2238 translate_z.Translate3d(0, 0, 10); | 2239 translate_z.Translate3d(0, 0, 10); |
2239 root->SetTransform(translate_z); | 2240 root->test_properties()->transform = translate_z; |
2240 root->SetBounds(gfx::Size(100, 100)); | 2241 root->SetBounds(gfx::Size(100, 100)); |
2241 root->SetDrawsContent(true); | 2242 root->SetDrawsContent(true); |
2242 } | 2243 } |
2243 { | 2244 { |
2244 gfx::Transform translate_z; | 2245 gfx::Transform translate_z; |
2245 translate_z.Translate3d(0, 0, 10); | 2246 translate_z.Translate3d(0, 0, 10); |
2246 left_child->SetTransform(translate_z); | 2247 left_child->test_properties()->transform = translate_z; |
2247 left_child->SetBounds(gfx::Size(100, 100)); | 2248 left_child->SetBounds(gfx::Size(100, 100)); |
2248 left_child->SetDrawsContent(true); | 2249 left_child->SetDrawsContent(true); |
2249 } | 2250 } |
2250 { | 2251 { |
2251 gfx::Transform translate_z; | 2252 gfx::Transform translate_z; |
2252 translate_z.Translate3d(0, 0, 10); | 2253 translate_z.Translate3d(0, 0, 10); |
2253 right_child->SetTransform(translate_z); | 2254 right_child->test_properties()->transform = translate_z; |
2254 right_child->SetBounds(gfx::Size(100, 100)); | 2255 right_child->SetBounds(gfx::Size(100, 100)); |
2255 } | 2256 } |
2256 | 2257 |
2257 root->test_properties()->AddChild(std::move(left_child)); | 2258 root->test_properties()->AddChild(std::move(left_child)); |
2258 root->test_properties()->AddChild(std::move(right_child)); | 2259 root->test_properties()->AddChild(std::move(right_child)); |
2259 | 2260 |
2260 host_impl().SetViewportSize(root->bounds()); | 2261 host_impl().SetViewportSize(root->bounds()); |
2261 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2262 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
2262 CHECK_EQ(1u, RenderSurfaceLayerList().size()); | 2263 CHECK_EQ(1u, RenderSurfaceLayerList().size()); |
2263 | 2264 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 auto weak_promise = promise->AsWeakPtr(); | 2371 auto weak_promise = promise->AsWeakPtr(); |
2371 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); | 2372 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); |
2372 host_impl().active_tree()->BreakSwapPromises( | 2373 host_impl().active_tree()->BreakSwapPromises( |
2373 SwapPromise::DidNotSwapReason::SWAP_FAILS); | 2374 SwapPromise::DidNotSwapReason::SWAP_FAILS); |
2374 EXPECT_FALSE(weak_promise); | 2375 EXPECT_FALSE(weak_promise); |
2375 } | 2376 } |
2376 } | 2377 } |
2377 | 2378 |
2378 } // namespace | 2379 } // namespace |
2379 } // namespace cc | 2380 } // namespace cc |
OLD | NEW |