| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 expected.Translate(-2, -2); | 414 expected.Translate(-2, -2); |
| 415 success = tree.ComputeTransform(-1, 0, &transform); | 415 success = tree.ComputeTransform(-1, 0, &transform); |
| 416 EXPECT_TRUE(success); | 416 EXPECT_TRUE(success); |
| 417 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 417 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 418 } | 418 } |
| 419 }; | 419 }; |
| 420 | 420 |
| 421 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 421 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 422 PropertyTreeTestComputeTransformRoot); | 422 PropertyTreeTestComputeTransformRoot); |
| 423 | 423 |
| 424 class PropertyTreeTestSetNeedsUpdate : public PropertyTreeTest { | |
| 425 protected: | |
| 426 void StartTest() override { | |
| 427 PropertyTrees property_trees; | |
| 428 TransformTree& tree = property_trees.transform_tree; | |
| 429 TransformNode contents_root; | |
| 430 contents_root.source_node_id = 0; | |
| 431 contents_root.id = tree.Insert(contents_root, 0); | |
| 432 tree.SetTargetId(contents_root.id, 0); | |
| 433 SetupTransformTreeForTest(&tree); | |
| 434 | |
| 435 EXPECT_FALSE(tree.needs_update()); | |
| 436 tree.SetRootTransformsAndScales(0.6f, 1.f, gfx::Transform(), gfx::PointF()); | |
| 437 EXPECT_TRUE(tree.needs_update()); | |
| 438 tree.set_needs_update(false); | |
| 439 tree.SetRootTransformsAndScales(0.6f, 1.f, gfx::Transform(), gfx::PointF()); | |
| 440 EXPECT_FALSE(tree.needs_update()); | |
| 441 } | |
| 442 }; | |
| 443 | |
| 444 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(PropertyTreeTestSetNeedsUpdate); | |
| 445 | |
| 446 class PropertyTreeTestComputeTransformChild : public PropertyTreeTest { | 424 class PropertyTreeTestComputeTransformChild : public PropertyTreeTest { |
| 447 protected: | 425 protected: |
| 448 void StartTest() override { | 426 void StartTest() override { |
| 449 PropertyTrees property_trees; | 427 PropertyTrees property_trees; |
| 450 TransformTree& tree = property_trees.transform_tree; | 428 TransformTree& tree = property_trees.transform_tree; |
| 451 TransformNode& root = *tree.Node(0); | 429 TransformNode& root = *tree.Node(0); |
| 452 root.local.Translate(2, 2); | 430 root.local.Translate(2, 2); |
| 453 tree.SetTargetId(root.id, 0); | 431 tree.SetTargetId(root.id, 0); |
| 454 tree.UpdateTransforms(0); | 432 tree.UpdateTransforms(0); |
| 455 | 433 |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 | 1159 |
| 1182 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1160 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1183 PropertyTreeTestSingularTransformSnapTest); | 1161 PropertyTreeTestSingularTransformSnapTest); |
| 1184 | 1162 |
| 1185 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1163 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
| 1186 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1164 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
| 1187 #undef DIRECT_PROPERTY_TREE_TEST_F | 1165 #undef DIRECT_PROPERTY_TREE_TEST_F |
| 1188 | 1166 |
| 1189 } // namespace | 1167 } // namespace |
| 1190 } // namespace cc | 1168 } // namespace cc |
| OLD | NEW |