OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/layer_tree_host_common.h" | 5 #include "cc/trees/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "cc/animation/layer_animation_controller.h" | 10 #include "cc/animation/layer_animation_controller.h" |
(...skipping 5659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5670 // We should have one render surface and two layers. The child | 5670 // We should have one render surface and two layers. The child |
5671 // layer should be included even though it is transparent. | 5671 // layer should be included even though it is transparent. |
5672 ASSERT_EQ(1u, render_surface_layer_list.size()); | 5672 ASSERT_EQ(1u, render_surface_layer_list.size()); |
5673 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); | 5673 ASSERT_EQ(2u, root->render_surface()->layer_list().size()); |
5674 } | 5674 } |
5675 | 5675 |
5676 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; | 5676 using LCDTextTestParam = std::tr1::tuple<bool, bool, bool>; |
5677 class LCDTextTest | 5677 class LCDTextTest |
5678 : public LayerTreeHostCommonTestBase, | 5678 : public LayerTreeHostCommonTestBase, |
5679 public testing::TestWithParam<LCDTextTestParam> { | 5679 public testing::TestWithParam<LCDTextTestParam> { |
5680 public: | |
5681 LCDTextTest() | |
5682 : host_impl_(&proxy_, &shared_bitmap_manager_), | |
5683 root_(nullptr), | |
5684 child_(nullptr), | |
5685 grand_child_(nullptr) {} | |
5686 | |
5687 protected: | 5680 protected: |
5688 void SetUp() override { | 5681 void SetUp() override { |
5689 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); | 5682 can_use_lcd_text_ = std::tr1::get<0>(GetParam()); |
5690 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); | 5683 layers_always_allowed_lcd_text_ = std::tr1::get<1>(GetParam()); |
5691 | 5684 |
5692 scoped_ptr<LayerImpl> root_ptr = | 5685 root_ = Layer::Create(); |
5693 LayerImpl::Create(host_impl_.active_tree(), 1); | 5686 child_ = Layer::Create(); |
5694 scoped_ptr<LayerImpl> child_ptr = | 5687 grand_child_ = Layer::Create(); |
5695 LayerImpl::Create(host_impl_.active_tree(), 2); | 5688 child_->AddChild(grand_child_.get()); |
5696 scoped_ptr<LayerImpl> grand_child_ptr = | 5689 root_->AddChild(child_.get()); |
5697 LayerImpl::Create(host_impl_.active_tree(), 3); | |
5698 | |
5699 // Stash raw pointers to look at later. | |
5700 root_ = root_ptr.get(); | |
5701 child_ = child_ptr.get(); | |
5702 grand_child_ = grand_child_ptr.get(); | |
5703 | |
5704 child_->AddChild(grand_child_ptr.Pass()); | |
5705 root_->AddChild(child_ptr.Pass()); | |
5706 host_impl_.active_tree()->SetRootLayer(root_ptr.Pass()); | |
5707 | 5690 |
5708 root_->SetContentsOpaque(true); | 5691 root_->SetContentsOpaque(true); |
5709 child_->SetContentsOpaque(true); | 5692 child_->SetContentsOpaque(true); |
5710 grand_child_->SetContentsOpaque(true); | 5693 grand_child_->SetContentsOpaque(true); |
5711 | 5694 |
5712 gfx::Transform identity_matrix; | 5695 gfx::Transform identity_matrix; |
5713 SetLayerPropertiesForTesting(root_, identity_matrix, gfx::Point3F(), | 5696 SetLayerPropertiesForTesting(root_.get(), |
5714 gfx::PointF(), gfx::Size(1, 1), true, false, | 5697 identity_matrix, |
5715 true); | 5698 gfx::Point3F(), |
5716 SetLayerPropertiesForTesting(child_, identity_matrix, gfx::Point3F(), | 5699 gfx::PointF(), |
5717 gfx::PointF(), gfx::Size(1, 1), true, false, | 5700 gfx::Size(1, 1), |
5718 std::tr1::get<2>(GetParam())); | 5701 true, |
5719 SetLayerPropertiesForTesting(grand_child_, identity_matrix, gfx::Point3F(), | |
5720 gfx::PointF(), gfx::Size(1, 1), true, false, | |
5721 false); | 5702 false); |
| 5703 SetLayerPropertiesForTesting(child_.get(), |
| 5704 identity_matrix, |
| 5705 gfx::Point3F(), |
| 5706 gfx::PointF(), |
| 5707 gfx::Size(1, 1), |
| 5708 true, |
| 5709 false); |
| 5710 SetLayerPropertiesForTesting(grand_child_.get(), |
| 5711 identity_matrix, |
| 5712 gfx::Point3F(), |
| 5713 gfx::PointF(), |
| 5714 gfx::Size(1, 1), |
| 5715 true, |
| 5716 false); |
| 5717 |
| 5718 child_->SetForceRenderSurface(std::tr1::get<2>(GetParam())); |
| 5719 |
| 5720 host_ = CreateFakeLayerTreeHost(); |
| 5721 host_->SetRootLayer(root_); |
5722 } | 5722 } |
5723 | 5723 |
5724 bool can_use_lcd_text_; | 5724 bool can_use_lcd_text_; |
5725 bool layers_always_allowed_lcd_text_; | 5725 bool layers_always_allowed_lcd_text_; |
5726 | 5726 scoped_ptr<FakeLayerTreeHost> host_; |
5727 FakeImplProxy proxy_; | 5727 scoped_refptr<Layer> root_; |
5728 TestSharedBitmapManager shared_bitmap_manager_; | 5728 scoped_refptr<Layer> child_; |
5729 FakeLayerTreeHostImpl host_impl_; | 5729 scoped_refptr<Layer> grand_child_; |
5730 | |
5731 LayerImpl* root_; | |
5732 LayerImpl* child_; | |
5733 LayerImpl* grand_child_; | |
5734 }; | 5730 }; |
5735 | 5731 |
5736 TEST_P(LCDTextTest, CanUseLCDText) { | 5732 TEST_P(LCDTextTest, CanUseLCDText) { |
5737 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; | 5733 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; |
5738 bool expect_not_lcd_text = layers_always_allowed_lcd_text_; | 5734 bool expect_not_lcd_text = layers_always_allowed_lcd_text_; |
5739 | 5735 |
5740 // Case 1: Identity transform. | 5736 // Case 1: Identity transform. |
5741 gfx::Transform identity_matrix; | 5737 gfx::Transform identity_matrix; |
5742 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5738 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5743 layers_always_allowed_lcd_text_); | 5739 layers_always_allowed_lcd_text_); |
5744 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5740 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5745 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); | 5741 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); |
5746 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); | 5742 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
5747 | 5743 |
5748 // Case 2: Integral translation. | 5744 // Case 2: Integral translation. |
5749 gfx::Transform integral_translation; | 5745 gfx::Transform integral_translation; |
5750 integral_translation.Translate(1.0, 2.0); | 5746 integral_translation.Translate(1.0, 2.0); |
5751 child_->SetTransform(integral_translation); | 5747 child_->SetTransform(integral_translation); |
5752 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5748 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5753 layers_always_allowed_lcd_text_); | 5749 layers_always_allowed_lcd_text_); |
5754 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5750 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5755 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); | 5751 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); |
5756 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); | 5752 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
5757 | 5753 |
5758 // Case 3: Non-integral translation. | 5754 // Case 3: Non-integral translation. |
5759 gfx::Transform non_integral_translation; | 5755 gfx::Transform non_integral_translation; |
5760 non_integral_translation.Translate(1.5, 2.5); | 5756 non_integral_translation.Translate(1.5, 2.5); |
5761 child_->SetTransform(non_integral_translation); | 5757 child_->SetTransform(non_integral_translation); |
5762 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5758 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5763 layers_always_allowed_lcd_text_); | 5759 layers_always_allowed_lcd_text_); |
5764 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5760 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5765 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); | 5761 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); |
5766 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); | 5762 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); |
5767 | 5763 |
5768 // Case 4: Rotation. | 5764 // Case 4: Rotation. |
5769 gfx::Transform rotation; | 5765 gfx::Transform rotation; |
5770 rotation.Rotate(10.0); | 5766 rotation.Rotate(10.0); |
5771 child_->SetTransform(rotation); | 5767 child_->SetTransform(rotation); |
5772 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5768 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5773 layers_always_allowed_lcd_text_); | 5769 layers_always_allowed_lcd_text_); |
5774 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5770 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5775 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); | 5771 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); |
5776 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); | 5772 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); |
5777 | 5773 |
5778 // Case 5: Scale. | 5774 // Case 5: Scale. |
5779 gfx::Transform scale; | 5775 gfx::Transform scale; |
5780 scale.Scale(2.0, 2.0); | 5776 scale.Scale(2.0, 2.0); |
5781 child_->SetTransform(scale); | 5777 child_->SetTransform(scale); |
5782 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5778 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5783 layers_always_allowed_lcd_text_); | 5779 layers_always_allowed_lcd_text_); |
5784 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5780 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5785 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); | 5781 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); |
5786 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); | 5782 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); |
5787 | 5783 |
5788 // Case 6: Skew. | 5784 // Case 6: Skew. |
5789 gfx::Transform skew; | 5785 gfx::Transform skew; |
5790 skew.SkewX(10.0); | 5786 skew.SkewX(10.0); |
5791 child_->SetTransform(skew); | 5787 child_->SetTransform(skew); |
5792 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5788 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5793 layers_always_allowed_lcd_text_); | 5789 layers_always_allowed_lcd_text_); |
5794 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5790 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5795 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); | 5791 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); |
5796 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); | 5792 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); |
5797 | 5793 |
5798 // Case 7: Translucent. | 5794 // Case 7: Translucent. |
5799 child_->SetTransform(identity_matrix); | 5795 child_->SetTransform(identity_matrix); |
5800 child_->SetOpacity(0.5f); | 5796 child_->SetOpacity(0.5f); |
5801 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5797 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5802 layers_always_allowed_lcd_text_); | 5798 layers_always_allowed_lcd_text_); |
5803 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5799 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5804 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); | 5800 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); |
5805 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); | 5801 EXPECT_EQ(expect_not_lcd_text, grand_child_->can_use_lcd_text()); |
5806 | 5802 |
5807 // Case 8: Sanity check: restore transform and opacity. | 5803 // Case 8: Sanity check: restore transform and opacity. |
5808 child_->SetTransform(identity_matrix); | 5804 child_->SetTransform(identity_matrix); |
5809 child_->SetOpacity(1.f); | 5805 child_->SetOpacity(1.f); |
5810 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5806 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5811 layers_always_allowed_lcd_text_); | 5807 layers_always_allowed_lcd_text_); |
5812 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5808 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5813 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); | 5809 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); |
5814 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); | 5810 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
5815 | 5811 |
5816 // Case 9: Non-opaque content. | 5812 // Case 9: Non-opaque content. |
5817 child_->SetContentsOpaque(false); | 5813 child_->SetContentsOpaque(false); |
5818 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5814 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5819 layers_always_allowed_lcd_text_); | 5815 layers_always_allowed_lcd_text_); |
5820 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5816 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5821 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); | 5817 EXPECT_EQ(expect_not_lcd_text, child_->can_use_lcd_text()); |
5822 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); | 5818 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
5823 | 5819 |
5824 // Case 10: Sanity check: restore content opaqueness. | 5820 // Case 10: Sanity check: restore content opaqueness. |
5825 child_->SetContentsOpaque(true); | 5821 child_->SetContentsOpaque(true); |
5826 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5822 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5827 layers_always_allowed_lcd_text_); | 5823 layers_always_allowed_lcd_text_); |
5828 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5824 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5829 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); | 5825 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); |
5830 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); | 5826 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
5831 } | 5827 } |
5832 | 5828 |
5833 TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) { | 5829 TEST_P(LCDTextTest, CanUseLCDTextWithAnimation) { |
5834 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; | 5830 bool expect_lcd_text = can_use_lcd_text_ || layers_always_allowed_lcd_text_; |
5835 | 5831 |
5836 // Sanity check: Make sure can_use_lcd_text_ is set on each node. | 5832 // Sanity check: Make sure can_use_lcd_text_ is set on each node. |
5837 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5833 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5838 layers_always_allowed_lcd_text_); | 5834 layers_always_allowed_lcd_text_); |
5839 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5835 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5840 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); | 5836 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); |
5841 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); | 5837 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
5842 | 5838 |
5843 // Add opacity animation. | 5839 // Add opacity animation. |
5844 child_->SetOpacity(0.9f); | 5840 child_->SetOpacity(0.9f); |
5845 AddOpacityTransitionToController( | 5841 AddOpacityTransitionToController( |
5846 child_->layer_animation_controller(), 10.0, 0.9f, 0.1f, false); | 5842 child_->layer_animation_controller(), 10.0, 0.9f, 0.1f, false); |
5847 | 5843 |
5848 ExecuteCalculateDrawProperties(root_, 1.f, 1.f, NULL, can_use_lcd_text_, | 5844 ExecuteCalculateDrawProperties(root_.get(), 1.f, 1.f, NULL, can_use_lcd_text_, |
5849 layers_always_allowed_lcd_text_); | 5845 layers_always_allowed_lcd_text_); |
5850 // Text AA should not be adjusted while animation is active. | 5846 // Text AA should not be adjusted while animation is active. |
5851 // Make sure LCD text AA setting remains unchanged. | 5847 // Make sure LCD text AA setting remains unchanged. |
5852 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); | 5848 EXPECT_EQ(expect_lcd_text, root_->can_use_lcd_text()); |
5853 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); | 5849 EXPECT_EQ(expect_lcd_text, child_->can_use_lcd_text()); |
5854 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); | 5850 EXPECT_EQ(expect_lcd_text, grand_child_->can_use_lcd_text()); |
5855 } | 5851 } |
5856 | 5852 |
5857 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, | 5853 INSTANTIATE_TEST_CASE_P(LayerTreeHostCommonTest, |
5858 LCDTextTest, | 5854 LCDTextTest, |
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7968 // |grand_parent|, |parent|, and |child| have scale-affecting animations. | 7964 // |grand_parent|, |parent|, and |child| have scale-affecting animations. |
7969 EXPECT_EQ(5.f, | 7965 EXPECT_EQ(5.f, |
7970 grand_parent->draw_properties().maximum_animation_contents_scale); | 7966 grand_parent->draw_properties().maximum_animation_contents_scale); |
7971 EXPECT_EQ(0.f, | 7967 EXPECT_EQ(0.f, |
7972 parent_raw->draw_properties().maximum_animation_contents_scale); | 7968 parent_raw->draw_properties().maximum_animation_contents_scale); |
7973 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7969 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); |
7974 EXPECT_EQ( | 7970 EXPECT_EQ( |
7975 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | 7971 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); |
7976 | 7972 |
7977 grand_parent->layer_animation_controller()->AbortAnimations( | 7973 grand_parent->layer_animation_controller()->AbortAnimations( |
7978 Animation::TRANSFORM); | 7974 Animation::Transform); |
7979 parent_raw->layer_animation_controller()->AbortAnimations( | 7975 parent_raw->layer_animation_controller()->AbortAnimations( |
7980 Animation::TRANSFORM); | 7976 Animation::Transform); |
7981 child_raw->layer_animation_controller()->AbortAnimations( | 7977 child_raw->layer_animation_controller()->AbortAnimations( |
7982 Animation::TRANSFORM); | 7978 Animation::Transform); |
7983 | 7979 |
7984 TransformOperations perspective; | 7980 TransformOperations perspective; |
7985 perspective.AppendPerspective(10.f); | 7981 perspective.AppendPerspective(10.f); |
7986 | 7982 |
7987 AddAnimatedTransformToLayer( | 7983 AddAnimatedTransformToLayer( |
7988 child_raw, 1.0, TransformOperations(), perspective); | 7984 child_raw, 1.0, TransformOperations(), perspective); |
7989 ExecuteCalculateDrawProperties(grand_parent.get()); | 7985 ExecuteCalculateDrawProperties(grand_parent.get()); |
7990 | 7986 |
7991 // |child| has a scale-affecting animation but computing the maximum of this | 7987 // |child| has a scale-affecting animation but computing the maximum of this |
7992 // animation is not supported. | 7988 // animation is not supported. |
7993 EXPECT_EQ(0.f, | 7989 EXPECT_EQ(0.f, |
7994 grand_parent->draw_properties().maximum_animation_contents_scale); | 7990 grand_parent->draw_properties().maximum_animation_contents_scale); |
7995 EXPECT_EQ(0.f, | 7991 EXPECT_EQ(0.f, |
7996 parent_raw->draw_properties().maximum_animation_contents_scale); | 7992 parent_raw->draw_properties().maximum_animation_contents_scale); |
7997 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); | 7993 EXPECT_EQ(0.f, child_raw->draw_properties().maximum_animation_contents_scale); |
7998 EXPECT_EQ( | 7994 EXPECT_EQ( |
7999 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); | 7995 0.f, grand_child_raw->draw_properties().maximum_animation_contents_scale); |
8000 | 7996 |
8001 child_raw->layer_animation_controller()->AbortAnimations( | 7997 child_raw->layer_animation_controller()->AbortAnimations( |
8002 Animation::TRANSFORM); | 7998 Animation::Transform); |
8003 | 7999 |
8004 gfx::Transform scale_matrix; | 8000 gfx::Transform scale_matrix; |
8005 scale_matrix.Scale(1.f, 2.f); | 8001 scale_matrix.Scale(1.f, 2.f); |
8006 grand_parent->SetTransform(scale_matrix); | 8002 grand_parent->SetTransform(scale_matrix); |
8007 parent_raw->SetTransform(scale_matrix); | 8003 parent_raw->SetTransform(scale_matrix); |
8008 AddAnimatedTransformToLayer(parent_raw, 1.0, TransformOperations(), scale); | 8004 AddAnimatedTransformToLayer(parent_raw, 1.0, TransformOperations(), scale); |
8009 ExecuteCalculateDrawProperties(grand_parent.get()); | 8005 ExecuteCalculateDrawProperties(grand_parent.get()); |
8010 | 8006 |
8011 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale | 8007 // |grand_parent| and |parent| each have scale 2.f. |parent| has a scale |
8012 // animation with maximum scale 5.f. | 8008 // animation with maximum scale 5.f. |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8670 | 8666 |
8671 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 8667 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
8672 | 8668 |
8673 gfx::Rect affected_by_delta(0, 0, root_size.width(), | 8669 gfx::Rect affected_by_delta(0, 0, root_size.width(), |
8674 root_size.height() + 50); | 8670 root_size.height() + 50); |
8675 EXPECT_EQ(affected_by_delta, sublayer->visible_content_rect()); | 8671 EXPECT_EQ(affected_by_delta, sublayer->visible_content_rect()); |
8676 } | 8672 } |
8677 | 8673 |
8678 } // namespace | 8674 } // namespace |
8679 } // namespace cc | 8675 } // namespace cc |
OLD | NEW |