OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef CC_ANIMATION_ANIMATION_TIMELINE_H_ | 5 #ifndef CC_ANIMATION_ANIMATION_TIMELINE_H_ |
6 #define CC_ANIMATION_ANIMATION_TIMELINE_H_ | 6 #define CC_ANIMATION_ANIMATION_TIMELINE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "cc/animation/animation_events.h" | 14 #include "cc/animation/animation_events.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 | 16 |
| 17 namespace gfx { |
| 18 class ScrollOffset; |
| 19 } |
| 20 |
17 namespace cc { | 21 namespace cc { |
18 | 22 |
19 class AnimationPlayer; | 23 class AnimationPlayer; |
20 class AnimationRegistrar; | 24 class AnimationRegistrar; |
21 class LayerTreeHost; | 25 class LayerTreeHost; |
22 class LayerTreeMutatorsClient; | 26 class LayerTreeMutatorsClient; |
23 | 27 |
24 typedef std::vector<scoped_refptr<AnimationPlayer>> AnimationPlayerList; | 28 typedef std::vector<scoped_refptr<AnimationPlayer>> AnimationPlayerList; |
25 | 29 |
26 class CC_EXPORT AnimationTimeline : public base::RefCounted<AnimationTimeline> { | 30 class CC_EXPORT AnimationTimeline : public base::RefCounted<AnimationTimeline> { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 const gfx::BoxF& box, | 88 const gfx::BoxF& box, |
85 gfx::BoxF* bounds) const; | 89 gfx::BoxF* bounds) const; |
86 | 90 |
87 bool HasOnlyTranslationTransforms(int layer_id) const; | 91 bool HasOnlyTranslationTransforms(int layer_id) const; |
88 bool AnimationsPreserveAxisAlignment(int layer_id) const; | 92 bool AnimationsPreserveAxisAlignment(int layer_id) const; |
89 bool MaximumTargetScale(int layer_id, float* max_scale) const; | 93 bool MaximumTargetScale(int layer_id, float* max_scale) const; |
90 | 94 |
91 bool HasAnyAnimation(int layer_id) const; | 95 bool HasAnyAnimation(int layer_id) const; |
92 bool HasActiveAnimation(int layer_id) const; | 96 bool HasActiveAnimation(int layer_id) const; |
93 | 97 |
| 98 void ScrollAnimationCreate(int layer_id, |
| 99 const gfx::ScrollOffset& target_offset, |
| 100 const gfx::ScrollOffset& current_offset); |
| 101 bool ScrollAnimationUpdateTarget(int layer_id, |
| 102 const gfx::Vector2dF& scroll_delta, |
| 103 const gfx::ScrollOffset& max_scroll_offset, |
| 104 base::TimeTicks frame_monotonic_time); |
| 105 |
94 private: | 106 private: |
95 friend class base::RefCounted<AnimationTimeline>; | 107 friend class base::RefCounted<AnimationTimeline>; |
96 | 108 |
97 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share | 109 // TODO(loyso): Temporary 1:1 mapping. AnimationPlayers share |
98 // LayerAnimationController for a given layer at the moment. | 110 // LayerAnimationController for a given layer at the moment. |
99 // Introduce LayersAnimations for the many AnimationPlayers to many Layers | 111 // Introduce LayersAnimations for the many AnimationPlayers to many Layers |
100 // mapping (a CC counterpart for blink::ElementAnimations). | 112 // mapping (a CC counterpart for blink::ElementAnimations). |
101 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; | 113 typedef base::hash_map<int, AnimationPlayer*> LayerToPlayerMap; |
102 LayerToPlayerMap layer_to_player_map_; | 114 LayerToPlayerMap layer_to_player_map_; |
103 | 115 |
104 AnimationTimeline(); | 116 AnimationTimeline(); |
105 virtual ~AnimationTimeline(); | 117 virtual ~AnimationTimeline(); |
106 | 118 |
107 void PushAttachedPlayersToImplThread(AnimationTimeline* timeline) const; | 119 void PushAttachedPlayersToImplThread(AnimationTimeline* timeline) const; |
108 void RemoveDetachedPlayersFromImplThread(AnimationTimeline* timeline) const; | 120 void RemoveDetachedPlayersFromImplThread(AnimationTimeline* timeline) const; |
109 void PushPropertiesToImplThread(AnimationTimeline* timeline); | 121 void PushPropertiesToImplThread(AnimationTimeline* timeline); |
110 | 122 |
111 void ErasePlayers(AnimationPlayerList::iterator begin, | 123 void ErasePlayers(AnimationPlayerList::iterator begin, |
112 AnimationPlayerList::iterator end); | 124 AnimationPlayerList::iterator end); |
113 | 125 |
114 AnimationPlayer* GetPlayerForLayerId(int layer_id) const; | 126 AnimationPlayer* GetPlayerForLayerId(int layer_id) const; |
115 | 127 |
116 AnimationPlayerList players_; | 128 AnimationPlayerList players_; |
117 scoped_ptr<AnimationRegistrar> animation_registrar_; | 129 scoped_ptr<AnimationRegistrar> animation_registrar_; |
118 LayerTreeMutatorsClient* layer_tree_mutators_client_; | 130 LayerTreeMutatorsClient* layer_tree_mutators_client_; |
119 | 131 |
| 132 scoped_refptr<AnimationPlayer> scroll_offset_animation_player_; |
| 133 |
120 DISALLOW_COPY_AND_ASSIGN(AnimationTimeline); | 134 DISALLOW_COPY_AND_ASSIGN(AnimationTimeline); |
121 }; | 135 }; |
122 | 136 |
123 } // namespace cc | 137 } // namespace cc |
124 | 138 |
125 #endif // CC_ANIMATION_ANIMATION_TIMELINE_H_ | 139 #endif // CC_ANIMATION_ANIMATION_TIMELINE_H_ |
OLD | NEW |