Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 1904653002: CC Animation: Merge LayerAnimationController into ElementAnimations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor AnimationHost::RegisterPlayerForLayer. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 #include <set> 11 #include <set>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "cc/animation/animation_host.h" 15 #include "cc/animation/animation_host.h"
16 #include "cc/animation/animation_id_provider.h" 16 #include "cc/animation/animation_id_provider.h"
17 #include "cc/animation/animation_player.h" 17 #include "cc/animation/animation_player.h"
18 #include "cc/animation/element_animations.h"
18 #include "cc/animation/keyframed_animation_curve.h" 19 #include "cc/animation/keyframed_animation_curve.h"
19 #include "cc/animation/layer_animation_controller.h"
20 #include "cc/animation/transform_operations.h" 20 #include "cc/animation/transform_operations.h"
21 #include "cc/base/math_util.h" 21 #include "cc/base/math_util.h"
22 #include "cc/input/main_thread_scrolling_reason.h" 22 #include "cc/input/main_thread_scrolling_reason.h"
23 #include "cc/layers/content_layer_client.h" 23 #include "cc/layers/content_layer_client.h"
24 #include "cc/layers/layer.h" 24 #include "cc/layers/layer.h"
25 #include "cc/layers/layer_client.h" 25 #include "cc/layers/layer_client.h"
26 #include "cc/layers/layer_impl.h" 26 #include "cc/layers/layer_impl.h"
27 #include "cc/layers/layer_iterator.h" 27 #include "cc/layers/layer_iterator.h"
28 #include "cc/layers/render_surface_impl.h" 28 #include "cc/layers/render_surface_impl.h"
29 #include "cc/output/copy_output_request.h" 29 #include "cc/output/copy_output_request.h"
(...skipping 8850 matching lines...) Expand 10 before | Expand all | Expand 10 after
8880 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); 8880 TransformKeyframe::Create(base::TimeDelta(), start, nullptr));
8881 curve->AddKeyframe(TransformKeyframe::Create( 8881 curve->AddKeyframe(TransformKeyframe::Create(
8882 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 8882 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
8883 std::unique_ptr<Animation> transform_animation( 8883 std::unique_ptr<Animation> transform_animation(
8884 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 8884 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
8885 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8885 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8886 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer( 8886 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer(
8887 root_ptr->id(), player.get()); 8887 root_ptr->id(), player.get());
8888 host_impl.active_tree() 8888 host_impl.active_tree()
8889 ->animation_host() 8889 ->animation_host()
8890 ->GetControllerForLayerId(root_ptr->id()) 8890 ->GetElementAnimationsForLayerId(root_ptr->id())
8891 ->AddAnimation(std::move(transform_animation)); 8891 ->AddAnimation(std::move(transform_animation));
8892 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 8892 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
8893 child_ptr->SetScrollClipLayer(root_ptr->id()); 8893 child_ptr->SetScrollClipLayer(root_ptr->id());
8894 root_ptr->SetTransform(singular); 8894 root_ptr->SetTransform(singular);
8895 child_ptr->SetTransform(singular); 8895 child_ptr->SetTransform(singular);
8896 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 8896 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
8897 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 8897 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
8898 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect()); 8898 EXPECT_EQ(gfx::Rect(0, 0), grandchild_ptr->visible_layer_rect());
8899 8899
8900 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer( 8900 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
8936 curve->AddKeyframe(TransformKeyframe::Create( 8936 curve->AddKeyframe(TransformKeyframe::Create(
8937 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); 8937 base::TimeDelta::FromSecondsD(1.0), operation, nullptr));
8938 std::unique_ptr<Animation> transform_animation( 8938 std::unique_ptr<Animation> transform_animation(
8939 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); 8939 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM));
8940 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 8940 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
8941 host_impl()->active_tree()->animation_host()->RegisterPlayerForLayer( 8941 host_impl()->active_tree()->animation_host()->RegisterPlayerForLayer(
8942 grand_child->id(), player.get()); 8942 grand_child->id(), player.get());
8943 host_impl() 8943 host_impl()
8944 ->active_tree() 8944 ->active_tree()
8945 ->animation_host() 8945 ->animation_host()
8946 ->GetControllerForLayerId(grand_child->id()) 8946 ->GetElementAnimationsForLayerId(grand_child->id())
8947 ->AddAnimation(std::move(transform_animation)); 8947 ->AddAnimation(std::move(transform_animation));
8948 8948
8949 ExecuteCalculateDrawProperties(root); 8949 ExecuteCalculateDrawProperties(root);
8950 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect()); 8950 EXPECT_EQ(gfx::Rect(0, 0), grand_child->visible_layer_rect());
8951 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect()); 8951 EXPECT_EQ(gfx::Rect(0, 0), child->visible_layer_rect());
8952 8952
8953 host_impl()->active_tree()->animation_host()->UnregisterPlayerForLayer( 8953 host_impl()->active_tree()->animation_host()->UnregisterPlayerForLayer(
8954 grand_child->id(), player.get()); 8954 grand_child->id(), player.get());
8955 } 8955 }
8956 8956
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
9006 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func))); 9006 FloatKeyframe::Create(base::TimeDelta(), 0.9f, std::move(func)));
9007 curve->AddKeyframe( 9007 curve->AddKeyframe(
9008 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr)); 9008 FloatKeyframe::Create(base::TimeDelta::FromSecondsD(1.0), 0.3f, nullptr));
9009 std::unique_ptr<Animation> animation( 9009 std::unique_ptr<Animation> animation(
9010 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY)); 9010 Animation::Create(std::move(curve), 3, 3, TargetProperty::OPACITY));
9011 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); 9011 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1));
9012 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer( 9012 host_impl.active_tree()->animation_host()->RegisterPlayerForLayer(
9013 root_ptr->id(), player.get()); 9013 root_ptr->id(), player.get());
9014 host_impl.active_tree() 9014 host_impl.active_tree()
9015 ->animation_host() 9015 ->animation_host()
9016 ->GetControllerForLayerId(root_ptr->id()) 9016 ->GetElementAnimationsForLayerId(root_ptr->id())
9017 ->AddAnimation(std::move(animation)); 9017 ->AddAnimation(std::move(animation));
9018 root_ptr->SetOpacity(0); 9018 root_ptr->SetOpacity(0);
9019 grandchild_ptr->set_visible_layer_rect(gfx::Rect()); 9019 grandchild_ptr->set_visible_layer_rect(gfx::Rect());
9020 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true; 9020 root_ptr->layer_tree_impl()->property_trees()->needs_rebuild = true;
9021 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr); 9021 ExecuteCalculateDrawPropertiesWithPropertyTrees(root_ptr);
9022 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect()); 9022 EXPECT_EQ(gfx::Rect(10, 10), grandchild_ptr->visible_layer_rect());
9023 9023
9024 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer( 9024 host_impl.active_tree()->animation_host()->UnregisterPlayerForLayer(
9025 root_ptr->id(), player.get()); 9025 root_ptr->id(), player.get());
9026 } 9026 }
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
10018 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); 10018 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index());
10019 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); 10019 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index());
10020 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); 10020 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index());
10021 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); 10021 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index());
10022 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); 10022 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index());
10023 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); 10023 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index());
10024 } 10024 }
10025 10025
10026 } // namespace 10026 } // namespace
10027 } // namespace cc 10027 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698