| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 third.id = original.Insert(third, 1); | 79 third.id = original.Insert(third, 1); |
| 80 original.SetTargetId(third.id, 0); | 80 original.SetTargetId(third.id, 0); |
| 81 | 81 |
| 82 original.set_needs_update(true); | 82 original.set_needs_update(true); |
| 83 | 83 |
| 84 original.set_page_scale_factor(0.5f); | 84 original.set_page_scale_factor(0.5f); |
| 85 original.set_device_scale_factor(0.6f); | 85 original.set_device_scale_factor(0.6f); |
| 86 gfx::Transform transform = | 86 gfx::Transform transform = |
| 87 gfx::Transform(1.05f, 2.15f, 3.14f, 4.13f, 5.12f, 6.11f, 7.1f, 8.9f, 9.8f, | 87 gfx::Transform(1.05f, 2.15f, 3.14f, 4.13f, 5.12f, 6.11f, 7.1f, 8.9f, 9.8f, |
| 88 10.7f, 11.6f, 12.5f, 13.4f, 14.3f, 15.2f, 16.1f); | 88 10.7f, 11.6f, 12.5f, 13.4f, 14.3f, 15.2f, 16.1f); |
| 89 original.SetRootTransformsAndScales(0.6f, 1.f, transform, gfx::PointF()); | 89 original.SetDeviceTransformScaleFactor(transform); |
| 90 original.AddNodeAffectedByInnerViewportBoundsDelta(0); | 90 original.AddNodeAffectedByInnerViewportBoundsDelta(0); |
| 91 original.AddNodeAffectedByOuterViewportBoundsDelta(1); | 91 original.AddNodeAffectedByOuterViewportBoundsDelta(1); |
| 92 | 92 |
| 93 proto::PropertyTree proto; | 93 proto::PropertyTree proto; |
| 94 original.ToProtobuf(&proto); | 94 original.ToProtobuf(&proto); |
| 95 TransformTree result; | 95 TransformTree result; |
| 96 std::unordered_map<int, int> transform_id_to_index_map; | 96 std::unordered_map<int, int> transform_id_to_index_map; |
| 97 result.FromProtobuf(proto, &transform_id_to_index_map); | 97 result.FromProtobuf(proto, &transform_id_to_index_map); |
| 98 | 98 |
| 99 EXPECT_EQ(transform_id_to_index_map[1], 0); | 99 EXPECT_EQ(transform_id_to_index_map[1], 0); |
| (...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 // This tests that to_target transform is not snapped when it has a singular | 1114 // This tests that to_target transform is not snapped when it has a singular |
| 1115 // transform. | 1115 // transform. |
| 1116 PropertyTrees property_trees; | 1116 PropertyTrees property_trees; |
| 1117 property_trees.verify_transform_tree_calculations = true; | 1117 property_trees.verify_transform_tree_calculations = true; |
| 1118 TransformTree& tree = property_trees.transform_tree; | 1118 TransformTree& tree = property_trees.transform_tree; |
| 1119 EffectTree& effect_tree = property_trees.effect_tree; | 1119 EffectTree& effect_tree = property_trees.effect_tree; |
| 1120 | 1120 |
| 1121 int parent = tree.Insert(TransformNode(), 0); | 1121 int parent = tree.Insert(TransformNode(), 0); |
| 1122 int effect_parent = effect_tree.Insert(EffectNode(), 0); | 1122 int effect_parent = effect_tree.Insert(EffectNode(), 0); |
| 1123 effect_tree.Node(effect_parent)->has_render_surface = true; | 1123 effect_tree.Node(effect_parent)->has_render_surface = true; |
| 1124 effect_tree.Node(effect_parent)->surface_contents_scale = | |
| 1125 gfx::Vector2dF(1.f, 1.f); | |
| 1126 | |
| 1127 tree.SetTargetId(parent, parent); | 1124 tree.SetTargetId(parent, parent); |
| 1128 tree.Node(parent)->scrolls = true; | 1125 tree.Node(parent)->scrolls = true; |
| 1129 tree.Node(parent)->source_node_id = 0; | 1126 tree.Node(parent)->source_node_id = 0; |
| 1130 | 1127 |
| 1131 int child = tree.Insert(TransformNode(), parent); | 1128 int child = tree.Insert(TransformNode(), parent); |
| 1132 TransformNode* child_node = tree.Node(child); | 1129 TransformNode* child_node = tree.Node(child); |
| 1133 tree.SetTargetId(child, parent); | 1130 tree.SetTargetId(child, parent); |
| 1134 child_node->scrolls = true; | 1131 child_node->scrolls = true; |
| 1135 child_node->local.Scale3d(6.0f, 6.0f, 0.0f); | 1132 child_node->local.Scale3d(6.0f, 6.0f, 0.0f); |
| 1136 child_node->local.Translate(1.3f, 1.3f); | 1133 child_node->local.Translate(1.3f, 1.3f); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1159 | 1156 |
| 1160 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1157 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1161 PropertyTreeTestSingularTransformSnapTest); | 1158 PropertyTreeTestSingularTransformSnapTest); |
| 1162 | 1159 |
| 1163 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1160 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
| 1164 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1161 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
| 1165 #undef DIRECT_PROPERTY_TREE_TEST_F | 1162 #undef DIRECT_PROPERTY_TREE_TEST_F |
| 1166 | 1163 |
| 1167 } // namespace | 1164 } // namespace |
| 1168 } // namespace cc | 1165 } // namespace cc |
| OLD | NEW |