| 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_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 23 matching lines...) Expand all Loading... |
| 34 class FilterOperations; | 34 class FilterOperations; |
| 35 class KeyframeValueList; | 35 class KeyframeValueList; |
| 36 enum class LayerTreeType; | 36 enum class LayerTreeType; |
| 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 layer. |
| 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 enum class ObserverType { ACTIVE, PENDING }; | |
| 45 | |
| 46 static scoped_refptr<ElementAnimations> Create(); | 44 static scoped_refptr<ElementAnimations> Create(); |
| 47 | 45 |
| 48 int layer_id() const { return layer_id_; } | 46 int layer_id() const { return layer_id_; } |
| 49 void SetLayerId(int layer_id); | 47 void SetLayerId(int layer_id); |
| 50 | 48 |
| 51 // Parent AnimationHost. | 49 // Parent AnimationHost. |
| 52 AnimationHost* animation_host() { return animation_host_; } | 50 AnimationHost* animation_host() { return animation_host_; } |
| 53 const AnimationHost* animation_host() const { return animation_host_; } | 51 const AnimationHost* animation_host() const { return animation_host_; } |
| 54 void SetAnimationHost(AnimationHost* host); | 52 void SetAnimationHost(AnimationHost* host); |
| 55 | 53 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // aborted. | 100 // aborted. |
| 103 bool HasActiveAnimation() const; | 101 bool HasActiveAnimation() const; |
| 104 | 102 |
| 105 // Returns true if there are any animations at all to process. | 103 // Returns true if there are any animations at all to process. |
| 106 bool has_any_animation() const { return !animations_.empty(); } | 104 bool has_any_animation() const { return !animations_.empty(); } |
| 107 | 105 |
| 108 // 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 |
| 109 // 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 |
| 110 // that affects the given observer type. | 108 // that affects the given observer type. |
| 111 bool IsPotentiallyAnimatingProperty(TargetProperty::Type target_property, | 109 bool IsPotentiallyAnimatingProperty(TargetProperty::Type target_property, |
| 112 ObserverType observer_type) const; | 110 LayerTreeType observer_type) const; |
| 113 | 111 |
| 114 // 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 |
| 115 // property and that affects the given observer type. | 113 // property and that affects the given observer type. |
| 116 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property, | 114 bool IsCurrentlyAnimatingProperty(TargetProperty::Type target_property, |
| 117 ObserverType observer_type) const; | 115 LayerTreeType observer_type) const; |
| 118 | 116 |
| 119 void NotifyAnimationStarted(const AnimationEvent& event); | 117 void NotifyAnimationStarted(const AnimationEvent& event); |
| 120 void NotifyAnimationFinished(const AnimationEvent& event); | 118 void NotifyAnimationFinished(const AnimationEvent& event); |
| 121 void NotifyAnimationAborted(const AnimationEvent& event); | 119 void NotifyAnimationAborted(const AnimationEvent& event); |
| 122 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); | 120 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); |
| 123 void NotifyAnimationTakeover(const AnimationEvent& event); | 121 void NotifyAnimationTakeover(const AnimationEvent& event); |
| 124 | 122 |
| 125 bool needs_active_value_observations() const { | 123 bool needs_active_value_observations() const { |
| 126 return needs_active_value_observations_; | 124 return needs_active_value_observations_; |
| 127 } | 125 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 145 HasFilterAnimationThatInflatesBounds(); | 143 HasFilterAnimationThatInflatesBounds(); |
| 146 } | 144 } |
| 147 | 145 |
| 148 bool FilterAnimationBoundsForBox(const gfx::BoxF& box, | 146 bool FilterAnimationBoundsForBox(const gfx::BoxF& box, |
| 149 gfx::BoxF* bounds) const; | 147 gfx::BoxF* bounds) const; |
| 150 bool TransformAnimationBoundsForBox(const gfx::BoxF& box, | 148 bool TransformAnimationBoundsForBox(const gfx::BoxF& box, |
| 151 gfx::BoxF* bounds) const; | 149 gfx::BoxF* bounds) const; |
| 152 | 150 |
| 153 bool HasAnimationThatAffectsScale() const; | 151 bool HasAnimationThatAffectsScale() const; |
| 154 | 152 |
| 155 bool HasOnlyTranslationTransforms(ObserverType observer_type) const; | 153 bool HasOnlyTranslationTransforms(LayerTreeType observer_type) const; |
| 156 | 154 |
| 157 bool AnimationsPreserveAxisAlignment() const; | 155 bool AnimationsPreserveAxisAlignment() const; |
| 158 | 156 |
| 159 // Sets |start_scale| to the maximum of starting animation scale along any | 157 // Sets |start_scale| to the maximum of starting animation scale along any |
| 160 // dimension at any destination in active animations. Returns false if the | 158 // dimension at any destination in active animations. Returns false if the |
| 161 // starting scale cannot be computed. | 159 // starting scale cannot be computed. |
| 162 bool AnimationStartScale(ObserverType observer_type, | 160 bool AnimationStartScale(LayerTreeType observer_type, |
| 163 float* start_scale) const; | 161 float* start_scale) const; |
| 164 | 162 |
| 165 // Sets |max_scale| to the maximum scale along any dimension at any | 163 // Sets |max_scale| to the maximum scale along any dimension at any |
| 166 // destination in active animations. Returns false if the maximum scale cannot | 164 // destination in active animations. Returns false if the maximum scale cannot |
| 167 // be computed. | 165 // be computed. |
| 168 bool MaximumTargetScale(ObserverType observer_type, float* max_scale) const; | 166 bool MaximumTargetScale(LayerTreeType observer_type, float* max_scale) const; |
| 169 | 167 |
| 170 // When a scroll animation is removed on the main thread, its compositor | 168 // When a scroll animation is removed on the main thread, its compositor |
| 171 // thread counterpart continues producing scroll deltas until activation. | 169 // thread counterpart continues producing scroll deltas until activation. |
| 172 // These scroll deltas need to be cleared at activation, so that the active | 170 // These scroll deltas need to be cleared at activation, so that the active |
| 173 // layer's scroll offset matches the offset provided by the main thread | 171 // layer's scroll offset matches the offset provided by the main thread |
| 174 // rather than a combination of this offset and scroll deltas produced by | 172 // rather than a combination of this offset and scroll deltas produced by |
| 175 // the removed animation. This is to provide the illusion of synchronicity to | 173 // the removed animation. This is to provide the illusion of synchronicity to |
| 176 // JS that simultaneously removes an animation and sets the scroll offset. | 174 // JS that simultaneously removes an animation and sets the scroll offset. |
| 177 bool scroll_offset_animation_was_interrupted() const { | 175 bool scroll_offset_animation_was_interrupted() const { |
| 178 return scroll_offset_animation_was_interrupted_; | 176 return scroll_offset_animation_was_interrupted_; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 281 |
| 284 bool potentially_animating_transform_for_active_observers_; | 282 bool potentially_animating_transform_for_active_observers_; |
| 285 bool potentially_animating_transform_for_pending_observers_; | 283 bool potentially_animating_transform_for_pending_observers_; |
| 286 | 284 |
| 287 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); | 285 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); |
| 288 }; | 286 }; |
| 289 | 287 |
| 290 } // namespace cc | 288 } // namespace cc |
| 291 | 289 |
| 292 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ | 290 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ |
| OLD | NEW |