| OLD | NEW |
| 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 <set> | 10 #include <set> |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 SetLayerPropertiesForTesting(grand_child_of_rs2, layer_transform, | 813 SetLayerPropertiesForTesting(grand_child_of_rs2, layer_transform, |
| 814 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), | 814 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), |
| 815 gfx::Size(10, 10), true, false, false); | 815 gfx::Size(10, 10), true, false, false); |
| 816 SetLayerPropertiesForTesting(replica_of_rs1.get(), replica_layer_transform, | 816 SetLayerPropertiesForTesting(replica_of_rs1.get(), replica_layer_transform, |
| 817 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), | 817 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), |
| 818 gfx::Size(), true, false, false); | 818 gfx::Size(), true, false, false); |
| 819 SetLayerPropertiesForTesting(replica_of_rs2.get(), replica_layer_transform, | 819 SetLayerPropertiesForTesting(replica_of_rs2.get(), replica_layer_transform, |
| 820 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), | 820 gfx::Point3F(2.5f, 0.f, 0.f), gfx::PointF(), |
| 821 gfx::Size(), true, false, false); | 821 gfx::Size(), true, false, false); |
| 822 | 822 |
| 823 // We need to set parent on replica layers for property tree building. |
| 824 replica_of_rs1->SetParent(render_surface1); |
| 825 replica_of_rs2->SetParent(render_surface2); |
| 823 render_surface1->SetReplicaLayer(std::move(replica_of_rs1)); | 826 render_surface1->SetReplicaLayer(std::move(replica_of_rs1)); |
| 824 render_surface2->SetReplicaLayer(std::move(replica_of_rs2)); | 827 render_surface2->SetReplicaLayer(std::move(replica_of_rs2)); |
| 825 ExecuteCalculateDrawProperties(root); | 828 ExecuteCalculateDrawProperties(root); |
| 826 | 829 |
| 827 // Only layers that are associated with render surfaces should have an actual | 830 // Only layers that are associated with render surfaces should have an actual |
| 828 // RenderSurface() value. | 831 // RenderSurface() value. |
| 829 ASSERT_TRUE(root->render_surface()); | 832 ASSERT_TRUE(root->render_surface()); |
| 830 ASSERT_FALSE(child_of_root->render_surface()); | 833 ASSERT_FALSE(child_of_root->render_surface()); |
| 831 ASSERT_FALSE(grand_child_of_root->render_surface()); | 834 ASSERT_FALSE(grand_child_of_root->render_surface()); |
| 832 | 835 |
| (...skipping 4101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4934 true, true); | 4937 true, true); |
| 4935 | 4938 |
| 4936 gfx::Transform replica_transform; | 4939 gfx::Transform replica_transform; |
| 4937 replica_transform.Scale(1.0, -1.0); | 4940 replica_transform.Scale(1.0, -1.0); |
| 4938 | 4941 |
| 4939 scoped_ptr<LayerImpl> replica = | 4942 scoped_ptr<LayerImpl> replica = |
| 4940 LayerImpl::Create(host_impl()->active_tree(), 7); | 4943 LayerImpl::Create(host_impl()->active_tree(), 7); |
| 4941 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), | 4944 SetLayerPropertiesForTesting(replica.get(), replica_transform, gfx::Point3F(), |
| 4942 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, | 4945 gfx::PointF(2.f, 2.f), gfx::Size(10, 10), false, |
| 4943 true, false); | 4946 true, false); |
| 4947 // We need to set parent on replica layer for property tree building. |
| 4948 replica->SetParent(child); |
| 4944 child->SetReplicaLayer(std::move(replica)); | 4949 child->SetReplicaLayer(std::move(replica)); |
| 4945 | 4950 |
| 4946 // This layer should end up in the same surface as child, with the same draw | 4951 // This layer should end up in the same surface as child, with the same draw |
| 4947 // and screen space transforms. | 4952 // and screen space transforms. |
| 4948 LayerImpl* duplicate_child_non_owner = AddChild<LayerImpl>(child); | 4953 LayerImpl* duplicate_child_non_owner = AddChild<LayerImpl>(child); |
| 4949 duplicate_child_non_owner->SetDrawsContent(true); | 4954 duplicate_child_non_owner->SetDrawsContent(true); |
| 4950 SetLayerPropertiesForTesting(duplicate_child_non_owner, identity_matrix, | 4955 SetLayerPropertiesForTesting(duplicate_child_non_owner, identity_matrix, |
| 4951 gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10), | 4956 gfx::Point3F(), gfx::PointF(), gfx::Size(10, 10), |
| 4952 false, true, false); | 4957 false, true, false); |
| 4953 | 4958 |
| (...skipping 4930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9884 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 9889 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 9885 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 9890 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 9886 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 9891 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 9887 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 9892 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 9888 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 9893 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 9889 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 9894 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 9890 } | 9895 } |
| 9891 | 9896 |
| 9892 } // namespace | 9897 } // namespace |
| 9893 } // namespace cc | 9898 } // namespace cc |
| OLD | NEW |