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

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

Issue 2084233002: cc: Move LayerImpl::AddChild and RemoveChild to LayerImplTestProperties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 position, bounds, true, false, true); 162 position, bounds, true, false, true);
163 root->SetDrawsContent(true); 163 root->SetDrawsContent(true);
164 164
165 // Create hud and add it as a child of root. 165 // Create hud and add it as a child of root.
166 gfx::Size hud_bounds(200, 200); 166 gfx::Size hud_bounds(200, 200);
167 SetLayerPropertiesForTesting(hud.get(), identity_matrix, transform_origin, 167 SetLayerPropertiesForTesting(hud.get(), identity_matrix, transform_origin,
168 position, hud_bounds, true, false, false); 168 position, hud_bounds, true, false, false);
169 hud->SetDrawsContent(true); 169 hud->SetDrawsContent(true);
170 170
171 host_impl().active_tree()->set_hud_layer(hud.get()); 171 host_impl().active_tree()->set_hud_layer(hud.get());
172 root->AddChild(std::move(hud)); 172 root->test_properties()->AddChild(std::move(hud));
173 173
174 host_impl().SetViewportSize(hud_bounds); 174 host_impl().SetViewportSize(hud_bounds);
175 host_impl().active_tree()->SetRootLayer(std::move(root)); 175 host_impl().active_tree()->SetRootLayer(std::move(root));
176 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 176 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
177 177
178 // Sanity check the scenario we just created. 178 // Sanity check the scenario we just created.
179 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 179 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
180 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); 180 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size());
181 181
182 // Hit testing for a point inside HUD, but outside root should return null 182 // Hit testing for a point inside HUD, but outside root should return null
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 false); 411 false);
412 clip->SetMasksToBounds(true); 412 clip->SetMasksToBounds(true);
413 413
414 std::unique_ptr<LayerImpl> test = 414 std::unique_ptr<LayerImpl> test =
415 LayerImpl::Create(host_impl().active_tree(), 5); 415 LayerImpl::Create(host_impl().active_tree(), 5);
416 SetLayerPropertiesForTesting(test.get(), identity_matrix, gfx::Point3F(), 416 SetLayerPropertiesForTesting(test.get(), identity_matrix, gfx::Point3F(),
417 gfx::PointF(), gfx::Size(100, 100), true, false, 417 gfx::PointF(), gfx::Size(100, 100), true, false,
418 false); 418 false);
419 test->SetDrawsContent(true); 419 test->SetDrawsContent(true);
420 420
421 clip->AddChild(std::move(test)); 421 clip->test_properties()->AddChild(std::move(test));
422 scale->AddChild(std::move(clip)); 422 scale->test_properties()->AddChild(std::move(clip));
423 render_surface->AddChild(std::move(scale)); 423 render_surface->test_properties()->AddChild(std::move(scale));
424 root->AddChild(std::move(render_surface)); 424 root->test_properties()->AddChild(std::move(render_surface));
425 425
426 host_impl().SetViewportSize(root->bounds()); 426 host_impl().SetViewportSize(root->bounds());
427 host_impl().active_tree()->SetRootLayer(std::move(root)); 427 host_impl().active_tree()->SetRootLayer(std::move(root));
428 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 428 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
429 429
430 gfx::PointF test_point(160.f, 160.f); 430 gfx::PointF test_point(160.f, 160.f);
431 LayerImpl* result_layer = 431 LayerImpl* result_layer =
432 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 432 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
433 EXPECT_FALSE(result_layer); 433 EXPECT_FALSE(result_layer);
434 434
(...skipping 23 matching lines...) Expand all
458 false); 458 false);
459 child1->SetMasksToBounds(true); 459 child1->SetMasksToBounds(true);
460 child1->SetDrawsContent(true); 460 child1->SetDrawsContent(true);
461 std::unique_ptr<LayerImpl> child2 = 461 std::unique_ptr<LayerImpl> child2 =
462 LayerImpl::Create(host_impl().active_tree(), 3); 462 LayerImpl::Create(host_impl().active_tree(), 3);
463 SetLayerPropertiesForTesting(child2.get(), identity_matrix, gfx::Point3F(), 463 SetLayerPropertiesForTesting(child2.get(), identity_matrix, gfx::Point3F(),
464 gfx::PointF(), gfx::Size(75, 75), true, false, 464 gfx::PointF(), gfx::Size(75, 75), true, false,
465 false); 465 false);
466 child2->SetMasksToBounds(true); 466 child2->SetMasksToBounds(true);
467 child2->SetDrawsContent(true); 467 child2->SetDrawsContent(true);
468 root->AddChild(std::move(child1)); 468 root->test_properties()->AddChild(std::move(child1));
469 root->AddChild(std::move(child2)); 469 root->test_properties()->AddChild(std::move(child2));
470 470
471 host_impl().SetViewportSize(root->bounds()); 471 host_impl().SetViewportSize(root->bounds());
472 host_impl().active_tree()->SetRootLayer(std::move(root)); 472 host_impl().active_tree()->SetRootLayer(std::move(root));
473 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 473 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
474 474
475 gfx::PointF test_point(50.f, 50.f); 475 gfx::PointF test_point(50.f, 50.f);
476 LayerImpl* result_layer = 476 LayerImpl* result_layer =
477 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 477 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
478 ASSERT_TRUE(result_layer); 478 ASSERT_TRUE(result_layer);
479 EXPECT_EQ(3, result_layer->id()); 479 EXPECT_EQ(3, result_layer->id());
(...skipping 10 matching lines...) Expand all
490 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(), 490 SetLayerPropertiesForTesting(root.get(), identity_matrix, gfx::Point3F(),
491 gfx::PointF(), bounds, true, false, true); 491 gfx::PointF(), bounds, true, false, true);
492 492
493 std::unique_ptr<LayerImpl> surface = 493 std::unique_ptr<LayerImpl> surface =
494 LayerImpl::Create(host_impl().active_tree(), 2); 494 LayerImpl::Create(host_impl().active_tree(), 2);
495 SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(), 495 SetLayerPropertiesForTesting(surface.get(), identity_matrix, gfx::Point3F(),
496 gfx::PointF(), bounds, true, false, true); 496 gfx::PointF(), bounds, true, false, true);
497 surface->SetMasksToBounds(true); 497 surface->SetMasksToBounds(true);
498 surface->SetDrawsContent(true); 498 surface->SetDrawsContent(true);
499 499
500 root->AddChild(std::move(surface)); 500 root->test_properties()->AddChild(std::move(surface));
501 host_impl().SetViewportSize(root->bounds()); 501 host_impl().SetViewportSize(root->bounds());
502 host_impl().active_tree()->SetRootLayer(std::move(root)); 502 host_impl().active_tree()->SetRootLayer(std::move(root));
503 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 503 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
504 504
505 gfx::PointF test_point(max_texture_size - 50, max_texture_size - 50); 505 gfx::PointF test_point(max_texture_size - 50, max_texture_size - 50);
506 LayerImpl* result_layer = 506 LayerImpl* result_layer =
507 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 507 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
508 EXPECT_TRUE(result_layer); 508 EXPECT_TRUE(result_layer);
509 509
510 test_point = gfx::PointF(max_texture_size + 50, max_texture_size + 50); 510 test_point = gfx::PointF(max_texture_size + 50, max_texture_size + 50);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 false, false); 595 false, false);
596 clipping_layer->SetMasksToBounds(true); 596 clipping_layer->SetMasksToBounds(true);
597 597
598 std::unique_ptr<LayerImpl> child = 598 std::unique_ptr<LayerImpl> child =
599 LayerImpl::Create(host_impl().active_tree(), 456); 599 LayerImpl::Create(host_impl().active_tree(), 456);
600 position = gfx::PointF(-50.f, -50.f); 600 position = gfx::PointF(-50.f, -50.f);
601 bounds = gfx::Size(300, 300); 601 bounds = gfx::Size(300, 300);
602 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, 602 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
603 position, bounds, true, false, false); 603 position, bounds, true, false, false);
604 child->SetDrawsContent(true); 604 child->SetDrawsContent(true);
605 clipping_layer->AddChild(std::move(child)); 605 clipping_layer->test_properties()->AddChild(std::move(child));
606 root->AddChild(std::move(clipping_layer)); 606 root->test_properties()->AddChild(std::move(clipping_layer));
607 } 607 }
608 608
609 host_impl().SetViewportSize(root->bounds()); 609 host_impl().SetViewportSize(root->bounds());
610 host_impl().active_tree()->SetRootLayer(std::move(root)); 610 host_impl().active_tree()->SetRootLayer(std::move(root));
611 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 611 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
612 612
613 // Sanity check the scenario we just created. 613 // Sanity check the scenario we just created.
614 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 614 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
615 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 615 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
616 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); 616 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id());
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 rotated_leaf_transform.Translate(50.0, 50.0); 702 rotated_leaf_transform.Translate(50.0, 50.0);
703 rotated_leaf_transform.RotateAboutZAxis(45.0); 703 rotated_leaf_transform.RotateAboutZAxis(45.0);
704 rotated_leaf_transform.Translate(-50.0, -50.0); 704 rotated_leaf_transform.Translate(-50.0, -50.0);
705 position = gfx::PointF(); 705 position = gfx::PointF();
706 bounds = gfx::Size(100, 100); 706 bounds = gfx::Size(100, 100);
707 SetLayerPropertiesForTesting(rotated_leaf.get(), rotated_leaf_transform, 707 SetLayerPropertiesForTesting(rotated_leaf.get(), rotated_leaf_transform,
708 transform_origin, position, bounds, true, 708 transform_origin, position, bounds, true,
709 false, false); 709 false, false);
710 rotated_leaf->SetDrawsContent(true); 710 rotated_leaf->SetDrawsContent(true);
711 711
712 grand_child->AddChild(std::move(rotated_leaf)); 712 grand_child->test_properties()->AddChild(std::move(rotated_leaf));
713 child->AddChild(std::move(grand_child)); 713 child->test_properties()->AddChild(std::move(grand_child));
714 root->AddChild(std::move(child)); 714 root->test_properties()->AddChild(std::move(child));
715 host_impl().active_tree()->SetRootLayer(std::move(root)); 715 host_impl().active_tree()->SetRootLayer(std::move(root));
716 716
717 ExecuteCalculateDrawProperties(root_layer); 717 ExecuteCalculateDrawProperties(root_layer);
718 } 718 }
719 719
720 host_impl().SetViewportSize(root_layer->bounds()); 720 host_impl().SetViewportSize(root_layer->bounds());
721 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 721 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
722 // (11, 89) is close to the the bottom left corner within the clip, but it is 722 // (11, 89) is close to the the bottom left corner within the clip, but it is
723 // not inside the layer. 723 // not inside the layer.
724 gfx::PointF test_point(11.f, 89.f); 724 gfx::PointF test_point(11.f, 89.f);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 // The child of the intermediate_layer is translated so that it does not 794 // The child of the intermediate_layer is translated so that it does not
795 // overlap intermediate_layer at all. If child is incorrectly clipped, we 795 // overlap intermediate_layer at all. If child is incorrectly clipped, we
796 // would not be able to hit it successfully. 796 // would not be able to hit it successfully.
797 std::unique_ptr<LayerImpl> child = 797 std::unique_ptr<LayerImpl> child =
798 LayerImpl::Create(host_impl().active_tree(), 456); 798 LayerImpl::Create(host_impl().active_tree(), 456);
799 position = gfx::PointF(60.f, 60.f); // 70, 70 in screen space 799 position = gfx::PointF(60.f, 60.f); // 70, 70 in screen space
800 bounds = gfx::Size(20, 20); 800 bounds = gfx::Size(20, 20);
801 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, 801 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
802 position, bounds, true, false, false); 802 position, bounds, true, false, false);
803 child->SetDrawsContent(true); 803 child->SetDrawsContent(true);
804 intermediate_layer->AddChild(std::move(child)); 804 intermediate_layer->test_properties()->AddChild(std::move(child));
805 root->AddChild(std::move(intermediate_layer)); 805 root->test_properties()->AddChild(std::move(intermediate_layer));
806 } 806 }
807 807
808 host_impl().SetViewportSize(root->bounds()); 808 host_impl().SetViewportSize(root->bounds());
809 host_impl().active_tree()->SetRootLayer(std::move(root)); 809 host_impl().active_tree()->SetRootLayer(std::move(root));
810 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 810 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
811 811
812 // Sanity check the scenario we just created. 812 // Sanity check the scenario we just created.
813 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 813 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
814 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 814 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
815 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); 815 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 // Remember that grand_child is positioned with respect to its parent (i.e. 882 // Remember that grand_child is positioned with respect to its parent (i.e.
883 // child1). In screen space, the intended position is (10, 50), with size 883 // child1). In screen space, the intended position is (10, 50), with size
884 // 100 x 50. 884 // 100 x 50.
885 position = gfx::PointF(0.f, 40.f); 885 position = gfx::PointF(0.f, 40.f);
886 bounds = gfx::Size(100, 50); 886 bounds = gfx::Size(100, 50);
887 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, 887 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
888 transform_origin, position, bounds, true, 888 transform_origin, position, bounds, true,
889 false, false); 889 false, false);
890 grand_child1->SetDrawsContent(true); 890 grand_child1->SetDrawsContent(true);
891 891
892 child1->AddChild(std::move(grand_child1)); 892 child1->test_properties()->AddChild(std::move(grand_child1));
893 root->AddChild(std::move(child1)); 893 root->test_properties()->AddChild(std::move(child1));
894 root->AddChild(std::move(child2)); 894 root->test_properties()->AddChild(std::move(child2));
895 host_impl().active_tree()->SetRootLayer(std::move(root)); 895 host_impl().active_tree()->SetRootLayer(std::move(root));
896 896
897 ExecuteCalculateDrawProperties(root_layer); 897 ExecuteCalculateDrawProperties(root_layer);
898 } 898 }
899 899
900 LayerImpl* child1 = root_layer->test_properties()->children[0]; 900 LayerImpl* child1 = root_layer->test_properties()->children[0];
901 LayerImpl* child2 = root_layer->test_properties()->children[1]; 901 LayerImpl* child2 = root_layer->test_properties()->children[1];
902 LayerImpl* grand_child1 = child1->test_properties()->children[0]; 902 LayerImpl* grand_child1 = child1->test_properties()->children[0];
903 903
904 host_impl().SetViewportSize(root_layer->bounds()); 904 host_impl().SetViewportSize(root_layer->bounds());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 { 1004 {
1005 gfx::Transform translate_z; 1005 gfx::Transform translate_z;
1006 translate_z.Translate3d(0, 0, right_child_depth); 1006 translate_z.Translate3d(0, 0, right_child_depth);
1007 SetLayerPropertiesForTesting(right_child.get(), translate_z, 1007 SetLayerPropertiesForTesting(right_child.get(), translate_z,
1008 transform_origin, position, bounds, false, 1008 transform_origin, position, bounds, false,
1009 false, false); 1009 false, false);
1010 right_child->SetDrawsContent(true); 1010 right_child->SetDrawsContent(true);
1011 right_child->Set3dSortingContextId(right_child_sorting_context); 1011 right_child->Set3dSortingContextId(right_child_sorting_context);
1012 } 1012 }
1013 1013
1014 root->AddChild(std::move(left_child)); 1014 root->test_properties()->AddChild(std::move(left_child));
1015 root->AddChild(std::move(right_child)); 1015 root->test_properties()->AddChild(std::move(right_child));
1016 1016
1017 host_impl().SetViewportSize(root->bounds()); 1017 host_impl().SetViewportSize(root->bounds());
1018 host_impl().active_tree()->SetRootLayer(std::move(root)); 1018 host_impl().active_tree()->SetRootLayer(std::move(root));
1019 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1019 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1020 CHECK_EQ(1u, RenderSurfaceLayerList().size()); 1020 CHECK_EQ(1u, RenderSurfaceLayerList().size());
1021 1021
1022 gfx::PointF test_point = gfx::PointF(1.f, 1.f); 1022 gfx::PointF test_point = gfx::PointF(1.f, 1.f);
1023 LayerImpl* result_layer = 1023 LayerImpl* result_layer =
1024 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 1024 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
1025 1025
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 // child1). In screen space, the intended position is (10, 50), with size 1113 // child1). In screen space, the intended position is (10, 50), with size
1114 // 100 x 50. 1114 // 100 x 50.
1115 position = gfx::PointF(0.f, 40.f); 1115 position = gfx::PointF(0.f, 40.f);
1116 bounds = gfx::Size(100, 50); 1116 bounds = gfx::Size(100, 50);
1117 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, 1117 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
1118 transform_origin, position, bounds, true, 1118 transform_origin, position, bounds, true,
1119 false, false); 1119 false, false);
1120 grand_child1->SetDrawsContent(true); 1120 grand_child1->SetDrawsContent(true);
1121 grand_child1->test_properties()->should_flatten_transform = false; 1121 grand_child1->test_properties()->should_flatten_transform = false;
1122 1122
1123 child1->AddChild(std::move(grand_child1)); 1123 child1->test_properties()->AddChild(std::move(grand_child1));
1124 root->AddChild(std::move(child1)); 1124 root->test_properties()->AddChild(std::move(child1));
1125 root->AddChild(std::move(child2)); 1125 root->test_properties()->AddChild(std::move(child2));
1126 } 1126 }
1127 1127
1128 LayerImpl* child1 = root->test_properties()->children[0]; 1128 LayerImpl* child1 = root->test_properties()->children[0];
1129 LayerImpl* child2 = root->test_properties()->children[1]; 1129 LayerImpl* child2 = root->test_properties()->children[1];
1130 LayerImpl* grand_child1 = child1->test_properties()->children[0]; 1130 LayerImpl* grand_child1 = child1->test_properties()->children[0];
1131 1131
1132 host_impl().SetViewportSize(root->bounds()); 1132 host_impl().SetViewportSize(root->bounds());
1133 host_impl().active_tree()->SetRootLayer(std::move(root)); 1133 host_impl().active_tree()->SetRootLayer(std::move(root));
1134 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1134 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1135 1135
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 grand_child->SetDrawsContent(true); 1219 grand_child->SetDrawsContent(true);
1220 grand_child->SetHasRenderSurface(true); 1220 grand_child->SetHasRenderSurface(true);
1221 1221
1222 // This should let |grand_child| "escape" |child|'s clip. 1222 // This should let |grand_child| "escape" |child|'s clip.
1223 grand_child->test_properties()->clip_parent = root.get(); 1223 grand_child->test_properties()->clip_parent = root.get();
1224 std::unique_ptr<std::set<LayerImpl*>> clip_children( 1224 std::unique_ptr<std::set<LayerImpl*>> clip_children(
1225 new std::set<LayerImpl*>); 1225 new std::set<LayerImpl*>);
1226 clip_children->insert(grand_child.get()); 1226 clip_children->insert(grand_child.get());
1227 root->test_properties()->clip_children.reset(clip_children.release()); 1227 root->test_properties()->clip_children.reset(clip_children.release());
1228 1228
1229 child->AddChild(std::move(grand_child)); 1229 child->test_properties()->AddChild(std::move(grand_child));
1230 root->AddChild(std::move(child)); 1230 root->test_properties()->AddChild(std::move(child));
1231 } 1231 }
1232 1232
1233 host_impl().SetViewportSize(root->bounds()); 1233 host_impl().SetViewportSize(root->bounds());
1234 host_impl().active_tree()->SetRootLayer(std::move(root)); 1234 host_impl().active_tree()->SetRootLayer(std::move(root));
1235 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1235 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1236 1236
1237 gfx::PointF test_point(12.f, 52.f); 1237 gfx::PointF test_point(12.f, 52.f);
1238 LayerImpl* result_layer = 1238 LayerImpl* result_layer =
1239 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 1239 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
1240 ASSERT_TRUE(result_layer); 1240 ASSERT_TRUE(result_layer);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 new std::set<LayerImpl*>); 1280 new std::set<LayerImpl*>);
1281 scroll_children->insert(scroll_child.get()); 1281 scroll_children->insert(scroll_child.get());
1282 child->test_properties()->scroll_children.reset(scroll_children.release()); 1282 child->test_properties()->scroll_children.reset(scroll_children.release());
1283 1283
1284 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix, 1284 SetLayerPropertiesForTesting(grand_child.get(), identity_matrix,
1285 transform_origin, position, bounds, true, 1285 transform_origin, position, bounds, true,
1286 false, false); 1286 false, false);
1287 grand_child->SetDrawsContent(true); 1287 grand_child->SetDrawsContent(true);
1288 grand_child->SetHasRenderSurface(true); 1288 grand_child->SetHasRenderSurface(true);
1289 1289
1290 scroll_child->AddChild(std::move(grand_child)); 1290 scroll_child->test_properties()->AddChild(std::move(grand_child));
1291 root->AddChild(std::move(scroll_child)); 1291 root->test_properties()->AddChild(std::move(scroll_child));
1292 root->AddChild(std::move(child)); 1292 root->test_properties()->AddChild(std::move(child));
1293 } 1293 }
1294 1294
1295 host_impl().SetViewportSize(root->bounds()); 1295 host_impl().SetViewportSize(root->bounds());
1296 host_impl().active_tree()->SetRootLayer(std::move(root)); 1296 host_impl().active_tree()->SetRootLayer(std::move(root));
1297 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1297 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1298 1298
1299 gfx::PointF test_point(12.f, 52.f); 1299 gfx::PointF test_point(12.f, 52.f);
1300 LayerImpl* result_layer = 1300 LayerImpl* result_layer =
1301 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 1301 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
1302 // The |test_point| should have been clipped away by |child|, the scroll 1302 // The |test_point| should have been clipped away by |child|, the scroll
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 // child1). In screen space, the intended position is (10, 50), with size 1354 // child1). In screen space, the intended position is (10, 50), with size
1355 // 100 x 50. 1355 // 100 x 50.
1356 position = gfx::PointF(0.f, 40.f); 1356 position = gfx::PointF(0.f, 40.f);
1357 bounds = gfx::Size(100, 50); 1357 bounds = gfx::Size(100, 50);
1358 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix, 1358 SetLayerPropertiesForTesting(grand_child1.get(), identity_matrix,
1359 transform_origin, position, bounds, true, 1359 transform_origin, position, bounds, true,
1360 false, false); 1360 false, false);
1361 grand_child1->SetDrawsContent(true); 1361 grand_child1->SetDrawsContent(true);
1362 grand_child1->test_properties()->force_render_surface = true; 1362 grand_child1->test_properties()->force_render_surface = true;
1363 1363
1364 child1->AddChild(std::move(grand_child1)); 1364 child1->test_properties()->AddChild(std::move(grand_child1));
1365 root->AddChild(std::move(child1)); 1365 root->test_properties()->AddChild(std::move(child1));
1366 root->AddChild(std::move(child2)); 1366 root->test_properties()->AddChild(std::move(child2));
1367 host_impl().active_tree()->SetRootLayer(std::move(root)); 1367 host_impl().active_tree()->SetRootLayer(std::move(root));
1368 1368
1369 ExecuteCalculateDrawProperties(root_layer); 1369 ExecuteCalculateDrawProperties(root_layer);
1370 } 1370 }
1371 1371
1372 LayerImpl* child1 = root_layer->test_properties()->children[0]; 1372 LayerImpl* child1 = root_layer->test_properties()->children[0];
1373 LayerImpl* child2 = root_layer->test_properties()->children[1]; 1373 LayerImpl* child2 = root_layer->test_properties()->children[1];
1374 LayerImpl* grand_child1 = child1->test_properties()->children[0]; 1374 LayerImpl* grand_child1 = child1->test_properties()->children[0];
1375 1375
1376 host_impl().SetViewportSize(root_layer->bounds()); 1376 host_impl().SetViewportSize(root_layer->bounds());
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 gfx::PointF position(25.f, 25.f); 1682 gfx::PointF position(25.f, 25.f);
1683 gfx::Size bounds(50, 50); 1683 gfx::Size bounds(50, 50);
1684 std::unique_ptr<LayerImpl> test_layer = 1684 std::unique_ptr<LayerImpl> test_layer =
1685 LayerImpl::Create(host_impl().active_tree(), 12345); 1685 LayerImpl::Create(host_impl().active_tree(), 12345);
1686 SetLayerPropertiesForTesting(test_layer.get(), identity_matrix, 1686 SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
1687 transform_origin, position, bounds, true, 1687 transform_origin, position, bounds, true,
1688 false, false); 1688 false, false);
1689 1689
1690 test_layer->SetDrawsContent(true); 1690 test_layer->SetDrawsContent(true);
1691 test_layer->SetTouchEventHandlerRegion(touch_handler_region); 1691 test_layer->SetTouchEventHandlerRegion(touch_handler_region);
1692 root->AddChild(std::move(test_layer)); 1692 root->test_properties()->AddChild(std::move(test_layer));
1693 } 1693 }
1694 1694
1695 float device_scale_factor = 3.f; 1695 float device_scale_factor = 3.f;
1696 float page_scale_factor = 5.f; 1696 float page_scale_factor = 5.f;
1697 float max_page_scale_factor = 10.f; 1697 float max_page_scale_factor = 10.f;
1698 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( 1698 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize(
1699 root->bounds(), device_scale_factor * page_scale_factor); 1699 root->bounds(), device_scale_factor * page_scale_factor);
1700 host_impl().SetViewportSize(scaled_bounds_for_root); 1700 host_impl().SetViewportSize(scaled_bounds_for_root);
1701 1701
1702 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); 1702 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 1837
1838 std::unique_ptr<LayerImpl> child = 1838 std::unique_ptr<LayerImpl> child =
1839 LayerImpl::Create(host_impl().active_tree(), 456); 1839 LayerImpl::Create(host_impl().active_tree(), 456);
1840 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); 1840 Region touch_handler_region(gfx::Rect(10, 10, 50, 50));
1841 position = gfx::PointF(-50.f, -50.f); 1841 position = gfx::PointF(-50.f, -50.f);
1842 bounds = gfx::Size(300, 300); 1842 bounds = gfx::Size(300, 300);
1843 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, 1843 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
1844 position, bounds, true, false, false); 1844 position, bounds, true, false, false);
1845 child->SetDrawsContent(true); 1845 child->SetDrawsContent(true);
1846 child->SetTouchEventHandlerRegion(touch_handler_region); 1846 child->SetTouchEventHandlerRegion(touch_handler_region);
1847 clipping_layer->AddChild(std::move(child)); 1847 clipping_layer->test_properties()->AddChild(std::move(child));
1848 root->AddChild(std::move(clipping_layer)); 1848 root->test_properties()->AddChild(std::move(clipping_layer));
1849 } 1849 }
1850 1850
1851 host_impl().SetViewportSize(root->bounds()); 1851 host_impl().SetViewportSize(root->bounds());
1852 host_impl().active_tree()->SetRootLayer(std::move(root)); 1852 host_impl().active_tree()->SetRootLayer(std::move(root));
1853 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 1853 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1854 1854
1855 // Sanity check the scenario we just created. 1855 // Sanity check the scenario we just created.
1856 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1856 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1857 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1857 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1858 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); 1858 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1930 1930
1931 std::unique_ptr<LayerImpl> child = 1931 std::unique_ptr<LayerImpl> child =
1932 LayerImpl::Create(host_impl().active_tree(), 456); 1932 LayerImpl::Create(host_impl().active_tree(), 456);
1933 Region touch_handler_region(gfx::Rect(0, 0, 300, 300)); 1933 Region touch_handler_region(gfx::Rect(0, 0, 300, 300));
1934 position = gfx::PointF(-50.f, -50.f); 1934 position = gfx::PointF(-50.f, -50.f);
1935 bounds = gfx::Size(300, 300); 1935 bounds = gfx::Size(300, 300);
1936 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin, 1936 SetLayerPropertiesForTesting(child.get(), identity_matrix, transform_origin,
1937 position, bounds, true, false, false); 1937 position, bounds, true, false, false);
1938 child->SetDrawsContent(true); 1938 child->SetDrawsContent(true);
1939 child->SetTouchEventHandlerRegion(touch_handler_region); 1939 child->SetTouchEventHandlerRegion(touch_handler_region);
1940 clipping_layer->AddChild(std::move(child)); 1940 clipping_layer->test_properties()->AddChild(std::move(child));
1941 surface->AddChild(std::move(clipping_layer)); 1941 surface->test_properties()->AddChild(std::move(clipping_layer));
1942 root->AddChild(std::move(surface)); 1942 root->test_properties()->AddChild(std::move(surface));
1943 } 1943 }
1944 1944
1945 float device_scale_factor = 3.f; 1945 float device_scale_factor = 3.f;
1946 float page_scale_factor = 1.f; 1946 float page_scale_factor = 1.f;
1947 float max_page_scale_factor = 1.f; 1947 float max_page_scale_factor = 1.f;
1948 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( 1948 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize(
1949 root->bounds(), device_scale_factor * page_scale_factor); 1949 root->bounds(), device_scale_factor * page_scale_factor);
1950 host_impl().SetViewportSize(scaled_bounds_for_root); 1950 host_impl().SetViewportSize(scaled_bounds_for_root);
1951 1951
1952 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); 1952 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 LayerImpl::Create(host_impl().active_tree(), 123); 1999 LayerImpl::Create(host_impl().active_tree(), 123);
2000 // this layer is positioned, and hit testing should correctly know where the 2000 // this layer is positioned, and hit testing should correctly know where the
2001 // layer is located. 2001 // layer is located.
2002 gfx::PointF position; 2002 gfx::PointF position;
2003 gfx::Size bounds(50, 50); 2003 gfx::Size bounds(50, 50);
2004 SetLayerPropertiesForTesting(touch_layer.get(), identity_matrix, 2004 SetLayerPropertiesForTesting(touch_layer.get(), identity_matrix,
2005 transform_origin, position, bounds, true, 2005 transform_origin, position, bounds, true,
2006 false, false); 2006 false, false);
2007 touch_layer->SetDrawsContent(true); 2007 touch_layer->SetDrawsContent(true);
2008 touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50)); 2008 touch_layer->SetTouchEventHandlerRegion(gfx::Rect(0, 0, 50, 50));
2009 root->AddChild(std::move(touch_layer)); 2009 root->test_properties()->AddChild(std::move(touch_layer));
2010 } 2010 }
2011 2011
2012 { 2012 {
2013 std::unique_ptr<LayerImpl> notouch_layer = 2013 std::unique_ptr<LayerImpl> notouch_layer =
2014 LayerImpl::Create(host_impl().active_tree(), 1234); 2014 LayerImpl::Create(host_impl().active_tree(), 1234);
2015 // this layer is positioned, and hit testing should correctly know where the 2015 // this layer is positioned, and hit testing should correctly know where the
2016 // layer is located. 2016 // layer is located.
2017 gfx::PointF position(0, 25); 2017 gfx::PointF position(0, 25);
2018 gfx::Size bounds(50, 50); 2018 gfx::Size bounds(50, 50);
2019 SetLayerPropertiesForTesting(notouch_layer.get(), identity_matrix, 2019 SetLayerPropertiesForTesting(notouch_layer.get(), identity_matrix,
2020 transform_origin, position, bounds, true, 2020 transform_origin, position, bounds, true,
2021 false, false); 2021 false, false);
2022 notouch_layer->SetDrawsContent(true); 2022 notouch_layer->SetDrawsContent(true);
2023 root->AddChild(std::move(notouch_layer)); 2023 root->test_properties()->AddChild(std::move(notouch_layer));
2024 } 2024 }
2025 2025
2026 host_impl().SetViewportSize(root->bounds()); 2026 host_impl().SetViewportSize(root->bounds());
2027 host_impl().active_tree()->SetRootLayer(std::move(root)); 2027 host_impl().active_tree()->SetRootLayer(std::move(root));
2028 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2028 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2029 2029
2030 // Sanity check the scenario we just created. 2030 // Sanity check the scenario we just created.
2031 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2031 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
2032 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); 2032 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size());
2033 ASSERT_EQ(123, root_layer()->render_surface()->layer_list().at(0)->id()); 2033 ASSERT_EQ(123, root_layer()->render_surface()->layer_list().at(0)->id());
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 gfx::PointF position; 2082 gfx::PointF position;
2083 gfx::Size bounds(50, 50); 2083 gfx::Size bounds(50, 50);
2084 std::unique_ptr<LayerImpl> test_layer = 2084 std::unique_ptr<LayerImpl> test_layer =
2085 LayerImpl::Create(host_impl().active_tree(), 12345); 2085 LayerImpl::Create(host_impl().active_tree(), 12345);
2086 SetLayerPropertiesForTesting(test_layer.get(), identity_matrix, 2086 SetLayerPropertiesForTesting(test_layer.get(), identity_matrix,
2087 transform_origin, position, bounds, true, 2087 transform_origin, position, bounds, true,
2088 false, false); 2088 false, false);
2089 2089
2090 test_layer->SetDrawsContent(false); 2090 test_layer->SetDrawsContent(false);
2091 test_layer->SetTouchEventHandlerRegion(touch_handler_region); 2091 test_layer->SetTouchEventHandlerRegion(touch_handler_region);
2092 root->AddChild(std::move(test_layer)); 2092 root->test_properties()->AddChild(std::move(test_layer));
2093 } 2093 }
2094 host_impl().SetViewportSize(root->bounds()); 2094 host_impl().SetViewportSize(root->bounds());
2095 host_impl().active_tree()->SetRootLayer(std::move(root)); 2095 host_impl().active_tree()->SetRootLayer(std::move(root));
2096 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2096 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2097 2097
2098 LayerImpl* test_layer = 2098 LayerImpl* test_layer =
2099 host_impl().active_tree()->root_layer()->test_properties()->children[0]; 2099 host_impl().active_tree()->root_layer()->test_properties()->children[0];
2100 // As test_layer doesn't draw content, the layer list of root's render surface 2100 // As test_layer doesn't draw content, the layer list of root's render surface
2101 // should contain only the root layer. 2101 // should contain only the root layer.
2102 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2102 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2255 clipping_layer->SetMasksToBounds(true); 2255 clipping_layer->SetMasksToBounds(true);
2256 2256
2257 std::unique_ptr<LayerImpl> clipped_layer = 2257 std::unique_ptr<LayerImpl> clipped_layer =
2258 LayerImpl::Create(host_impl().active_tree(), clipped_layer_id); 2258 LayerImpl::Create(host_impl().active_tree(), clipped_layer_id);
2259 position = gfx::PointF(); 2259 position = gfx::PointF();
2260 bounds = gfx::Size(100, 100); 2260 bounds = gfx::Size(100, 100);
2261 SetLayerPropertiesForTesting(clipped_layer.get(), identity_matrix, 2261 SetLayerPropertiesForTesting(clipped_layer.get(), identity_matrix,
2262 transform_origin, position, bounds, true, 2262 transform_origin, position, bounds, true,
2263 false, false); 2263 false, false);
2264 clipped_layer->SetDrawsContent(true); 2264 clipped_layer->SetDrawsContent(true);
2265 clipping_layer->AddChild(std::move(clipped_layer)); 2265 clipping_layer->test_properties()->AddChild(std::move(clipped_layer));
2266 root->AddChild(std::move(clipping_layer)); 2266 root->test_properties()->AddChild(std::move(clipping_layer));
2267 } 2267 }
2268 2268
2269 host_impl().SetViewportSize(root->bounds()); 2269 host_impl().SetViewportSize(root->bounds());
2270 host_impl().active_tree()->SetRootLayer(std::move(root)); 2270 host_impl().active_tree()->SetRootLayer(std::move(root));
2271 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2271 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2272 2272
2273 // Sanity check the scenario we just created. 2273 // Sanity check the scenario we just created.
2274 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2274 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
2275 2275
2276 LayerSelection input; 2276 LayerSelection input;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 gfx::Vector2dF sub_layer_offset(10, 0); 2343 gfx::Vector2dF sub_layer_offset(10, 0);
2344 { 2344 {
2345 std::unique_ptr<LayerImpl> sub_layer = 2345 std::unique_ptr<LayerImpl> sub_layer =
2346 LayerImpl::Create(host_impl().active_tree(), sub_layer_id); 2346 LayerImpl::Create(host_impl().active_tree(), sub_layer_id);
2347 gfx::PointF position = gfx::PointF() + sub_layer_offset; 2347 gfx::PointF position = gfx::PointF() + sub_layer_offset;
2348 gfx::Size bounds(50, 50); 2348 gfx::Size bounds(50, 50);
2349 SetLayerPropertiesForTesting(sub_layer.get(), identity_matrix, 2349 SetLayerPropertiesForTesting(sub_layer.get(), identity_matrix,
2350 transform_origin, position, bounds, true, 2350 transform_origin, position, bounds, true,
2351 false, false); 2351 false, false);
2352 sub_layer->SetDrawsContent(true); 2352 sub_layer->SetDrawsContent(true);
2353 root->AddChild(std::move(sub_layer)); 2353 root->test_properties()->AddChild(std::move(sub_layer));
2354 } 2354 }
2355 2355
2356 float device_scale_factor = 3.f; 2356 float device_scale_factor = 3.f;
2357 float page_scale_factor = 5.f; 2357 float page_scale_factor = 5.f;
2358 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize( 2358 gfx::Size scaled_bounds_for_root = gfx::ScaleToCeiledSize(
2359 root->bounds(), device_scale_factor * page_scale_factor); 2359 root->bounds(), device_scale_factor * page_scale_factor);
2360 host_impl().SetViewportSize(scaled_bounds_for_root); 2360 host_impl().SetViewportSize(scaled_bounds_for_root);
2361 2361
2362 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor); 2362 host_impl().active_tree()->SetDeviceScaleFactor(device_scale_factor);
2363 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor); 2363 host_impl().active_tree()->SetPageScaleOnActiveTree(page_scale_factor);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2435 SetLayerPropertiesForTesting(child.get(), large_transform, transform_origin, 2435 SetLayerPropertiesForTesting(child.get(), large_transform, transform_origin,
2436 position, bounds, true, false, false); 2436 position, bounds, true, false, false);
2437 2437
2438 std::unique_ptr<LayerImpl> grand_child = 2438 std::unique_ptr<LayerImpl> grand_child =
2439 LayerImpl::Create(host_impl().active_tree(), grand_child_id); 2439 LayerImpl::Create(host_impl().active_tree(), grand_child_id);
2440 SetLayerPropertiesForTesting(grand_child.get(), large_transform, 2440 SetLayerPropertiesForTesting(grand_child.get(), large_transform,
2441 transform_origin, position, bounds, true, 2441 transform_origin, position, bounds, true,
2442 false, false); 2442 false, false);
2443 grand_child->SetDrawsContent(true); 2443 grand_child->SetDrawsContent(true);
2444 2444
2445 child->AddChild(std::move(grand_child)); 2445 child->test_properties()->AddChild(std::move(grand_child));
2446 root->AddChild(std::move(child)); 2446 root->test_properties()->AddChild(std::move(child));
2447 } 2447 }
2448 2448
2449 host_impl().SetViewportSize(root->bounds()); 2449 host_impl().SetViewportSize(root->bounds());
2450 host_impl().active_tree()->SetRootLayer(std::move(root)); 2450 host_impl().active_tree()->SetRootLayer(std::move(root));
2451 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2451 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2452 2452
2453 LayerSelection input; 2453 LayerSelection input;
2454 2454
2455 input.start.type = gfx::SelectionBound::LEFT; 2455 input.start.type = gfx::SelectionBound::LEFT;
2456 input.start.edge_top = gfx::Point(10, 10); 2456 input.start.edge_top = gfx::Point(10, 10);
(...skipping 20 matching lines...) Expand all
2477 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2477 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2478 std::unique_ptr<LayerImpl> root = 2478 std::unique_ptr<LayerImpl> root =
2479 LayerImpl::Create(host_impl().active_tree(), 1); 2479 LayerImpl::Create(host_impl().active_tree(), 1);
2480 EXPECT_EQ(1u, host_impl().active_tree()->NumLayers()); 2480 EXPECT_EQ(1u, host_impl().active_tree()->NumLayers());
2481 } 2481 }
2482 2482
2483 TEST_F(LayerTreeImplTest, NumLayersSmallTree) { 2483 TEST_F(LayerTreeImplTest, NumLayersSmallTree) {
2484 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2484 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2485 std::unique_ptr<LayerImpl> root = 2485 std::unique_ptr<LayerImpl> root =
2486 LayerImpl::Create(host_impl().active_tree(), 1); 2486 LayerImpl::Create(host_impl().active_tree(), 1);
2487 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2487 root->test_properties()->AddChild(
2488 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2488 LayerImpl::Create(host_impl().active_tree(), 2));
2489 root->test_properties()->children[1]->AddChild( 2489 root->test_properties()->AddChild(
2490 LayerImpl::Create(host_impl().active_tree(), 3));
2491 root->test_properties()->children[1]->test_properties()->AddChild(
2490 LayerImpl::Create(host_impl().active_tree(), 4)); 2492 LayerImpl::Create(host_impl().active_tree(), 4));
2491 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2493 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2492 } 2494 }
2493 2495
2494 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) { 2496 TEST_F(LayerTreeImplTest, DeviceScaleFactorNeedsDrawPropertiesUpdate) {
2495 host_impl().active_tree()->SetDeviceScaleFactor(1.f); 2497 host_impl().active_tree()->SetDeviceScaleFactor(1.f);
2496 host_impl().active_tree()->UpdateDrawProperties(false); 2498 host_impl().active_tree()->UpdateDrawProperties(false);
2497 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties()); 2499 EXPECT_FALSE(host_impl().active_tree()->needs_update_draw_properties());
2498 host_impl().active_tree()->SetDeviceScaleFactor(2.f); 2500 host_impl().active_tree()->SetDeviceScaleFactor(2.f);
2499 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties()); 2501 EXPECT_TRUE(host_impl().active_tree()->needs_update_draw_properties());
(...skipping 28 matching lines...) Expand all
2528 left_child->SetDrawsContent(true); 2530 left_child->SetDrawsContent(true);
2529 } 2531 }
2530 { 2532 {
2531 gfx::Transform translate_z; 2533 gfx::Transform translate_z;
2532 translate_z.Translate3d(0, 0, 10); 2534 translate_z.Translate3d(0, 0, 10);
2533 SetLayerPropertiesForTesting(right_child.get(), translate_z, 2535 SetLayerPropertiesForTesting(right_child.get(), translate_z,
2534 transform_origin, position, bounds, false, 2536 transform_origin, position, bounds, false,
2535 false, false); 2537 false, false);
2536 } 2538 }
2537 2539
2538 root->AddChild(std::move(left_child)); 2540 root->test_properties()->AddChild(std::move(left_child));
2539 root->AddChild(std::move(right_child)); 2541 root->test_properties()->AddChild(std::move(right_child));
2540 2542
2541 host_impl().SetViewportSize(root->bounds()); 2543 host_impl().SetViewportSize(root->bounds());
2542 host_impl().active_tree()->SetRootLayer(std::move(root)); 2544 host_impl().active_tree()->SetRootLayer(std::move(root));
2543 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); 2545 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2544 CHECK_EQ(1u, RenderSurfaceLayerList().size()); 2546 CHECK_EQ(1u, RenderSurfaceLayerList().size());
2545 2547
2546 gfx::PointF test_point = gfx::PointF(1.f, 1.f); 2548 gfx::PointF test_point = gfx::PointF(1.f, 1.f);
2547 LayerImpl* result_layer = 2549 LayerImpl* result_layer =
2548 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 2550 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
2549 2551
2550 CHECK(result_layer); 2552 CHECK(result_layer);
2551 EXPECT_EQ(2, result_layer->id()); 2553 EXPECT_EQ(2, result_layer->id());
2552 } 2554 }
2553 2555
2554 } // namespace 2556 } // namespace
2555 } // namespace cc 2557 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698