| 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_surface_contents_scale = false; | |
| 41 original.affected_by_inner_viewport_bounds_delta_x = false; | 40 original.affected_by_inner_viewport_bounds_delta_x = false; |
| 42 original.affected_by_inner_viewport_bounds_delta_y = false; | 41 original.affected_by_inner_viewport_bounds_delta_y = false; |
| 43 original.affected_by_outer_viewport_bounds_delta_x = false; | 42 original.affected_by_outer_viewport_bounds_delta_x = false; |
| 44 original.affected_by_outer_viewport_bounds_delta_y = false; | 43 original.affected_by_outer_viewport_bounds_delta_y = false; |
| 45 original.in_subtree_of_page_scale_layer = false; | 44 original.in_subtree_of_page_scale_layer = false; |
| 46 original.post_local_scale_factor = 0.5f; | 45 original.post_local_scale_factor = 0.5f; |
| 47 original.surface_contents_scale = gfx::Vector2dF(0.5f, 0.5f); | |
| 48 original.scroll_offset = gfx::ScrollOffset(1.5f, 1.5f); | 46 original.scroll_offset = gfx::ScrollOffset(1.5f, 1.5f); |
| 49 original.scroll_snap = gfx::Vector2dF(0.4f, 0.4f); | 47 original.scroll_snap = gfx::Vector2dF(0.4f, 0.4f); |
| 50 original.source_offset = gfx::Vector2dF(2.5f, 2.4f); | 48 original.source_offset = gfx::Vector2dF(2.5f, 2.4f); |
| 51 original.source_to_parent = gfx::Vector2dF(3.2f, 3.2f); | 49 original.source_to_parent = gfx::Vector2dF(3.2f, 3.2f); |
| 52 | 50 |
| 53 proto::TreeNode proto; | 51 proto::TreeNode proto; |
| 54 original.ToProtobuf(&proto); | 52 original.ToProtobuf(&proto); |
| 55 TransformNode result; | 53 TransformNode result; |
| 56 result.FromProtobuf(proto); | 54 result.FromProtobuf(proto); |
| 57 | 55 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 TransformTree& tree = property_trees.transform_tree; | 390 TransformTree& tree = property_trees.transform_tree; |
| 393 TransformNode& root = *tree.Node(0); | 391 TransformNode& root = *tree.Node(0); |
| 394 root.id = 0; | 392 root.id = 0; |
| 395 root.local.Translate(2, 2); | 393 root.local.Translate(2, 2); |
| 396 tree.SetTargetId(root.id, 0); | 394 tree.SetTargetId(root.id, 0); |
| 397 SetupTransformTreeForTest(&tree); | 395 SetupTransformTreeForTest(&tree); |
| 398 tree.UpdateTransforms(0); | 396 tree.UpdateTransforms(0); |
| 399 | 397 |
| 400 gfx::Transform expected; | 398 gfx::Transform expected; |
| 401 gfx::Transform transform; | 399 gfx::Transform transform; |
| 402 bool success = tree.ComputeTransform(0, 0, &transform); | 400 bool success = tree.ComputeTransformForTesting(0, 0, &transform); |
| 403 EXPECT_TRUE(success); | 401 EXPECT_TRUE(success); |
| 404 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 402 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 405 | 403 |
| 406 transform.MakeIdentity(); | 404 transform.MakeIdentity(); |
| 407 expected.Translate(2, 2); | 405 expected.Translate(2, 2); |
| 408 success = tree.ComputeTransform(0, -1, &transform); | 406 success = tree.ComputeTransformForTesting(0, -1, &transform); |
| 409 EXPECT_TRUE(success); | 407 EXPECT_TRUE(success); |
| 410 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 408 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 411 | 409 |
| 412 transform.MakeIdentity(); | 410 transform.MakeIdentity(); |
| 413 expected.MakeIdentity(); | 411 expected.MakeIdentity(); |
| 414 expected.Translate(-2, -2); | 412 expected.Translate(-2, -2); |
| 415 success = tree.ComputeTransform(-1, 0, &transform); | 413 success = tree.ComputeTransformForTesting(-1, 0, &transform); |
| 416 EXPECT_TRUE(success); | 414 EXPECT_TRUE(success); |
| 417 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 415 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 418 } | 416 } |
| 419 }; | 417 }; |
| 420 | 418 |
| 421 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 419 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 422 PropertyTreeTestComputeTransformRoot); | 420 PropertyTreeTestComputeTransformRoot); |
| 423 | 421 |
| 424 class PropertyTreeTestComputeTransformChild : public PropertyTreeTest { | 422 class PropertyTreeTestComputeTransformChild : public PropertyTreeTest { |
| 425 protected: | 423 protected: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 437 child.id = tree.Insert(child, 0); | 435 child.id = tree.Insert(child, 0); |
| 438 tree.SetTargetId(child.id, 0); | 436 tree.SetTargetId(child.id, 0); |
| 439 | 437 |
| 440 SetupTransformTreeForTest(&tree); | 438 SetupTransformTreeForTest(&tree); |
| 441 tree.UpdateTransforms(1); | 439 tree.UpdateTransforms(1); |
| 442 | 440 |
| 443 gfx::Transform expected; | 441 gfx::Transform expected; |
| 444 gfx::Transform transform; | 442 gfx::Transform transform; |
| 445 | 443 |
| 446 expected.Translate(3, 3); | 444 expected.Translate(3, 3); |
| 447 bool success = tree.ComputeTransform(1, 0, &transform); | 445 bool success = tree.ComputeTransformForTesting(1, 0, &transform); |
| 448 EXPECT_TRUE(success); | 446 EXPECT_TRUE(success); |
| 449 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 447 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 450 | 448 |
| 451 transform.MakeIdentity(); | 449 transform.MakeIdentity(); |
| 452 expected.MakeIdentity(); | 450 expected.MakeIdentity(); |
| 453 expected.Translate(-3, -3); | 451 expected.Translate(-3, -3); |
| 454 success = tree.ComputeTransform(0, 1, &transform); | 452 success = tree.ComputeTransformForTesting(0, 1, &transform); |
| 455 EXPECT_TRUE(success); | 453 EXPECT_TRUE(success); |
| 456 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 454 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 457 | 455 |
| 458 transform.MakeIdentity(); | 456 transform.MakeIdentity(); |
| 459 expected.MakeIdentity(); | 457 expected.MakeIdentity(); |
| 460 expected.Translate(5, 5); | 458 expected.Translate(5, 5); |
| 461 success = tree.ComputeTransform(1, -1, &transform); | 459 success = tree.ComputeTransformForTesting(1, -1, &transform); |
| 462 EXPECT_TRUE(success); | 460 EXPECT_TRUE(success); |
| 463 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 461 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 464 | 462 |
| 465 transform.MakeIdentity(); | 463 transform.MakeIdentity(); |
| 466 expected.MakeIdentity(); | 464 expected.MakeIdentity(); |
| 467 expected.Translate(-5, -5); | 465 expected.Translate(-5, -5); |
| 468 success = tree.ComputeTransform(-1, 1, &transform); | 466 success = tree.ComputeTransformForTesting(-1, 1, &transform); |
| 469 EXPECT_TRUE(success); | 467 EXPECT_TRUE(success); |
| 470 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 468 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 471 } | 469 } |
| 472 }; | 470 }; |
| 473 | 471 |
| 474 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 472 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 475 PropertyTreeTestComputeTransformChild); | 473 PropertyTreeTestComputeTransformChild); |
| 476 | 474 |
| 477 class PropertyTreeTestComputeTransformSibling : public PropertyTreeTest { | 475 class PropertyTreeTestComputeTransformSibling : public PropertyTreeTest { |
| 478 protected: | 476 protected: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 498 | 496 |
| 499 SetupTransformTreeForTest(&tree); | 497 SetupTransformTreeForTest(&tree); |
| 500 | 498 |
| 501 tree.UpdateTransforms(1); | 499 tree.UpdateTransforms(1); |
| 502 tree.UpdateTransforms(2); | 500 tree.UpdateTransforms(2); |
| 503 | 501 |
| 504 gfx::Transform expected; | 502 gfx::Transform expected; |
| 505 gfx::Transform transform; | 503 gfx::Transform transform; |
| 506 | 504 |
| 507 expected.Translate(4, 4); | 505 expected.Translate(4, 4); |
| 508 bool success = tree.ComputeTransform(2, 1, &transform); | 506 bool success = tree.ComputeTransformForTesting(2, 1, &transform); |
| 509 EXPECT_TRUE(success); | 507 EXPECT_TRUE(success); |
| 510 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 508 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 511 | 509 |
| 512 transform.MakeIdentity(); | 510 transform.MakeIdentity(); |
| 513 expected.MakeIdentity(); | 511 expected.MakeIdentity(); |
| 514 expected.Translate(-4, -4); | 512 expected.Translate(-4, -4); |
| 515 success = tree.ComputeTransform(1, 2, &transform); | 513 success = tree.ComputeTransformForTesting(1, 2, &transform); |
| 516 EXPECT_TRUE(success); | 514 EXPECT_TRUE(success); |
| 517 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 515 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 518 } | 516 } |
| 519 }; | 517 }; |
| 520 | 518 |
| 521 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 519 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 522 PropertyTreeTestComputeTransformSibling); | 520 PropertyTreeTestComputeTransformSibling); |
| 523 | 521 |
| 524 class PropertyTreeTestComputeTransformSiblingSingularAncestor | 522 class PropertyTreeTestComputeTransformSiblingSingularAncestor |
| 525 : public PropertyTreeTest { | 523 : public PropertyTreeTest { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 SetupTransformTreeForTest(&tree); | 560 SetupTransformTreeForTest(&tree); |
| 563 | 561 |
| 564 tree.UpdateTransforms(1); | 562 tree.UpdateTransforms(1); |
| 565 tree.UpdateTransforms(2); | 563 tree.UpdateTransforms(2); |
| 566 tree.UpdateTransforms(3); | 564 tree.UpdateTransforms(3); |
| 567 | 565 |
| 568 gfx::Transform expected; | 566 gfx::Transform expected; |
| 569 gfx::Transform transform; | 567 gfx::Transform transform; |
| 570 | 568 |
| 571 expected.Translate(4, 4); | 569 expected.Translate(4, 4); |
| 572 bool success = tree.ComputeTransform(3, 2, &transform); | 570 bool success = tree.ComputeTransformForTesting(3, 2, &transform); |
| 573 EXPECT_TRUE(success); | 571 EXPECT_TRUE(success); |
| 574 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 572 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 575 | 573 |
| 576 transform.MakeIdentity(); | 574 transform.MakeIdentity(); |
| 577 expected.MakeIdentity(); | 575 expected.MakeIdentity(); |
| 578 expected.Translate(-4, -4); | 576 expected.Translate(-4, -4); |
| 579 success = tree.ComputeTransform(2, 3, &transform); | 577 success = tree.ComputeTransformForTesting(2, 3, &transform); |
| 580 EXPECT_TRUE(success); | 578 EXPECT_TRUE(success); |
| 581 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 579 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 582 } | 580 } |
| 583 }; | 581 }; |
| 584 | 582 |
| 585 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 583 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 586 PropertyTreeTestComputeTransformSiblingSingularAncestor); | 584 PropertyTreeTestComputeTransformSiblingSingularAncestor); |
| 587 | 585 |
| 588 class PropertyTreeTestTransformsWithFlattening : public PropertyTreeTest { | 586 class PropertyTreeTestTransformsWithFlattening : public PropertyTreeTest { |
| 589 protected: | 587 protected: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 604 | 602 |
| 605 gfx::Transform rotation_about_x; | 603 gfx::Transform rotation_about_x; |
| 606 rotation_about_x.RotateAboutXAxis(15); | 604 rotation_about_x.RotateAboutXAxis(15); |
| 607 | 605 |
| 608 int parent = tree.Insert(TransformNode(), grand_parent); | 606 int parent = tree.Insert(TransformNode(), grand_parent); |
| 609 int effect_parent = effect_tree.Insert(EffectNode(), effect_grand_parent); | 607 int effect_parent = effect_tree.Insert(EffectNode(), effect_grand_parent); |
| 610 effect_tree.Node(effect_parent)->transform_id = parent; | 608 effect_tree.Node(effect_parent)->transform_id = parent; |
| 611 effect_tree.Node(effect_parent)->has_render_surface = true; | 609 effect_tree.Node(effect_parent)->has_render_surface = true; |
| 612 effect_tree.Node(effect_parent)->surface_contents_scale = | 610 effect_tree.Node(effect_parent)->surface_contents_scale = |
| 613 gfx::Vector2dF(1.f, 1.f); | 611 gfx::Vector2dF(1.f, 1.f); |
| 614 tree.Node(parent)->needs_surface_contents_scale = true; | |
| 615 tree.SetTargetId(parent, grand_parent); | 612 tree.SetTargetId(parent, grand_parent); |
| 616 tree.SetContentTargetId(parent, parent); | 613 tree.SetContentTargetId(parent, parent); |
| 617 tree.Node(parent)->source_node_id = grand_parent; | 614 tree.Node(parent)->source_node_id = grand_parent; |
| 618 tree.Node(parent)->local = rotation_about_x; | 615 tree.Node(parent)->local = rotation_about_x; |
| 619 | 616 |
| 620 int child = tree.Insert(TransformNode(), parent); | 617 int child = tree.Insert(TransformNode(), parent); |
| 621 tree.SetTargetId(child, parent); | 618 tree.SetTargetId(child, parent); |
| 622 tree.SetContentTargetId(child, parent); | 619 tree.SetContentTargetId(child, parent); |
| 623 tree.Node(child)->source_node_id = parent; | 620 tree.Node(child)->source_node_id = parent; |
| 624 tree.Node(child)->flattens_inherited_transform = true; | 621 tree.Node(child)->flattens_inherited_transform = true; |
| 625 tree.Node(child)->local = rotation_about_x; | 622 tree.Node(child)->local = rotation_about_x; |
| 626 | 623 |
| 627 int grand_child = tree.Insert(TransformNode(), child); | 624 int grand_child = tree.Insert(TransformNode(), child); |
| 628 tree.SetTargetId(grand_child, parent); | 625 tree.SetTargetId(grand_child, parent); |
| 629 tree.SetContentTargetId(grand_child, parent); | 626 tree.SetContentTargetId(grand_child, parent); |
| 630 tree.Node(grand_child)->source_node_id = child; | 627 tree.Node(grand_child)->source_node_id = child; |
| 631 tree.Node(grand_child)->flattens_inherited_transform = true; | 628 tree.Node(grand_child)->flattens_inherited_transform = true; |
| 632 tree.Node(grand_child)->local = rotation_about_x; | 629 tree.Node(grand_child)->local = rotation_about_x; |
| 633 | 630 |
| 634 tree.set_needs_update(true); | 631 tree.set_needs_update(true); |
| 635 SetupTransformTreeForTest(&tree); | 632 SetupTransformTreeForTest(&tree); |
| 636 draw_property_utils::ComputeTransforms(&tree); | 633 draw_property_utils::ComputeTransforms(&tree); |
| 637 property_trees.ResetCachedData(); | 634 property_trees.ResetCachedData(); |
| 638 | 635 |
| 639 gfx::Transform flattened_rotation_about_x = rotation_about_x; | 636 gfx::Transform flattened_rotation_about_x = rotation_about_x; |
| 640 flattened_rotation_about_x.FlattenTo2d(); | 637 flattened_rotation_about_x.FlattenTo2d(); |
| 641 | 638 |
| 642 EXPECT_TRANSFORMATION_MATRIX_EQ(rotation_about_x, | 639 gfx::Transform to_target; |
| 643 tree.ToTarget(child, effect_parent)); | 640 property_trees.GetToTarget(child, effect_parent, &to_target); |
| 641 EXPECT_TRANSFORMATION_MATRIX_EQ(rotation_about_x, to_target); |
| 644 | 642 |
| 645 EXPECT_TRANSFORMATION_MATRIX_EQ( | 643 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 646 flattened_rotation_about_x * rotation_about_x, tree.ToScreen(child)); | 644 flattened_rotation_about_x * rotation_about_x, tree.ToScreen(child)); |
| 647 | 645 |
| 646 property_trees.GetToTarget(grand_child, effect_parent, &to_target); |
| 648 EXPECT_TRANSFORMATION_MATRIX_EQ( | 647 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 649 flattened_rotation_about_x * rotation_about_x, | 648 flattened_rotation_about_x * rotation_about_x, to_target); |
| 650 tree.ToTarget(grand_child, effect_parent)); | |
| 651 | 649 |
| 652 EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_x * | 650 EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_x * |
| 653 flattened_rotation_about_x * | 651 flattened_rotation_about_x * |
| 654 rotation_about_x, | 652 rotation_about_x, |
| 655 tree.ToScreen(grand_child)); | 653 tree.ToScreen(grand_child)); |
| 656 | 654 |
| 657 gfx::Transform grand_child_to_child; | 655 gfx::Transform grand_child_to_child; |
| 658 bool success = | 656 bool success = tree.ComputeTransformForTesting(grand_child, child, |
| 659 tree.ComputeTransform(grand_child, child, &grand_child_to_child); | 657 &grand_child_to_child); |
| 660 EXPECT_TRUE(success); | 658 EXPECT_TRUE(success); |
| 661 EXPECT_TRANSFORMATION_MATRIX_EQ(rotation_about_x, grand_child_to_child); | 659 EXPECT_TRANSFORMATION_MATRIX_EQ(rotation_about_x, grand_child_to_child); |
| 662 | 660 |
| 663 // Remove flattening at grand_child, and recompute transforms. | 661 // Remove flattening at grand_child, and recompute transforms. |
| 664 tree.Node(grand_child)->flattens_inherited_transform = false; | 662 tree.Node(grand_child)->flattens_inherited_transform = false; |
| 665 tree.set_needs_update(true); | 663 tree.set_needs_update(true); |
| 666 SetupTransformTreeForTest(&tree); | 664 SetupTransformTreeForTest(&tree); |
| 667 draw_property_utils::ComputeTransforms(&tree); | 665 draw_property_utils::ComputeTransforms(&tree); |
| 668 | 666 |
| 667 property_trees.GetToTarget(grand_child, effect_parent, &to_target); |
| 669 EXPECT_TRANSFORMATION_MATRIX_EQ(rotation_about_x * rotation_about_x, | 668 EXPECT_TRANSFORMATION_MATRIX_EQ(rotation_about_x * rotation_about_x, |
| 670 tree.ToTarget(grand_child, effect_parent)); | 669 to_target); |
| 671 | 670 |
| 672 EXPECT_TRANSFORMATION_MATRIX_EQ( | 671 EXPECT_TRANSFORMATION_MATRIX_EQ( |
| 673 flattened_rotation_about_x * rotation_about_x * rotation_about_x, | 672 flattened_rotation_about_x * rotation_about_x * rotation_about_x, |
| 674 tree.ToScreen(grand_child)); | 673 tree.ToScreen(grand_child)); |
| 675 | 674 |
| 676 success = tree.ComputeTransform(grand_child, child, &grand_child_to_child); | 675 success = tree.ComputeTransformForTesting(grand_child, child, |
| 676 &grand_child_to_child); |
| 677 EXPECT_TRUE(success); | 677 EXPECT_TRUE(success); |
| 678 EXPECT_TRANSFORMATION_MATRIX_EQ(rotation_about_x, grand_child_to_child); | 678 EXPECT_TRANSFORMATION_MATRIX_EQ(rotation_about_x, grand_child_to_child); |
| 679 } | 679 } |
| 680 }; | 680 }; |
| 681 | 681 |
| 682 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 682 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 683 PropertyTreeTestTransformsWithFlattening); | 683 PropertyTreeTestTransformsWithFlattening); |
| 684 | 684 |
| 685 class PropertyTreeTestMultiplicationOrder : public PropertyTreeTest { | 685 class PropertyTreeTestMultiplicationOrder : public PropertyTreeTest { |
| 686 protected: | 686 protected: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 701 SetupTransformTreeForTest(&tree); | 701 SetupTransformTreeForTest(&tree); |
| 702 tree.UpdateTransforms(1); | 702 tree.UpdateTransforms(1); |
| 703 | 703 |
| 704 gfx::Transform expected; | 704 gfx::Transform expected; |
| 705 expected.Translate(2, 2); | 705 expected.Translate(2, 2); |
| 706 expected.Scale(2, 2); | 706 expected.Scale(2, 2); |
| 707 | 707 |
| 708 gfx::Transform transform; | 708 gfx::Transform transform; |
| 709 gfx::Transform inverse; | 709 gfx::Transform inverse; |
| 710 | 710 |
| 711 bool success = tree.ComputeTransform(1, -1, &transform); | 711 bool success = tree.ComputeTransformForTesting(1, -1, &transform); |
| 712 EXPECT_TRUE(success); | 712 EXPECT_TRUE(success); |
| 713 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 713 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 714 | 714 |
| 715 success = tree.ComputeTransform(-1, 1, &inverse); | 715 success = tree.ComputeTransformForTesting(-1, 1, &inverse); |
| 716 EXPECT_TRUE(success); | 716 EXPECT_TRUE(success); |
| 717 | 717 |
| 718 transform = transform * inverse; | 718 transform = transform * inverse; |
| 719 expected.MakeIdentity(); | 719 expected.MakeIdentity(); |
| 720 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 720 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 721 } | 721 } |
| 722 }; | 722 }; |
| 723 | 723 |
| 724 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(PropertyTreeTestMultiplicationOrder); | 724 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F(PropertyTreeTestMultiplicationOrder); |
| 725 | 725 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 741 | 741 |
| 742 SetupTransformTreeForTest(&tree); | 742 SetupTransformTreeForTest(&tree); |
| 743 tree.UpdateTransforms(1); | 743 tree.UpdateTransforms(1); |
| 744 | 744 |
| 745 gfx::Transform expected; | 745 gfx::Transform expected; |
| 746 expected.Scale(0, 0); | 746 expected.Scale(0, 0); |
| 747 | 747 |
| 748 gfx::Transform transform; | 748 gfx::Transform transform; |
| 749 gfx::Transform inverse; | 749 gfx::Transform inverse; |
| 750 | 750 |
| 751 bool success = tree.ComputeTransform(1, 0, &transform); | 751 bool success = tree.ComputeTransformForTesting(1, 0, &transform); |
| 752 EXPECT_TRUE(success); | 752 EXPECT_TRUE(success); |
| 753 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); | 753 EXPECT_TRANSFORMATION_MATRIX_EQ(expected, transform); |
| 754 | 754 |
| 755 // To compute this would require inverting the 0 matrix, so we cannot | 755 // To compute this would require inverting the 0 matrix, so we cannot |
| 756 // succeed. | 756 // succeed. |
| 757 success = tree.ComputeTransform(0, 1, &inverse); | 757 success = tree.ComputeTransformForTesting(0, 1, &inverse); |
| 758 EXPECT_FALSE(success); | 758 EXPECT_FALSE(success); |
| 759 } | 759 } |
| 760 }; | 760 }; |
| 761 | 761 |
| 762 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 762 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 763 PropertyTreeTestComputeTransformWithUninvertibleTransform); | 763 PropertyTreeTestComputeTransformWithUninvertibleTransform); |
| 764 | 764 |
| 765 class PropertyTreeTestComputeTransformWithSurfaceContentsScale | |
| 766 : public PropertyTreeTest { | |
| 767 protected: | |
| 768 void StartTest() override { | |
| 769 PropertyTrees property_trees; | |
| 770 TransformTree& tree = property_trees.transform_tree; | |
| 771 TransformNode& root = *tree.Node(0); | |
| 772 root.id = 0; | |
| 773 tree.SetTargetId(root.id, 0); | |
| 774 tree.UpdateTransforms(0); | |
| 775 | |
| 776 TransformNode grand_parent; | |
| 777 grand_parent.local.Scale(2.f, 2.f); | |
| 778 grand_parent.source_node_id = 0; | |
| 779 grand_parent.needs_surface_contents_scale = true; | |
| 780 int grand_parent_id = tree.Insert(grand_parent, 0); | |
| 781 tree.SetTargetId(grand_parent_id, 0); | |
| 782 tree.UpdateTransforms(grand_parent_id); | |
| 783 | |
| 784 TransformNode parent; | |
| 785 parent.local.Translate(15.f, 15.f); | |
| 786 parent.source_node_id = grand_parent_id; | |
| 787 int parent_id = tree.Insert(parent, grand_parent_id); | |
| 788 tree.SetTargetId(parent_id, grand_parent_id); | |
| 789 tree.UpdateTransforms(parent_id); | |
| 790 | |
| 791 TransformNode child; | |
| 792 child.local.Scale(3.f, 3.f); | |
| 793 child.source_node_id = parent_id; | |
| 794 int child_id = tree.Insert(child, parent_id); | |
| 795 tree.SetTargetId(child_id, grand_parent_id); | |
| 796 tree.UpdateTransforms(child_id); | |
| 797 | |
| 798 TransformNode grand_child; | |
| 799 grand_child.local.Scale(5.f, 5.f); | |
| 800 grand_child.source_node_id = child_id; | |
| 801 grand_child.needs_surface_contents_scale = true; | |
| 802 int grand_child_id = tree.Insert(grand_child, child_id); | |
| 803 tree.SetTargetId(grand_child_id, grand_parent_id); | |
| 804 SetupTransformTreeForTest(&tree); | |
| 805 tree.UpdateTransforms(grand_child_id); | |
| 806 | |
| 807 EXPECT_EQ(gfx::Vector2dF(2.f, 2.f), | |
| 808 tree.Node(grand_parent_id)->surface_contents_scale); | |
| 809 EXPECT_EQ(gfx::Vector2dF(30.f, 30.f), | |
| 810 tree.Node(grand_child_id)->surface_contents_scale); | |
| 811 | |
| 812 // Compute transform from grand_parent to grand_child. | |
| 813 gfx::Transform expected_transform_without_surface_contents_scale; | |
| 814 expected_transform_without_surface_contents_scale.Scale(1.f / 15.f, | |
| 815 1.f / 15.f); | |
| 816 expected_transform_without_surface_contents_scale.Translate(-15.f, -15.f); | |
| 817 | |
| 818 gfx::Transform expected_transform_with_dest_surface_contents_scale; | |
| 819 expected_transform_with_dest_surface_contents_scale.Scale(30.f, 30.f); | |
| 820 expected_transform_with_dest_surface_contents_scale.Scale(1.f / 15.f, | |
| 821 1.f / 15.f); | |
| 822 expected_transform_with_dest_surface_contents_scale.Translate(-15.f, -15.f); | |
| 823 | |
| 824 gfx::Transform expected_transform_with_source_surface_contents_scale; | |
| 825 expected_transform_with_source_surface_contents_scale.Scale(1.f / 15.f, | |
| 826 1.f / 15.f); | |
| 827 expected_transform_with_source_surface_contents_scale.Translate(-15.f, | |
| 828 -15.f); | |
| 829 expected_transform_with_source_surface_contents_scale.Scale(0.5f, 0.5f); | |
| 830 | |
| 831 gfx::Transform transform; | |
| 832 bool success = | |
| 833 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); | |
| 834 EXPECT_TRUE(success); | |
| 835 EXPECT_TRANSFORMATION_MATRIX_EQ( | |
| 836 expected_transform_without_surface_contents_scale, transform); | |
| 837 | |
| 838 success = | |
| 839 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); | |
| 840 const TransformNode* grand_child_node = tree.Node(grand_child_id); | |
| 841 transform.matrix().postScale(grand_child_node->surface_contents_scale.x(), | |
| 842 grand_child_node->surface_contents_scale.y(), | |
| 843 1.f); | |
| 844 EXPECT_TRUE(success); | |
| 845 EXPECT_TRANSFORMATION_MATRIX_EQ( | |
| 846 expected_transform_with_dest_surface_contents_scale, transform); | |
| 847 | |
| 848 success = | |
| 849 tree.ComputeTransform(grand_parent_id, grand_child_id, &transform); | |
| 850 const TransformNode* grand_parent_node = tree.Node(grand_parent_id); | |
| 851 EXPECT_NE(grand_parent_node->surface_contents_scale.x(), 0.f); | |
| 852 EXPECT_NE(grand_parent_node->surface_contents_scale.y(), 0.f); | |
| 853 transform.Scale(1.0 / grand_parent_node->surface_contents_scale.x(), | |
| 854 1.0 / grand_parent_node->surface_contents_scale.y()); | |
| 855 EXPECT_TRUE(success); | |
| 856 EXPECT_TRANSFORMATION_MATRIX_EQ( | |
| 857 expected_transform_with_source_surface_contents_scale, transform); | |
| 858 | |
| 859 // Now compute transform from grand_child to grand_parent. | |
| 860 expected_transform_without_surface_contents_scale.MakeIdentity(); | |
| 861 expected_transform_without_surface_contents_scale.Translate(15.f, 15.f); | |
| 862 expected_transform_without_surface_contents_scale.Scale(15.f, 15.f); | |
| 863 | |
| 864 expected_transform_with_dest_surface_contents_scale.MakeIdentity(); | |
| 865 expected_transform_with_dest_surface_contents_scale.Scale(2.f, 2.f); | |
| 866 expected_transform_with_dest_surface_contents_scale.Translate(15.f, 15.f); | |
| 867 expected_transform_with_dest_surface_contents_scale.Scale(15.f, 15.f); | |
| 868 | |
| 869 expected_transform_with_source_surface_contents_scale.MakeIdentity(); | |
| 870 expected_transform_with_source_surface_contents_scale.Translate(15.f, 15.f); | |
| 871 expected_transform_with_source_surface_contents_scale.Scale(15.f, 15.f); | |
| 872 expected_transform_with_source_surface_contents_scale.Scale(1.f / 30.f, | |
| 873 1.f / 30.f); | |
| 874 | |
| 875 success = | |
| 876 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); | |
| 877 EXPECT_TRUE(success); | |
| 878 EXPECT_TRANSFORMATION_MATRIX_EQ( | |
| 879 expected_transform_without_surface_contents_scale, transform); | |
| 880 | |
| 881 success = | |
| 882 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); | |
| 883 transform.matrix().postScale(grand_parent_node->surface_contents_scale.x(), | |
| 884 grand_parent_node->surface_contents_scale.y(), | |
| 885 1.f); | |
| 886 EXPECT_TRUE(success); | |
| 887 EXPECT_TRANSFORMATION_MATRIX_EQ( | |
| 888 expected_transform_with_dest_surface_contents_scale, transform); | |
| 889 | |
| 890 success = | |
| 891 tree.ComputeTransform(grand_child_id, grand_parent_id, &transform); | |
| 892 EXPECT_NE(grand_child_node->surface_contents_scale.x(), 0.f); | |
| 893 EXPECT_NE(grand_child_node->surface_contents_scale.y(), 0.f); | |
| 894 transform.Scale(1.0 / grand_child_node->surface_contents_scale.x(), | |
| 895 1.0 / grand_child_node->surface_contents_scale.y()); | |
| 896 EXPECT_TRUE(success); | |
| 897 EXPECT_TRANSFORMATION_MATRIX_EQ( | |
| 898 expected_transform_with_source_surface_contents_scale, transform); | |
| 899 } | |
| 900 }; | |
| 901 | |
| 902 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | |
| 903 PropertyTreeTestComputeTransformWithSurfaceContentsScale); | |
| 904 | |
| 905 class PropertyTreeTestComputeTransformToTargetWithZeroSurfaceContentsScale | 765 class PropertyTreeTestComputeTransformToTargetWithZeroSurfaceContentsScale |
| 906 : public PropertyTreeTest { | 766 : public PropertyTreeTest { |
| 907 protected: | 767 protected: |
| 908 void StartTest() override { | 768 void StartTest() override { |
| 909 PropertyTrees property_trees; | 769 PropertyTrees property_trees; |
| 910 TransformTree& tree = property_trees.transform_tree; | 770 TransformTree& tree = property_trees.transform_tree; |
| 911 TransformNode& root = *tree.Node(0); | 771 TransformNode& root = *tree.Node(0); |
| 912 tree.SetTargetId(root.id, 0); | 772 tree.SetTargetId(root.id, 0); |
| 913 tree.UpdateTransforms(0); | 773 tree.UpdateTransforms(0); |
| 914 | 774 |
| 915 TransformNode grand_parent; | 775 TransformNode grand_parent; |
| 916 grand_parent.local.Scale(2.f, 0.f); | 776 grand_parent.local.Scale(2.f, 0.f); |
| 917 grand_parent.source_node_id = 0; | 777 grand_parent.source_node_id = 0; |
| 918 grand_parent.needs_surface_contents_scale = true; | |
| 919 int grand_parent_id = tree.Insert(grand_parent, 0); | 778 int grand_parent_id = tree.Insert(grand_parent, 0); |
| 920 tree.SetTargetId(grand_parent_id, 0); | 779 tree.SetTargetId(grand_parent_id, 0); |
| 921 tree.SetContentTargetId(grand_parent_id, grand_parent_id); | 780 tree.SetContentTargetId(grand_parent_id, grand_parent_id); |
| 922 tree.UpdateTransforms(grand_parent_id); | 781 tree.UpdateTransforms(grand_parent_id); |
| 923 | 782 |
| 924 TransformNode parent; | 783 TransformNode parent; |
| 925 parent.local.Translate(1.f, 1.f); | 784 parent.local.Translate(1.f, 1.f); |
| 926 parent.source_node_id = grand_parent_id; | 785 parent.source_node_id = grand_parent_id; |
| 927 int parent_id = tree.Insert(parent, grand_parent_id); | 786 int parent_id = tree.Insert(parent, grand_parent_id); |
| 928 tree.SetTargetId(parent_id, grand_parent_id); | 787 tree.SetTargetId(parent_id, grand_parent_id); |
| 929 tree.SetContentTargetId(parent_id, grand_parent_id); | 788 tree.SetContentTargetId(parent_id, grand_parent_id); |
| 930 tree.UpdateTransforms(parent_id); | 789 tree.UpdateTransforms(parent_id); |
| 931 | 790 |
| 932 TransformNode child; | 791 TransformNode child; |
| 933 child.local.Translate(3.f, 4.f); | 792 child.local.Translate(3.f, 4.f); |
| 934 child.source_node_id = parent_id; | 793 child.source_node_id = parent_id; |
| 935 int child_id = tree.Insert(child, parent_id); | 794 int child_id = tree.Insert(child, parent_id); |
| 936 tree.SetTargetId(child_id, grand_parent_id); | 795 tree.SetTargetId(child_id, grand_parent_id); |
| 937 tree.SetContentTargetId(child_id, grand_parent_id); | 796 tree.SetContentTargetId(child_id, grand_parent_id); |
| 938 SetupTransformTreeForTest(&tree); | 797 SetupTransformTreeForTest(&tree); |
| 939 tree.UpdateTransforms(child_id); | 798 tree.UpdateTransforms(child_id); |
| 940 | 799 |
| 941 gfx::Transform expected_transform; | 800 gfx::Transform expected_transform; |
| 942 expected_transform.Translate(4.f, 5.f); | 801 expected_transform.Translate(4.f, 5.f); |
| 943 | 802 |
| 944 gfx::Transform transform; | 803 gfx::Transform transform; |
| 945 bool success = tree.ComputeTransform(child_id, grand_parent_id, &transform); | 804 bool success = |
| 805 tree.ComputeTransformForTesting(child_id, grand_parent_id, &transform); |
| 946 EXPECT_TRUE(success); | 806 EXPECT_TRUE(success); |
| 947 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, transform); | 807 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, transform); |
| 948 | 808 |
| 949 tree.Node(grand_parent_id)->local.MakeIdentity(); | 809 tree.Node(grand_parent_id)->local.MakeIdentity(); |
| 950 tree.Node(grand_parent_id)->local.Scale(0.f, 2.f); | 810 tree.Node(grand_parent_id)->local.Scale(0.f, 2.f); |
| 951 tree.Node(grand_parent_id)->needs_local_transform_update = true; | 811 tree.Node(grand_parent_id)->needs_local_transform_update = true; |
| 952 tree.set_needs_update(true); | 812 tree.set_needs_update(true); |
| 953 SetupTransformTreeForTest(&tree); | 813 SetupTransformTreeForTest(&tree); |
| 954 | 814 |
| 955 draw_property_utils::ComputeTransforms(&tree); | 815 draw_property_utils::ComputeTransforms(&tree); |
| 956 | 816 |
| 957 success = tree.ComputeTransform(child_id, grand_parent_id, &transform); | 817 success = |
| 818 tree.ComputeTransformForTesting(child_id, grand_parent_id, &transform); |
| 958 EXPECT_TRUE(success); | 819 EXPECT_TRUE(success); |
| 959 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, transform); | 820 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, transform); |
| 960 | 821 |
| 961 tree.Node(grand_parent_id)->local.MakeIdentity(); | 822 tree.Node(grand_parent_id)->local.MakeIdentity(); |
| 962 tree.Node(grand_parent_id)->local.Scale(0.f, 0.f); | 823 tree.Node(grand_parent_id)->local.Scale(0.f, 0.f); |
| 963 tree.Node(grand_parent_id)->needs_local_transform_update = true; | 824 tree.Node(grand_parent_id)->needs_local_transform_update = true; |
| 964 tree.set_needs_update(true); | 825 tree.set_needs_update(true); |
| 965 SetupTransformTreeForTest(&tree); | 826 SetupTransformTreeForTest(&tree); |
| 966 | 827 |
| 967 draw_property_utils::ComputeTransforms(&tree); | 828 draw_property_utils::ComputeTransforms(&tree); |
| 968 | 829 |
| 969 success = tree.ComputeTransform(child_id, grand_parent_id, &transform); | 830 success = |
| 831 tree.ComputeTransformForTesting(child_id, grand_parent_id, &transform); |
| 970 EXPECT_TRUE(success); | 832 EXPECT_TRUE(success); |
| 971 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, transform); | 833 EXPECT_TRANSFORMATION_MATRIX_EQ(expected_transform, transform); |
| 972 } | 834 } |
| 973 }; | 835 }; |
| 974 | 836 |
| 975 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 837 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 976 PropertyTreeTestComputeTransformToTargetWithZeroSurfaceContentsScale); | 838 PropertyTreeTestComputeTransformToTargetWithZeroSurfaceContentsScale); |
| 977 | 839 |
| 978 class PropertyTreeTestFlatteningWhenDestinationHasOnlyFlatAncestors | 840 class PropertyTreeTestFlatteningWhenDestinationHasOnlyFlatAncestors |
| 979 : public PropertyTreeTest { | 841 : public PropertyTreeTest { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1007 tree.Node(grand_child)->flattens_inherited_transform = true; | 869 tree.Node(grand_child)->flattens_inherited_transform = true; |
| 1008 | 870 |
| 1009 tree.set_needs_update(true); | 871 tree.set_needs_update(true); |
| 1010 SetupTransformTreeForTest(&tree); | 872 SetupTransformTreeForTest(&tree); |
| 1011 draw_property_utils::ComputeTransforms(&tree); | 873 draw_property_utils::ComputeTransforms(&tree); |
| 1012 | 874 |
| 1013 gfx::Transform flattened_rotation_about_x = rotation_about_x; | 875 gfx::Transform flattened_rotation_about_x = rotation_about_x; |
| 1014 flattened_rotation_about_x.FlattenTo2d(); | 876 flattened_rotation_about_x.FlattenTo2d(); |
| 1015 | 877 |
| 1016 gfx::Transform grand_child_to_parent; | 878 gfx::Transform grand_child_to_parent; |
| 1017 bool success = | 879 bool success = tree.ComputeTransformForTesting(grand_child, parent, |
| 1018 tree.ComputeTransform(grand_child, parent, &grand_child_to_parent); | 880 &grand_child_to_parent); |
| 1019 EXPECT_TRUE(success); | 881 EXPECT_TRUE(success); |
| 1020 EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_x, | 882 EXPECT_TRANSFORMATION_MATRIX_EQ(flattened_rotation_about_x, |
| 1021 grand_child_to_parent); | 883 grand_child_to_parent); |
| 1022 } | 884 } |
| 1023 }; | 885 }; |
| 1024 | 886 |
| 1025 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 887 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1026 PropertyTreeTestFlatteningWhenDestinationHasOnlyFlatAncestors); | 888 PropertyTreeTestFlatteningWhenDestinationHasOnlyFlatAncestors); |
| 1027 | 889 |
| 1028 class PropertyTreeTestScreenSpaceOpacityUpdateTest : public PropertyTreeTest { | 890 class PropertyTreeTestScreenSpaceOpacityUpdateTest : public PropertyTreeTest { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 child_node->local.Scale3d(6.0f, 6.0f, 0.0f); | 995 child_node->local.Scale3d(6.0f, 6.0f, 0.0f); |
| 1134 child_node->local.Translate(1.3f, 1.3f); | 996 child_node->local.Translate(1.3f, 1.3f); |
| 1135 child_node->source_node_id = parent; | 997 child_node->source_node_id = parent; |
| 1136 tree.set_needs_update(true); | 998 tree.set_needs_update(true); |
| 1137 | 999 |
| 1138 SetupTransformTreeForTest(&tree); | 1000 SetupTransformTreeForTest(&tree); |
| 1139 draw_property_utils::ComputeTransforms(&tree); | 1001 draw_property_utils::ComputeTransforms(&tree); |
| 1140 property_trees.ResetCachedData(); | 1002 property_trees.ResetCachedData(); |
| 1141 | 1003 |
| 1142 gfx::Transform from_target; | 1004 gfx::Transform from_target; |
| 1143 EXPECT_FALSE(tree.ToTarget(child, effect_parent).GetInverse(&from_target)); | 1005 gfx::Transform to_target; |
| 1006 property_trees.GetToTarget(child, effect_parent, &to_target); |
| 1007 EXPECT_FALSE(to_target.GetInverse(&from_target)); |
| 1144 // The following checks are to ensure that snapping is skipped because of | 1008 // The following checks are to ensure that snapping is skipped because of |
| 1145 // singular transform (and not because of other reasons which also cause | 1009 // singular transform (and not because of other reasons which also cause |
| 1146 // snapping to be skipped). | 1010 // snapping to be skipped). |
| 1147 EXPECT_TRUE(child_node->scrolls); | 1011 EXPECT_TRUE(child_node->scrolls); |
| 1148 EXPECT_TRUE(tree.ToTarget(child, effect_parent).IsScaleOrTranslation()); | 1012 property_trees.GetToTarget(child, effect_parent, &to_target); |
| 1013 EXPECT_TRUE(to_target.IsScaleOrTranslation()); |
| 1149 EXPECT_FALSE(child_node->to_screen_is_potentially_animated); | 1014 EXPECT_FALSE(child_node->to_screen_is_potentially_animated); |
| 1150 EXPECT_FALSE(child_node->ancestors_are_invertible); | 1015 EXPECT_FALSE(child_node->ancestors_are_invertible); |
| 1151 | 1016 |
| 1152 gfx::Transform rounded = tree.ToTarget(child, effect_parent); | 1017 gfx::Transform rounded; |
| 1018 property_trees.GetToTarget(child, effect_parent, &rounded); |
| 1153 rounded.RoundTranslationComponents(); | 1019 rounded.RoundTranslationComponents(); |
| 1154 EXPECT_NE(tree.ToTarget(child, effect_parent), rounded); | 1020 property_trees.GetToTarget(child, effect_parent, &to_target); |
| 1021 EXPECT_NE(to_target, rounded); |
| 1155 } | 1022 } |
| 1156 }; | 1023 }; |
| 1157 | 1024 |
| 1158 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( | 1025 DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F( |
| 1159 PropertyTreeTestSingularTransformSnapTest); | 1026 PropertyTreeTestSingularTransformSnapTest); |
| 1160 | 1027 |
| 1161 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F | 1028 #undef DIRECT_AND_SERIALIZED_PROPERTY_TREE_TEST_F |
| 1162 #undef SERIALIZED_PROPERTY_TREE_TEST_F | 1029 #undef SERIALIZED_PROPERTY_TREE_TEST_F |
| 1163 #undef DIRECT_PROPERTY_TREE_TEST_F | 1030 #undef DIRECT_PROPERTY_TREE_TEST_F |
| 1164 | 1031 |
| 1165 } // namespace | 1032 } // namespace |
| 1166 } // namespace cc | 1033 } // namespace cc |
| OLD | NEW |