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

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

Issue 2035863003: cc: Add mask and replica layer ids to the effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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_host_common.h" 5 #include "cc/trees/layer_tree_host_common.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 gfx::Size(10, 12), true, false, false); 666 gfx::Size(10, 12), true, false, false);
667 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(), 667 SetLayerPropertiesForTesting(child, identity_matrix, gfx::Point3F(),
668 gfx::PointF(), gfx::Size(16, 18), true, false, 668 gfx::PointF(), gfx::Size(16, 18), true, false,
669 true); 669 true);
670 SetLayerPropertiesForTesting(grand_child, identity_matrix, gfx::Point3F(), 670 SetLayerPropertiesForTesting(grand_child, identity_matrix, gfx::Point3F(),
671 gfx::PointF(-0.5f, -0.5f), gfx::Size(1, 1), true, 671 gfx::PointF(-0.5f, -0.5f), gfx::Size(1, 1), true,
672 false, false); 672 false, false);
673 SetLayerPropertiesForTesting(child_replica.get(), replica_layer_transform, 673 SetLayerPropertiesForTesting(child_replica.get(), replica_layer_transform,
674 gfx::Point3F(), gfx::PointF(), gfx::Size(), true, 674 gfx::Point3F(), gfx::PointF(), gfx::Size(), true,
675 false, false); 675 false, false);
676 child->SetReplicaLayer(std::move(child_replica)); 676 child->test_properties()->SetReplicaLayer(std::move(child_replica));
677 677
678 ExecuteCalculateDrawProperties(root); 678 ExecuteCalculateDrawProperties(root);
679 679
680 // Render surface should have been created now. 680 // Render surface should have been created now.
681 ASSERT_TRUE(child->render_surface()); 681 ASSERT_TRUE(child->render_surface());
682 ASSERT_EQ(child->render_surface(), child->render_target()); 682 ASSERT_EQ(child->render_surface(), child->render_target());
683 683
684 EXPECT_TRANSFORMATION_MATRIX_EQ( 684 EXPECT_TRANSFORMATION_MATRIX_EQ(
685 replica_composite_transform, 685 replica_composite_transform,
686 child->render_target()->replica_draw_transform()); 686 child->render_target()->replica_draw_transform());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 SetLayerPropertiesForTesting(replica_of_rs1.get(), replica_layer_transform, 808 SetLayerPropertiesForTesting(replica_of_rs1.get(), replica_layer_transform,
809 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), 809 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(),
810 gfx::Size(), true, false, false); 810 gfx::Size(), true, false, false);
811 SetLayerPropertiesForTesting(replica_of_rs2.get(), replica_layer_transform, 811 SetLayerPropertiesForTesting(replica_of_rs2.get(), replica_layer_transform,
812 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), 812 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(),
813 gfx::Size(), true, false, false); 813 gfx::Size(), true, false, false);
814 814
815 // We need to set parent on replica layers for property tree building. 815 // We need to set parent on replica layers for property tree building.
816 replica_of_rs1->SetParent(render_surface1); 816 replica_of_rs1->SetParent(render_surface1);
817 replica_of_rs2->SetParent(render_surface2); 817 replica_of_rs2->SetParent(render_surface2);
818 render_surface1->SetReplicaLayer(std::move(replica_of_rs1)); 818 render_surface1->test_properties()->SetReplicaLayer(
819 render_surface2->SetReplicaLayer(std::move(replica_of_rs2)); 819 std::move(replica_of_rs1));
820 render_surface2->test_properties()->SetReplicaLayer(
821 std::move(replica_of_rs2));
820 ExecuteCalculateDrawProperties(root); 822 ExecuteCalculateDrawProperties(root);
821 823
822 // Only layers that are associated with render surfaces should have an actual 824 // Only layers that are associated with render surfaces should have an actual
823 // RenderSurface() value. 825 // RenderSurface() value.
824 ASSERT_TRUE(root->render_surface()); 826 ASSERT_TRUE(root->render_surface());
825 ASSERT_FALSE(child_of_root->render_surface()); 827 ASSERT_FALSE(child_of_root->render_surface());
826 ASSERT_FALSE(grand_child_of_root->render_surface()); 828 ASSERT_FALSE(grand_child_of_root->render_surface());
827 829
828 ASSERT_TRUE(render_surface1->render_surface()); 830 ASSERT_TRUE(render_surface1->render_surface());
829 ASSERT_FALSE(child_of_rs1->render_surface()); 831 ASSERT_FALSE(child_of_rs1->render_surface());
(...skipping 4094 matching lines...) Expand 10 before | Expand all | Expand 10 after
4924 gfx::Transform replica_transform; 4926 gfx::Transform replica_transform;
4925 replica_transform.Scale(1.0, -1.0); 4927 replica_transform.Scale(1.0, -1.0);
4926 4928
4927 std::unique_ptr<LayerImpl> replica = 4929 std::unique_ptr<LayerImpl> replica =
4928 LayerImpl::Create(host_impl()->active_tree(), 7); 4930 LayerImpl::Create(host_impl()->active_tree(), 7);
4929 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), 4931 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(),
4930 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, 4932 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false,
4931 true, false); 4933 true, false);
4932 // We need to set parent on replica layer for property tree building. 4934 // We need to set parent on replica layer for property tree building.
4933 replica->SetParent(child); 4935 replica->SetParent(child);
4934 child->SetReplicaLayer(std::move(replica)); 4936 child->test_properties()->SetReplicaLayer(std::move(replica));
4935 4937
4936 // This layer should end up in the same surface as child, with the same draw 4938 // This layer should end up in the same surface as child, with the same draw
4937 // and screen space transforms. 4939 // and screen space transforms.
4938 LayerImpl* duplicate_child_non_owner = AddChild<LayerImpl>(child); 4940 LayerImpl* duplicate_child_non_owner = AddChild<LayerImpl>(child);
4939 duplicate_child_non_owner->SetDrawsContent(true); 4941 duplicate_child_non_owner->SetDrawsContent(true);
4940 SetLayerPropertiesForTesting(duplicate_child_non_owner, identity_matrix, 4942 SetLayerPropertiesForTesting(duplicate_child_non_owner, identity_matrix,
4941 gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10), 4943 gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10),
4942 false, true, false); 4944 false, true, false);
4943 4945
4944 float device_scale_factor = 1.5f; 4946 float device_scale_factor = 1.5f;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
5035 gfx::PointF(), gfx::Size(13, 11), false, true, 5037 gfx::PointF(), gfx::Size(13, 11), false, true,
5036 true); 5038 true);
5037 5039
5038 gfx::Transform replica_transform; 5040 gfx::Transform replica_transform;
5039 replica_transform.Scale(1.0, -1.0); 5041 replica_transform.Scale(1.0, -1.0);
5040 std::unique_ptr<LayerImpl> replica = 5042 std::unique_ptr<LayerImpl> replica =
5041 LayerImpl::Create(host_impl()->active_tree(), 7); 5043 LayerImpl::Create(host_impl()->active_tree(), 7);
5042 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), 5044 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(),
5043 gfx::PointF(), gfx::Size(13, 11), false, true, 5045 gfx::PointF(), gfx::Size(13, 11), false, true,
5044 false); 5046 false);
5045 child->SetReplicaLayer(std::move(replica)); 5047 child->test_properties()->SetReplicaLayer(std::move(replica));
5046 5048
5047 float device_scale_factor = 1.7f; 5049 float device_scale_factor = 1.7f;
5048 ExecuteCalculateDrawProperties(parent, device_scale_factor); 5050 ExecuteCalculateDrawProperties(parent, device_scale_factor);
5049 5051
5050 // We should have two render surfaces. The root's render surface and child's 5052 // We should have two render surfaces. The root's render surface and child's
5051 // render surface (it needs one because it has a replica layer). 5053 // render surface (it needs one because it has a replica layer).
5052 EXPECT_EQ(2u, render_surface_layer_list_impl()->size()); 5054 EXPECT_EQ(2u, render_surface_layer_list_impl()->size());
5053 5055
5054 gfx::Transform identity_transform; 5056 gfx::Transform identity_transform;
5055 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform, 5057 EXPECT_TRANSFORMATION_MATRIX_EQ(identity_transform,
(...skipping 2507 matching lines...) Expand 10 before | Expand all | Expand 10 after
7563 for (LayerIterator it = LayerIterator::Begin(rsll), 7565 for (LayerIterator it = LayerIterator::Begin(rsll),
7564 end = LayerIterator::End(rsll); 7566 end = LayerIterator::End(rsll);
7565 it != end; ++it) { 7567 it != end; ++it) {
7566 LayerImpl* layer = *it; 7568 LayerImpl* layer = *it;
7567 if (it.represents_itself()) 7569 if (it.represents_itself())
7568 drawn_layers->insert(layer); 7570 drawn_layers->insert(layer);
7569 7571
7570 if (!it.represents_contributing_render_surface()) 7572 if (!it.represents_contributing_render_surface())
7571 continue; 7573 continue;
7572 7574
7573 if (layer->mask_layer()) 7575 if (layer->render_surface()->MaskLayer())
7574 drawn_layers->insert(layer->mask_layer()); 7576 drawn_layers->insert(layer->render_surface()->MaskLayer());
7575 if (layer->replica_layer() && layer->replica_layer()->mask_layer()) 7577 if (layer->render_surface()->ReplicaMaskLayer())
7576 drawn_layers->insert(layer->replica_layer()->mask_layer()); 7578 drawn_layers->insert(layer->render_surface()->ReplicaMaskLayer());
7577 } 7579 }
7578 } 7580 }
7579 7581
7580 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) { 7582 TEST_F(LayerTreeHostCommonTest, RenderSurfaceLayerListMembership) {
7581 FakeImplTaskRunnerProvider task_runner_provider; 7583 FakeImplTaskRunnerProvider task_runner_provider;
7582 TestSharedBitmapManager shared_bitmap_manager; 7584 TestSharedBitmapManager shared_bitmap_manager;
7583 TestTaskGraphRunner task_graph_runner; 7585 TestTaskGraphRunner task_graph_runner;
7584 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager, 7586 FakeLayerTreeHostImpl host_impl(&task_runner_provider, &shared_bitmap_manager,
7585 &task_graph_runner); 7587 &task_graph_runner);
7586 gfx::Transform identity_matrix; 7588 gfx::Transform identity_matrix;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
7695 EXPECT_TRUE(grand_child2_raw->is_drawn_render_surface_layer_list_member()); 7697 EXPECT_TRUE(grand_child2_raw->is_drawn_render_surface_layer_list_member());
7696 7698
7697 expected.clear(); 7699 expected.clear();
7698 expected.insert(grand_child2_raw); 7700 expected.insert(grand_child2_raw);
7699 7701
7700 actual.clear(); 7702 actual.clear();
7701 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 7703 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
7702 EXPECT_EQ(expected, actual); 7704 EXPECT_EQ(expected, actual);
7703 7705
7704 // Add a mask layer to child. 7706 // Add a mask layer to child.
7705 child_raw->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); 7707 child_raw->test_properties()->SetMaskLayer(
7708 LayerImpl::Create(host_impl.active_tree(), 6));
7706 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7709 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7707 7710
7708 ExecuteCalculateDrawProperties(grand_parent_raw); 7711 ExecuteCalculateDrawProperties(grand_parent_raw);
7709 7712
7710 EXPECT_FALSE(grand_parent_raw->is_drawn_render_surface_layer_list_member()); 7713 EXPECT_FALSE(grand_parent_raw->is_drawn_render_surface_layer_list_member());
7711 EXPECT_FALSE(parent_raw->is_drawn_render_surface_layer_list_member()); 7714 EXPECT_FALSE(parent_raw->is_drawn_render_surface_layer_list_member());
7712 EXPECT_FALSE(child_raw->is_drawn_render_surface_layer_list_member()); 7715 EXPECT_FALSE(child_raw->is_drawn_render_surface_layer_list_member());
7713 EXPECT_TRUE( 7716 EXPECT_TRUE(child_raw->test_properties()
7714 child_raw->mask_layer()->is_drawn_render_surface_layer_list_member()); 7717 ->mask_layer->is_drawn_render_surface_layer_list_member());
7715 EXPECT_FALSE(grand_child1_raw->is_drawn_render_surface_layer_list_member()); 7718 EXPECT_FALSE(grand_child1_raw->is_drawn_render_surface_layer_list_member());
7716 EXPECT_TRUE(grand_child2_raw->is_drawn_render_surface_layer_list_member()); 7719 EXPECT_TRUE(grand_child2_raw->is_drawn_render_surface_layer_list_member());
7717 7720
7718 expected.clear(); 7721 expected.clear();
7719 expected.insert(grand_child2_raw); 7722 expected.insert(grand_child2_raw);
7720 expected.insert(child_raw->mask_layer()); 7723 expected.insert(child_raw->test_properties()->mask_layer);
7721 7724
7722 expected.clear(); 7725 expected.clear();
7723 expected.insert(grand_child2_raw); 7726 expected.insert(grand_child2_raw);
7724 expected.insert(child_raw->mask_layer()); 7727 expected.insert(child_raw->test_properties()->mask_layer);
7725 7728
7726 actual.clear(); 7729 actual.clear();
7727 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 7730 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
7728 EXPECT_EQ(expected, actual); 7731 EXPECT_EQ(expected, actual);
7729 7732
7730 // Add replica mask layer. 7733 // Add replica mask layer.
7731 std::unique_ptr<LayerImpl> replica_layer = 7734 std::unique_ptr<LayerImpl> replica_layer =
7732 LayerImpl::Create(host_impl.active_tree(), 20); 7735 LayerImpl::Create(host_impl.active_tree(), 20);
7733 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 21)); 7736 replica_layer->test_properties()->SetMaskLayer(
7734 child_raw->SetReplicaLayer(std::move(replica_layer)); 7737 LayerImpl::Create(host_impl.active_tree(), 21));
7738 child_raw->test_properties()->SetReplicaLayer(std::move(replica_layer));
7735 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7739 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7736 7740
7737 ExecuteCalculateDrawProperties(grand_parent_raw); 7741 ExecuteCalculateDrawProperties(grand_parent_raw);
7738 7742
7739 EXPECT_FALSE(grand_parent_raw->is_drawn_render_surface_layer_list_member()); 7743 EXPECT_FALSE(grand_parent_raw->is_drawn_render_surface_layer_list_member());
7740 EXPECT_FALSE(parent_raw->is_drawn_render_surface_layer_list_member()); 7744 EXPECT_FALSE(parent_raw->is_drawn_render_surface_layer_list_member());
7741 EXPECT_FALSE(child_raw->is_drawn_render_surface_layer_list_member()); 7745 EXPECT_FALSE(child_raw->is_drawn_render_surface_layer_list_member());
7742 EXPECT_TRUE( 7746 EXPECT_TRUE(child_raw->test_properties()
7743 child_raw->mask_layer()->is_drawn_render_surface_layer_list_member()); 7747 ->mask_layer->is_drawn_render_surface_layer_list_member());
7744 EXPECT_TRUE(child_raw->replica_layer() 7748 EXPECT_TRUE(child_raw->test_properties()
7745 ->mask_layer() 7749 ->replica_layer->test_properties()
7746 ->is_drawn_render_surface_layer_list_member()); 7750 ->mask_layer->is_drawn_render_surface_layer_list_member());
7747 EXPECT_FALSE(grand_child1_raw->is_drawn_render_surface_layer_list_member()); 7751 EXPECT_FALSE(grand_child1_raw->is_drawn_render_surface_layer_list_member());
7748 EXPECT_TRUE(grand_child2_raw->is_drawn_render_surface_layer_list_member()); 7752 EXPECT_TRUE(grand_child2_raw->is_drawn_render_surface_layer_list_member());
7749 7753
7750 expected.clear(); 7754 expected.clear();
7751 expected.insert(grand_child2_raw); 7755 expected.insert(grand_child2_raw);
7752 expected.insert(child_raw->mask_layer()); 7756 expected.insert(child_raw->test_properties()->mask_layer);
7753 expected.insert(child_raw->replica_layer()->mask_layer()); 7757 expected.insert(child_raw->test_properties()
7758 ->replica_layer->test_properties()
7759 ->mask_layer);
7754 7760
7755 actual.clear(); 7761 actual.clear();
7756 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 7762 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
7757 EXPECT_EQ(expected, actual); 7763 EXPECT_EQ(expected, actual);
7758 7764
7759 child_raw->TakeReplicaLayerForTesting(); 7765 child_raw->test_properties()->SetReplicaLayer(nullptr);
7766 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7760 7767
7761 // With nothing drawing, we should have no layers. 7768 // With nothing drawing, we should have no layers.
7762 grand_child2_raw->SetDrawsContent(false); 7769 grand_child2_raw->SetDrawsContent(false);
7763 7770
7764 ExecuteCalculateDrawProperties(grand_parent_raw); 7771 ExecuteCalculateDrawProperties(grand_parent_raw);
7765 7772
7766 EXPECT_FALSE(grand_parent_raw->is_drawn_render_surface_layer_list_member()); 7773 EXPECT_FALSE(grand_parent_raw->is_drawn_render_surface_layer_list_member());
7767 EXPECT_FALSE(parent_raw->is_drawn_render_surface_layer_list_member()); 7774 EXPECT_FALSE(parent_raw->is_drawn_render_surface_layer_list_member());
7768 EXPECT_FALSE(child_raw->is_drawn_render_surface_layer_list_member()); 7775 EXPECT_FALSE(child_raw->is_drawn_render_surface_layer_list_member());
7769 EXPECT_FALSE( 7776 EXPECT_FALSE(child_raw->test_properties()
7770 child_raw->mask_layer()->is_drawn_render_surface_layer_list_member()); 7777 ->mask_layer->is_drawn_render_surface_layer_list_member());
7771 EXPECT_FALSE(grand_child1_raw->is_drawn_render_surface_layer_list_member()); 7778 EXPECT_FALSE(grand_child1_raw->is_drawn_render_surface_layer_list_member());
7772 EXPECT_FALSE(grand_child2_raw->is_drawn_render_surface_layer_list_member()); 7779 EXPECT_FALSE(grand_child2_raw->is_drawn_render_surface_layer_list_member());
7773 7780
7774 expected.clear(); 7781 expected.clear();
7775 actual.clear(); 7782 actual.clear();
7776 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 7783 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
7777 EXPECT_EQ(expected, actual); 7784 EXPECT_EQ(expected, actual);
7778 7785
7779 // Child itself draws means that we should have the child and the mask in the 7786 // Child itself draws means that we should have the child and the mask in the
7780 // list. 7787 // list.
7781 child_raw->SetDrawsContent(true); 7788 child_raw->SetDrawsContent(true);
7782 7789
7783 ExecuteCalculateDrawProperties(grand_parent_raw); 7790 ExecuteCalculateDrawProperties(grand_parent_raw);
7784 7791
7785 EXPECT_FALSE(grand_parent_raw->is_drawn_render_surface_layer_list_member()); 7792 EXPECT_FALSE(grand_parent_raw->is_drawn_render_surface_layer_list_member());
7786 EXPECT_FALSE(parent_raw->is_drawn_render_surface_layer_list_member()); 7793 EXPECT_FALSE(parent_raw->is_drawn_render_surface_layer_list_member());
7787 EXPECT_TRUE(child_raw->is_drawn_render_surface_layer_list_member()); 7794 EXPECT_TRUE(child_raw->is_drawn_render_surface_layer_list_member());
7788 EXPECT_TRUE( 7795 EXPECT_TRUE(child_raw->test_properties()
7789 child_raw->mask_layer()->is_drawn_render_surface_layer_list_member()); 7796 ->mask_layer->is_drawn_render_surface_layer_list_member());
7790 EXPECT_FALSE(grand_child1_raw->is_drawn_render_surface_layer_list_member()); 7797 EXPECT_FALSE(grand_child1_raw->is_drawn_render_surface_layer_list_member());
7791 EXPECT_FALSE(grand_child2_raw->is_drawn_render_surface_layer_list_member()); 7798 EXPECT_FALSE(grand_child2_raw->is_drawn_render_surface_layer_list_member());
7792 7799
7793 expected.clear(); 7800 expected.clear();
7794 expected.insert(child_raw); 7801 expected.insert(child_raw);
7795 expected.insert(child_raw->mask_layer()); 7802 expected.insert(child_raw->test_properties()->mask_layer);
7796 actual.clear(); 7803 actual.clear();
7797 GatherDrawnLayers(render_surface_layer_list_impl(), &actual); 7804 GatherDrawnLayers(render_surface_layer_list_impl(), &actual);
7798 EXPECT_EQ(expected, actual); 7805 EXPECT_EQ(expected, actual);
7799 7806
7800 child_raw->TakeMaskLayer(); 7807 child_raw->test_properties()->SetMaskLayer(nullptr);
7801 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; 7808 child_raw->layer_tree_impl()->property_trees()->needs_rebuild = true;
7802 7809
7803 // Now everyone's a member! 7810 // Now everyone's a member!
7804 grand_parent_raw->SetDrawsContent(true); 7811 grand_parent_raw->SetDrawsContent(true);
7805 parent_raw->SetDrawsContent(true); 7812 parent_raw->SetDrawsContent(true);
7806 child_raw->SetDrawsContent(true); 7813 child_raw->SetDrawsContent(true);
7807 grand_child1_raw->SetDrawsContent(true); 7814 grand_child1_raw->SetDrawsContent(true);
7808 grand_child2_raw->SetDrawsContent(true); 7815 grand_child2_raw->SetDrawsContent(true);
7809 7816
7810 ExecuteCalculateDrawProperties(grand_parent_raw); 7817 ExecuteCalculateDrawProperties(grand_parent_raw);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
7857 scale_transform_child1.Scale(2, 3); 7864 scale_transform_child1.Scale(2, 3);
7858 scale_transform_child2.Scale(4, 5); 7865 scale_transform_child2.Scale(4, 5);
7859 7866
7860 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(), 7867 SetLayerPropertiesForTesting(root_layer, identity_matrix, gfx::Point3F(),
7861 gfx::PointF(), gfx::Size(1, 1), true, false, 7868 gfx::PointF(), gfx::Size(1, 1), true, false,
7862 true); 7869 true);
7863 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1, 7870 SetLayerPropertiesForTesting(child1_layer, scale_transform_child1,
7864 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), 7871 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1),
7865 true, false, false); 7872 true, false, false);
7866 7873
7867 child1_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 4)); 7874 child1_layer->test_properties()->SetMaskLayer(
7875 LayerImpl::Create(host_impl.active_tree(), 4));
7868 child1_layer->SetDrawsContent(true); 7876 child1_layer->SetDrawsContent(true);
7869 7877
7870 std::unique_ptr<LayerImpl> replica_layer = 7878 std::unique_ptr<LayerImpl> replica_layer =
7871 LayerImpl::Create(host_impl.active_tree(), 5); 7879 LayerImpl::Create(host_impl.active_tree(), 5);
7872 replica_layer->SetMaskLayer(LayerImpl::Create(host_impl.active_tree(), 6)); 7880 replica_layer->test_properties()->SetMaskLayer(
7873 child1_layer->SetReplicaLayer(std::move(replica_layer)); 7881 LayerImpl::Create(host_impl.active_tree(), 6));
7882 child1_layer->test_properties()->SetReplicaLayer(std::move(replica_layer));
7874 child1_layer->SetHasRenderSurface(true); 7883 child1_layer->SetHasRenderSurface(true);
7875 7884
7876 ExecuteCalculateDrawProperties(root_layer); 7885 ExecuteCalculateDrawProperties(root_layer);
7877 7886
7878 TransformOperations scale; 7887 TransformOperations scale;
7879 scale.AppendScale(5.f, 8.f, 3.f); 7888 scale.AppendScale(5.f, 8.f, 3.f);
7880 7889
7881 scoped_refptr<AnimationTimeline> timeline = 7890 scoped_refptr<AnimationTimeline> timeline =
7882 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 7891 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
7883 host_impl.animation_host()->AddAnimationTimeline(timeline); 7892 host_impl.animation_host()->AddAnimationTimeline(timeline);
7884 7893
7885 AddAnimatedTransformToLayerWithPlayer(child2_layer->id(), timeline, 1.0, 7894 AddAnimatedTransformToLayerWithPlayer(child2_layer->id(), timeline, 1.0,
7886 TransformOperations(), scale); 7895 TransformOperations(), scale);
7887 7896
7888 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2, 7897 SetLayerPropertiesForTesting(child2_layer, scale_transform_child2,
7889 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1), 7898 gfx::Point3F(), gfx::PointF(), gfx::Size(1, 1),
7890 true, false, false); 7899 true, false, false);
7891 child2_layer->SetDrawsContent(true); 7900 child2_layer->SetDrawsContent(true);
7892 7901
7893 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; 7902 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true;
7894 ExecuteCalculateDrawProperties(root_layer); 7903 ExecuteCalculateDrawProperties(root_layer);
7895 7904
7896 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale()); 7905 EXPECT_FLOAT_EQ(1.f, root_layer->GetIdealContentsScale());
7897 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale()); 7906 EXPECT_FLOAT_EQ(3.f, child1_layer->GetIdealContentsScale());
7898 EXPECT_FLOAT_EQ(3.f, child1_layer->mask_layer()->GetIdealContentsScale()); 7907 EXPECT_FLOAT_EQ(
7908 3.f,
7909 child1_layer->test_properties()->mask_layer->GetIdealContentsScale());
7899 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale()); 7910 EXPECT_FLOAT_EQ(5.f, child2_layer->GetIdealContentsScale());
7900 7911
7901 EXPECT_FLOAT_EQ( 7912 EXPECT_FLOAT_EQ(
7902 0.f, root_layer->draw_properties().maximum_animation_contents_scale); 7913 0.f, root_layer->draw_properties().maximum_animation_contents_scale);
7903 EXPECT_FLOAT_EQ( 7914 EXPECT_FLOAT_EQ(
7904 0.f, child1_layer->draw_properties().maximum_animation_contents_scale); 7915 0.f, child1_layer->draw_properties().maximum_animation_contents_scale);
7905 EXPECT_FLOAT_EQ(0.f,
7906 child1_layer->mask_layer()
7907 ->draw_properties()
7908 .maximum_animation_contents_scale);
7909 EXPECT_FLOAT_EQ(0.f,
7910 child1_layer->replica_layer()
7911 ->mask_layer()
7912 ->draw_properties()
7913 .maximum_animation_contents_scale);
7914 EXPECT_FLOAT_EQ( 7916 EXPECT_FLOAT_EQ(
7915 8.f, child2_layer->draw_properties().maximum_animation_contents_scale); 7917 8.f, child2_layer->draw_properties().maximum_animation_contents_scale);
7916 7918
7917 // Changing page-scale would affect ideal_contents_scale and 7919 // Changing page-scale would affect ideal_contents_scale and
7918 // maximum_animation_contents_scale. 7920 // maximum_animation_contents_scale.
7919 7921
7920 float page_scale_factor = 3.f; 7922 float page_scale_factor = 3.f;
7921 float device_scale_factor = 1.0f; 7923 float device_scale_factor = 1.0f;
7922 std::vector<LayerImpl*> render_surface_layer_list; 7924 std::vector<LayerImpl*> render_surface_layer_list;
7923 gfx::Size device_viewport_size = 7925 gfx::Size device_viewport_size =
7924 gfx::Size(root_layer->bounds().width() * device_scale_factor, 7926 gfx::Size(root_layer->bounds().width() * device_scale_factor,
7925 root_layer->bounds().height() * device_scale_factor); 7927 root_layer->bounds().height() * device_scale_factor);
7926 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs( 7928 LayerTreeHostCommon::CalcDrawPropsImplInputsForTesting inputs(
7927 root_layer, device_viewport_size, &render_surface_layer_list); 7929 root_layer, device_viewport_size, &render_surface_layer_list);
7928 7930
7929 inputs.page_scale_factor = page_scale_factor; 7931 inputs.page_scale_factor = page_scale_factor;
7930 inputs.can_adjust_raster_scales = true; 7932 inputs.can_adjust_raster_scales = true;
7931 inputs.page_scale_layer = root_layer; 7933 inputs.page_scale_layer = root_layer;
7932 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 7934 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
7933 7935
7934 EXPECT_FLOAT_EQ(3.f, root_layer->GetIdealContentsScale()); 7936 EXPECT_FLOAT_EQ(3.f, root_layer->GetIdealContentsScale());
7935 EXPECT_FLOAT_EQ(9.f, child1_layer->GetIdealContentsScale()); 7937 EXPECT_FLOAT_EQ(9.f, child1_layer->GetIdealContentsScale());
7936 EXPECT_FLOAT_EQ(9.f, child1_layer->mask_layer()->GetIdealContentsScale());
7937 EXPECT_FLOAT_EQ( 7938 EXPECT_FLOAT_EQ(
7938 9.f, 7939 9.f,
7939 child1_layer->replica_layer()->mask_layer()->GetIdealContentsScale()); 7940 child1_layer->test_properties()->mask_layer->GetIdealContentsScale());
7941 EXPECT_FLOAT_EQ(9.f, child1_layer->test_properties()
7942 ->replica_layer->test_properties()
7943 ->mask_layer->GetIdealContentsScale());
7940 EXPECT_FLOAT_EQ(15.f, child2_layer->GetIdealContentsScale()); 7944 EXPECT_FLOAT_EQ(15.f, child2_layer->GetIdealContentsScale());
7941 7945
7942 EXPECT_FLOAT_EQ( 7946 EXPECT_FLOAT_EQ(
7943 0.f, root_layer->draw_properties().maximum_animation_contents_scale); 7947 0.f, root_layer->draw_properties().maximum_animation_contents_scale);
7944 EXPECT_FLOAT_EQ( 7948 EXPECT_FLOAT_EQ(
7945 0.f, child1_layer->draw_properties().maximum_animation_contents_scale); 7949 0.f, child1_layer->draw_properties().maximum_animation_contents_scale);
7946 EXPECT_FLOAT_EQ(0.f,
7947 child1_layer->mask_layer()
7948 ->draw_properties()
7949 .maximum_animation_contents_scale);
7950 EXPECT_FLOAT_EQ(0.f,
7951 child1_layer->replica_layer()
7952 ->mask_layer()
7953 ->draw_properties()
7954 .maximum_animation_contents_scale);
7955 EXPECT_FLOAT_EQ( 7950 EXPECT_FLOAT_EQ(
7956 24.f, child2_layer->draw_properties().maximum_animation_contents_scale); 7951 24.f, child2_layer->draw_properties().maximum_animation_contents_scale);
7957 7952
7958 // Changing device-scale would affect ideal_contents_scale and 7953 // Changing device-scale would affect ideal_contents_scale and
7959 // maximum_animation_contents_scale. 7954 // maximum_animation_contents_scale.
7960 7955
7961 device_scale_factor = 4.0f; 7956 device_scale_factor = 4.0f;
7962 inputs.device_scale_factor = device_scale_factor; 7957 inputs.device_scale_factor = device_scale_factor;
7963 inputs.can_adjust_raster_scales = true; 7958 inputs.can_adjust_raster_scales = true;
7964 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true; 7959 root_layer->layer_tree_impl()->property_trees()->needs_rebuild = true;
7965 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs); 7960 LayerTreeHostCommon::CalculateDrawPropertiesForTesting(&inputs);
7966 7961
7967 EXPECT_FLOAT_EQ(12.f, root_layer->GetIdealContentsScale()); 7962 EXPECT_FLOAT_EQ(12.f, root_layer->GetIdealContentsScale());
7968 EXPECT_FLOAT_EQ(36.f, child1_layer->GetIdealContentsScale()); 7963 EXPECT_FLOAT_EQ(36.f, child1_layer->GetIdealContentsScale());
7969 EXPECT_FLOAT_EQ(36.f, child1_layer->mask_layer()->GetIdealContentsScale());
7970 EXPECT_FLOAT_EQ( 7964 EXPECT_FLOAT_EQ(
7971 36.f, 7965 36.f,
7972 child1_layer->replica_layer()->mask_layer()->GetIdealContentsScale()); 7966 child1_layer->test_properties()->mask_layer->GetIdealContentsScale());
7967 EXPECT_FLOAT_EQ(36.f, child1_layer->test_properties()
7968 ->replica_layer->test_properties()
7969 ->mask_layer->GetIdealContentsScale());
7973 EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale()); 7970 EXPECT_FLOAT_EQ(60.f, child2_layer->GetIdealContentsScale());
7974 7971
7975 EXPECT_FLOAT_EQ( 7972 EXPECT_FLOAT_EQ(
7976 0.f, root_layer->draw_properties().maximum_animation_contents_scale); 7973 0.f, root_layer->draw_properties().maximum_animation_contents_scale);
7977 EXPECT_FLOAT_EQ( 7974 EXPECT_FLOAT_EQ(
7978 0.f, child1_layer->draw_properties().maximum_animation_contents_scale); 7975 0.f, child1_layer->draw_properties().maximum_animation_contents_scale);
7979 EXPECT_FLOAT_EQ(0.f,
7980 child1_layer->mask_layer()
7981 ->draw_properties()
7982 .maximum_animation_contents_scale);
7983 EXPECT_FLOAT_EQ(0.f,
7984 child1_layer->replica_layer()
7985 ->mask_layer()
7986 ->draw_properties()
7987 .maximum_animation_contents_scale);
7988 EXPECT_FLOAT_EQ( 7976 EXPECT_FLOAT_EQ(
7989 96.f, child2_layer->draw_properties().maximum_animation_contents_scale); 7977 96.f, child2_layer->draw_properties().maximum_animation_contents_scale);
7990 } 7978 }
7991 7979
7992 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) { 7980 TEST_F(LayerTreeHostCommonTest, VisibleContentRectInChildRenderSurface) {
7993 LayerImpl* root = root_layer(); 7981 LayerImpl* root = root_layer();
7994 LayerImpl* clip = AddChild<LayerImpl>(root); 7982 LayerImpl* clip = AddChild<LayerImpl>(root);
7995 LayerImpl* content = AddChild<LayerImpl>(clip); 7983 LayerImpl* content = AddChild<LayerImpl>(clip);
7996 7984
7997 const gfx::Transform identity_matrix; 7985 const gfx::Transform identity_matrix;
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
9682 EXPECT_EQ(gfx::Rect(-10, -10, 30, 30), render_surface2->clip_rect()); 9670 EXPECT_EQ(gfx::Rect(-10, -10, 30, 30), render_surface2->clip_rect());
9683 // A clip node is created for every render surface and for layers that have 9671 // A clip node is created for every render surface and for layers that have
9684 // local clip. So, here it should be craeted for every layer. 9672 // local clip. So, here it should be craeted for every layer.
9685 EXPECT_EQ(root->layer_tree_impl()->property_trees()->clip_tree.size(), 5u); 9673 EXPECT_EQ(root->layer_tree_impl()->property_trees()->clip_tree.size(), 5u);
9686 } 9674 }
9687 9675
9688 TEST_F(LayerTreeHostCommonTest, MaskLayerDrawProperties) { 9676 TEST_F(LayerTreeHostCommonTest, MaskLayerDrawProperties) {
9689 // Tests that a mask layer's draw properties are computed correctly. 9677 // Tests that a mask layer's draw properties are computed correctly.
9690 LayerImpl* root = root_layer(); 9678 LayerImpl* root = root_layer();
9691 LayerImpl* child = AddChild<LayerImpl>(root); 9679 LayerImpl* child = AddChild<LayerImpl>(root);
9692 child->SetMaskLayer(LayerImpl::Create(root->layer_tree_impl(), 100)); 9680 child->test_properties()->SetMaskLayer(
9681 LayerImpl::Create(root->layer_tree_impl(), 100));
9682 LayerImpl* mask = child->test_properties()->mask_layer;
9693 9683
9694 const gfx::Transform identity_matrix; 9684 const gfx::Transform identity_matrix;
9695 gfx::Transform transform; 9685 gfx::Transform transform;
9696 transform.Translate(10, 10); 9686 transform.Translate(10, 10);
9697 9687
9698 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9688 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9699 gfx::PointF(), gfx::Size(40, 40), true, false, 9689 gfx::PointF(), gfx::Size(40, 40), true, false,
9700 true); 9690 true);
9701 SetLayerPropertiesForTesting(child, transform, gfx::Point3F(), gfx::PointF(), 9691 SetLayerPropertiesForTesting(child, transform, gfx::Point3F(), gfx::PointF(),
9702 gfx::Size(30, 30), true, false, false); 9692 gfx::Size(30, 30), true, false, false);
9703 SetLayerPropertiesForTesting(child->mask_layer(), identity_matrix, 9693 SetLayerPropertiesForTesting(mask, identity_matrix, gfx::Point3F(),
9704 gfx::Point3F(), gfx::PointF(), gfx::Size(20, 20), 9694 gfx::PointF(), gfx::Size(20, 20), true, false,
9705 true, false, false); 9695 false);
9706 root->SetDrawsContent(true); 9696 root->SetDrawsContent(true);
9707 child->SetDrawsContent(false); 9697 child->SetDrawsContent(false);
9708 ExecuteCalculateDrawProperties(root); 9698 ExecuteCalculateDrawProperties(root);
9709 9699
9710 // The render surface created for the mask has no contributing content, so the 9700 // The render surface created for the mask has no contributing content, so the
9711 // mask isn't a drawn RSLL member. This means it has an empty visible rect, 9701 // mask isn't a drawn RSLL member. This means it has an empty visible rect,
9712 // but its screen space transform can still be computed correctly on-demand. 9702 // but its screen space transform can still be computed correctly on-demand.
9713 EXPECT_FALSE( 9703 EXPECT_FALSE(mask->is_drawn_render_surface_layer_list_member());
9714 child->mask_layer()->is_drawn_render_surface_layer_list_member()); 9704 EXPECT_EQ(gfx::Rect(), mask->visible_layer_rect());
9715 EXPECT_EQ(gfx::Rect(), child->mask_layer()->visible_layer_rect()); 9705 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, mask->ScreenSpaceTransform());
9716 EXPECT_TRANSFORMATION_MATRIX_EQ(transform,
9717 child->mask_layer()->ScreenSpaceTransform());
9718 9706
9719 // Make the child's render surface have contributing content. 9707 // Make the child's render surface have contributing content.
9720 child->SetDrawsContent(true); 9708 child->SetDrawsContent(true);
9721 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 9709 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
9722 ExecuteCalculateDrawProperties(root); 9710 ExecuteCalculateDrawProperties(root);
9723 EXPECT_TRUE(child->mask_layer()->is_drawn_render_surface_layer_list_member()); 9711 EXPECT_TRUE(mask->is_drawn_render_surface_layer_list_member());
9724 EXPECT_EQ(gfx::Rect(20, 20), child->mask_layer()->visible_layer_rect()); 9712 EXPECT_EQ(gfx::Rect(20, 20), mask->visible_layer_rect());
9725 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, 9713 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, mask->ScreenSpaceTransform());
9726 child->mask_layer()->ScreenSpaceTransform());
9727 9714
9728 transform.Translate(10, 10); 9715 transform.Translate(10, 10);
9729 child->SetTransform(transform); 9716 child->SetTransform(transform);
9730 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 9717 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
9731 ExecuteCalculateDrawProperties(root); 9718 ExecuteCalculateDrawProperties(root);
9732 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, 9719 EXPECT_TRANSFORMATION_MATRIX_EQ(transform, mask->ScreenSpaceTransform());
9733 child->mask_layer()->ScreenSpaceTransform()); 9720 EXPECT_EQ(gfx::Rect(20, 20), mask->visible_layer_rect());
9734 EXPECT_EQ(gfx::Rect(20, 20), child->mask_layer()->visible_layer_rect());
9735 } 9721 }
9736 9722
9737 TEST_F(LayerTreeHostCommonTest, ReplicaMaskLayerDrawProperties) { 9723 TEST_F(LayerTreeHostCommonTest, ReplicaMaskLayerDrawProperties) {
9738 // Tests that a replica mask layer's draw properties are computed correctly. 9724 // Tests that a replica mask layer's draw properties are computed correctly.
9739 LayerImpl* root = root_layer(); 9725 LayerImpl* root = root_layer();
9740 LayerImpl* child = AddChild<LayerImpl>(root); 9726 LayerImpl* child = AddChild<LayerImpl>(root);
9741 child->SetReplicaLayer(LayerImpl::Create(root->layer_tree_impl(), 100)); 9727 child->test_properties()->SetReplicaLayer(
9742 child->replica_layer()->SetParent(child); 9728 LayerImpl::Create(root->layer_tree_impl(), 100));
9743 child->replica_layer()->SetMaskLayer( 9729 LayerImpl* replica = child->test_properties()->replica_layer;
9730 replica->SetParent(child);
9731 replica->test_properties()->SetMaskLayer(
9744 LayerImpl::Create(root->layer_tree_impl(), 200)); 9732 LayerImpl::Create(root->layer_tree_impl(), 200));
9733 LayerImpl* replica_mask = replica->test_properties()->mask_layer;
9745 9734
9746 const gfx::Transform identity_matrix; 9735 const gfx::Transform identity_matrix;
9747 gfx::Transform transform; 9736 gfx::Transform transform;
9748 transform.Translate(10, 10); 9737 transform.Translate(10, 10);
9749 9738
9750 gfx::PointF replica_position(3.f, 3.f); 9739 gfx::PointF replica_position(3.f, 3.f);
9751 9740
9752 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(), 9741 SetLayerPropertiesForTesting(root, identity_matrix, gfx::Point3F(),
9753 gfx::PointF(), gfx::Size(40, 40), true, false, 9742 gfx::PointF(), gfx::Size(40, 40), true, false,
9754 true); 9743 true);
9755 SetLayerPropertiesForTesting(child, transform, gfx::Point3F(), gfx::PointF(), 9744 SetLayerPropertiesForTesting(child, transform, gfx::Point3F(), gfx::PointF(),
9756 gfx::Size(30, 30), true, false, false); 9745 gfx::Size(30, 30), true, false, false);
9757 SetLayerPropertiesForTesting(child->replica_layer(), identity_matrix, 9746 SetLayerPropertiesForTesting(replica, identity_matrix, gfx::Point3F(),
9758 gfx::Point3F(), replica_position, 9747 replica_position, gfx::Size(30, 30), true, false,
9759 gfx::Size(30, 30), true, false, false); 9748 false);
9760 SetLayerPropertiesForTesting(child->replica_layer()->mask_layer(), 9749 SetLayerPropertiesForTesting(replica_mask, identity_matrix, gfx::Point3F(),
9761 identity_matrix, gfx::Point3F(), gfx::PointF(), 9750 gfx::PointF(), gfx::Size(20, 20), true, false,
9762 gfx::Size(20, 20), true, false, false); 9751 false);
9763 root->SetDrawsContent(true); 9752 root->SetDrawsContent(true);
9764 child->SetDrawsContent(false); 9753 child->SetDrawsContent(false);
9765 ExecuteCalculateDrawProperties(root); 9754 ExecuteCalculateDrawProperties(root);
9766 9755
9767 // The render surface created for the replica has no contributing content, so 9756 // The render surface created for the replica has no contributing content, so
9768 // the replica's mask isn't a drawn RSLL member. This means it has an empty 9757 // the replica's mask isn't a drawn RSLL member. This means it has an empty
9769 // visible rect, but its screen space transform can still be computed 9758 // visible rect, but its screen space transform can still be computed
9770 // correctly on-demand. 9759 // correctly on-demand.
9771 EXPECT_FALSE(child->replica_layer() 9760 EXPECT_FALSE(replica_mask->is_drawn_render_surface_layer_list_member());
9772 ->mask_layer() 9761 EXPECT_EQ(gfx::Rect(), replica_mask->visible_layer_rect());
9773 ->is_drawn_render_surface_layer_list_member());
9774 EXPECT_EQ(gfx::Rect(),
9775 child->replica_layer()->mask_layer()->visible_layer_rect());
9776 9762
9777 gfx::Transform expected_screen_space_transform = transform; 9763 gfx::Transform expected_screen_space_transform = transform;
9778 expected_screen_space_transform.Translate(replica_position.x(), 9764 expected_screen_space_transform.Translate(replica_position.x(),
9779 replica_position.y()); 9765 replica_position.y());
9780 9766
9781 EXPECT_TRANSFORMATION_MATRIX_EQ( 9767 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_screen_space_transform,
9782 expected_screen_space_transform, 9768 replica_mask->ScreenSpaceTransform());
9783 child->replica_layer()->mask_layer()->ScreenSpaceTransform());
9784 9769
9785 // Make the child's render surface have contributing content. 9770 // Make the child's render surface have contributing content.
9786 child->SetDrawsContent(true); 9771 child->SetDrawsContent(true);
9787 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 9772 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
9788 ExecuteCalculateDrawProperties(root); 9773 ExecuteCalculateDrawProperties(root);
9789 EXPECT_TRUE(child->replica_layer() 9774 EXPECT_TRUE(replica_mask->is_drawn_render_surface_layer_list_member());
9790 ->mask_layer() 9775 EXPECT_EQ(gfx::Rect(20, 20), replica_mask->visible_layer_rect());
9791 ->is_drawn_render_surface_layer_list_member()); 9776 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_screen_space_transform,
9792 EXPECT_EQ(gfx::Rect(20, 20), 9777 replica_mask->ScreenSpaceTransform());
9793 child->replica_layer()->mask_layer()->visible_layer_rect());
9794 EXPECT_TRANSFORMATION_MATRIX_EQ(
9795 expected_screen_space_transform,
9796 child->replica_layer()->mask_layer()->ScreenSpaceTransform());
9797 } 9778 }
9798 9779
9799 TEST_F(LayerTreeHostCommonTest, 9780 TEST_F(LayerTreeHostCommonTest,
9800 SublayerScaleWithTransformNodeBetweenTwoTargets) { 9781 SublayerScaleWithTransformNodeBetweenTwoTargets) {
9801 LayerImpl* root = root_layer(); 9782 LayerImpl* root = root_layer();
9802 LayerImpl* render_surface1 = AddChild<LayerImpl>(root); 9783 LayerImpl* render_surface1 = AddChild<LayerImpl>(root);
9803 LayerImpl* between_targets = AddChild<LayerImpl>(render_surface1); 9784 LayerImpl* between_targets = AddChild<LayerImpl>(render_surface1);
9804 LayerImpl* render_surface2 = AddChild<LayerImpl>(between_targets); 9785 LayerImpl* render_surface2 = AddChild<LayerImpl>(between_targets);
9805 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface2); 9786 LayerImpl* test_layer = AddChild<LayerImpl>(render_surface2);
9806 const gfx::Transform identity_matrix; 9787 const gfx::Transform identity_matrix;
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
10280 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10261 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10281 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10262 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10282 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10263 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10283 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10264 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10284 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10265 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10285 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10266 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10286 } 10267 }
10287 10268
10288 } // namespace 10269 } // namespace
10289 } // namespace cc 10270 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_common.cc ('k') | cc/trees/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698