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

Side by Side Diff: cc/animation/element_animations.h

Issue 1921583003: CC Animation: Let MutatorHostClient deals with elements instead of layers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@elementid
Patch Set: Rename methods in ElementAnimations 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
« no previous file with comments | « cc/animation/animation_player_unittest.cc ('k') | cc/animation/element_animations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ELEMENT_ANIMATIONS_H_ 5 #ifndef CC_ANIMATION_ELEMENT_ANIMATIONS_H_
6 #define CC_ANIMATION_ELEMENT_ANIMATIONS_H_ 6 #define CC_ANIMATION_ELEMENT_ANIMATIONS_H_
7 7
8 #include <bitset> 8 #include <bitset>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 namespace cc { 28 namespace cc {
29 29
30 class AnimationDelegate; 30 class AnimationDelegate;
31 class AnimationEvents; 31 class AnimationEvents;
32 class AnimationHost; 32 class AnimationHost;
33 class AnimationPlayer; 33 class AnimationPlayer;
34 class FilterOperations; 34 class FilterOperations;
35 class KeyframeValueList; 35 class KeyframeValueList;
36 enum class LayerTreeType; 36 enum class ElementListType;
37 37
38 // An ElementAnimations owns a list of all AnimationPlayers, attached to 38 // An ElementAnimations owns a list of all AnimationPlayers, attached to
39 // the layer. 39 // the element.
40 // This is a CC counterpart for blink::ElementAnimations (in 1:1 relationship). 40 // This is a CC counterpart for blink::ElementAnimations (in 1:1 relationship).
41 // No pointer to/from respective blink::ElementAnimations object for now. 41 // No pointer to/from respective blink::ElementAnimations object for now.
42 class CC_EXPORT ElementAnimations : public base::RefCounted<ElementAnimations> { 42 class CC_EXPORT ElementAnimations : public base::RefCounted<ElementAnimations> {
43 public: 43 public:
44 static scoped_refptr<ElementAnimations> Create(); 44 static scoped_refptr<ElementAnimations> Create();
45 45
46 ElementId element_id() const { return element_id_; } 46 ElementId element_id() const { return element_id_; }
47 void SetElementId(ElementId element_id); 47 void SetElementId(ElementId element_id);
48 48
49 // Parent AnimationHost. 49 // Parent AnimationHost.
50 AnimationHost* animation_host() { return animation_host_; } 50 AnimationHost* animation_host() { return animation_host_; }
51 const AnimationHost* animation_host() const { return animation_host_; } 51 const AnimationHost* animation_host() const { return animation_host_; }
52 void SetAnimationHost(AnimationHost* host); 52 void SetAnimationHost(AnimationHost* host);
53 53
54 void InitAffectedElementTypes(); 54 void InitAffectedElementTypes();
55 void ClearAffectedElementTypes(); 55 void ClearAffectedElementTypes();
56 56
57 void LayerRegistered(ElementId element_id, LayerTreeType tree_type); 57 void ElementRegistered(ElementId element_id, ElementListType list_type);
58 void LayerUnregistered(ElementId element_id, LayerTreeType tree_type); 58 void ElementUnregistered(ElementId element_id, ElementListType list_type);
59 59
60 void AddPlayer(AnimationPlayer* player); 60 void AddPlayer(AnimationPlayer* player);
61 void RemovePlayer(AnimationPlayer* player); 61 void RemovePlayer(AnimationPlayer* player);
62 bool IsEmpty() const; 62 bool IsEmpty() const;
63 63
64 typedef base::LinkedList<AnimationPlayer> PlayersList; 64 typedef base::LinkedList<AnimationPlayer> PlayersList;
65 typedef base::LinkNode<AnimationPlayer> PlayersListNode; 65 typedef base::LinkNode<AnimationPlayer> PlayersListNode;
66 const PlayersList& players_list() const { return *players_list_.get(); } 66 const PlayersList& players_list() const { return *players_list_.get(); }
67 67
68 // Ensures that the list of active animations on the main thread and the impl 68 // Ensures that the list of active animations on the main thread and the impl
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // aborted. 100 // aborted.
101 bool HasActiveAnimation() const; 101 bool HasActiveAnimation() const;
102 102
103 // Returns true if there are any animations at all to process. 103 // Returns true if there are any animations at all to process.
104 bool has_any_animation() const { return !animations_.empty(); } 104 bool has_any_animation() const { return !animations_.empty(); }
105 105
106 // Returns true if there is an animation that is either currently animating 106 // Returns true if there is an animation that is either currently animating
107 // the given property or scheduled to animate this property in the future, and 107 // the given property or scheduled to animate this property in the future, and
108 // that affects the given tree type. 108 // that affects the given tree type.
109 bool IsPotentiallyAnimatingProperty(TargetProperty::Type target_property, 109 bool IsPotentiallyAnimatingProperty(TargetProperty::Type target_property,
110 LayerTreeType tree_type) const; 110 ElementListType list_type) const;
111 111
112 // Returns true if there is an animation that is currently animating the given 112 // Returns true if there is an animation that is currently animating the given
113 // property and that affects the given tree type. 113 // property and that affects the given tree type.
114 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property, 114 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property,
115 LayerTreeType tree_type) const; 115 ElementListType list_type) const;
116 116
117 void NotifyAnimationStarted(const AnimationEvent& event); 117 void NotifyAnimationStarted(const AnimationEvent& event);
118 void NotifyAnimationFinished(const AnimationEvent& event); 118 void NotifyAnimationFinished(const AnimationEvent& event);
119 void NotifyAnimationAborted(const AnimationEvent& event); 119 void NotifyAnimationAborted(const AnimationEvent& event);
120 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); 120 void NotifyAnimationPropertyUpdate(const AnimationEvent& event);
121 void NotifyAnimationTakeover(const AnimationEvent& event); 121 void NotifyAnimationTakeover(const AnimationEvent& event);
122 122
123 bool has_element_in_active_list() const { 123 bool has_element_in_active_list() const {
124 return has_element_in_active_list_; 124 return has_element_in_active_list_;
125 } 125 }
(...skipping 15 matching lines...) Expand all
141 HasFilterAnimationThatInflatesBounds(); 141 HasFilterAnimationThatInflatesBounds();
142 } 142 }
143 143
144 bool FilterAnimationBoundsForBox(const gfx::BoxF& box, 144 bool FilterAnimationBoundsForBox(const gfx::BoxF& box,
145 gfx::BoxF* bounds) const; 145 gfx::BoxF* bounds) const;
146 bool TransformAnimationBoundsForBox(const gfx::BoxF& box, 146 bool TransformAnimationBoundsForBox(const gfx::BoxF& box,
147 gfx::BoxF* bounds) const; 147 gfx::BoxF* bounds) const;
148 148
149 bool HasAnimationThatAffectsScale() const; 149 bool HasAnimationThatAffectsScale() const;
150 150
151 bool HasOnlyTranslationTransforms(LayerTreeType tree_type) const; 151 bool HasOnlyTranslationTransforms(ElementListType list_type) const;
152 152
153 bool AnimationsPreserveAxisAlignment() const; 153 bool AnimationsPreserveAxisAlignment() const;
154 154
155 // Sets |start_scale| to the maximum of starting animation scale along any 155 // Sets |start_scale| to the maximum of starting animation scale along any
156 // dimension at any destination in active animations. Returns false if the 156 // dimension at any destination in active animations. Returns false if the
157 // starting scale cannot be computed. 157 // starting scale cannot be computed.
158 bool AnimationStartScale(LayerTreeType tree_type, float* start_scale) const; 158 bool AnimationStartScale(ElementListType list_type, float* start_scale) const;
159 159
160 // Sets |max_scale| to the maximum scale along any dimension at any 160 // Sets |max_scale| to the maximum scale along any dimension at any
161 // destination in active animations. Returns false if the maximum scale cannot 161 // destination in active animations. Returns false if the maximum scale cannot
162 // be computed. 162 // be computed.
163 bool MaximumTargetScale(LayerTreeType tree_type, float* max_scale) const; 163 bool MaximumTargetScale(ElementListType list_type, float* max_scale) const;
164 164
165 // When a scroll animation is removed on the main thread, its compositor 165 // When a scroll animation is removed on the main thread, its compositor
166 // thread counterpart continues producing scroll deltas until activation. 166 // thread counterpart continues producing scroll deltas until activation.
167 // These scroll deltas need to be cleared at activation, so that the active 167 // These scroll deltas need to be cleared at activation, so that the active
168 // layer's scroll offset matches the offset provided by the main thread 168 // element's scroll offset matches the offset provided by the main thread
169 // rather than a combination of this offset and scroll deltas produced by 169 // rather than a combination of this offset and scroll deltas produced by
170 // the removed animation. This is to provide the illusion of synchronicity to 170 // the removed animation. This is to provide the illusion of synchronicity to
171 // JS that simultaneously removes an animation and sets the scroll offset. 171 // JS that simultaneously removes an animation and sets the scroll offset.
172 bool scroll_offset_animation_was_interrupted() const { 172 bool scroll_offset_animation_was_interrupted() const {
173 return scroll_offset_animation_was_interrupted_; 173 return scroll_offset_animation_was_interrupted_;
174 } 174 }
175 175
176 bool needs_to_start_animations_for_testing() { 176 bool needs_to_start_animations_for_testing() {
177 return needs_to_start_animations_; 177 return needs_to_start_animations_;
178 } 178 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 bool notify_pending_elements); 222 bool notify_pending_elements);
223 223
224 void NotifyClientAnimationWaitingForDeletion(); 224 void NotifyClientAnimationWaitingForDeletion();
225 225
226 void NotifyClientTransformIsPotentiallyAnimatingChanged( 226 void NotifyClientTransformIsPotentiallyAnimatingChanged(
227 bool notify_active_elements, 227 bool notify_active_elements,
228 bool notify_pending_elements); 228 bool notify_pending_elements);
229 229
230 void UpdatePotentiallyAnimatingTransform(); 230 void UpdatePotentiallyAnimatingTransform();
231 231
232 void OnFilterAnimated(LayerTreeType tree_type, 232 void OnFilterAnimated(ElementListType list_type,
233 const FilterOperations& filters); 233 const FilterOperations& filters);
234 void OnOpacityAnimated(LayerTreeType tree_type, float opacity); 234 void OnOpacityAnimated(ElementListType list_type, float opacity);
235 void OnTransformAnimated(LayerTreeType tree_type, 235 void OnTransformAnimated(ElementListType list_type,
236 const gfx::Transform& transform); 236 const gfx::Transform& transform);
237 void OnScrollOffsetAnimated(LayerTreeType tree_type, 237 void OnScrollOffsetAnimated(ElementListType list_type,
238 const gfx::ScrollOffset& scroll_offset); 238 const gfx::ScrollOffset& scroll_offset);
239 void OnAnimationWaitingForDeletion(); 239 void OnAnimationWaitingForDeletion();
240 void OnTransformIsPotentiallyAnimatingChanged(LayerTreeType tree_type, 240 void OnTransformIsPotentiallyAnimatingChanged(ElementListType list_type,
241 bool is_animating); 241 bool is_animating);
242 gfx::ScrollOffset ScrollOffsetForAnimation() const; 242 gfx::ScrollOffset ScrollOffsetForAnimation() const;
243 243
244 void NotifyPlayersAnimationStarted(base::TimeTicks monotonic_time, 244 void NotifyPlayersAnimationStarted(base::TimeTicks monotonic_time,
245 TargetProperty::Type target_property, 245 TargetProperty::Type target_property,
246 int group); 246 int group);
247 void NotifyPlayersAnimationFinished(base::TimeTicks monotonic_time, 247 void NotifyPlayersAnimationFinished(base::TimeTicks monotonic_time,
248 TargetProperty::Type target_property, 248 TargetProperty::Type target_property,
249 int group); 249 int group);
250 void NotifyPlayersAnimationAborted(base::TimeTicks monotonic_time, 250 void NotifyPlayersAnimationAborted(base::TimeTicks monotonic_time,
(...skipping 26 matching lines...) Expand all
277 277
278 bool potentially_animating_transform_for_active_elements_; 278 bool potentially_animating_transform_for_active_elements_;
279 bool potentially_animating_transform_for_pending_elements_; 279 bool potentially_animating_transform_for_pending_elements_;
280 280
281 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); 281 DISALLOW_COPY_AND_ASSIGN(ElementAnimations);
282 }; 282 };
283 283
284 } // namespace cc 284 } // namespace cc
285 285
286 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ 286 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_
OLDNEW
« no previous file with comments | « cc/animation/animation_player_unittest.cc ('k') | cc/animation/element_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698