| 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 27 matching lines...) Expand all Loading... |
| 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_surface_contents_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.surface_contents_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_with_overscroll = 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 |
| 58 EXPECT_EQ(original, result); | 58 EXPECT_EQ(original, result); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 property_trees.is_main_thread = true; | 249 property_trees.is_main_thread = true; |
| 250 ScrollTree& original = property_trees.scroll_tree; | 250 ScrollTree& original = property_trees.scroll_tree; |
| 251 ScrollNode second; | 251 ScrollNode second; |
| 252 second.owner_id = 10; | 252 second.owner_id = 10; |
| 253 second.scrollable = true; | 253 second.scrollable = true; |
| 254 second.bounds = gfx::Size(15, 15); | 254 second.bounds = gfx::Size(15, 15); |
| 255 ScrollNode third; | 255 ScrollNode third; |
| 256 third.owner_id = 20; | 256 third.owner_id = 20; |
| 257 third.contains_non_fast_scrollable_region = true; | 257 third.contains_non_fast_scrollable_region = true; |
| 258 | 258 |
| 259 const gfx::ScrollOffset offset(1, 2); |
| 260 const gfx::ScrollOffset overscroll(3, 4); |
| 261 |
| 259 original.Insert(second, 0); | 262 original.Insert(second, 0); |
| 260 original.Insert(third, 1); | 263 original.Insert(third, 1); |
| 261 | 264 |
| 262 original.set_currently_scrolling_node(1); | 265 original.set_currently_scrolling_node(1); |
| 263 original.SetScrollOffset(1, gfx::ScrollOffset(1, 2)); | 266 original.SetScrollOffset(1, offset, overscroll); |
| 264 | 267 |
| 265 proto::PropertyTree proto; | 268 proto::PropertyTree proto; |
| 266 original.ToProtobuf(&proto); | 269 original.ToProtobuf(&proto); |
| 267 ScrollTree result; | 270 ScrollTree result; |
| 268 std::unordered_map<int, int> scroll_id_to_index_map; | 271 std::unordered_map<int, int> scroll_id_to_index_map; |
| 269 result.FromProtobuf(proto, &scroll_id_to_index_map); | 272 result.FromProtobuf(proto, &scroll_id_to_index_map); |
| 270 | 273 |
| 271 EXPECT_EQ(original, result); | 274 EXPECT_EQ(original, result); |
| 272 EXPECT_EQ(scroll_id_to_index_map[10], 1); | 275 EXPECT_EQ(scroll_id_to_index_map[10], 1); |
| 273 EXPECT_EQ(scroll_id_to_index_map[20], 2); | 276 EXPECT_EQ(scroll_id_to_index_map[20], 2); |
| 274 | 277 |
| 275 original.clear(); | 278 original.clear(); |
| 276 original.set_currently_scrolling_node(0); | 279 original.set_currently_scrolling_node(0); |
| 277 original.SetScrollOffset(2, gfx::ScrollOffset(1, 2)); | 280 original.SetScrollOffset(2, offset, overscroll); |
| 278 | 281 |
| 279 proto::PropertyTree proto2; | 282 proto::PropertyTree proto2; |
| 280 original.ToProtobuf(&proto2); | 283 original.ToProtobuf(&proto2); |
| 281 result = ScrollTree(); | 284 result = ScrollTree(); |
| 282 scroll_id_to_index_map.clear(); | 285 scroll_id_to_index_map.clear(); |
| 283 result.FromProtobuf(proto2, &scroll_id_to_index_map); | 286 result.FromProtobuf(proto2, &scroll_id_to_index_map); |
| 284 | 287 |
| 285 EXPECT_EQ(original, result); | 288 EXPECT_EQ(original, result); |
| 286 } | 289 } |
| 287 | 290 |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1136 | 1139 |
| 1137 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1140 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1138 PropertyTreeTestSingularTransformSnapTest); | 1141 PropertyTreeTestSingularTransformSnapTest); |
| 1139 | 1142 |
| 1140 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1143 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
| 1141 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1144 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
| 1142 #undef DIRECT_PROPERTY_TREE_TEST_F | 1145 #undef DIRECT_PROPERTY_TREE_TEST_F |
| 1143 | 1146 |
| 1144 } // namespace | 1147 } // namespace |
| 1145 } // namespace cc | 1148 } // namespace cc |
| OLD | NEW |