| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 7519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7530 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); | 7530 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_parent_raw)); |
| 7531 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); | 7531 EXPECT_EQ(0.f, GetMaximumAnimationScale(parent_raw)); |
| 7532 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); | 7532 EXPECT_EQ(0.f, GetMaximumAnimationScale(child_raw)); |
| 7533 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); | 7533 EXPECT_EQ(0.f, GetMaximumAnimationScale(grand_child_raw)); |
| 7534 | 7534 |
| 7535 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); | 7535 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_parent_raw)); |
| 7536 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); | 7536 EXPECT_EQ(0.f, GetStartingAnimationScale(parent_raw)); |
| 7537 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); | 7537 EXPECT_EQ(0.f, GetStartingAnimationScale(child_raw)); |
| 7538 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); | 7538 EXPECT_EQ(0.f, GetStartingAnimationScale(grand_child_raw)); |
| 7539 | 7539 |
| 7540 AbortAnimationsOnElementWithPlayer(child_raw->element_id(), timeline, | 7540 child_player->AbortAnimations(TargetProperty::TRANSFORM, false); |
| 7541 TargetProperty::TRANSFORM); | 7541 |
| 7542 gfx::Transform scale_matrix; | 7542 gfx::Transform scale_matrix; |
| 7543 scale_matrix.Scale(1.f, 2.f); | 7543 scale_matrix.Scale(1.f, 2.f); |
| 7544 grand_parent_raw->test_properties()->transform = scale_matrix; | 7544 grand_parent_raw->test_properties()->transform = scale_matrix; |
| 7545 parent_raw->test_properties()->transform = scale_matrix; | 7545 parent_raw->test_properties()->transform = scale_matrix; |
| 7546 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; | 7546 grand_parent_raw->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 7547 | 7547 |
| 7548 AddAnimatedTransformToPlayer(parent_player.get(), 1.0, TransformOperations(), | 7548 AddAnimatedTransformToPlayer(parent_player.get(), 1.0, TransformOperations(), |
| 7549 scale); | 7549 scale); |
| 7550 ExecuteCalculateDrawProperties(grand_parent_raw); | 7550 ExecuteCalculateDrawProperties(grand_parent_raw); |
| 7551 | 7551 |
| (...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8885 operation.AppendMatrix(transform); | 8885 operation.AppendMatrix(transform); |
| 8886 curve->AddKeyframe( | 8886 curve->AddKeyframe( |
| 8887 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); | 8887 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); |
| 8888 curve->AddKeyframe(TransformKeyframe::Create( | 8888 curve->AddKeyframe(TransformKeyframe::Create( |
| 8889 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 8889 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 8890 std::unique_ptr<Animation> transform_animation( | 8890 std::unique_ptr<Animation> transform_animation( |
| 8891 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 8891 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 8892 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 8892 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 8893 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( | 8893 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
| 8894 root_ptr->element_id(), player.get()); | 8894 root_ptr->element_id(), player.get()); |
| 8895 host_impl.active_tree() | 8895 player->AddAnimation(std::move(transform_animation)); |
| 8896 ->animation_host() | |
| 8897 ->GetElementAnimationsForElementId(root_ptr->element_id()) | |
| 8898 ->AddAnimation(std::move(transform_animation)); | |
| 8899 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 8896 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 8900 child_ptr->SetScrollClipLayer(root_ptr->id()); | 8897 child_ptr->SetScrollClipLayer(root_ptr->id()); |
| 8901 root_ptr->test_properties()->transform = singular; | 8898 root_ptr->test_properties()->transform = singular; |
| 8902 child_ptr->test_properties()->transform = singular; | 8899 child_ptr->test_properties()->transform = singular; |
| 8903 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 8900 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 8904 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); | 8901 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 8905 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); | 8902 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); |
| 8906 | 8903 |
| 8907 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( | 8904 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
| 8908 root_ptr->element_id(), player.get()); | 8905 root_ptr->element_id(), player.get()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 8936 operation.AppendMatrix(transform); | 8933 operation.AppendMatrix(transform); |
| 8937 curve->AddKeyframe( | 8934 curve->AddKeyframe( |
| 8938 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); | 8935 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); |
| 8939 curve->AddKeyframe(TransformKeyframe::Create( | 8936 curve->AddKeyframe(TransformKeyframe::Create( |
| 8940 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 8937 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
| 8941 std::unique_ptr<Animation> transform_animation( | 8938 std::unique_ptr<Animation> transform_animation( |
| 8942 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 8939 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
| 8943 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 8940 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 8944 host_impl()->active_tree()->animation_host()->RegisterPlayerForElement( | 8941 host_impl()->active_tree()->animation_host()->RegisterPlayerForElement( |
| 8945 grand_child->element_id(), player.get()); | 8942 grand_child->element_id(), player.get()); |
| 8946 host_impl() | 8943 player->AddAnimation(std::move(transform_animation)); |
| 8947 ->active_tree() | |
| 8948 ->animation_host() | |
| 8949 ->GetElementAnimationsForElementId(grand_child->element_id()) | |
| 8950 ->AddAnimation(std::move(transform_animation)); | |
| 8951 | 8944 |
| 8952 ExecuteCalculateDrawProperties(root); | 8945 ExecuteCalculateDrawProperties(root); |
| 8953 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); | 8946 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); |
| 8954 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); | 8947 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); |
| 8955 | 8948 |
| 8956 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( | 8949 host_impl()->active_tree()->animation_host()->UnregisterPlayerForElement( |
| 8957 grand_child->element_id(), player.get()); | 8950 grand_child->element_id(), player.get()); |
| 8958 } | 8951 } |
| 8959 | 8952 |
| 8960 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { | 8953 TEST_F(LayerTreeHostCommonTest, SkippingPendingLayerImpl) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9002 CubicBezierTimingFunction::EaseType::EASE); | 8995 CubicBezierTimingFunction::EaseType::EASE); |
| 9003 curve->AddKeyframe( | 8996 curve->AddKeyframe( |
| 9004 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); | 8997 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); |
| 9005 curve->AddKeyframe( | 8998 curve->AddKeyframe( |
| 9006 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); | 8999 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); |
| 9007 std::unique_ptr<Animation> animation( | 9000 std::unique_ptr<Animation> animation( |
| 9008 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); | 9001 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); |
| 9009 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 9002 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
| 9010 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( | 9003 host_impl.active_tree()->animation_host()->RegisterPlayerForElement( |
| 9011 root_ptr->element_id(), player.get()); | 9004 root_ptr->element_id(), player.get()); |
| 9012 host_impl.active_tree() | 9005 player->AddAnimation(std::move(animation)); |
| 9013 ->animation_host() | |
| 9014 ->GetElementAnimationsForElementId(root_ptr->element_id()) | |
| 9015 ->AddAnimation(std::move(animation)); | |
| 9016 root_ptr->test_properties()->opacity = 0.f; | 9006 root_ptr->test_properties()->opacity = 0.f; |
| 9017 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); | 9007 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); |
| 9018 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; | 9008 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 9019 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); | 9009 ExecuteCalculateDrawPropertiesAndSaveUpdateLayerList(root_ptr); |
| 9020 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); | 9010 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); |
| 9021 | 9011 |
| 9022 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( | 9012 host_impl.active_tree()->animation_host()->UnregisterPlayerForElement( |
| 9023 root_ptr->element_id(), player.get()); | 9013 root_ptr->element_id(), player.get()); |
| 9024 } | 9014 } |
| 9025 | 9015 |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10129 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 10119 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
| 10130 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10120 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
| 10131 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10121 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
| 10132 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10122 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
| 10133 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10123 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
| 10134 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10124 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
| 10135 } | 10125 } |
| 10136 | 10126 |
| 10137 } // namespace | 10127 } // namespace |
| 10138 } // namespace cc | 10128 } // namespace cc |
| OLD | NEW |