Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "cc/layers/heads_up_display_layer_impl.h" | 7 #include "cc/layers/heads_up_display_layer_impl.h" |
| 8 #include "cc/layers/layer.h" | 8 #include "cc/layers/layer.h" |
| 9 #include "cc/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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 gfx::Transform identity_matrix; | 50 gfx::Transform identity_matrix; |
| 51 gfx::Point3F transform_origin; | 51 gfx::Point3F transform_origin; |
| 52 gfx::PointF position; | 52 gfx::PointF position; |
| 53 gfx::Size bounds(100, 100); | 53 gfx::Size bounds(100, 100); |
| 54 SetLayerPropertiesForTesting(root.get(), | 54 SetLayerPropertiesForTesting(root.get(), |
| 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 true); | |
| 61 root->SetDrawsContent(true); | 62 root->SetDrawsContent(true); |
| 62 | 63 |
| 63 host_impl().SetViewportSize(root->bounds()); | 64 host_impl().SetViewportSize(root->bounds()); |
| 64 host_impl().active_tree()->SetRootLayer(root.Pass()); | 65 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 65 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 66 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 66 | 67 |
| 67 // Sanity check the scenario we just created. | 68 // Sanity check the scenario we just created. |
| 68 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 69 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 69 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 70 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 70 | 71 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 gfx::Transform identity_matrix; | 103 gfx::Transform identity_matrix; |
| 103 gfx::Point3F transform_origin; | 104 gfx::Point3F transform_origin; |
| 104 gfx::PointF position; | 105 gfx::PointF position; |
| 105 gfx::Size bounds(100, 100); | 106 gfx::Size bounds(100, 100); |
| 106 SetLayerPropertiesForTesting(root.get(), | 107 SetLayerPropertiesForTesting(root.get(), |
| 107 identity_matrix, | 108 identity_matrix, |
| 108 transform_origin, | 109 transform_origin, |
| 109 position, | 110 position, |
| 110 bounds, | 111 bounds, |
| 111 true, | 112 true, |
| 112 false); | 113 false, |
| 114 true); | |
| 113 root->SetDrawsContent(true); | 115 root->SetDrawsContent(true); |
| 114 | 116 |
| 115 // Create hud and add it as a child of root. | 117 // Create hud and add it as a child of root. |
| 116 gfx::Size hud_bounds(200, 200); | 118 gfx::Size hud_bounds(200, 200); |
| 117 SetLayerPropertiesForTesting(hud.get(), | 119 SetLayerPropertiesForTesting(hud.get(), |
| 118 identity_matrix, | 120 identity_matrix, |
| 119 transform_origin, | 121 transform_origin, |
| 120 position, | 122 position, |
| 121 hud_bounds, | 123 hud_bounds, |
| 122 true, | 124 true, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 gfx::Transform identity_matrix; | 176 gfx::Transform identity_matrix; |
| 175 gfx::Point3F transform_origin; | 177 gfx::Point3F transform_origin; |
| 176 gfx::PointF position; | 178 gfx::PointF position; |
| 177 gfx::Size bounds(100, 100); | 179 gfx::Size bounds(100, 100); |
| 178 SetLayerPropertiesForTesting(root.get(), | 180 SetLayerPropertiesForTesting(root.get(), |
| 179 uninvertible_transform, | 181 uninvertible_transform, |
| 180 transform_origin, | 182 transform_origin, |
| 181 position, | 183 position, |
| 182 bounds, | 184 bounds, |
| 183 true, | 185 true, |
| 184 false); | 186 false, |
| 187 true); | |
| 185 root->SetDrawsContent(true); | 188 root->SetDrawsContent(true); |
| 186 | 189 |
| 187 host_impl().SetViewportSize(root->bounds()); | 190 host_impl().SetViewportSize(root->bounds()); |
| 188 host_impl().active_tree()->SetRootLayer(root.Pass()); | 191 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 189 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 192 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 190 // Sanity check the scenario we just created. | 193 // Sanity check the scenario we just created. |
| 191 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 194 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 192 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 195 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 193 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); | 196 ASSERT_FALSE(root_layer()->screen_space_transform().IsInvertible()); |
| 194 | 197 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 // this layer is positioned, and hit testing should correctly know where the | 243 // this layer is positioned, and hit testing should correctly know where the |
| 241 // layer is located. | 244 // layer is located. |
| 242 gfx::PointF position(50.f, 50.f); | 245 gfx::PointF position(50.f, 50.f); |
| 243 gfx::Size bounds(100, 100); | 246 gfx::Size bounds(100, 100); |
| 244 SetLayerPropertiesForTesting(root.get(), | 247 SetLayerPropertiesForTesting(root.get(), |
| 245 identity_matrix, | 248 identity_matrix, |
| 246 transform_origin, | 249 transform_origin, |
| 247 position, | 250 position, |
| 248 bounds, | 251 bounds, |
| 249 true, | 252 true, |
| 250 false); | 253 false, |
| 254 true); | |
| 251 root->SetDrawsContent(true); | 255 root->SetDrawsContent(true); |
| 252 | 256 |
| 253 host_impl().SetViewportSize(root->bounds()); | 257 host_impl().SetViewportSize(root->bounds()); |
| 254 host_impl().active_tree()->SetRootLayer(root.Pass()); | 258 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 255 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 259 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 256 | 260 |
| 257 // Sanity check the scenario we just created. | 261 // Sanity check the scenario we just created. |
| 258 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 262 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 259 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 263 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 260 | 264 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 rotation45_degrees_about_center.Translate(-50.0, -50.0); | 300 rotation45_degrees_about_center.Translate(-50.0, -50.0); |
| 297 gfx::Point3F transform_origin; | 301 gfx::Point3F transform_origin; |
| 298 gfx::PointF position; | 302 gfx::PointF position; |
| 299 gfx::Size bounds(100, 100); | 303 gfx::Size bounds(100, 100); |
| 300 SetLayerPropertiesForTesting(root.get(), | 304 SetLayerPropertiesForTesting(root.get(), |
| 301 rotation45_degrees_about_center, | 305 rotation45_degrees_about_center, |
| 302 transform_origin, | 306 transform_origin, |
| 303 position, | 307 position, |
| 304 bounds, | 308 bounds, |
| 305 true, | 309 true, |
| 306 false); | 310 false, |
| 311 true); | |
| 307 root->SetDrawsContent(true); | 312 root->SetDrawsContent(true); |
| 308 | 313 |
| 309 host_impl().SetViewportSize(root->bounds()); | 314 host_impl().SetViewportSize(root->bounds()); |
| 310 host_impl().active_tree()->SetRootLayer(root.Pass()); | 315 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 311 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 316 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 312 | 317 |
| 313 // Sanity check the scenario we just created. | 318 // Sanity check the scenario we just created. |
| 314 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 319 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 315 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 320 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 316 | 321 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 gfx::Point3F transform_origin; | 370 gfx::Point3F transform_origin; |
| 366 gfx::PointF position; | 371 gfx::PointF position; |
| 367 gfx::Size bounds(100, 100); | 372 gfx::Size bounds(100, 100); |
| 368 SetLayerPropertiesForTesting( | 373 SetLayerPropertiesForTesting( |
| 369 root.get(), | 374 root.get(), |
| 370 perspective_projection_about_center * translation_by_z, | 375 perspective_projection_about_center * translation_by_z, |
| 371 transform_origin, | 376 transform_origin, |
| 372 position, | 377 position, |
| 373 bounds, | 378 bounds, |
| 374 true, | 379 true, |
| 375 false); | 380 false, |
| 381 true); | |
| 376 root->SetDrawsContent(true); | 382 root->SetDrawsContent(true); |
| 377 | 383 |
| 378 host_impl().SetViewportSize(root->bounds()); | 384 host_impl().SetViewportSize(root->bounds()); |
| 379 host_impl().active_tree()->SetRootLayer(root.Pass()); | 385 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 380 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 386 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 381 | 387 |
| 382 // Sanity check the scenario we just created. | 388 // Sanity check the scenario we just created. |
| 383 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 389 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 384 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 390 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 385 | 391 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 | 432 |
| 427 gfx::Transform identity_matrix; | 433 gfx::Transform identity_matrix; |
| 428 gfx::Point3F transform_origin; | 434 gfx::Point3F transform_origin; |
| 429 | 435 |
| 430 SetLayerPropertiesForTesting(root.get(), | 436 SetLayerPropertiesForTesting(root.get(), |
| 431 identity_matrix, | 437 identity_matrix, |
| 432 transform_origin, | 438 transform_origin, |
| 433 gfx::PointF(), | 439 gfx::PointF(), |
| 434 gfx::Size(100, 100), | 440 gfx::Size(100, 100), |
| 435 true, | 441 true, |
| 436 false); | 442 false, |
| 443 true); | |
| 437 { | 444 { |
| 438 gfx::PointF position(25.f, 25.f); | 445 gfx::PointF position(25.f, 25.f); |
| 439 gfx::Size bounds(50, 50); | 446 gfx::Size bounds(50, 50); |
| 440 scoped_ptr<LayerImpl> test_layer = | 447 scoped_ptr<LayerImpl> test_layer = |
| 441 LayerImpl::Create(host_impl().active_tree(), 12345); | 448 LayerImpl::Create(host_impl().active_tree(), 12345); |
| 442 SetLayerPropertiesForTesting(test_layer.get(), | 449 SetLayerPropertiesForTesting(test_layer.get(), |
| 443 identity_matrix, | 450 identity_matrix, |
| 444 transform_origin, | 451 transform_origin, |
| 445 position, | 452 position, |
| 446 bounds, | 453 bounds, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 gfx::Transform identity_matrix; | 513 gfx::Transform identity_matrix; |
| 507 gfx::Point3F transform_origin; | 514 gfx::Point3F transform_origin; |
| 508 | 515 |
| 509 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 516 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
| 510 SetLayerPropertiesForTesting(root.get(), | 517 SetLayerPropertiesForTesting(root.get(), |
| 511 identity_matrix, | 518 identity_matrix, |
| 512 transform_origin, | 519 transform_origin, |
| 513 gfx::PointF(), | 520 gfx::PointF(), |
| 514 gfx::Size(100, 100), | 521 gfx::Size(100, 100), |
| 515 true, | 522 true, |
| 516 false); | 523 false, |
| 524 true); | |
| 517 { | 525 { |
| 518 scoped_ptr<LayerImpl> clipping_layer = | 526 scoped_ptr<LayerImpl> clipping_layer = |
| 519 LayerImpl::Create(host_impl().active_tree(), 123); | 527 LayerImpl::Create(host_impl().active_tree(), 123); |
| 520 // this layer is positioned, and hit testing should correctly know where the | 528 // this layer is positioned, and hit testing should correctly know where the |
| 521 // layer is located. | 529 // layer is located. |
| 522 gfx::PointF position(25.f, 25.f); | 530 gfx::PointF position(25.f, 25.f); |
| 523 gfx::Size bounds(50, 50); | 531 gfx::Size bounds(50, 50); |
| 524 SetLayerPropertiesForTesting(clipping_layer.get(), | 532 SetLayerPropertiesForTesting(clipping_layer.get(), |
| 525 identity_matrix, | 533 identity_matrix, |
| 526 transform_origin, | 534 transform_origin, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 gfx::Transform identity_matrix; | 609 gfx::Transform identity_matrix; |
| 602 gfx::Point3F transform_origin; | 610 gfx::Point3F transform_origin; |
| 603 gfx::PointF position; | 611 gfx::PointF position; |
| 604 gfx::Size bounds(100, 100); | 612 gfx::Size bounds(100, 100); |
| 605 SetLayerPropertiesForTesting(root.get(), | 613 SetLayerPropertiesForTesting(root.get(), |
| 606 identity_matrix, | 614 identity_matrix, |
| 607 transform_origin, | 615 transform_origin, |
| 608 position, | 616 position, |
| 609 bounds, | 617 bounds, |
| 610 true, | 618 true, |
| 611 false); | 619 false, |
| 620 true); | |
| 612 root->SetMasksToBounds(true); | 621 root->SetMasksToBounds(true); |
| 613 { | 622 { |
| 614 scoped_ptr<LayerImpl> child = | 623 scoped_ptr<LayerImpl> child = |
| 615 LayerImpl::Create(host_impl().active_tree(), 456); | 624 LayerImpl::Create(host_impl().active_tree(), 456); |
| 616 scoped_ptr<LayerImpl> grand_child = | 625 scoped_ptr<LayerImpl> grand_child = |
| 617 LayerImpl::Create(host_impl().active_tree(), 789); | 626 LayerImpl::Create(host_impl().active_tree(), 789); |
| 618 scoped_ptr<LayerImpl> rotated_leaf = | 627 scoped_ptr<LayerImpl> rotated_leaf = |
| 619 LayerImpl::Create(host_impl().active_tree(), 2468); | 628 LayerImpl::Create(host_impl().active_tree(), 2468); |
| 620 | 629 |
| 621 position = gfx::PointF(10.f, 10.f); | 630 position = gfx::PointF(10.f, 10.f); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 667 rotated_leaf->SetDrawsContent(true); | 676 rotated_leaf->SetDrawsContent(true); |
| 668 | 677 |
| 669 grand_child->AddChild(rotated_leaf.Pass()); | 678 grand_child->AddChild(rotated_leaf.Pass()); |
| 670 child->AddChild(grand_child.Pass()); | 679 child->AddChild(grand_child.Pass()); |
| 671 root->AddChild(child.Pass()); | 680 root->AddChild(child.Pass()); |
| 672 } | 681 } |
| 673 | 682 |
| 674 host_impl().SetViewportSize(root->bounds()); | 683 host_impl().SetViewportSize(root->bounds()); |
| 675 host_impl().active_tree()->SetRootLayer(root.Pass()); | 684 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 676 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 685 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 677 | 686 |
|
awoloszyn
2014/08/25 21:03:44
This will move to the RenderSurface creation tests
| |
| 678 // Sanity check the scenario we just created. | |
| 679 // The grand_child is expected to create a render surface because it | |
| 680 // MasksToBounds and is not axis aligned. | |
| 681 ASSERT_EQ(2u, RenderSurfaceLayerList().size()); | |
| 682 ASSERT_EQ( | |
| 683 1u, | |
| 684 RenderSurfaceLayerList().at(0)->render_surface()->layer_list().size()); | |
| 685 ASSERT_EQ(789, | |
| 686 RenderSurfaceLayerList() | |
| 687 .at(0) | |
| 688 ->render_surface() | |
| 689 ->layer_list() | |
| 690 .at(0) | |
| 691 ->id()); // grand_child's surface. | |
| 692 ASSERT_EQ( | |
| 693 1u, | |
| 694 RenderSurfaceLayerList().at(1)->render_surface()->layer_list().size()); | |
| 695 ASSERT_EQ( | |
| 696 2468, | |
| 697 RenderSurfaceLayerList()[1]->render_surface()->layer_list().at(0)->id()); | |
| 698 | |
| 699 // (11, 89) is close to the the bottom left corner within the clip, but it is | 687 // (11, 89) is close to the the bottom left corner within the clip, but it is |
| 700 // not inside the layer. | 688 // not inside the layer. |
| 701 gfx::Point test_point(11, 89); | 689 gfx::Point test_point(11, 89); |
| 702 LayerImpl* result_layer = | 690 LayerImpl* result_layer = |
| 703 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); | 691 host_impl().active_tree()->FindLayerThatIsHitByPoint(test_point); |
| 704 EXPECT_FALSE(result_layer); | 692 EXPECT_FALSE(result_layer); |
| 705 | 693 |
| 706 // Closer inwards from the bottom left will overlap the layer. | 694 // Closer inwards from the bottom left will overlap the layer. |
| 707 test_point = gfx::Point(25, 75); | 695 test_point = gfx::Point(25, 75); |
| 708 result_layer = | 696 result_layer = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 gfx::Transform identity_matrix; | 737 gfx::Transform identity_matrix; |
| 750 gfx::Point3F transform_origin; | 738 gfx::Point3F transform_origin; |
| 751 | 739 |
| 752 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 740 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
| 753 SetLayerPropertiesForTesting(root.get(), | 741 SetLayerPropertiesForTesting(root.get(), |
| 754 identity_matrix, | 742 identity_matrix, |
| 755 transform_origin, | 743 transform_origin, |
| 756 gfx::PointF(), | 744 gfx::PointF(), |
| 757 gfx::Size(100, 100), | 745 gfx::Size(100, 100), |
| 758 true, | 746 true, |
| 759 false); | 747 false, |
| 748 true); | |
| 760 { | 749 { |
| 761 scoped_ptr<LayerImpl> intermediate_layer = | 750 scoped_ptr<LayerImpl> intermediate_layer = |
| 762 LayerImpl::Create(host_impl().active_tree(), 123); | 751 LayerImpl::Create(host_impl().active_tree(), 123); |
| 763 // this layer is positioned, and hit testing should correctly know where the | 752 // this layer is positioned, and hit testing should correctly know where the |
| 764 // layer is located. | 753 // layer is located. |
| 765 gfx::PointF position(10.f, 10.f); | 754 gfx::PointF position(10.f, 10.f); |
| 766 gfx::Size bounds(50, 50); | 755 gfx::Size bounds(50, 50); |
| 767 SetLayerPropertiesForTesting(intermediate_layer.get(), | 756 SetLayerPropertiesForTesting(intermediate_layer.get(), |
| 768 identity_matrix, | 757 identity_matrix, |
| 769 transform_origin, | 758 transform_origin, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 gfx::Transform identity_matrix; | 823 gfx::Transform identity_matrix; |
| 835 gfx::Point3F transform_origin; | 824 gfx::Point3F transform_origin; |
| 836 gfx::PointF position; | 825 gfx::PointF position; |
| 837 gfx::Size bounds(100, 100); | 826 gfx::Size bounds(100, 100); |
| 838 SetLayerPropertiesForTesting(root.get(), | 827 SetLayerPropertiesForTesting(root.get(), |
| 839 identity_matrix, | 828 identity_matrix, |
| 840 transform_origin, | 829 transform_origin, |
| 841 position, | 830 position, |
| 842 bounds, | 831 bounds, |
| 843 true, | 832 true, |
| 844 false); | 833 false, |
| 834 true); | |
| 845 root->SetDrawsContent(true); | 835 root->SetDrawsContent(true); |
| 846 { | 836 { |
| 847 // child 1 and child2 are initialized to overlap between x=50 and x=60. | 837 // child 1 and child2 are initialized to overlap between x=50 and x=60. |
| 848 // grand_child is set to overlap both child1 and child2 between y=50 and | 838 // grand_child is set to overlap both child1 and child2 between y=50 and |
| 849 // y=60. The expected stacking order is: (front) child2, (second) | 839 // y=60. The expected stacking order is: (front) child2, (second) |
| 850 // grand_child, (third) child1, and (back) the root layer behind all other | 840 // grand_child, (third) child1, and (back) the root layer behind all other |
| 851 // layers. | 841 // layers. |
| 852 | 842 |
| 853 scoped_ptr<LayerImpl> child1 = | 843 scoped_ptr<LayerImpl> child1 = |
| 854 LayerImpl::Create(host_impl().active_tree(), 2); | 844 LayerImpl::Create(host_impl().active_tree(), 2); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 973 gfx::Transform identity_matrix; | 963 gfx::Transform identity_matrix; |
| 974 gfx::Point3F transform_origin; | 964 gfx::Point3F transform_origin; |
| 975 gfx::PointF position; | 965 gfx::PointF position; |
| 976 gfx::Size bounds(100, 100); | 966 gfx::Size bounds(100, 100); |
| 977 SetLayerPropertiesForTesting(root.get(), | 967 SetLayerPropertiesForTesting(root.get(), |
| 978 identity_matrix, | 968 identity_matrix, |
| 979 transform_origin, | 969 transform_origin, |
| 980 position, | 970 position, |
| 981 bounds, | 971 bounds, |
| 982 true, | 972 true, |
| 983 false); | 973 false, |
| 974 true); | |
| 984 root->SetDrawsContent(true); | 975 root->SetDrawsContent(true); |
| 985 root->SetShouldFlattenTransform(false); | 976 root->SetShouldFlattenTransform(false); |
| 986 root->Set3dSortingContextId(1); | 977 root->Set3dSortingContextId(1); |
| 987 { | 978 { |
| 988 // child 1 and child2 are initialized to overlap between x=50 and x=60. | 979 // child 1 and child2 are initialized to overlap between x=50 and x=60. |
| 989 // grand_child is set to overlap both child1 and child2 between y=50 and | 980 // grand_child is set to overlap both child1 and child2 between y=50 and |
| 990 // y=60. The expected stacking order is: (front) child2, (second) | 981 // y=60. The expected stacking order is: (front) child2, (second) |
| 991 // grand_child, (third) child1, and (back) the root layer behind all other | 982 // grand_child, (third) child1, and (back) the root layer behind all other |
| 992 // layers. | 983 // layers. |
| 993 | 984 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1122 gfx::Transform identity_matrix; | 1113 gfx::Transform identity_matrix; |
| 1123 gfx::Point3F transform_origin; | 1114 gfx::Point3F transform_origin; |
| 1124 gfx::PointF position; | 1115 gfx::PointF position; |
| 1125 gfx::Size bounds(100, 100); | 1116 gfx::Size bounds(100, 100); |
| 1126 SetLayerPropertiesForTesting(root.get(), | 1117 SetLayerPropertiesForTesting(root.get(), |
| 1127 identity_matrix, | 1118 identity_matrix, |
| 1128 transform_origin, | 1119 transform_origin, |
| 1129 position, | 1120 position, |
| 1130 bounds, | 1121 bounds, |
| 1131 true, | 1122 true, |
| 1132 false); | 1123 false, |
| 1124 true); | |
| 1133 root->SetDrawsContent(true); | 1125 root->SetDrawsContent(true); |
| 1134 { | 1126 { |
| 1135 scoped_ptr<LayerImpl> child = | 1127 scoped_ptr<LayerImpl> child = |
| 1136 LayerImpl::Create(host_impl().active_tree(), 2); | 1128 LayerImpl::Create(host_impl().active_tree(), 2); |
| 1137 scoped_ptr<LayerImpl> grand_child = | 1129 scoped_ptr<LayerImpl> grand_child = |
| 1138 LayerImpl::Create(host_impl().active_tree(), 4); | 1130 LayerImpl::Create(host_impl().active_tree(), 4); |
| 1139 | 1131 |
| 1140 position = gfx::PointF(10.f, 10.f); | 1132 position = gfx::PointF(10.f, 10.f); |
| 1141 bounds = gfx::Size(1, 1); | 1133 bounds = gfx::Size(1, 1); |
| 1142 SetLayerPropertiesForTesting(child.get(), | 1134 SetLayerPropertiesForTesting(child.get(), |
| 1143 identity_matrix, | 1135 identity_matrix, |
| 1144 transform_origin, | 1136 transform_origin, |
| 1145 position, | 1137 position, |
| 1146 bounds, | 1138 bounds, |
| 1147 true, | 1139 true, |
| 1148 false); | 1140 false); |
| 1149 child->SetDrawsContent(true); | 1141 child->SetDrawsContent(true); |
| 1150 child->SetMasksToBounds(true); | 1142 child->SetMasksToBounds(true); |
| 1151 | 1143 |
| 1152 position = gfx::PointF(0.f, 40.f); | 1144 position = gfx::PointF(0.f, 40.f); |
| 1153 bounds = gfx::Size(100, 50); | 1145 bounds = gfx::Size(100, 50); |
| 1154 SetLayerPropertiesForTesting(grand_child.get(), | 1146 SetLayerPropertiesForTesting(grand_child.get(), |
| 1155 identity_matrix, | 1147 identity_matrix, |
| 1156 transform_origin, | 1148 transform_origin, |
| 1157 position, | 1149 position, |
| 1158 bounds, | 1150 bounds, |
| 1159 true, | 1151 true, |
| 1160 false); | 1152 false); |
| 1161 grand_child->SetDrawsContent(true); | 1153 grand_child->SetDrawsContent(true); |
| 1162 grand_child->SetForceRenderSurface(true); | 1154 grand_child->CreateRenderSurface(); |
| 1163 | 1155 |
| 1164 // This should let |grand_child| "escape" |child|'s clip. | 1156 // This should let |grand_child| "escape" |child|'s clip. |
| 1165 grand_child->SetClipParent(root.get()); | 1157 grand_child->SetClipParent(root.get()); |
| 1166 | 1158 |
| 1167 child->AddChild(grand_child.Pass()); | 1159 child->AddChild(grand_child.Pass()); |
| 1168 root->AddChild(child.Pass()); | 1160 root->AddChild(child.Pass()); |
| 1169 } | 1161 } |
| 1170 | 1162 |
| 1171 host_impl().SetViewportSize(root->bounds()); | 1163 host_impl().SetViewportSize(root->bounds()); |
| 1172 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1164 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1184 gfx::Transform identity_matrix; | 1176 gfx::Transform identity_matrix; |
| 1185 gfx::Point3F transform_origin; | 1177 gfx::Point3F transform_origin; |
| 1186 gfx::PointF position; | 1178 gfx::PointF position; |
| 1187 gfx::Size bounds(100, 100); | 1179 gfx::Size bounds(100, 100); |
| 1188 SetLayerPropertiesForTesting(root.get(), | 1180 SetLayerPropertiesForTesting(root.get(), |
| 1189 identity_matrix, | 1181 identity_matrix, |
| 1190 transform_origin, | 1182 transform_origin, |
| 1191 position, | 1183 position, |
| 1192 bounds, | 1184 bounds, |
| 1193 true, | 1185 true, |
| 1194 false); | 1186 false, |
| 1187 true); | |
| 1195 root->SetDrawsContent(true); | 1188 root->SetDrawsContent(true); |
| 1196 { | 1189 { |
| 1197 scoped_ptr<LayerImpl> child = | 1190 scoped_ptr<LayerImpl> child = |
| 1198 LayerImpl::Create(host_impl().active_tree(), 2); | 1191 LayerImpl::Create(host_impl().active_tree(), 2); |
| 1199 scoped_ptr<LayerImpl> scroll_child = | 1192 scoped_ptr<LayerImpl> scroll_child = |
| 1200 LayerImpl::Create(host_impl().active_tree(), 3); | 1193 LayerImpl::Create(host_impl().active_tree(), 3); |
| 1201 scoped_ptr<LayerImpl> grand_child = | 1194 scoped_ptr<LayerImpl> grand_child = |
| 1202 LayerImpl::Create(host_impl().active_tree(), 4); | 1195 LayerImpl::Create(host_impl().active_tree(), 4); |
| 1203 | 1196 |
| 1204 position = gfx::PointF(10.f, 10.f); | 1197 position = gfx::PointF(10.f, 10.f); |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1229 scroll_child->SetScrollParent(child.get()); | 1222 scroll_child->SetScrollParent(child.get()); |
| 1230 | 1223 |
| 1231 SetLayerPropertiesForTesting(grand_child.get(), | 1224 SetLayerPropertiesForTesting(grand_child.get(), |
| 1232 identity_matrix, | 1225 identity_matrix, |
| 1233 transform_origin, | 1226 transform_origin, |
| 1234 position, | 1227 position, |
| 1235 bounds, | 1228 bounds, |
| 1236 true, | 1229 true, |
| 1237 false); | 1230 false); |
| 1238 grand_child->SetDrawsContent(true); | 1231 grand_child->SetDrawsContent(true); |
| 1239 grand_child->SetForceRenderSurface(true); | 1232 grand_child->CreateRenderSurface(); |
| 1240 | 1233 |
| 1241 scroll_child->AddChild(grand_child.Pass()); | 1234 scroll_child->AddChild(grand_child.Pass()); |
| 1242 root->AddChild(scroll_child.Pass()); | 1235 root->AddChild(scroll_child.Pass()); |
| 1243 root->AddChild(child.Pass()); | 1236 root->AddChild(child.Pass()); |
| 1244 } | 1237 } |
| 1245 | 1238 |
| 1246 host_impl().SetViewportSize(root->bounds()); | 1239 host_impl().SetViewportSize(root->bounds()); |
| 1247 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1240 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 1248 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1241 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1249 | 1242 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1265 gfx::Transform identity_matrix; | 1258 gfx::Transform identity_matrix; |
| 1266 gfx::Point3F transform_origin; | 1259 gfx::Point3F transform_origin; |
| 1267 gfx::PointF position; | 1260 gfx::PointF position; |
| 1268 gfx::Size bounds(100, 100); | 1261 gfx::Size bounds(100, 100); |
| 1269 SetLayerPropertiesForTesting(root.get(), | 1262 SetLayerPropertiesForTesting(root.get(), |
| 1270 identity_matrix, | 1263 identity_matrix, |
| 1271 transform_origin, | 1264 transform_origin, |
| 1272 position, | 1265 position, |
| 1273 bounds, | 1266 bounds, |
| 1274 true, | 1267 true, |
| 1275 false); | 1268 false, |
| 1269 true); | |
| 1276 root->SetDrawsContent(true); | 1270 root->SetDrawsContent(true); |
| 1277 { | 1271 { |
| 1278 // child 1 and child2 are initialized to overlap between x=50 and x=60. | 1272 // child 1 and child2 are initialized to overlap between x=50 and x=60. |
| 1279 // grand_child is set to overlap both child1 and child2 between y=50 and | 1273 // grand_child is set to overlap both child1 and child2 between y=50 and |
| 1280 // y=60. The expected stacking order is: (front) child2, (second) | 1274 // y=60. The expected stacking order is: (front) child2, (second) |
| 1281 // grand_child, (third) child1, and (back) the root layer behind all other | 1275 // grand_child, (third) child1, and (back) the root layer behind all other |
| 1282 // layers. | 1276 // layers. |
| 1283 | 1277 |
| 1284 scoped_ptr<LayerImpl> child1 = | 1278 scoped_ptr<LayerImpl> child1 = |
| 1285 LayerImpl::Create(host_impl().active_tree(), 2); | 1279 LayerImpl::Create(host_impl().active_tree(), 2); |
| 1286 scoped_ptr<LayerImpl> child2 = | 1280 scoped_ptr<LayerImpl> child2 = |
| 1287 LayerImpl::Create(host_impl().active_tree(), 3); | 1281 LayerImpl::Create(host_impl().active_tree(), 3); |
| 1288 scoped_ptr<LayerImpl> grand_child1 = | 1282 scoped_ptr<LayerImpl> grand_child1 = |
| 1289 LayerImpl::Create(host_impl().active_tree(), 4); | 1283 LayerImpl::Create(host_impl().active_tree(), 4); |
| 1290 | 1284 |
| 1291 position = gfx::PointF(10.f, 10.f); | 1285 position = gfx::PointF(10.f, 10.f); |
| 1292 bounds = gfx::Size(50, 50); | 1286 bounds = gfx::Size(50, 50); |
| 1293 SetLayerPropertiesForTesting(child1.get(), | 1287 SetLayerPropertiesForTesting(child1.get(), |
| 1294 identity_matrix, | 1288 identity_matrix, |
| 1295 transform_origin, | 1289 transform_origin, |
| 1296 position, | 1290 position, |
| 1297 bounds, | 1291 bounds, |
| 1298 true, | 1292 true, |
| 1299 false); | 1293 false); |
| 1300 child1->SetDrawsContent(true); | 1294 child1->SetDrawsContent(true); |
| 1301 child1->SetForceRenderSurface(true); | 1295 child1->CreateRenderSurface(); |
| 1302 | 1296 |
| 1303 position = gfx::PointF(50.f, 10.f); | 1297 position = gfx::PointF(50.f, 10.f); |
| 1304 bounds = gfx::Size(50, 50); | 1298 bounds = gfx::Size(50, 50); |
| 1305 SetLayerPropertiesForTesting(child2.get(), | 1299 SetLayerPropertiesForTesting(child2.get(), |
| 1306 identity_matrix, | 1300 identity_matrix, |
| 1307 transform_origin, | 1301 transform_origin, |
| 1308 position, | 1302 position, |
| 1309 bounds, | 1303 bounds, |
| 1310 true, | 1304 true, |
| 1311 false); | 1305 false); |
| 1312 child2->SetDrawsContent(true); | 1306 child2->SetDrawsContent(true); |
| 1313 child2->SetForceRenderSurface(true); | 1307 child2->CreateRenderSurface(); |
| 1314 | 1308 |
| 1315 // Remember that grand_child is positioned with respect to its parent (i.e. | 1309 // Remember that grand_child is positioned with respect to its parent (i.e. |
| 1316 // child1). In screen space, the intended position is (10, 50), with size | 1310 // child1). In screen space, the intended position is (10, 50), with size |
| 1317 // 100 x 50. | 1311 // 100 x 50. |
| 1318 position = gfx::PointF(0.f, 40.f); | 1312 position = gfx::PointF(0.f, 40.f); |
| 1319 bounds = gfx::Size(100, 50); | 1313 bounds = gfx::Size(100, 50); |
| 1320 SetLayerPropertiesForTesting(grand_child1.get(), | 1314 SetLayerPropertiesForTesting(grand_child1.get(), |
| 1321 identity_matrix, | 1315 identity_matrix, |
| 1322 transform_origin, | 1316 transform_origin, |
| 1323 position, | 1317 position, |
| 1324 bounds, | 1318 bounds, |
| 1325 true, | 1319 true, |
| 1326 false); | 1320 false); |
| 1327 grand_child1->SetDrawsContent(true); | 1321 grand_child1->SetDrawsContent(true); |
| 1328 grand_child1->SetForceRenderSurface(true); | 1322 grand_child1->CreateRenderSurface(); |
| 1329 | 1323 |
| 1330 child1->AddChild(grand_child1.Pass()); | 1324 child1->AddChild(grand_child1.Pass()); |
| 1331 root->AddChild(child1.Pass()); | 1325 root->AddChild(child1.Pass()); |
| 1332 root->AddChild(child2.Pass()); | 1326 root->AddChild(child2.Pass()); |
| 1333 } | 1327 } |
| 1334 | 1328 |
| 1335 LayerImpl* child1 = root->children()[0]; | 1329 LayerImpl* child1 = root->children()[0]; |
| 1336 LayerImpl* child2 = root->children()[1]; | 1330 LayerImpl* child2 = root->children()[1]; |
| 1337 LayerImpl* grand_child1 = child1->children()[0]; | 1331 LayerImpl* grand_child1 = child1->children()[0]; |
| 1338 | 1332 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1416 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); | 1410 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); |
| 1417 gfx::Point3F transform_origin; | 1411 gfx::Point3F transform_origin; |
| 1418 gfx::PointF position; | 1412 gfx::PointF position; |
| 1419 gfx::Size bounds(100, 100); | 1413 gfx::Size bounds(100, 100); |
| 1420 SetLayerPropertiesForTesting(root.get(), | 1414 SetLayerPropertiesForTesting(root.get(), |
| 1421 identity_matrix, | 1415 identity_matrix, |
| 1422 transform_origin, | 1416 transform_origin, |
| 1423 position, | 1417 position, |
| 1424 bounds, | 1418 bounds, |
| 1425 true, | 1419 true, |
| 1426 false); | 1420 false, |
| 1421 true); | |
| 1427 root->SetDrawsContent(true); | 1422 root->SetDrawsContent(true); |
| 1428 | 1423 |
| 1429 host_impl().SetViewportSize(root->bounds()); | 1424 host_impl().SetViewportSize(root->bounds()); |
| 1430 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1425 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 1431 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1426 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1432 | 1427 |
| 1433 // Sanity check the scenario we just created. | 1428 // Sanity check the scenario we just created. |
| 1434 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1429 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1435 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1430 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 1436 | 1431 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1504 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); | 1499 Region touch_handler_region(gfx::Rect(10, 10, 50, 50)); |
| 1505 gfx::Point3F transform_origin; | 1500 gfx::Point3F transform_origin; |
| 1506 gfx::PointF position; | 1501 gfx::PointF position; |
| 1507 gfx::Size bounds(100, 100); | 1502 gfx::Size bounds(100, 100); |
| 1508 SetLayerPropertiesForTesting(root.get(), | 1503 SetLayerPropertiesForTesting(root.get(), |
| 1509 uninvertible_transform, | 1504 uninvertible_transform, |
| 1510 transform_origin, | 1505 transform_origin, |
| 1511 position, | 1506 position, |
| 1512 bounds, | 1507 bounds, |
| 1513 true, | 1508 true, |
| 1514 false); | 1509 false, |
| 1510 true); | |
| 1515 root->SetDrawsContent(true); | 1511 root->SetDrawsContent(true); |
| 1516 root->SetTouchEventHandlerRegion(touch_handler_region); | 1512 root->SetTouchEventHandlerRegion(touch_handler_region); |
| 1517 | 1513 |
| 1518 host_impl().SetViewportSize(root->bounds()); | 1514 host_impl().SetViewportSize(root->bounds()); |
| 1519 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1515 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 1520 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1516 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1521 | 1517 |
| 1522 // Sanity check the scenario we just created. | 1518 // Sanity check the scenario we just created. |
| 1523 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1519 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1524 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1520 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1582 // this layer is positioned, and hit testing should correctly know where the | 1578 // this layer is positioned, and hit testing should correctly know where the |
| 1583 // layer is located. | 1579 // layer is located. |
| 1584 gfx::PointF position(50.f, 50.f); | 1580 gfx::PointF position(50.f, 50.f); |
| 1585 gfx::Size bounds(100, 100); | 1581 gfx::Size bounds(100, 100); |
| 1586 SetLayerPropertiesForTesting(root.get(), | 1582 SetLayerPropertiesForTesting(root.get(), |
| 1587 identity_matrix, | 1583 identity_matrix, |
| 1588 transform_origin, | 1584 transform_origin, |
| 1589 position, | 1585 position, |
| 1590 bounds, | 1586 bounds, |
| 1591 true, | 1587 true, |
| 1592 false); | 1588 false, |
| 1589 true); | |
| 1593 root->SetDrawsContent(true); | 1590 root->SetDrawsContent(true); |
| 1594 root->SetTouchEventHandlerRegion(touch_handler_region); | 1591 root->SetTouchEventHandlerRegion(touch_handler_region); |
| 1595 | 1592 |
| 1596 host_impl().SetViewportSize(root->bounds()); | 1593 host_impl().SetViewportSize(root->bounds()); |
| 1597 host_impl().active_tree()->SetRootLayer(root.Pass()); | 1594 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 1598 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 1595 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 1599 | 1596 |
| 1600 // Sanity check the scenario we just created. | 1597 // Sanity check the scenario we just created. |
| 1601 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 1598 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 1602 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 1599 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1658 | 1655 |
| 1659 gfx::Transform identity_matrix; | 1656 gfx::Transform identity_matrix; |
| 1660 gfx::Point3F transform_origin; | 1657 gfx::Point3F transform_origin; |
| 1661 | 1658 |
| 1662 SetLayerPropertiesForTesting(root.get(), | 1659 SetLayerPropertiesForTesting(root.get(), |
| 1663 identity_matrix, | 1660 identity_matrix, |
| 1664 transform_origin, | 1661 transform_origin, |
| 1665 gfx::PointF(), | 1662 gfx::PointF(), |
| 1666 gfx::Size(100, 100), | 1663 gfx::Size(100, 100), |
| 1667 true, | 1664 true, |
| 1668 false); | 1665 false, |
| 1666 true); | |
| 1669 { | 1667 { |
| 1670 Region touch_handler_region(gfx::Rect(10, 10, 30, 30)); | 1668 Region touch_handler_region(gfx::Rect(10, 10, 30, 30)); |
| 1671 gfx::PointF position(25.f, 25.f); | 1669 gfx::PointF position(25.f, 25.f); |
| 1672 gfx::Size bounds(50, 50); | 1670 gfx::Size bounds(50, 50); |
| 1673 scoped_ptr<LayerImpl> test_layer = | 1671 scoped_ptr<LayerImpl> test_layer = |
| 1674 LayerImpl::Create(host_impl().active_tree(), 12345); | 1672 LayerImpl::Create(host_impl().active_tree(), 12345); |
| 1675 SetLayerPropertiesForTesting(test_layer.get(), | 1673 SetLayerPropertiesForTesting(test_layer.get(), |
| 1676 identity_matrix, | 1674 identity_matrix, |
| 1677 transform_origin, | 1675 transform_origin, |
| 1678 position, | 1676 position, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1762 | 1760 |
| 1763 gfx::Transform identity_matrix; | 1761 gfx::Transform identity_matrix; |
| 1764 gfx::Point3F transform_origin; | 1762 gfx::Point3F transform_origin; |
| 1765 // Set the bounds of the root layer big enough to fit the child when scaled. | 1763 // Set the bounds of the root layer big enough to fit the child when scaled. |
| 1766 SetLayerPropertiesForTesting(root.get(), | 1764 SetLayerPropertiesForTesting(root.get(), |
| 1767 identity_matrix, | 1765 identity_matrix, |
| 1768 transform_origin, | 1766 transform_origin, |
| 1769 gfx::PointF(), | 1767 gfx::PointF(), |
| 1770 gfx::Size(100, 100), | 1768 gfx::Size(100, 100), |
| 1771 true, | 1769 true, |
| 1772 false); | 1770 false, |
| 1771 true); | |
| 1773 { | 1772 { |
| 1774 Region touch_handler_region(gfx::Rect(10, 10, 30, 30)); | 1773 Region touch_handler_region(gfx::Rect(10, 10, 30, 30)); |
| 1775 gfx::PointF position(25.f, 25.f); | 1774 gfx::PointF position(25.f, 25.f); |
| 1776 gfx::Size bounds(50, 50); | 1775 gfx::Size bounds(50, 50); |
| 1777 scoped_ptr<LayerImpl> test_layer = | 1776 scoped_ptr<LayerImpl> test_layer = |
| 1778 LayerImpl::Create(host_impl().active_tree(), 12345); | 1777 LayerImpl::Create(host_impl().active_tree(), 12345); |
| 1779 SetLayerPropertiesForTesting(test_layer.get(), | 1778 SetLayerPropertiesForTesting(test_layer.get(), |
| 1780 identity_matrix, | 1779 identity_matrix, |
| 1781 transform_origin, | 1780 transform_origin, |
| 1782 position, | 1781 position, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1886 gfx::Transform identity_matrix; | 1885 gfx::Transform identity_matrix; |
| 1887 gfx::Point3F transform_origin; | 1886 gfx::Point3F transform_origin; |
| 1888 | 1887 |
| 1889 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 1888 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
| 1890 SetLayerPropertiesForTesting(root.get(), | 1889 SetLayerPropertiesForTesting(root.get(), |
| 1891 identity_matrix, | 1890 identity_matrix, |
| 1892 transform_origin, | 1891 transform_origin, |
| 1893 gfx::PointF(), | 1892 gfx::PointF(), |
| 1894 gfx::Size(100, 100), | 1893 gfx::Size(100, 100), |
| 1895 true, | 1894 true, |
| 1896 false); | 1895 false, |
| 1896 true); | |
| 1897 { | 1897 { |
| 1898 scoped_ptr<LayerImpl> clipping_layer = | 1898 scoped_ptr<LayerImpl> clipping_layer = |
| 1899 LayerImpl::Create(host_impl().active_tree(), 123); | 1899 LayerImpl::Create(host_impl().active_tree(), 123); |
| 1900 // this layer is positioned, and hit testing should correctly know where the | 1900 // this layer is positioned, and hit testing should correctly know where the |
| 1901 // layer is located. | 1901 // layer is located. |
| 1902 gfx::PointF position(25.f, 25.f); | 1902 gfx::PointF position(25.f, 25.f); |
| 1903 gfx::Size bounds(50, 50); | 1903 gfx::Size bounds(50, 50); |
| 1904 SetLayerPropertiesForTesting(clipping_layer.get(), | 1904 SetLayerPropertiesForTesting(clipping_layer.get(), |
| 1905 identity_matrix, | 1905 identity_matrix, |
| 1906 transform_origin, | 1906 transform_origin, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1981 gfx::Transform identity_matrix; | 1981 gfx::Transform identity_matrix; |
| 1982 gfx::Point3F transform_origin; | 1982 gfx::Point3F transform_origin; |
| 1983 | 1983 |
| 1984 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 1984 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
| 1985 SetLayerPropertiesForTesting(root.get(), | 1985 SetLayerPropertiesForTesting(root.get(), |
| 1986 identity_matrix, | 1986 identity_matrix, |
| 1987 transform_origin, | 1987 transform_origin, |
| 1988 gfx::PointF(), | 1988 gfx::PointF(), |
| 1989 gfx::Size(100, 100), | 1989 gfx::Size(100, 100), |
| 1990 true, | 1990 true, |
| 1991 false); | 1991 false, |
| 1992 true); | |
| 1992 { | 1993 { |
| 1993 scoped_ptr<LayerImpl> touch_layer = | 1994 scoped_ptr<LayerImpl> touch_layer = |
| 1994 LayerImpl::Create(host_impl().active_tree(), 123); | 1995 LayerImpl::Create(host_impl().active_tree(), 123); |
| 1995 // this layer is positioned, and hit testing should correctly know where the | 1996 // this layer is positioned, and hit testing should correctly know where the |
| 1996 // layer is located. | 1997 // layer is located. |
| 1997 gfx::PointF position; | 1998 gfx::PointF position; |
| 1998 gfx::Size bounds(50, 50); | 1999 gfx::Size bounds(50, 50); |
| 1999 SetLayerPropertiesForTesting(touch_layer.get(), | 2000 SetLayerPropertiesForTesting(touch_layer.get(), |
| 2000 identity_matrix, | 2001 identity_matrix, |
| 2001 transform_origin, | 2002 transform_origin, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2078 gfx::Transform identity_matrix; | 2079 gfx::Transform identity_matrix; |
| 2079 gfx::Point3F transform_origin; | 2080 gfx::Point3F transform_origin; |
| 2080 gfx::PointF position; | 2081 gfx::PointF position; |
| 2081 gfx::Size bounds(100, 100); | 2082 gfx::Size bounds(100, 100); |
| 2082 SetLayerPropertiesForTesting(root.get(), | 2083 SetLayerPropertiesForTesting(root.get(), |
| 2083 identity_matrix, | 2084 identity_matrix, |
| 2084 transform_origin, | 2085 transform_origin, |
| 2085 position, | 2086 position, |
| 2086 bounds, | 2087 bounds, |
| 2087 true, | 2088 true, |
| 2088 false); | 2089 false, |
| 2090 true); | |
| 2089 root->SetDrawsContent(true); | 2091 root->SetDrawsContent(true); |
| 2090 | 2092 |
| 2091 host_impl().SetViewportSize(root->bounds()); | 2093 host_impl().SetViewportSize(root->bounds()); |
| 2092 host_impl().active_tree()->SetRootLayer(root.Pass()); | 2094 host_impl().active_tree()->SetRootLayer(root.Pass()); |
| 2093 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); | 2095 host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); |
| 2094 | 2096 |
| 2095 // Sanity check the scenario we just created. | 2097 // Sanity check the scenario we just created. |
| 2096 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); | 2098 ASSERT_EQ(1u, RenderSurfaceLayerList().size()); |
| 2097 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); | 2099 ASSERT_EQ(1u, root_layer()->render_surface()->layer_list().size()); |
| 2098 | 2100 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2154 gfx::Transform identity_matrix; | 2156 gfx::Transform identity_matrix; |
| 2155 gfx::Point3F transform_origin; | 2157 gfx::Point3F transform_origin; |
| 2156 gfx::PointF position; | 2158 gfx::PointF position; |
| 2157 gfx::Size bounds(100, 100); | 2159 gfx::Size bounds(100, 100); |
| 2158 SetLayerPropertiesForTesting(root.get(), | 2160 SetLayerPropertiesForTesting(root.get(), |
| 2159 identity_matrix, | 2161 identity_matrix, |
| 2160 transform_origin, | 2162 transform_origin, |
| 2161 position, | 2163 position, |
| 2162 bounds, | 2164 bounds, |
| 2163 true, | 2165 true, |
| 2164 false); | 2166 false, |
| 2167 true); | |
| 2165 | 2168 |
| 2166 gfx::Vector2dF clipping_offset(10, 10); | 2169 gfx::Vector2dF clipping_offset(10, 10); |
| 2167 { | 2170 { |
| 2168 scoped_ptr<LayerImpl> clipping_layer = | 2171 scoped_ptr<LayerImpl> clipping_layer = |
| 2169 LayerImpl::Create(host_impl().active_tree(), clip_layer_id); | 2172 LayerImpl::Create(host_impl().active_tree(), clip_layer_id); |
| 2170 // The clipping layer should occlude the right selection bound. | 2173 // The clipping layer should occlude the right selection bound. |
| 2171 gfx::PointF position = gfx::PointF() + clipping_offset; | 2174 gfx::PointF position = gfx::PointF() + clipping_offset; |
| 2172 gfx::Size bounds(50, 50); | 2175 gfx::Size bounds(50, 50); |
| 2173 SetLayerPropertiesForTesting(clipping_layer.get(), | 2176 SetLayerPropertiesForTesting(clipping_layer.get(), |
| 2174 identity_matrix, | 2177 identity_matrix, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2266 gfx::Transform identity_matrix; | 2269 gfx::Transform identity_matrix; |
| 2267 gfx::Point3F transform_origin; | 2270 gfx::Point3F transform_origin; |
| 2268 gfx::PointF position; | 2271 gfx::PointF position; |
| 2269 gfx::Size bounds(100, 100); | 2272 gfx::Size bounds(100, 100); |
| 2270 SetLayerPropertiesForTesting(root.get(), | 2273 SetLayerPropertiesForTesting(root.get(), |
| 2271 identity_matrix, | 2274 identity_matrix, |
| 2272 transform_origin, | 2275 transform_origin, |
| 2273 position, | 2276 position, |
| 2274 bounds, | 2277 bounds, |
| 2275 true, | 2278 true, |
| 2276 false); | 2279 false, |
| 2280 true); | |
| 2277 | 2281 |
| 2278 gfx::Vector2dF sub_layer_offset(10, 0); | 2282 gfx::Vector2dF sub_layer_offset(10, 0); |
| 2279 { | 2283 { |
| 2280 scoped_ptr<LayerImpl> sub_layer = | 2284 scoped_ptr<LayerImpl> sub_layer = |
| 2281 LayerImpl::Create(host_impl().active_tree(), sub_layer_id); | 2285 LayerImpl::Create(host_impl().active_tree(), sub_layer_id); |
| 2282 gfx::PointF position = gfx::PointF() + sub_layer_offset; | 2286 gfx::PointF position = gfx::PointF() + sub_layer_offset; |
| 2283 gfx::Size bounds(50, 50); | 2287 gfx::Size bounds(50, 50); |
| 2284 SetLayerPropertiesForTesting(sub_layer.get(), | 2288 SetLayerPropertiesForTesting(sub_layer.get(), |
| 2285 identity_matrix, | 2289 identity_matrix, |
| 2286 transform_origin, | 2290 transform_origin, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2357 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); | 2361 EXPECT_EQ(0u, host_impl().active_tree()->NumLayers()); |
| 2358 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); | 2362 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1); |
| 2359 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); | 2363 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 2)); |
| 2360 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); | 2364 root->AddChild(LayerImpl::Create(host_impl().active_tree(), 3)); |
| 2361 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); | 2365 root->child_at(1)->AddChild(LayerImpl::Create(host_impl().active_tree(), 4)); |
| 2362 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); | 2366 EXPECT_EQ(4u, host_impl().active_tree()->NumLayers()); |
| 2363 } | 2367 } |
| 2364 | 2368 |
| 2365 } // namespace | 2369 } // namespace |
| 2366 } // namespace cc | 2370 } // namespace cc |
| OLD | NEW |