| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 property_trees.is_main_thread = true; | 243 property_trees.is_main_thread = true; |
| 244 ScrollTree& original = property_trees.scroll_tree; | 244 ScrollTree& original = property_trees.scroll_tree; |
| 245 ScrollNode second; | 245 ScrollNode second; |
| 246 second.owner_id = 10; | 246 second.owner_id = 10; |
| 247 second.scrollable = true; | 247 second.scrollable = true; |
| 248 second.bounds = gfx::Size(15, 15); | 248 second.bounds = gfx::Size(15, 15); |
| 249 ScrollNode third; | 249 ScrollNode third; |
| 250 third.owner_id = 20; | 250 third.owner_id = 20; |
| 251 third.contains_non_fast_scrollable_region = true; | 251 third.contains_non_fast_scrollable_region = true; |
| 252 | 252 |
| 253 const gfx::ScrollOffset offset(1, 2); |
| 254 const gfx::ScrollOffset overscroll(3, 4); |
| 255 |
| 253 original.Insert(second, 0); | 256 original.Insert(second, 0); |
| 254 original.Insert(third, 1); | 257 original.Insert(third, 1); |
| 255 | 258 |
| 256 original.set_currently_scrolling_node(1); | 259 original.set_currently_scrolling_node(1); |
| 257 original.SetScrollOffset(1, gfx::ScrollOffset(1, 2)); | 260 original.SetScrollOffset(1, offset, overscroll); |
| 258 | 261 |
| 259 proto::PropertyTree proto; | 262 proto::PropertyTree proto; |
| 260 original.ToProtobuf(&proto); | 263 original.ToProtobuf(&proto); |
| 261 ScrollTree result; | 264 ScrollTree result; |
| 262 std::unordered_map<int, int> scroll_id_to_index_map; | 265 std::unordered_map<int, int> scroll_id_to_index_map; |
| 263 result.FromProtobuf(proto, &scroll_id_to_index_map); | 266 result.FromProtobuf(proto, &scroll_id_to_index_map); |
| 264 | 267 |
| 265 EXPECT_EQ(original, result); | 268 EXPECT_EQ(original, result); |
| 266 EXPECT_EQ(scroll_id_to_index_map[10], 1); | 269 EXPECT_EQ(scroll_id_to_index_map[10], 1); |
| 267 EXPECT_EQ(scroll_id_to_index_map[20], 2); | 270 EXPECT_EQ(scroll_id_to_index_map[20], 2); |
| 268 | 271 |
| 269 original.clear(); | 272 original.clear(); |
| 270 original.set_currently_scrolling_node(0); | 273 original.set_currently_scrolling_node(0); |
| 271 original.SetScrollOffset(2, gfx::ScrollOffset(1, 2)); | 274 original.SetScrollOffset(2, offset, overscroll); |
| 272 | 275 |
| 273 proto::PropertyTree proto2; | 276 proto::PropertyTree proto2; |
| 274 original.ToProtobuf(&proto2); | 277 original.ToProtobuf(&proto2); |
| 275 result = ScrollTree(); | 278 result = ScrollTree(); |
| 276 scroll_id_to_index_map.clear(); | 279 scroll_id_to_index_map.clear(); |
| 277 result.FromProtobuf(proto2, &scroll_id_to_index_map); | 280 result.FromProtobuf(proto2, &scroll_id_to_index_map); |
| 278 | 281 |
| 279 EXPECT_EQ(original, result); | 282 EXPECT_EQ(original, result); |
| 280 } | 283 } |
| 281 | 284 |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 | 1159 |
| 1157 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1160 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1158 PropertyTreeTestSingularTransformSnapTest); | 1161 PropertyTreeTestSingularTransformSnapTest); |
| 1159 | 1162 |
| 1160 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1163 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
| 1161 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1164 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
| 1162 #undef DIRECT_PROPERTY_TREE_TEST_F | 1165 #undef DIRECT_PROPERTY_TREE_TEST_F |
| 1163 | 1166 |
| 1164 } // namespace | 1167 } // namespace |
| 1165 } // namespace cc | 1168 } // namespace cc |
| OLD | NEW |