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

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

Issue 373113003: Keeping track of descendants that draw content instead of recalcualting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « cc/trees/layer_tree_host_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/test/fake_impl_proxy.h" 9 #include "cc/test/fake_impl_proxy.h"
10 #include "cc/test/fake_layer_tree_host_impl.h" 10 #include "cc/test/fake_layer_tree_host_impl.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 identity_matrix, 55 identity_matrix,
56 transform_origin, 56 transform_origin,
57 position, 57 position,
58 bounds, 58 bounds,
59 true, 59 true,
60 false); 60 false);
61 root->SetDrawsContent(true); 61 root->SetDrawsContent(true);
62 62
63 host_impl().SetViewportSize(root->bounds()); 63 host_impl().SetViewportSize(root->bounds());
64 host_impl().active_tree()->SetRootLayer(root.Pass()); 64 host_impl().active_tree()->SetRootLayer(root.Pass());
65 host_impl().active_tree()->UpdateDrawProperties(); 65 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
66 66
67 // Sanity check the scenario we just created. 67 // Sanity check the scenario we just created.
68 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 68 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
69 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 69 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
70 70
71 // Hit testing for a point outside the layer should return a null pointer. 71 // Hit testing for a point outside the layer should return a null pointer.
72 gfx::Point test_point(101, 101); 72 gfx::Point test_point(101, 101);
73 LayerImpl* result_layer = 73 LayerImpl* result_layer =
74 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 74 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
75 EXPECT_FALSE(result_layer); 75 EXPECT_FALSE(result_layer);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 hud_bounds, 121 hud_bounds,
122 true, 122 true,
123 false); 123 false);
124 hud->SetDrawsContent(true); 124 hud->SetDrawsContent(true);
125 125
126 host_impl().active_tree()->set_hud_layer(hud.get()); 126 host_impl().active_tree()->set_hud_layer(hud.get());
127 root->AddChild(hud.PassAs<LayerImpl>()); 127 root->AddChild(hud.PassAs<LayerImpl>());
128 128
129 host_impl().SetViewportSize(hud_bounds); 129 host_impl().SetViewportSize(hud_bounds);
130 host_impl().active_tree()->SetRootLayer(root.Pass()); 130 host_impl().active_tree()->SetRootLayer(root.Pass());
131 host_impl().active_tree()->UpdateDrawProperties(); 131 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
132 132
133 // Sanity check the scenario we just created. 133 // Sanity check the scenario we just created.
134 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 134 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
135 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); 135 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size());
136 136
137 // Hit testing for a point inside HUD, but outside root should return null 137 // Hit testing for a point inside HUD, but outside root should return null
138 gfx::Point test_point(101, 101); 138 gfx::Point test_point(101, 101);
139 LayerImpl* result_layer = 139 LayerImpl* result_layer =
140 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 140 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
141 EXPECT_FALSE(result_layer); 141 EXPECT_FALSE(result_layer);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 uninvertible_transform, 179 uninvertible_transform,
180 transform_origin, 180 transform_origin,
181 position, 181 position,
182 bounds, 182 bounds,
183 true, 183 true,
184 false); 184 false);
185 root->SetDrawsContent(true); 185 root->SetDrawsContent(true);
186 186
187 host_impl().SetViewportSize(root->bounds()); 187 host_impl().SetViewportSize(root->bounds());
188 host_impl().active_tree()->SetRootLayer(root.Pass()); 188 host_impl().active_tree()->SetRootLayer(root.Pass());
189 host_impl().active_tree()->UpdateDrawProperties(); 189 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
190 // Sanity check the scenario we just created. 190 // Sanity check the scenario we just created.
191 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 191 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
192 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 192 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
193 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); 193 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible());
194 194
195 // Hit testing any point should not hit the layer. If the invertible matrix is 195 // Hit testing any point should not hit the layer. If the invertible matrix is
196 // accidentally ignored and treated like an identity, then the hit testing 196 // accidentally ignored and treated like an identity, then the hit testing
197 // will incorrectly hit the layer when it shouldn't. 197 // will incorrectly hit the layer when it shouldn't.
198 gfx::Point test_point(1, 1); 198 gfx::Point test_point(1, 1);
199 LayerImpl* result_layer = 199 LayerImpl* result_layer =
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 identity_matrix, 245 identity_matrix,
246 transform_origin, 246 transform_origin,
247 position, 247 position,
248 bounds, 248 bounds,
249 true, 249 true,
250 false); 250 false);
251 root->SetDrawsContent(true); 251 root->SetDrawsContent(true);
252 252
253 host_impl().SetViewportSize(root->bounds()); 253 host_impl().SetViewportSize(root->bounds());
254 host_impl().active_tree()->SetRootLayer(root.Pass()); 254 host_impl().active_tree()->SetRootLayer(root.Pass());
255 host_impl().active_tree()->UpdateDrawProperties(); 255 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
256 256
257 // Sanity check the scenario we just created. 257 // Sanity check the scenario we just created.
258 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 258 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
259 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 259 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
260 260
261 // Hit testing for a point outside the layer should return a null pointer. 261 // Hit testing for a point outside the layer should return a null pointer.
262 gfx::Point test_point(49, 49); 262 gfx::Point test_point(49, 49);
263 LayerImpl* result_layer = 263 LayerImpl* result_layer =
264 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 264 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
265 EXPECT_FALSE(result_layer); 265 EXPECT_FALSE(result_layer);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 rotation45_degrees_about_center, 301 rotation45_degrees_about_center,
302 transform_origin, 302 transform_origin,
303 position, 303 position,
304 bounds, 304 bounds,
305 true, 305 true,
306 false); 306 false);
307 root->SetDrawsContent(true); 307 root->SetDrawsContent(true);
308 308
309 host_impl().SetViewportSize(root->bounds()); 309 host_impl().SetViewportSize(root->bounds());
310 host_impl().active_tree()->SetRootLayer(root.Pass()); 310 host_impl().active_tree()->SetRootLayer(root.Pass());
311 host_impl().active_tree()->UpdateDrawProperties(); 311 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
312 312
313 // Sanity check the scenario we just created. 313 // Sanity check the scenario we just created.
314 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 314 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
315 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 315 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
316 316
317 // Hit testing for points outside the layer. 317 // Hit testing for points outside the layer.
318 // These corners would have been inside the un-transformed layer, but they 318 // These corners would have been inside the un-transformed layer, but they
319 // should not hit the correctly transformed layer. 319 // should not hit the correctly transformed layer.
320 gfx::Point test_point(99, 99); 320 gfx::Point test_point(99, 99);
321 LayerImpl* result_layer = 321 LayerImpl* result_layer =
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 perspective_projection_about_center * translation_by_z, 370 perspective_projection_about_center * translation_by_z,
371 transform_origin, 371 transform_origin,
372 position, 372 position,
373 bounds, 373 bounds,
374 true, 374 true,
375 false); 375 false);
376 root->SetDrawsContent(true); 376 root->SetDrawsContent(true);
377 377
378 host_impl().SetViewportSize(root->bounds()); 378 host_impl().SetViewportSize(root->bounds());
379 host_impl().active_tree()->SetRootLayer(root.Pass()); 379 host_impl().active_tree()->SetRootLayer(root.Pass());
380 host_impl().active_tree()->UpdateDrawProperties(); 380 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
381 381
382 // Sanity check the scenario we just created. 382 // Sanity check the scenario we just created.
383 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 383 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
384 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 384 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
385 385
386 // Hit testing for points outside the layer. 386 // Hit testing for points outside the layer.
387 // These corners would have been inside the un-transformed layer, but they 387 // These corners would have been inside the un-transformed layer, but they
388 // should not hit the correctly transformed layer. 388 // should not hit the correctly transformed layer.
389 gfx::Point test_point(24, 24); 389 gfx::Point test_point(24, 24);
390 LayerImpl* result_layer = 390 LayerImpl* result_layer =
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // override content bounds and contents scale 450 // override content bounds and contents scale
451 test_layer->SetContentBounds(gfx::Size(100, 100)); 451 test_layer->SetContentBounds(gfx::Size(100, 100));
452 test_layer->SetContentsScale(2, 2); 452 test_layer->SetContentsScale(2, 2);
453 453
454 test_layer->SetDrawsContent(true); 454 test_layer->SetDrawsContent(true);
455 root->AddChild(test_layer.Pass()); 455 root->AddChild(test_layer.Pass());
456 } 456 }
457 457
458 host_impl().SetViewportSize(root->bounds()); 458 host_impl().SetViewportSize(root->bounds());
459 host_impl().active_tree()->SetRootLayer(root.Pass()); 459 host_impl().active_tree()->SetRootLayer(root.Pass());
460 host_impl().active_tree()->UpdateDrawProperties(); 460 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
461 461
462 // Sanity check the scenario we just created. 462 // Sanity check the scenario we just created.
463 // The visible content rect for test_layer is actually 100x100, even though 463 // The visible content rect for test_layer is actually 100x100, even though
464 // its layout size is 50x50, positioned at 25x25. 464 // its layout size is 50x50, positioned at 25x25.
465 LayerImpl* test_layer = 465 LayerImpl* test_layer =
466 host_impl().active_tree()->root_layer()->children()[0]; 466 host_impl().active_tree()->root_layer()->children()[0];
467 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect()); 467 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect());
468 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 468 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
469 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 469 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
470 470
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 bounds, 541 bounds,
542 true, 542 true,
543 false); 543 false);
544 child->SetDrawsContent(true); 544 child->SetDrawsContent(true);
545 clipping_layer->AddChild(child.Pass()); 545 clipping_layer->AddChild(child.Pass());
546 root->AddChild(clipping_layer.Pass()); 546 root->AddChild(clipping_layer.Pass());
547 } 547 }
548 548
549 host_impl().SetViewportSize(root->bounds()); 549 host_impl().SetViewportSize(root->bounds());
550 host_impl().active_tree()->SetRootLayer(root.Pass()); 550 host_impl().active_tree()->SetRootLayer(root.Pass());
551 host_impl().active_tree()->UpdateDrawProperties(); 551 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
552 552
553 // Sanity check the scenario we just created. 553 // Sanity check the scenario we just created.
554 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 554 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
555 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 555 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
556 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); 556 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id());
557 557
558 // Hit testing for a point outside the layer should return a null pointer. 558 // Hit testing for a point outside the layer should return a null pointer.
559 // Despite the child layer being very large, it should be clipped to the root 559 // Despite the child layer being very large, it should be clipped to the root
560 // layer's bounds. 560 // layer's bounds.
561 gfx::Point test_point(24, 24); 561 gfx::Point test_point(24, 24);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 false); 666 false);
667 rotated_leaf->SetDrawsContent(true); 667 rotated_leaf->SetDrawsContent(true);
668 668
669 grand_child->AddChild(rotated_leaf.Pass()); 669 grand_child->AddChild(rotated_leaf.Pass());
670 child->AddChild(grand_child.Pass()); 670 child->AddChild(grand_child.Pass());
671 root->AddChild(child.Pass()); 671 root->AddChild(child.Pass());
672 } 672 }
673 673
674 host_impl().SetViewportSize(root->bounds()); 674 host_impl().SetViewportSize(root->bounds());
675 host_impl().active_tree()->SetRootLayer(root.Pass()); 675 host_impl().active_tree()->SetRootLayer(root.Pass());
676 host_impl().active_tree()->UpdateDrawProperties(); 676 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
677 677
678 // Sanity check the scenario we just created. 678 // Sanity check the scenario we just created.
679 // The grand_child is expected to create a render surface because it 679 // The grand_child is expected to create a render surface because it
680 // MasksToBounds and is not axis aligned. 680 // MasksToBounds and is not axis aligned.
681 ASSERT_EQ(2u, RenderSurfaceLayerList().size()); 681 ASSERT_EQ(2u, RenderSurfaceLayerList().size());
682 ASSERT_EQ( 682 ASSERT_EQ(
683 1u, 683 1u,
684 RenderSurfaceLayerList().at(0)->render_surface()->layer_list().size()); 684 RenderSurfaceLayerList().at(0)->render_surface()->layer_list().size());
685 ASSERT_EQ(789, 685 ASSERT_EQ(789,
686 RenderSurfaceLayerList() 686 RenderSurfaceLayerList()
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 bounds, 789 bounds,
790 true, 790 true,
791 false); 791 false);
792 child->SetDrawsContent(true); 792 child->SetDrawsContent(true);
793 intermediate_layer->AddChild(child.Pass()); 793 intermediate_layer->AddChild(child.Pass());
794 root->AddChild(intermediate_layer.Pass()); 794 root->AddChild(intermediate_layer.Pass());
795 } 795 }
796 796
797 host_impl().SetViewportSize(root->bounds()); 797 host_impl().SetViewportSize(root->bounds());
798 host_impl().active_tree()->SetRootLayer(root.Pass()); 798 host_impl().active_tree()->SetRootLayer(root.Pass());
799 host_impl().active_tree()->UpdateDrawProperties(); 799 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
800 800
801 // Sanity check the scenario we just created. 801 // Sanity check the scenario we just created.
802 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 802 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
803 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 803 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
804 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); 804 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id());
805 805
806 // Hit testing for a point outside the layer should return a null pointer. 806 // Hit testing for a point outside the layer should return a null pointer.
807 gfx::Point test_point(69, 69); 807 gfx::Point test_point(69, 69);
808 LayerImpl* result_layer = 808 LayerImpl* result_layer =
809 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 809 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 root->AddChild(child1.Pass()); 897 root->AddChild(child1.Pass());
898 root->AddChild(child2.Pass()); 898 root->AddChild(child2.Pass());
899 } 899 }
900 900
901 LayerImpl* child1 = root->children()[0]; 901 LayerImpl* child1 = root->children()[0];
902 LayerImpl* child2 = root->children()[1]; 902 LayerImpl* child2 = root->children()[1];
903 LayerImpl* grand_child1 = child1->children()[0]; 903 LayerImpl* grand_child1 = child1->children()[0];
904 904
905 host_impl().SetViewportSize(root->bounds()); 905 host_impl().SetViewportSize(root->bounds());
906 host_impl().active_tree()->SetRootLayer(root.Pass()); 906 host_impl().active_tree()->SetRootLayer(root.Pass());
907 host_impl().active_tree()->UpdateDrawProperties(); 907 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
908 908
909 // Sanity check the scenario we just created. 909 // Sanity check the scenario we just created.
910 ASSERT_TRUE(child1); 910 ASSERT_TRUE(child1);
911 ASSERT_TRUE(child2); 911 ASSERT_TRUE(child2);
912 ASSERT_TRUE(grand_child1); 912 ASSERT_TRUE(grand_child1);
913 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 913 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
914 914
915 RenderSurfaceImpl* root_render_surface = root_layer()->render_surface(); 915 RenderSurfaceImpl* root_render_surface = root_layer()->render_surface();
916 ASSERT_EQ(4u, root_render_surface->layer_list().size()); 916 ASSERT_EQ(4u, root_render_surface->layer_list().size());
917 ASSERT_EQ(1, root_render_surface->layer_list().at(0)->id()); // root layer 917 ASSERT_EQ(1, root_render_surface->layer_list().at(0)->id()); // root layer
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 root->AddChild(child1.Pass()); 1045 root->AddChild(child1.Pass());
1046 root->AddChild(child2.Pass()); 1046 root->AddChild(child2.Pass());
1047 } 1047 }
1048 1048
1049 LayerImpl* child1 = root->children()[0]; 1049 LayerImpl* child1 = root->children()[0];
1050 LayerImpl* child2 = root->children()[1]; 1050 LayerImpl* child2 = root->children()[1];
1051 LayerImpl* grand_child1 = child1->children()[0]; 1051 LayerImpl* grand_child1 = child1->children()[0];
1052 1052
1053 host_impl().SetViewportSize(root->bounds()); 1053 host_impl().SetViewportSize(root->bounds());
1054 host_impl().active_tree()->SetRootLayer(root.Pass()); 1054 host_impl().active_tree()->SetRootLayer(root.Pass());
1055 host_impl().active_tree()->UpdateDrawProperties(); 1055 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1056 1056
1057 // Sanity check the scenario we just created. 1057 // Sanity check the scenario we just created.
1058 ASSERT_TRUE(child1); 1058 ASSERT_TRUE(child1);
1059 ASSERT_TRUE(child2); 1059 ASSERT_TRUE(child2);
1060 ASSERT_TRUE(grand_child1); 1060 ASSERT_TRUE(grand_child1);
1061 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1061 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1062 1062
1063 RenderSurfaceImpl* root_render_surface = 1063 RenderSurfaceImpl* root_render_surface =
1064 host_impl().active_tree()->root_layer()->render_surface(); 1064 host_impl().active_tree()->root_layer()->render_surface();
1065 ASSERT_EQ(4u, root_render_surface->layer_list().size()); 1065 ASSERT_EQ(4u, root_render_surface->layer_list().size());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 1163
1164 // This should let |grand_child| "escape" |child|'s clip. 1164 // This should let |grand_child| "escape" |child|'s clip.
1165 grand_child->SetClipParent(root.get()); 1165 grand_child->SetClipParent(root.get());
1166 1166
1167 child->AddChild(grand_child.Pass()); 1167 child->AddChild(grand_child.Pass());
1168 root->AddChild(child.Pass()); 1168 root->AddChild(child.Pass());
1169 } 1169 }
1170 1170
1171 host_impl().SetViewportSize(root->bounds()); 1171 host_impl().SetViewportSize(root->bounds());
1172 host_impl().active_tree()->SetRootLayer(root.Pass()); 1172 host_impl().active_tree()->SetRootLayer(root.Pass());
1173 host_impl().active_tree()->UpdateDrawProperties(); 1173 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1174 1174
1175 gfx::Point test_point = gfx::Point(12, 52); 1175 gfx::Point test_point = gfx::Point(12, 52);
1176 LayerImpl* result_layer = 1176 LayerImpl* result_layer =
1177 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 1177 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
1178 ASSERT_TRUE(result_layer); 1178 ASSERT_TRUE(result_layer);
1179 EXPECT_EQ(4, result_layer->id()); 1179 EXPECT_EQ(4, result_layer->id());
1180 } 1180 }
1181 1181
1182 TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) { 1182 TEST_F(LayerTreeImplTest, HitTestingRespectsScrollParents) {
1183 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 1183 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 grand_child->SetDrawsContent(true); 1238 grand_child->SetDrawsContent(true);
1239 grand_child->SetForceRenderSurface(true); 1239 grand_child->SetForceRenderSurface(true);
1240 1240
1241 scroll_child->AddChild(grand_child.Pass()); 1241 scroll_child->AddChild(grand_child.Pass());
1242 root->AddChild(scroll_child.Pass()); 1242 root->AddChild(scroll_child.Pass());
1243 root->AddChild(child.Pass()); 1243 root->AddChild(child.Pass());
1244 } 1244 }
1245 1245
1246 host_impl().SetViewportSize(root->bounds()); 1246 host_impl().SetViewportSize(root->bounds());
1247 host_impl().active_tree()->SetRootLayer(root.Pass()); 1247 host_impl().active_tree()->SetRootLayer(root.Pass());
1248 host_impl().active_tree()->UpdateDrawProperties(); 1248 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1249 1249
1250 gfx::Point test_point = gfx::Point(12, 52); 1250 gfx::Point test_point = gfx::Point(12, 52);
1251 LayerImpl* result_layer = 1251 LayerImpl* result_layer =
1252 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); 1252 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point);
1253 // The |test_point| should have been clipped away by |child|, the scroll 1253 // The |test_point| should have been clipped away by |child|, the scroll
1254 // parent, so the only thing that should be hit is |root|. 1254 // parent, so the only thing that should be hit is |root|.
1255 ASSERT_TRUE(result_layer); 1255 ASSERT_TRUE(result_layer);
1256 ASSERT_EQ(1, result_layer->id()); 1256 ASSERT_EQ(1, result_layer->id());
1257 } 1257 }
1258 TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) { 1258 TEST_F(LayerTreeImplTest, HitTestingForMultipleLayerLists) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 root->AddChild(child1.Pass()); 1331 root->AddChild(child1.Pass());
1332 root->AddChild(child2.Pass()); 1332 root->AddChild(child2.Pass());
1333 } 1333 }
1334 1334
1335 LayerImpl* child1 = root->children()[0]; 1335 LayerImpl* child1 = root->children()[0];
1336 LayerImpl* child2 = root->children()[1]; 1336 LayerImpl* child2 = root->children()[1];
1337 LayerImpl* grand_child1 = child1->children()[0]; 1337 LayerImpl* grand_child1 = child1->children()[0];
1338 1338
1339 host_impl().SetViewportSize(root->bounds()); 1339 host_impl().SetViewportSize(root->bounds());
1340 host_impl().active_tree()->SetRootLayer(root.Pass()); 1340 host_impl().active_tree()->SetRootLayer(root.Pass());
1341 host_impl().active_tree()->UpdateDrawProperties(); 1341 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1342 1342
1343 // Sanity check the scenario we just created. 1343 // Sanity check the scenario we just created.
1344 ASSERT_TRUE(child1); 1344 ASSERT_TRUE(child1);
1345 ASSERT_TRUE(child2); 1345 ASSERT_TRUE(child2);
1346 ASSERT_TRUE(grand_child1); 1346 ASSERT_TRUE(grand_child1);
1347 ASSERT_TRUE(child1->render_surface()); 1347 ASSERT_TRUE(child1->render_surface());
1348 ASSERT_TRUE(child2->render_surface()); 1348 ASSERT_TRUE(child2->render_surface());
1349 ASSERT_TRUE(grand_child1->render_surface()); 1349 ASSERT_TRUE(grand_child1->render_surface());
1350 ASSERT_EQ(4u, RenderSurfaceLayerList().size()); 1350 ASSERT_EQ(4u, RenderSurfaceLayerList().size());
1351 // The root surface has the root layer, and child1's and child2's render 1351 // The root surface has the root layer, and child1's and child2's render
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1421 identity_matrix, 1421 identity_matrix,
1422 transform_origin, 1422 transform_origin,
1423 position, 1423 position,
1424 bounds, 1424 bounds,
1425 true, 1425 true,
1426 false); 1426 false);
1427 root->SetDrawsContent(true); 1427 root->SetDrawsContent(true);
1428 1428
1429 host_impl().SetViewportSize(root->bounds()); 1429 host_impl().SetViewportSize(root->bounds());
1430 host_impl().active_tree()->SetRootLayer(root.Pass()); 1430 host_impl().active_tree()->SetRootLayer(root.Pass());
1431 host_impl().active_tree()->UpdateDrawProperties(); 1431 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1432 1432
1433 // Sanity check the scenario we just created. 1433 // Sanity check the scenario we just created.
1434 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1434 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1435 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1435 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1436 1436
1437 // Hit checking for any point should return a null pointer for a layer without 1437 // Hit checking for any point should return a null pointer for a layer without
1438 // any touch event handler regions. 1438 // any touch event handler regions.
1439 gfx::Point test_point(11, 11); 1439 gfx::Point test_point(11, 11);
1440 LayerImpl* result_layer = 1440 LayerImpl* result_layer =
1441 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion( 1441 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 transform_origin, 1510 transform_origin,
1511 position, 1511 position,
1512 bounds, 1512 bounds,
1513 true, 1513 true,
1514 false); 1514 false);
1515 root->SetDrawsContent(true); 1515 root->SetDrawsContent(true);
1516 root->SetTouchEventHandlerRegion(touch_handler_region); 1516 root->SetTouchEventHandlerRegion(touch_handler_region);
1517 1517
1518 host_impl().SetViewportSize(root->bounds()); 1518 host_impl().SetViewportSize(root->bounds());
1519 host_impl().active_tree()->SetRootLayer(root.Pass()); 1519 host_impl().active_tree()->SetRootLayer(root.Pass());
1520 host_impl().active_tree()->UpdateDrawProperties(); 1520 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1521 1521
1522 // Sanity check the scenario we just created. 1522 // Sanity check the scenario we just created.
1523 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1523 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1524 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1524 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1525 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); 1525 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible());
1526 1526
1527 // Hit checking any point should not hit the touch handler region on the 1527 // Hit checking any point should not hit the touch handler region on the
1528 // layer. If the invertible matrix is accidentally ignored and treated like an 1528 // layer. If the invertible matrix is accidentally ignored and treated like an
1529 // identity, then the hit testing will incorrectly hit the layer when it 1529 // identity, then the hit testing will incorrectly hit the layer when it
1530 // shouldn't. 1530 // shouldn't.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 transform_origin, 1588 transform_origin,
1589 position, 1589 position,
1590 bounds, 1590 bounds,
1591 true, 1591 true,
1592 false); 1592 false);
1593 root->SetDrawsContent(true); 1593 root->SetDrawsContent(true);
1594 root->SetTouchEventHandlerRegion(touch_handler_region); 1594 root->SetTouchEventHandlerRegion(touch_handler_region);
1595 1595
1596 host_impl().SetViewportSize(root->bounds()); 1596 host_impl().SetViewportSize(root->bounds());
1597 host_impl().active_tree()->SetRootLayer(root.Pass()); 1597 host_impl().active_tree()->SetRootLayer(root.Pass());
1598 host_impl().active_tree()->UpdateDrawProperties(); 1598 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1599 1599
1600 // Sanity check the scenario we just created. 1600 // Sanity check the scenario we just created.
1601 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1601 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1602 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1602 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1603 1603
1604 // Hit checking for a point outside the layer should return a null pointer. 1604 // Hit checking for a point outside the layer should return a null pointer.
1605 gfx::Point test_point(49, 49); 1605 gfx::Point test_point(49, 49);
1606 LayerImpl* result_layer = 1606 LayerImpl* result_layer =
1607 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion( 1607 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
1608 test_point); 1608 test_point);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 test_layer->SetContentBounds(gfx::Size(100, 100)); 1684 test_layer->SetContentBounds(gfx::Size(100, 100));
1685 test_layer->SetContentsScale(2, 2); 1685 test_layer->SetContentsScale(2, 2);
1686 1686
1687 test_layer->SetDrawsContent(true); 1687 test_layer->SetDrawsContent(true);
1688 test_layer->SetTouchEventHandlerRegion(touch_handler_region); 1688 test_layer->SetTouchEventHandlerRegion(touch_handler_region);
1689 root->AddChild(test_layer.Pass()); 1689 root->AddChild(test_layer.Pass());
1690 } 1690 }
1691 1691
1692 host_impl().SetViewportSize(root->bounds()); 1692 host_impl().SetViewportSize(root->bounds());
1693 host_impl().active_tree()->SetRootLayer(root.Pass()); 1693 host_impl().active_tree()->SetRootLayer(root.Pass());
1694 host_impl().active_tree()->UpdateDrawProperties(); 1694 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1695 1695
1696 // Sanity check the scenario we just created. 1696 // Sanity check the scenario we just created.
1697 // The visible content rect for test_layer is actually 100x100, even though 1697 // The visible content rect for test_layer is actually 100x100, even though
1698 // its layout size is 50x50, positioned at 25x25. 1698 // its layout size is 50x50, positioned at 25x25.
1699 LayerImpl* test_layer = 1699 LayerImpl* test_layer =
1700 host_impl().active_tree()->root_layer()->children()[0]; 1700 host_impl().active_tree()->root_layer()->children()[0];
1701 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect()); 1701 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), test_layer->visible_content_rect());
1702 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1702 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1703 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1703 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1704 1704
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 float page_scale_factor = 5.f; 1793 float page_scale_factor = 5.f;
1794 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( 1794 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize(
1795 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); 1795 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor));
1796 host_impl().SetViewportSize(scaled_bounds_for_root); 1796 host_impl().SetViewportSize(scaled_bounds_for_root);
1797 1797
1798 host_impl().SetDeviceScaleFactor(device_scale_factor); 1798 host_impl().SetDeviceScaleFactor(device_scale_factor);
1799 host_impl().active_tree()->SetPageScaleFactorAndLimits( 1799 host_impl().active_tree()->SetPageScaleFactorAndLimits(
1800 page_scale_factor, page_scale_factor, page_scale_factor); 1800 page_scale_factor, page_scale_factor, page_scale_factor);
1801 host_impl().active_tree()->SetRootLayer(root.Pass()); 1801 host_impl().active_tree()->SetRootLayer(root.Pass());
1802 host_impl().active_tree()->SetViewportLayersFromIds(1, 1, Layer::INVALID_ID); 1802 host_impl().active_tree()->SetViewportLayersFromIds(1, 1, Layer::INVALID_ID);
1803 host_impl().active_tree()->UpdateDrawProperties(); 1803 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1804 1804
1805 // Sanity check the scenario we just created. 1805 // Sanity check the scenario we just created.
1806 // The visible content rect for test_layer is actually 100x100, even though 1806 // The visible content rect for test_layer is actually 100x100, even though
1807 // its layout size is 50x50, positioned at 25x25. 1807 // its layout size is 50x50, positioned at 25x25.
1808 LayerImpl* test_layer = 1808 LayerImpl* test_layer =
1809 host_impl().active_tree()->root_layer()->children()[0]; 1809 host_impl().active_tree()->root_layer()->children()[0];
1810 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1810 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1811 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1811 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1812 1812
1813 // Check whether the child layer fits into the root after scaled. 1813 // Check whether the child layer fits into the root after scaled.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 true, 1923 true,
1924 false); 1924 false);
1925 child->SetDrawsContent(true); 1925 child->SetDrawsContent(true);
1926 child->SetTouchEventHandlerRegion(touch_handler_region); 1926 child->SetTouchEventHandlerRegion(touch_handler_region);
1927 clipping_layer->AddChild(child.Pass()); 1927 clipping_layer->AddChild(child.Pass());
1928 root->AddChild(clipping_layer.Pass()); 1928 root->AddChild(clipping_layer.Pass());
1929 } 1929 }
1930 1930
1931 host_impl().SetViewportSize(root->bounds()); 1931 host_impl().SetViewportSize(root->bounds());
1932 host_impl().active_tree()->SetRootLayer(root.Pass()); 1932 host_impl().active_tree()->SetRootLayer(root.Pass());
1933 host_impl().active_tree()->UpdateDrawProperties(); 1933 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
1934 1934
1935 // Sanity check the scenario we just created. 1935 // Sanity check the scenario we just created.
1936 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 1936 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
1937 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 1937 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
1938 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id()); 1938 ASSERT_EQ(456, root_layer()->render_surface()->layer_list().at(0)->id());
1939 1939
1940 // Hit checking for a point outside the layer should return a null pointer. 1940 // Hit checking for a point outside the layer should return a null pointer.
1941 // Despite the child layer being very large, it should be clipped to the root 1941 // Despite the child layer being very large, it should be clipped to the root
1942 // layer's bounds. 1942 // layer's bounds.
1943 gfx::Point test_point(24, 24); 1943 gfx::Point test_point(24, 24);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 position, 2021 position,
2022 bounds, 2022 bounds,
2023 true, 2023 true,
2024 false); 2024 false);
2025 notouch_layer->SetDrawsContent(true); 2025 notouch_layer->SetDrawsContent(true);
2026 root->AddChild(notouch_layer.Pass()); 2026 root->AddChild(notouch_layer.Pass());
2027 } 2027 }
2028 2028
2029 host_impl().SetViewportSize(root->bounds()); 2029 host_impl().SetViewportSize(root->bounds());
2030 host_impl().active_tree()->SetRootLayer(root.Pass()); 2030 host_impl().active_tree()->SetRootLayer(root.Pass());
2031 host_impl().active_tree()->UpdateDrawProperties(); 2031 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2032 2032
2033 // Sanity check the scenario we just created. 2033 // Sanity check the scenario we just created.
2034 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2034 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
2035 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size()); 2035 ASSERT_EQ(2u, root_layer()->render_surface()->layer_list().size());
2036 ASSERT_EQ(123, root_layer()->render_surface()->layer_list().at(0)->id()); 2036 ASSERT_EQ(123, root_layer()->render_surface()->layer_list().at(0)->id());
2037 ASSERT_EQ(1234, root_layer()->render_surface()->layer_list().at(1)->id()); 2037 ASSERT_EQ(1234, root_layer()->render_surface()->layer_list().at(1)->id());
2038 2038
2039 gfx::Point test_point(35, 35); 2039 gfx::Point test_point(35, 35);
2040 LayerImpl* result_layer = 2040 LayerImpl* result_layer =
2041 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion( 2041 host_impl().active_tree()->FindLayerThatIsHitByPointInTouchHandlerRegion(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 identity_matrix, 2083 identity_matrix,
2084 transform_origin, 2084 transform_origin,
2085 position, 2085 position,
2086 bounds, 2086 bounds,
2087 true, 2087 true,
2088 false); 2088 false);
2089 root->SetDrawsContent(true); 2089 root->SetDrawsContent(true);
2090 2090
2091 host_impl().SetViewportSize(root->bounds()); 2091 host_impl().SetViewportSize(root->bounds());
2092 host_impl().active_tree()->SetRootLayer(root.Pass()); 2092 host_impl().active_tree()->SetRootLayer(root.Pass());
2093 host_impl().active_tree()->UpdateDrawProperties(); 2093 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2094 2094
2095 // Sanity check the scenario we just created. 2095 // Sanity check the scenario we just created.
2096 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2096 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
2097 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); 2097 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size());
2098 2098
2099 LayerSelectionBound left_input; 2099 LayerSelectionBound left_input;
2100 left_input.type = SELECTION_BOUND_LEFT; 2100 left_input.type = SELECTION_BOUND_LEFT;
2101 left_input.layer_rect = gfx::RectF(10, 10, 5, 20); 2101 left_input.layer_rect = gfx::RectF(10, 10, 5, 20);
2102 left_input.layer_id = root_layer_id; 2102 left_input.layer_id = root_layer_id;
2103 2103
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 bounds, 2184 bounds,
2185 true, 2185 true,
2186 false); 2186 false);
2187 clipped_layer->SetDrawsContent(true); 2187 clipped_layer->SetDrawsContent(true);
2188 clipping_layer->AddChild(clipped_layer.Pass()); 2188 clipping_layer->AddChild(clipped_layer.Pass());
2189 root->AddChild(clipping_layer.Pass()); 2189 root->AddChild(clipping_layer.Pass());
2190 } 2190 }
2191 2191
2192 host_impl().SetViewportSize(root->bounds()); 2192 host_impl().SetViewportSize(root->bounds());
2193 host_impl().active_tree()->SetRootLayer(root.Pass()); 2193 host_impl().active_tree()->SetRootLayer(root.Pass());
2194 host_impl().active_tree()->UpdateDrawProperties(); 2194 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2195 2195
2196 // Sanity check the scenario we just created. 2196 // Sanity check the scenario we just created.
2197 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2197 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
2198 2198
2199 LayerSelectionBound left_input; 2199 LayerSelectionBound left_input;
2200 left_input.type = SELECTION_BOUND_LEFT; 2200 left_input.type = SELECTION_BOUND_LEFT;
2201 left_input.layer_rect = gfx::RectF(25, 10, 5, 20); 2201 left_input.layer_rect = gfx::RectF(25, 10, 5, 20);
2202 left_input.layer_id = clipped_layer_id; 2202 left_input.layer_id = clipped_layer_id;
2203 2203
2204 LayerSelectionBound right_input; 2204 LayerSelectionBound right_input;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 float page_scale_factor = 5.f; 2279 float page_scale_factor = 5.f;
2280 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize( 2280 gfx::Size scaled_bounds_for_root = gfx::ToCeiledSize(
2281 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor)); 2281 gfx::ScaleSize(root->bounds(), device_scale_factor * page_scale_factor));
2282 host_impl().SetViewportSize(scaled_bounds_for_root); 2282 host_impl().SetViewportSize(scaled_bounds_for_root);
2283 2283
2284 host_impl().SetDeviceScaleFactor(device_scale_factor); 2284 host_impl().SetDeviceScaleFactor(device_scale_factor);
2285 host_impl().active_tree()->SetPageScaleFactorAndLimits( 2285 host_impl().active_tree()->SetPageScaleFactorAndLimits(
2286 page_scale_factor, page_scale_factor, page_scale_factor); 2286 page_scale_factor, page_scale_factor, page_scale_factor);
2287 host_impl().active_tree()->SetRootLayer(root.Pass()); 2287 host_impl().active_tree()->SetRootLayer(root.Pass());
2288 host_impl().active_tree()->SetViewportLayersFromIds(1, 1, Layer::INVALID_ID); 2288 host_impl().active_tree()->SetViewportLayersFromIds(1, 1, Layer::INVALID_ID);
2289 host_impl().active_tree()->UpdateDrawProperties(); 2289 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
2290 2290
2291 // Sanity check the scenario we just created. 2291 // Sanity check the scenario we just created.
2292 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); 2292 ASSERT_EQ(1u, RenderSurfaceLayerList().size());
2293 2293
2294 LayerSelectionBound left_input; 2294 LayerSelectionBound left_input;
2295 left_input.type = SELECTION_BOUND_LEFT; 2295 left_input.type = SELECTION_BOUND_LEFT;
2296 left_input.layer_rect = gfx::RectF(10, 10, 5, 20); 2296 left_input.layer_rect = gfx::RectF(10, 10, 5, 20);
2297 left_input.layer_id = root_layer_id; 2297 left_input.layer_id = root_layer_id;
2298 2298
2299 LayerSelectionBound right_input; 2299 LayerSelectionBound right_input;
(...skipping 29 matching lines...) Expand all
2329 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); 2329 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers());
2330 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); 2330 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
2331 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); 2331 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2));
2332 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); 2332 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3));
2333 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); 2333 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4));
2334 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); 2334 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
2335 } 2335 }
2336 2336
2337 } // namespace 2337 } // namespace
2338 } // namespace cc 2338 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698