Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Side by Side Diff: cc/trees/layer_tree_impl_unittest.cc

Issue 2254543004: cc : Delete LayerImpl::transform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/test/fake_layer_tree_host_impl.h" 8 #include "cc/test/fake_layer_tree_host_impl.h"
9 #include "cc/test/geometry_test_utils.h" 9 #include "cc/test/geometry_test_utils.h"
10 #include "cc/test/layer_test_common.h" 10 #include "cc/test/layer_test_common.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 LayerImpl::Create(host_impl().active_tree(), root_id); 65 LayerImpl::Create(host_impl().active_tree(), root_id);
66 std::unique_ptr<LayerImpl> left_child = 66 std::unique_ptr<LayerImpl> left_child =
67 LayerImpl::Create(host_impl().active_tree(), left_child_id); 67 LayerImpl::Create(host_impl().active_tree(), left_child_id);
68 std::unique_ptr<LayerImpl> right_child = 68 std::unique_ptr<LayerImpl> right_child =
69 LayerImpl::Create(host_impl().active_tree(), right_child_id); 69 LayerImpl::Create(host_impl().active_tree(), right_child_id);
70 70
71 gfx::Size bounds(100, 100); 71 gfx::Size bounds(100, 100);
72 { 72 {
73 gfx::Transform translate_z; 73 gfx::Transform translate_z;
74 translate_z.Translate3d(0, 0, root_depth); 74 translate_z.Translate3d(0, 0, root_depth);
75 root->SetTransform(translate_z); 75 root->test_properties()->transform = translate_z;
76 root->SetBounds(bounds); 76 root->SetBounds(bounds);
77 root->SetDrawsContent(true); 77 root->SetDrawsContent(true);
78 root->Set3dSortingContextId(root_sorting_context); 78 root->Set3dSortingContextId(root_sorting_context);
79 } 79 }
80 { 80 {
81 gfx::Transform translate_z; 81 gfx::Transform translate_z;
82 translate_z.Translate3d(0, 0, left_child_depth); 82 translate_z.Translate3d(0, 0, left_child_depth);
83 left_child->SetTransform(translate_z); 83 left_child->test_properties()->transform = translate_z;
84 left_child->SetBounds(bounds); 84 left_child->SetBounds(bounds);
85 left_child->SetDrawsContent(true); 85 left_child->SetDrawsContent(true);
86 left_child->Set3dSortingContextId(left_child_sorting_context); 86 left_child->Set3dSortingContextId(left_child_sorting_context);
87 left_child->test_properties()->should_flatten_transform = false; 87 left_child->test_properties()->should_flatten_transform = false;
88 } 88 }
89 { 89 {
90 gfx::Transform translate_z; 90 gfx::Transform translate_z;
91 translate_z.Translate3d(0, 0, right_child_depth); 91 translate_z.Translate3d(0, 0, right_child_depth);
92 right_child->SetTransform(translate_z); 92 right_child->test_properties()->transform = translate_z;
93 right_child->SetBounds(bounds); 93 right_child->SetBounds(bounds);
94 right_child->SetDrawsContent(true); 94 right_child->SetDrawsContent(true);
95 right_child->Set3dSortingContextId(right_child_sorting_context); 95 right_child->Set3dSortingContextId(right_child_sorting_context);
96 } 96 }
97 97
98 root->test_properties()->AddChild(std::move(left_child)); 98 root->test_properties()->AddChild(std::move(left_child));
99 root->test_properties()->AddChild(std::move(right_child)); 99 root->test_properties()->AddChild(std::move(right_child));
100 100
101 host_impl().SetViewportSize(root->bounds()); 101 host_impl().SetViewportSize(root->bounds());
102 host_impl().active_tree()->SetRootLayerForTesting(std::move(root)); 102 host_impl().active_tree()->SetRootLayerForTesting(std::move(root));
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) { 227 TEST_F(LayerTreeImplTest, HitTestingForUninvertibleTransform) {
228 gfx::Transform uninvertible_transform; 228 gfx::Transform uninvertible_transform;
229 uninvertible_transform.matrix().set(0, 0, 0.0); 229 uninvertible_transform.matrix().set(0, 0, 0.0);
230 uninvertible_transform.matrix().set(1, 1, 0.0); 230 uninvertible_transform.matrix().set(1, 1, 0.0);
231 uninvertible_transform.matrix().set(2, 2, 0.0); 231 uninvertible_transform.matrix().set(2, 2, 0.0);
232 uninvertible_transform.matrix().set(3, 3, 0.0); 232 uninvertible_transform.matrix().set(3, 3, 0.0);
233 ASSERT_FALSE(uninvertible_transform.IsInvertible()); 233 ASSERT_FALSE(uninvertible_transform.IsInvertible());
234 234
235 LayerImpl* root = root_layer(); 235 LayerImpl* root = root_layer();
236 root->SetTransform(uninvertible_transform); 236 root->test_properties()->transform = uninvertible_transform;
237 root->SetBounds(gfx::Size(100, 100)); 237 root->SetBounds(gfx::Size(100, 100));
238 root->SetDrawsContent(true); 238 root->SetDrawsContent(true);
239 239
240 host_impl().SetViewportSize(root->bounds()); 240 host_impl().SetViewportSize(root->bounds());
241 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 241 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
242 // Sanity check the scenario we just created. 242 // Sanity check the scenario we just created.
243 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 243 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
244 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 244 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
245 ASSERT_FALSE(root_layer()->ScreenSpaceTransform().IsInvertible()); 245 ASSERT_FALSE(root_layer()->ScreenSpaceTransform().IsInvertible());
246 246
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 EXPECT_EQ(root->id(), result_layer->id()); 325 EXPECT_EQ(root->id(), result_layer->id());
326 } 326 }
327 327
328 TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) { 328 TEST_F(LayerTreeImplTest, HitTestingForSingleRotatedLayer) {
329 gfx::Transform rotation45_degrees_about_center; 329 gfx::Transform rotation45_degrees_about_center;
330 rotation45_degrees_about_center.Translate(50.0, 50.0); 330 rotation45_degrees_about_center.Translate(50.0, 50.0);
331 rotation45_degrees_about_center.RotateAboutZAxis(45.0); 331 rotation45_degrees_about_center.RotateAboutZAxis(45.0);
332 rotation45_degrees_about_center.Translate(-50.0, -50.0); 332 rotation45_degrees_about_center.Translate(-50.0, -50.0);
333 333
334 LayerImpl* root = root_layer(); 334 LayerImpl* root = root_layer();
335 root->SetTransform(rotation45_degrees_about_center); 335 root->test_properties()->transform = rotation45_degrees_about_center;
336 root->SetBounds(gfx::Size(100, 100)); 336 root->SetBounds(gfx::Size(100, 100));
337 root->SetDrawsContent(true); 337 root->SetDrawsContent(true);
338 338
339 host_impl().SetViewportSize(root->bounds()); 339 host_impl().SetViewportSize(root->bounds());
340 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 340 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
341 341
342 // Sanity check the scenario we just created. 342 // Sanity check the scenario we just created.
343 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 343 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
344 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 344 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
345 345
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 TEST_F(LayerTreeImplTest, HitTestingClipNodeDifferentTransformAndTargetIds) { 379 TEST_F(LayerTreeImplTest, HitTestingClipNodeDifferentTransformAndTargetIds) {
380 // Tests hit testing on a layer whose clip node has different transform and 380 // Tests hit testing on a layer whose clip node has different transform and
381 // target id. 381 // target id.
382 LayerImpl* root = root_layer(); 382 LayerImpl* root = root_layer();
383 root->SetBounds(gfx::Size(500, 500)); 383 root->SetBounds(gfx::Size(500, 500));
384 384
385 gfx::Transform translation; 385 gfx::Transform translation;
386 translation.Translate(100, 100); 386 translation.Translate(100, 100);
387 std::unique_ptr<LayerImpl> render_surface = 387 std::unique_ptr<LayerImpl> render_surface =
388 LayerImpl::Create(host_impl().active_tree(), 2); 388 LayerImpl::Create(host_impl().active_tree(), 2);
389 render_surface->SetTransform(translation); 389 render_surface->test_properties()->transform = translation;
390 render_surface->SetBounds(gfx::Size(100, 100)); 390 render_surface->SetBounds(gfx::Size(100, 100));
391 render_surface->test_properties()->force_render_surface = true; 391 render_surface->test_properties()->force_render_surface = true;
392 392
393 gfx::Transform scale_matrix; 393 gfx::Transform scale_matrix;
394 scale_matrix.Scale(2, 2); 394 scale_matrix.Scale(2, 2);
395 std::unique_ptr<LayerImpl> scale = 395 std::unique_ptr<LayerImpl> scale =
396 LayerImpl::Create(host_impl().active_tree(), 3); 396 LayerImpl::Create(host_impl().active_tree(), 3);
397 scale->SetTransform(scale_matrix); 397 scale->test_properties()->transform = scale_matrix;
398 scale->SetBounds(gfx::Size(50, 50)); 398 scale->SetBounds(gfx::Size(50, 50));
399 399
400 std::unique_ptr<LayerImpl> clip = 400 std::unique_ptr<LayerImpl> clip =
401 LayerImpl::Create(host_impl().active_tree(), 4); 401 LayerImpl::Create(host_impl().active_tree(), 4);
402 clip->SetBounds(gfx::Size(25, 25)); 402 clip->SetBounds(gfx::Size(25, 25));
403 clip->SetMasksToBounds(true); 403 clip->SetMasksToBounds(true);
404 404
405 std::unique_ptr<LayerImpl> test = 405 std::unique_ptr<LayerImpl> test =
406 LayerImpl::Create(host_impl().active_tree(), 5); 406 LayerImpl::Create(host_impl().active_tree(), 5);
407 test->SetBounds(gfx::Size(100, 100)); 407 test->SetBounds(gfx::Size(100, 100));
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // perspective_projection_about_center * translation_by_z is designed so that 496 // perspective_projection_about_center * translation_by_z is designed so that
497 // the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50). 497 // the 100 x 100 layer becomes 50 x 50, and remains centered at (50, 50).
498 gfx::Transform perspective_projection_about_center; 498 gfx::Transform perspective_projection_about_center;
499 perspective_projection_about_center.Translate(50.0, 50.0); 499 perspective_projection_about_center.Translate(50.0, 50.0);
500 perspective_projection_about_center.ApplyPerspectiveDepth(1.0); 500 perspective_projection_about_center.ApplyPerspectiveDepth(1.0);
501 perspective_projection_about_center.Translate(-50.0, -50.0); 501 perspective_projection_about_center.Translate(-50.0, -50.0);
502 gfx::Transform translation_by_z; 502 gfx::Transform translation_by_z;
503 translation_by_z.Translate3d(0.0, 0.0, -1.0); 503 translation_by_z.Translate3d(0.0, 0.0, -1.0);
504 504
505 LayerImpl* root = root_layer(); 505 LayerImpl* root = root_layer();
506 root->SetTransform(perspective_projection_about_center * translation_by_z); 506 root->test_properties()->transform =
507 (perspective_projection_about_center * translation_by_z);
507 root->SetBounds(gfx::Size(100, 100)); 508 root->SetBounds(gfx::Size(100, 100));
508 root->SetDrawsContent(true); 509 root->SetDrawsContent(true);
509 510
510 host_impl().SetViewportSize(root->bounds()); 511 host_impl().SetViewportSize(root->bounds());
511 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 512 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
512 513
513 // Sanity check the scenario we just created. 514 // Sanity check the scenario we just created.
514 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 515 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
515 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 516 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
516 517
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 child->SetBounds(gfx::Size(80, 80)); 630 child->SetBounds(gfx::Size(80, 80));
630 child->SetMasksToBounds(true); 631 child->SetMasksToBounds(true);
631 632
632 gfx::Transform rotation45_degrees_about_corner; 633 gfx::Transform rotation45_degrees_about_corner;
633 rotation45_degrees_about_corner.RotateAboutZAxis(45.0); 634 rotation45_degrees_about_corner.RotateAboutZAxis(45.0);
634 635
635 // This is positioned with respect to its parent which is already at 636 // This is positioned with respect to its parent which is already at
636 // position (10, 10). 637 // position (10, 10).
637 // The size is to ensure it covers at least sqrt(2) * 100. 638 // The size is to ensure it covers at least sqrt(2) * 100.
638 grand_child->SetBounds(gfx::Size(200, 200)); 639 grand_child->SetBounds(gfx::Size(200, 200));
639 grand_child->SetTransform(rotation45_degrees_about_corner); 640 grand_child->test_properties()->transform = rotation45_degrees_about_corner;
640 grand_child->SetMasksToBounds(true); 641 grand_child->SetMasksToBounds(true);
641 642
642 // Rotates about the center of the layer 643 // Rotates about the center of the layer
643 gfx::Transform rotated_leaf_transform; 644 gfx::Transform rotated_leaf_transform;
644 rotated_leaf_transform.Translate( 645 rotated_leaf_transform.Translate(
645 -10.0, -10.0); // cancel out the grand_parent's position 646 -10.0, -10.0); // cancel out the grand_parent's position
646 rotated_leaf_transform.RotateAboutZAxis( 647 rotated_leaf_transform.RotateAboutZAxis(
647 -45.0); // cancel out the corner 45-degree rotation of the parent. 648 -45.0); // cancel out the corner 45-degree rotation of the parent.
648 rotated_leaf_transform.Translate(50.0, 50.0); 649 rotated_leaf_transform.Translate(50.0, 50.0);
649 rotated_leaf_transform.RotateAboutZAxis(45.0); 650 rotated_leaf_transform.RotateAboutZAxis(45.0);
650 rotated_leaf_transform.Translate(-50.0, -50.0); 651 rotated_leaf_transform.Translate(-50.0, -50.0);
651 rotated_leaf->SetBounds(gfx::Size(100, 100)); 652 rotated_leaf->SetBounds(gfx::Size(100, 100));
652 rotated_leaf->SetTransform(rotated_leaf_transform); 653 rotated_leaf->test_properties()->transform = rotated_leaf_transform;
653 rotated_leaf->SetDrawsContent(true); 654 rotated_leaf->SetDrawsContent(true);
654 655
655 grand_child->test_properties()->AddChild(std::move(rotated_leaf)); 656 grand_child->test_properties()->AddChild(std::move(rotated_leaf));
656 child->test_properties()->AddChild(std::move(grand_child)); 657 child->test_properties()->AddChild(std::move(grand_child));
657 root->test_properties()->AddChild(std::move(child)); 658 root->test_properties()->AddChild(std::move(child));
658 659
659 ExecuteCalculateDrawProperties(root); 660 ExecuteCalculateDrawProperties(root);
660 } 661 }
661 662
662 host_impl().SetViewportSize(root->bounds()); 663 host_impl().SetViewportSize(root->bounds());
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 child1->SetPosition(gfx::PointF(10.f, 10.f)); 940 child1->SetPosition(gfx::PointF(10.f, 10.f));
940 child1->SetBounds(gfx::Size(50, 50)); 941 child1->SetBounds(gfx::Size(50, 50));
941 child1->SetDrawsContent(true); 942 child1->SetDrawsContent(true);
942 child1->test_properties()->should_flatten_transform = false; 943 child1->test_properties()->should_flatten_transform = false;
943 child1->Set3dSortingContextId(1); 944 child1->Set3dSortingContextId(1);
944 945
945 child2->SetPosition(gfx::PointF(50.f, 10.f)); 946 child2->SetPosition(gfx::PointF(50.f, 10.f));
946 child2->SetBounds(gfx::Size(50, 50)); 947 child2->SetBounds(gfx::Size(50, 50));
947 gfx::Transform translate_z; 948 gfx::Transform translate_z;
948 translate_z.Translate3d(0, 0, 10.f); 949 translate_z.Translate3d(0, 0, 10.f);
949 child2->SetTransform(translate_z); 950 child2->test_properties()->transform = translate_z;
950 child2->SetDrawsContent(true); 951 child2->SetDrawsContent(true);
951 child2->test_properties()->should_flatten_transform = false; 952 child2->test_properties()->should_flatten_transform = false;
952 child2->Set3dSortingContextId(1); 953 child2->Set3dSortingContextId(1);
953 954
954 // Remember that grand_child is positioned with respect to its parent (i.e. 955 // Remember that grand_child is positioned with respect to its parent (i.e.
955 // child1). In screen space, the intended position is (10, 50), with size 956 // child1). In screen space, the intended position is (10, 50), with size
956 // 100 x 50. 957 // 100 x 50.
957 grand_child1->SetPosition(gfx::PointF(0.f, 40.f)); 958 grand_child1->SetPosition(gfx::PointF(0.f, 40.f));
958 grand_child1->SetBounds(gfx::Size(100, 50)); 959 grand_child1->SetBounds(gfx::Size(100, 50));
959 grand_child1->SetDrawsContent(true); 960 grand_child1->SetDrawsContent(true);
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 gfx::Transform uninvertible_transform; 1309 gfx::Transform uninvertible_transform;
1309 uninvertible_transform.matrix().set(0, 0, 0.0); 1310 uninvertible_transform.matrix().set(0, 0, 0.0);
1310 uninvertible_transform.matrix().set(1, 1, 0.0); 1311 uninvertible_transform.matrix().set(1, 1, 0.0);
1311 uninvertible_transform.matrix().set(2, 2, 0.0); 1312 uninvertible_transform.matrix().set(2, 2, 0.0);
1312 uninvertible_transform.matrix().set(3, 3, 0.0); 1313 uninvertible_transform.matrix().set(3, 3, 0.0);
1313 ASSERT_FALSE(uninvertible_transform.IsInvertible()); 1314 ASSERT_FALSE(uninvertible_transform.IsInvertible());
1314 1315
1315 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); 1316 Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
1316 1317
1317 LayerImpl* root = root_layer(); 1318 LayerImpl* root = root_layer();
1318 root->SetTransform(uninvertible_transform); 1319 root->test_properties()->transform = uninvertible_transform;
1319 root->SetBounds(gfx::Size(100, 100)); 1320 root->SetBounds(gfx::Size(100, 100));
1320 root->SetDrawsContent(true); 1321 root->SetDrawsContent(true);
1321 root->SetTouchEventHandlerRegion(touch_handler_region); 1322 root->SetTouchEventHandlerRegion(touch_handler_region);
1322 1323
1323 host_impl().SetViewportSize(root->bounds()); 1324 host_impl().SetViewportSize(root->bounds());
1324 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1325 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1325 1326
1326 // Sanity check the scenario we just created. 1327 // Sanity check the scenario we just created.
1327 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1328 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1328 ASSERT_EQ(1u, root->render_surface()->layer_list().size()); 1329 ASSERT_EQ(1u, root->render_surface()->layer_list().size());
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 int child_id = 2; 2100 int child_id = 2;
2100 int grand_child_id = 3; 2101 int grand_child_id = 3;
2101 2102
2102 gfx::Transform large_transform; 2103 gfx::Transform large_transform;
2103 large_transform.Scale(SkDoubleToMScalar(1e37), SkDoubleToMScalar(1e37)); 2104 large_transform.Scale(SkDoubleToMScalar(1e37), SkDoubleToMScalar(1e37));
2104 large_transform.RotateAboutYAxis(30); 2105 large_transform.RotateAboutYAxis(30);
2105 2106
2106 { 2107 {
2107 std::unique_ptr<LayerImpl> child = 2108 std::unique_ptr<LayerImpl> child =
2108 LayerImpl::Create(host_impl().active_tree(), child_id); 2109 LayerImpl::Create(host_impl().active_tree(), child_id);
2109 child->SetTransform(large_transform); 2110 child->test_properties()->transform = large_transform;
2110 child->SetBounds(gfx::Size(100, 100)); 2111 child->SetBounds(gfx::Size(100, 100));
2111 2112
2112 std::unique_ptr<LayerImpl> grand_child = 2113 std::unique_ptr<LayerImpl> grand_child =
2113 LayerImpl::Create(host_impl().active_tree(), grand_child_id); 2114 LayerImpl::Create(host_impl().active_tree(), grand_child_id);
2114 grand_child->SetTransform(large_transform); 2115 grand_child->test_properties()->transform = large_transform;
2115 grand_child->SetBounds(gfx::Size(100, 100)); 2116 grand_child->SetBounds(gfx::Size(100, 100));
2116 grand_child->SetDrawsContent(true); 2117 grand_child->SetDrawsContent(true);
2117 2118
2118 child->test_properties()->AddChild(std::move(grand_child)); 2119 child->test_properties()->AddChild(std::move(grand_child));
2119 root->test_properties()->AddChild(std::move(child)); 2120 root->test_properties()->AddChild(std::move(child));
2120 } 2121 }
2121 2122
2122 host_impl().SetViewportSize(root->bounds()); 2123 host_impl().SetViewportSize(root->bounds());
2123 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2124 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2124 2125
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2181 2182
2182 LayerImpl* root = root_layer(); 2183 LayerImpl* root = root_layer();
2183 std::unique_ptr<LayerImpl> left_child = 2184 std::unique_ptr<LayerImpl> left_child =
2184 LayerImpl::Create(host_impl().active_tree(), 2); 2185 LayerImpl::Create(host_impl().active_tree(), 2);
2185 std::unique_ptr<LayerImpl> right_child = 2186 std::unique_ptr<LayerImpl> right_child =
2186 LayerImpl::Create(host_impl().active_tree(), 3); 2187 LayerImpl::Create(host_impl().active_tree(), 3);
2187 2188
2188 { 2189 {
2189 gfx::Transform translate_z; 2190 gfx::Transform translate_z;
2190 translate_z.Translate3d(0, 0, 10); 2191 translate_z.Translate3d(0, 0, 10);
2191 root->SetTransform(translate_z); 2192 root->test_properties()->transform = translate_z;
2192 root->SetBounds(gfx::Size(100, 100)); 2193 root->SetBounds(gfx::Size(100, 100));
2193 root->SetDrawsContent(true); 2194 root->SetDrawsContent(true);
2194 } 2195 }
2195 { 2196 {
2196 gfx::Transform translate_z; 2197 gfx::Transform translate_z;
2197 translate_z.Translate3d(0, 0, 10); 2198 translate_z.Translate3d(0, 0, 10);
2198 left_child->SetTransform(translate_z); 2199 left_child->test_properties()->transform = translate_z;
2199 left_child->SetBounds(gfx::Size(100, 100)); 2200 left_child->SetBounds(gfx::Size(100, 100));
2200 left_child->SetDrawsContent(true); 2201 left_child->SetDrawsContent(true);
2201 } 2202 }
2202 { 2203 {
2203 gfx::Transform translate_z; 2204 gfx::Transform translate_z;
2204 translate_z.Translate3d(0, 0, 10); 2205 translate_z.Translate3d(0, 0, 10);
2205 right_child->SetTransform(translate_z); 2206 right_child->test_properties()->transform = translate_z;
2206 right_child->SetBounds(gfx::Size(100, 100)); 2207 right_child->SetBounds(gfx::Size(100, 100));
2207 } 2208 }
2208 2209
2209 root->test_properties()->AddChild(std::move(left_child)); 2210 root->test_properties()->AddChild(std::move(left_child));
2210 root->test_properties()->AddChild(std::move(right_child)); 2211 root->test_properties()->AddChild(std::move(right_child));
2211 2212
2212 host_impl().SetViewportSize(root->bounds()); 2213 host_impl().SetViewportSize(root->bounds());
2213 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2214 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2214 CHECK_EQ(1u, RenderSurfaceLayerList().size()); 2215 CHECK_EQ(1u, RenderSurfaceLayerList().size());
2215 2216
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2322 auto weak_promise = promise->AsWeakPtr(); 2323 auto weak_promise = promise->AsWeakPtr();
2323 host_impl().active_tree()->QueueSwapPromise(std::move(promise)); 2324 host_impl().active_tree()->QueueSwapPromise(std::move(promise));
2324 host_impl().active_tree()->BreakSwapPromises( 2325 host_impl().active_tree()->BreakSwapPromises(
2325 SwapPromise::DidNotSwapReason::SWAP_FAILS); 2326 SwapPromise::DidNotSwapReason::SWAP_FAILS);
2326 EXPECT_FALSE(weak_promise); 2327 EXPECT_FALSE(weak_promise);
2327 } 2328 }
2328 } 2329 }
2329 2330
2330 } // namespace 2331 } // namespace
2331 } // namespace cc 2332 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698