| 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/property_tree.h" | 5 #include "cc/trees/property_tree.h" |
| 6 | 6 |
| 7 #include "cc/input/main_thread_scrolling_reason.h" | 7 #include "cc/input/main_thread_scrolling_reason.h" |
| 8 #include "cc/proto/property_tree.pb.h" | 8 #include "cc/proto/property_tree.pb.h" |
| 9 #include "cc/test/geometry_test_utils.h" | 9 #include "cc/test/geometry_test_utils.h" |
| 10 #include "cc/trees/clip_node.h" | 10 #include "cc/trees/clip_node.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 original.needs_local_transform_update = false; | 30 original.needs_local_transform_update = false; |
| 31 original.is_invertible = false; | 31 original.is_invertible = false; |
| 32 original.ancestors_are_invertible = false; | 32 original.ancestors_are_invertible = false; |
| 33 original.has_potential_animation = false; | 33 original.has_potential_animation = false; |
| 34 original.to_screen_is_potentially_animated = false; | 34 original.to_screen_is_potentially_animated = false; |
| 35 original.has_only_translation_animations = false; | 35 original.has_only_translation_animations = false; |
| 36 original.flattens_inherited_transform = false; | 36 original.flattens_inherited_transform = false; |
| 37 original.node_and_ancestors_are_flat = false; | 37 original.node_and_ancestors_are_flat = false; |
| 38 original.node_and_ancestors_have_only_integer_translation = false; | 38 original.node_and_ancestors_have_only_integer_translation = false; |
| 39 original.scrolls = false; | 39 original.scrolls = false; |
| 40 original.needs_sublayer_scale = false; | 40 original.needs_surface_contents_scale = false; |
| 41 original.affected_by_inner_viewport_bounds_delta_x = false; | 41 original.affected_by_inner_viewport_bounds_delta_x = false; |
| 42 original.affected_by_inner_viewport_bounds_delta_y = false; | 42 original.affected_by_inner_viewport_bounds_delta_y = false; |
| 43 original.affected_by_outer_viewport_bounds_delta_x = false; | 43 original.affected_by_outer_viewport_bounds_delta_x = false; |
| 44 original.affected_by_outer_viewport_bounds_delta_y = false; | 44 original.affected_by_outer_viewport_bounds_delta_y = false; |
| 45 original.in_subtree_of_page_scale_layer = false; | 45 original.in_subtree_of_page_scale_layer = false; |
| 46 original.post_local_scale_factor = 0.5f; | 46 original.post_local_scale_factor = 0.5f; |
| 47 original.sublayer_scale = gfx::Vector2dF(0.5f, 0.5f); | 47 original.surface_contents_scale = gfx::Vector2dF(0.5f, 0.5f); |
| 48 original.scroll_offset = gfx::ScrollOffset(1.5f, 1.5f); | 48 original.scroll_offset = gfx::ScrollOffset(1.5f, 1.5f); |
| 49 original.scroll_snap = gfx::Vector2dF(0.4f, 0.4f); | 49 original.scroll_snap = gfx::Vector2dF(0.4f, 0.4f); |
| 50 original.source_offset = gfx::Vector2dF(2.5f, 2.4f); | 50 original.source_offset = gfx::Vector2dF(2.5f, 2.4f); |
| 51 original.source_to_parent = gfx::Vector2dF(3.2f, 3.2f); | 51 original.source_to_parent = gfx::Vector2dF(3.2f, 3.2f); |
| 52 | 52 |
| 53 proto::TreeNode proto; | 53 proto::TreeNode proto; |
| 54 original.ToProtobuf(&proto); | 54 original.ToProtobuf(&proto); |
| 55 TransformNode result; | 55 TransformNode result; |
| 56 result.FromProtobuf(proto); | 56 result.FromProtobuf(proto); |
| 57 | 57 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 original.parent_id = 2; | 167 original.parent_id = 2; |
| 168 original.owner_id = 4; | 168 original.owner_id = 4; |
| 169 original.opacity = 0.5f; | 169 original.opacity = 0.5f; |
| 170 original.screen_space_opacity = 0.6f; | 170 original.screen_space_opacity = 0.6f; |
| 171 original.has_render_surface = false; | 171 original.has_render_surface = false; |
| 172 original.transform_id = 2; | 172 original.transform_id = 2; |
| 173 original.clip_id = 3; | 173 original.clip_id = 3; |
| 174 original.mask_layer_id = 6; | 174 original.mask_layer_id = 6; |
| 175 original.replica_layer_id = 10; | 175 original.replica_layer_id = 10; |
| 176 original.replica_mask_layer_id = 9; | 176 original.replica_mask_layer_id = 9; |
| 177 original.sublayer_scale = gfx::Vector2dF(0.5f, 0.5f); | 177 original.surface_contents_scale = gfx::Vector2dF(0.5f, 0.5f); |
| 178 | 178 |
| 179 proto::TreeNode proto; | 179 proto::TreeNode proto; |
| 180 original.ToProtobuf(&proto); | 180 original.ToProtobuf(&proto); |
| 181 EffectNode result; | 181 EffectNode result; |
| 182 result.FromProtobuf(proto); | 182 result.FromProtobuf(proto); |
| 183 | 183 |
| 184 EXPECT_EQ(original, result); | 184 EXPECT_EQ(original, result); |
| 185 } | 185 } |
| 186 | 186 |
| 187 TEST(PropertyTreeSerializationTest, EffectTreeSerialization) { | 187 TEST(PropertyTreeSerializationTest, EffectTreeSerialization) { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 | 599 |
| 600 int grand_parent = tree.Insert(TransformNode(), 0); | 600 int grand_parent = tree.Insert(TransformNode(), 0); |
| 601 tree.SetContentTargetId(grand_parent, grand_parent); | 601 tree.SetContentTargetId(grand_parent, grand_parent); |
| 602 tree.SetTargetId(grand_parent, grand_parent); | 602 tree.SetTargetId(grand_parent, grand_parent); |
| 603 tree.Node(grand_parent)->source_node_id = 0; | 603 tree.Node(grand_parent)->source_node_id = 0; |
| 604 | 604 |
| 605 gfx::Transform rotation_about_x; | 605 gfx::Transform rotation_about_x; |
| 606 rotation_about_x.RotateAboutXAxis(15); | 606 rotation_about_x.RotateAboutXAxis(15); |
| 607 | 607 |
| 608 int parent = tree.Insert(TransformNode(), grand_parent); | 608 int parent = tree.Insert(TransformNode(), grand_parent); |
| 609 tree.Node(parent)->needs_sublayer_scale = true; | 609 tree.Node(parent)->needs_surface_contents_scale = true; |
| 610 tree.SetTargetId(parent, grand_parent); | 610 tree.SetTargetId(parent, grand_parent); |
| 611 tree.SetContentTargetId(parent, parent); | 611 tree.SetContentTargetId(parent, parent); |
| 612 tree.Node(parent)->source_node_id = grand_parent; | 612 tree.Node(parent)->source_node_id = grand_parent; |
| 613 tree.Node(parent)->local = rotation_about_x; | 613 tree.Node(parent)->local = rotation_about_x; |
| 614 | 614 |
| 615 int child = tree.Insert(TransformNode(), parent); | 615 int child = tree.Insert(TransformNode(), parent); |
| 616 tree.SetTargetId(child, parent); | 616 tree.SetTargetId(child, parent); |
| 617 tree.SetContentTargetId(child, parent); | 617 tree.SetContentTargetId(child, parent); |
| 618 tree.Node(child)->source_node_id = parent; | 618 tree.Node(child)->source_node_id = parent; |
| 619 tree.Node(child)->flattens_inherited_transform = true; | 619 tree.Node(child)->flattens_inherited_transform = true; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 // To compute this would require inverting the 0 matrix, so we cannot | 748 // To compute this would require inverting the 0 matrix, so we cannot |
| 749 // succeed. | 749 // succeed. |
| 750 success = tree.ComputeTransform(0, 1, &inverse); | 750 success = tree.ComputeTransform(0, 1, &inverse); |
| 751 EXPECT_FALSE(success); | 751 EXPECT_FALSE(success); |
| 752 } | 752 } |
| 753 }; | 753 }; |
| 754 | 754 |
| 755 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 755 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 756 PropertyTreeTestComputeTransformWithUninvertibleTransform); | 756 PropertyTreeTestComputeTransformWithUninvertibleTransform); |
| 757 | 757 |
| 758 class PropertyTreeTestComputeTransformWithSublayerScale | 758 class PropertyTreeTestComputeTransformWithSurfaceContentsScale |
| 759 : public PropertyTreeTest { | 759 : public PropertyTreeTest { |
| 760 protected: | 760 protected: |
| 761 void StartTest() override { | 761 void StartTest() override { |
| 762 PropertyTrees property_trees; | 762 PropertyTrees property_trees; |
| 763 TransformTree& tree = property_trees.transform_tree; | 763 TransformTree& tree = property_trees.transform_tree; |
| 764 TransformNode& root = *tree.Node(0); | 764 TransformNode& root = *tree.Node(0); |
| 765 root.id = 0; | 765 root.id = 0; |
| 766 tree.SetTargetId(root.id, 0); | 766 tree.SetTargetId(root.id, 0); |
| 767 tree.UpdateTransforms(0); | 767 tree.UpdateTransforms(0); |
| 768 | 768 |
| 769 TransformNode grand_parent; | 769 TransformNode grand_parent; |
| 770 grand_parent.local.Scale(2.f, 2.f); | 770 grand_parent.local.Scale(2.f, 2.f); |
| 771 grand_parent.source_node_id = 0; | 771 grand_parent.source_node_id = 0; |
| 772 grand_parent.needs_sublayer_scale = true; | 772 grand_parent.needs_surface_contents_scale = true; |
| 773 int grand_parent_id = tree.Insert(grand_parent, 0); | 773 int grand_parent_id = tree.Insert(grand_parent, 0); |
| 774 tree.SetTargetId(grand_parent_id, 0); | 774 tree.SetTargetId(grand_parent_id, 0); |
| 775 tree.UpdateTransforms(grand_parent_id); | 775 tree.UpdateTransforms(grand_parent_id); |
| 776 | 776 |
| 777 TransformNode parent; | 777 TransformNode parent; |
| 778 parent.local.Translate(15.f, 15.f); | 778 parent.local.Translate(15.f, 15.f); |
| 779 parent.source_node_id = grand_parent_id; | 779 parent.source_node_id = grand_parent_id; |
| 780 int parent_id = tree.Insert(parent, grand_parent_id); | 780 int parent_id = tree.Insert(parent, grand_parent_id); |
| 781 tree.SetTargetId(parent_id, grand_parent_id); | 781 tree.SetTargetId(parent_id, grand_parent_id); |
| 782 tree.UpdateTransforms(parent_id); | 782 tree.UpdateTransforms(parent_id); |
| 783 | 783 |
| 784 TransformNode child; | 784 TransformNode child; |
| 785 child.local.Scale(3.f, 3.f); | 785 child.local.Scale(3.f, 3.f); |
| 786 child.source_node_id = parent_id; | 786 child.source_node_id = parent_id; |
| 787 int child_id = tree.Insert(child, parent_id); | 787 int child_id = tree.Insert(child, parent_id); |
| 788 tree.SetTargetId(child_id, grand_parent_id); | 788 tree.SetTargetId(child_id, grand_parent_id); |
| 789 tree.UpdateTransforms(child_id); | 789 tree.UpdateTransforms(child_id); |
| 790 | 790 |
| 791 TransformNode grand_child; | 791 TransformNode grand_child; |
| 792 grand_child.local.Scale(5.f, 5.f); | 792 grand_child.local.Scale(5.f, 5.f); |
| 793 grand_child.source_node_id = child_id; | 793 grand_child.source_node_id = child_id; |
| 794 grand_child.needs_sublayer_scale = true; | 794 grand_child.needs_surface_contents_scale = true; |
| 795 int grand_child_id = tree.Insert(grand_child, child_id); | 795 int grand_child_id = tree.Insert(grand_child, child_id); |
| 796 tree.SetTargetId(grand_child_id, grand_parent_id); | 796 tree.SetTargetId(grand_child_id, grand_parent_id); |
| 797 SetupTransformTreeForTest(&tree); | 797 SetupTransformTreeForTest(&tree); |
| 798 tree.UpdateTransforms(grand_child_id); | 798 tree.UpdateTransforms(grand_child_id); |
| 799 | 799 |
| 800 EXPECT_EQ(gfx::Vector2dF(2.f, 2.f), | 800 EXPECT_EQ(gfx::Vector2dF(2.f, 2.f), |
| 801 tree.Node(grand_parent_id)->sublayer_scale); | 801 tree.Node(grand_parent_id)->surface_contents_scale); |
| 802 EXPECT_EQ(gfx::Vector2dF(30.f, 30.f), | 802 EXPECT_EQ(gfx::Vector2dF(30.f, 30.f), |
| 803 tree.Node(grand_child_id)->sublayer_scale); | 803 tree.Node(grand_child_id)->surface_contents_scale); |
| 804 | 804 |
| 805 // Compute transform from grand_parent to grand_child. | 805 // Compute transform from grand_parent to grand_child. |
| 806 gfx::Transform expected_transform_without_sublayer_scale; | 806 gfx::Transform expected_transform_without_surface_contents_scale; |
| 807 expected_transform_without_sublayer_scale.Scale(1.f / 15.f, 1.f / 15.f); | 807 expected_transform_without_surface_contents_scale.Scale(1.f / 15.f, |
| 808 expected_transform_without_sublayer_scale.Translate(-15.f, -15.f); | 808 1.f / 15.f); |
| 809 expected_transform_without_surface_contents_scale.Translate(-15.f, -15.f); |
| 809 | 810 |
| 810 gfx::Transform expected_transform_with_dest_sublayer_scale; | 811 gfx::Transform expected_transform_with_dest_surface_contents_scale; |
| 811 expected_transform_with_dest_sublayer_scale.Scale(30.f, 30.f); | 812 expected_transform_with_dest_surface_contents_scale.Scale(30.f, 30.f); |
| 812 expected_transform_with_dest_sublayer_scale.Scale(1.f / 15.f, 1.f / 15.f); | 813 expected_transform_with_dest_surface_contents_scale.Scale(1.f / 15.f, |
| 813 expected_transform_with_dest_sublayer_scale.Translate(-15.f, -15.f); | 814 1.f / 15.f); |
| 815 expected_transform_with_dest_surface_contents_scale.Translate(-15.f, -15.f); |
| 814 | 816 |
| 815 gfx::Transform expected_transform_with_source_sublayer_scale; | 817 gfx::Transform expected_transform_with_source_surface_contents_scale; |
| 816 expected_transform_with_source_sublayer_scale.Scale(1.f / 15.f, 1.f / 15.f); | 818 expected_transform_with_source_surface_contents_scale.Scale(1.f / 15.f, |
| 817 expected_transform_with_source_sublayer_scale.Translate(-15.f, -15.f); | 819 1.f / 15.f); |
| 818 expected_transform_with_source_sublayer_scale.Scale(0.5f, 0.5f); | 820 expected_transform_with_source_surface_contents_scale.Translate(-15.f, |
| 821 -15.f); |
| 822 expected_transform_with_source_surface_contents_scale.Scale(0.5f, 0.5f); |
| 819 | 823 |
| 820 gfx::Transform transform; | 824 gfx::Transform transform; |
| 821 bool success = | 825 bool success = |
| 822 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); | 826 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); |
| 823 EXPECT_TRUE(success); | 827 EXPECT_TRUE(success); |
| 824 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_without_sublayer_scale, | 828 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 825 transform); | 829 expected_transform_without_surface_contents_scale, transform); |
| 826 | 830 |
| 827 success = tree.ComputeTransformWithDestinationSublayerScale( | 831 success = tree.ComputeTransformWithDestinationSurfaceContentsScale( |
| 828 grand_parent_id, grand_child_id, &transform); | |
| 829 EXPECT_TRUE(success); | |
| 830 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_dest_sublayer_scale, | |
| 831 transform); | |
| 832 | |
| 833 success = tree.ComputeTransformWithSourceSublayerScale( | |
| 834 grand_parent_id, grand_child_id, &transform); | 832 grand_parent_id, grand_child_id, &transform); |
| 835 EXPECT_TRUE(success); | 833 EXPECT_TRUE(success); |
| 836 EXPECT_TRANSFORMATION_MATRIX_EQ( | 834 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 837 expected_transform_with_source_sublayer_scale, transform); | 835 expected_transform_with_dest_surface_contents_scale, transform); |
| 836 |
| 837 success = |
| 838 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); |
| 839 const TransformNode* grand_parent_node = tree.Node(grand_parent_id); |
| 840 EXPECT_NE(grand_parent_node->surface_contents_scale.x(), 0.f); |
| 841 EXPECT_NE(grand_parent_node->surface_contents_scale.y(), 0.f); |
| 842 transform.Scale(1.0 / grand_parent_node->surface_contents_scale.x(), |
| 843 1.0 / grand_parent_node->surface_contents_scale.y()); |
| 844 EXPECT_TRUE(success); |
| 845 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 846 expected_transform_with_source_surface_contents_scale, transform); |
| 838 | 847 |
| 839 // Now compute transform from grand_child to grand_parent. | 848 // Now compute transform from grand_child to grand_parent. |
| 840 expected_transform_without_sublayer_scale.MakeIdentity(); | 849 expected_transform_without_surface_contents_scale.MakeIdentity(); |
| 841 expected_transform_without_sublayer_scale.Translate(15.f, 15.f); | 850 expected_transform_without_surface_contents_scale.Translate(15.f, 15.f); |
| 842 expected_transform_without_sublayer_scale.Scale(15.f, 15.f); | 851 expected_transform_without_surface_contents_scale.Scale(15.f, 15.f); |
| 843 | 852 |
| 844 expected_transform_with_dest_sublayer_scale.MakeIdentity(); | 853 expected_transform_with_dest_surface_contents_scale.MakeIdentity(); |
| 845 expected_transform_with_dest_sublayer_scale.Scale(2.f, 2.f); | 854 expected_transform_with_dest_surface_contents_scale.Scale(2.f, 2.f); |
| 846 expected_transform_with_dest_sublayer_scale.Translate(15.f, 15.f); | 855 expected_transform_with_dest_surface_contents_scale.Translate(15.f, 15.f); |
| 847 expected_transform_with_dest_sublayer_scale.Scale(15.f, 15.f); | 856 expected_transform_with_dest_surface_contents_scale.Scale(15.f, 15.f); |
| 848 | 857 |
| 849 expected_transform_with_source_sublayer_scale.MakeIdentity(); | 858 expected_transform_with_source_surface_contents_scale.MakeIdentity(); |
| 850 expected_transform_with_source_sublayer_scale.Translate(15.f, 15.f); | 859 expected_transform_with_source_surface_contents_scale.Translate(15.f, 15.f); |
| 851 expected_transform_with_source_sublayer_scale.Scale(15.f, 15.f); | 860 expected_transform_with_source_surface_contents_scale.Scale(15.f, 15.f); |
| 852 expected_transform_with_source_sublayer_scale.Scale(1.f / 30.f, 1.f / 30.f); | 861 expected_transform_with_source_surface_contents_scale.Scale(1.f / 30.f, |
| 862 1.f / 30.f); |
| 853 | 863 |
| 854 success = | 864 success = |
| 855 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); | 865 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); |
| 856 EXPECT_TRUE(success); | 866 EXPECT_TRUE(success); |
| 857 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_without_sublayer_scale, | 867 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 858 transform); | 868 expected_transform_without_surface_contents_scale, transform); |
| 859 | 869 |
| 860 success = tree.ComputeTransformWithDestinationSublayerScale( | 870 success = tree.ComputeTransformWithDestinationSurfaceContentsScale( |
| 861 grand_child_id, grand_parent_id, &transform); | |
| 862 EXPECT_TRUE(success); | |
| 863 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform_with_dest_sublayer_scale, | |
| 864 transform); | |
| 865 | |
| 866 success = tree.ComputeTransformWithSourceSublayerScale( | |
| 867 grand_child_id, grand_parent_id, &transform); | 871 grand_child_id, grand_parent_id, &transform); |
| 868 EXPECT_TRUE(success); | 872 EXPECT_TRUE(success); |
| 869 EXPECT_TRANSFORMATION_MATRIX_EQ( | 873 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 870 expected_transform_with_source_sublayer_scale, transform); | 874 expected_transform_with_dest_surface_contents_scale, transform); |
| 875 |
| 876 success = |
| 877 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); |
| 878 const TransformNode* grand_child_node = tree.Node(grand_child_id); |
| 879 EXPECT_NE(grand_child_node->surface_contents_scale.x(), 0.f); |
| 880 EXPECT_NE(grand_child_node->surface_contents_scale.y(), 0.f); |
| 881 transform.Scale(1.0 / grand_child_node->surface_contents_scale.x(), |
| 882 1.0 / grand_child_node->surface_contents_scale.y()); |
| 883 EXPECT_TRUE(success); |
| 884 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 885 expected_transform_with_source_surface_contents_scale, transform); |
| 871 } | 886 } |
| 872 }; | 887 }; |
| 873 | 888 |
| 874 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 889 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 875 PropertyTreeTestComputeTransformWithSublayerScale); | 890 PropertyTreeTestComputeTransformWithSurfaceContentsScale); |
| 876 | 891 |
| 877 class PropertyTreeTestComputeTransformToTargetWithZeroSublayerScale | 892 class PropertyTreeTestComputeTransformToTargetWithZeroSurfaceContentsScale |
| 878 : public PropertyTreeTest { | 893 : public PropertyTreeTest { |
| 879 protected: | 894 protected: |
| 880 void StartTest() override { | 895 void StartTest() override { |
| 881 PropertyTrees property_trees; | 896 PropertyTrees property_trees; |
| 882 TransformTree& tree = property_trees.transform_tree; | 897 TransformTree& tree = property_trees.transform_tree; |
| 883 TransformNode& root = *tree.Node(0); | 898 TransformNode& root = *tree.Node(0); |
| 884 tree.SetTargetId(root.id, 0); | 899 tree.SetTargetId(root.id, 0); |
| 885 tree.UpdateTransforms(0); | 900 tree.UpdateTransforms(0); |
| 886 | 901 |
| 887 TransformNode grand_parent; | 902 TransformNode grand_parent; |
| 888 grand_parent.local.Scale(2.f, 0.f); | 903 grand_parent.local.Scale(2.f, 0.f); |
| 889 grand_parent.source_node_id = 0; | 904 grand_parent.source_node_id = 0; |
| 890 grand_parent.needs_sublayer_scale = true; | 905 grand_parent.needs_surface_contents_scale = true; |
| 891 int grand_parent_id = tree.Insert(grand_parent, 0); | 906 int grand_parent_id = tree.Insert(grand_parent, 0); |
| 892 tree.SetTargetId(grand_parent_id, 0); | 907 tree.SetTargetId(grand_parent_id, 0); |
| 893 tree.SetContentTargetId(grand_parent_id, grand_parent_id); | 908 tree.SetContentTargetId(grand_parent_id, grand_parent_id); |
| 894 tree.UpdateTransforms(grand_parent_id); | 909 tree.UpdateTransforms(grand_parent_id); |
| 895 | 910 |
| 896 TransformNode parent; | 911 TransformNode parent; |
| 897 parent.local.Translate(1.f, 1.f); | 912 parent.local.Translate(1.f, 1.f); |
| 898 parent.source_node_id = grand_parent_id; | 913 parent.source_node_id = grand_parent_id; |
| 899 int parent_id = tree.Insert(parent, grand_parent_id); | 914 int parent_id = tree.Insert(parent, grand_parent_id); |
| 900 tree.SetTargetId(parent_id, grand_parent_id); | 915 tree.SetTargetId(parent_id, grand_parent_id); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 | 953 |
| 939 draw_property_utils::ComputeTransforms(&tree); | 954 draw_property_utils::ComputeTransforms(&tree); |
| 940 | 955 |
| 941 success = tree.ComputeTransform(child_id, grand_parent_id, &transform); | 956 success = tree.ComputeTransform(child_id, grand_parent_id, &transform); |
| 942 EXPECT_TRUE(success); | 957 EXPECT_TRUE(success); |
| 943 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, transform); | 958 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, transform); |
| 944 } | 959 } |
| 945 }; | 960 }; |
| 946 | 961 |
| 947 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 962 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 948 PropertyTreeTestComputeTransformToTargetWithZeroSublayerScale); | 963 PropertyTreeTestComputeTransformToTargetWithZeroSurfaceContentsScale); |
| 949 | 964 |
| 950 class PropertyTreeTestFlatteningWhenDestinationHasOnlyFlatAncestors | 965 class PropertyTreeTestFlatteningWhenDestinationHasOnlyFlatAncestors |
| 951 : public PropertyTreeTest { | 966 : public PropertyTreeTest { |
| 952 protected: | 967 protected: |
| 953 void StartTest() override { | 968 void StartTest() override { |
| 954 // This tests that flattening is performed correctly when | 969 // This tests that flattening is performed correctly when |
| 955 // destination and its ancestors are flat, but there are 3d transforms | 970 // destination and its ancestors are flat, but there are 3d transforms |
| 956 // and flattening between the source and destination. | 971 // and flattening between the source and destination. |
| 957 PropertyTrees property_trees; | 972 PropertyTrees property_trees; |
| 958 TransformTree& tree = property_trees.transform_tree; | 973 TransformTree& tree = property_trees.transform_tree; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 | 1130 |
| 1116 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1131 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1117 PropertyTreeTestSingularTransformSnapTest); | 1132 PropertyTreeTestSingularTransformSnapTest); |
| 1118 | 1133 |
| 1119 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1134 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
| 1120 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1135 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
| 1121 #undef DIRECT_PROPERTY_TREE_TEST_F | 1136 #undef DIRECT_PROPERTY_TREE_TEST_F |
| 1122 | 1137 |
| 1123 } // namespace | 1138 } // namespace |
| 1124 } // namespace cc | 1139 } // namespace cc |
| OLD | NEW |