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 <set> | 11 #include <set> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
14 #include "cc/animation/animation_host.h" | 15 #include "cc/animation/animation_host.h" |
15 #include "cc/animation/animation_id_provider.h" | 16 #include "cc/animation/animation_id_provider.h" |
16 #include "cc/animation/animation_player.h" | 17 #include "cc/animation/animation_player.h" |
17 #include "cc/animation/keyframed_animation_curve.h" | 18 #include "cc/animation/keyframed_animation_curve.h" |
18 #include "cc/animation/layer_animation_controller.h" | 19 #include "cc/animation/layer_animation_controller.h" |
19 #include "cc/animation/transform_operations.h" | 20 #include "cc/animation/transform_operations.h" |
(...skipping 8876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8896 false); | 8897 false); |
8897 | 8898 |
8898 gfx::Transform singular; | 8899 gfx::Transform singular; |
8899 singular.matrix().set(0, 0, 0); | 8900 singular.matrix().set(0, 0, 0); |
8900 singular.matrix().set(0, 1, 1); | 8901 singular.matrix().set(0, 1, 1); |
8901 | 8902 |
8902 child->SetTransform(singular); | 8903 child->SetTransform(singular); |
8903 child->SetDrawsContent(true); | 8904 child->SetDrawsContent(true); |
8904 grand_child->SetDrawsContent(true); | 8905 grand_child->SetDrawsContent(true); |
8905 | 8906 |
8906 scoped_ptr<KeyframedTransformAnimationCurve> curve( | 8907 std::unique_ptr<KeyframedTransformAnimationCurve> curve( |
8907 KeyframedTransformAnimationCurve::Create()); | 8908 KeyframedTransformAnimationCurve::Create()); |
8908 TransformOperations start; | 8909 TransformOperations start; |
8909 start.AppendTranslate(1.f, 2.f, 3.f); | 8910 start.AppendTranslate(1.f, 2.f, 3.f); |
8910 gfx::Transform transform; | 8911 gfx::Transform transform; |
8911 transform.Scale3d(1.0, 2.0, 3.0); | 8912 transform.Scale3d(1.0, 2.0, 3.0); |
8912 TransformOperations operation; | 8913 TransformOperations operation; |
8913 operation.AppendMatrix(transform); | 8914 operation.AppendMatrix(transform); |
8914 curve->AddKeyframe( | 8915 curve->AddKeyframe( |
8915 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); | 8916 TransformKeyframe::Create(base::TimeDelta(), start, nullptr)); |
8916 curve->AddKeyframe(TransformKeyframe::Create( | 8917 curve->AddKeyframe(TransformKeyframe::Create( |
8917 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); | 8918 base::TimeDelta::FromSecondsD(1.0), operation, nullptr)); |
8918 scoped_ptr<Animation> transform_animation( | 8919 std::unique_ptr<Animation> transform_animation( |
8919 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); | 8920 Animation::Create(std::move(curve), 3, 3, TargetProperty::TRANSFORM)); |
8920 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); | 8921 scoped_refptr<AnimationPlayer> player(AnimationPlayer::Create(1)); |
8921 host_impl()->active_tree()->animation_host()->RegisterPlayerForLayer( | 8922 host_impl()->active_tree()->animation_host()->RegisterPlayerForLayer( |
8922 grand_child->id(), player.get()); | 8923 grand_child->id(), player.get()); |
8923 host_impl() | 8924 host_impl() |
8924 ->active_tree() | 8925 ->active_tree() |
8925 ->animation_host() | 8926 ->animation_host() |
8926 ->GetControllerForLayerId(grand_child->id()) | 8927 ->GetControllerForLayerId(grand_child->id()) |
8927 ->AddAnimation(std::move(transform_animation)); | 8928 ->AddAnimation(std::move(transform_animation)); |
8928 | 8929 |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9998 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); | 9999 EXPECT_EQ(scroll_child6.id, grand_child10->scroll_tree_index()); |
9999 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); | 10000 EXPECT_EQ(scroll_root1.id, parent3->scroll_tree_index()); |
10000 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); | 10001 EXPECT_EQ(scroll_child7.id, child8->scroll_tree_index()); |
10001 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); | 10002 EXPECT_EQ(scroll_root1.id, parent4->scroll_tree_index()); |
10002 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); | 10003 EXPECT_EQ(scroll_root1.id, child9->scroll_tree_index()); |
10003 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); | 10004 EXPECT_EQ(scroll_root1.id, grand_child12->scroll_tree_index()); |
10004 } | 10005 } |
10005 | 10006 |
10006 } // namespace | 10007 } // namespace |
10007 } // namespace cc | 10008 } // namespace cc |
OLD | NEW |