| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/containers/linked_list.h" | 10 #include "base/containers/linked_list.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 ~ElementAnimations() override; | 43 ~ElementAnimations() override; |
| 44 | 44 |
| 45 int layer_id() const { | 45 int layer_id() const { |
| 46 return layer_animation_controller_ ? layer_animation_controller_->id() : 0; | 46 return layer_animation_controller_ ? layer_animation_controller_->id() : 0; |
| 47 } | 47 } |
| 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 | 52 |
| 53 LayerAnimationController* layer_animation_controller() const { | |
| 54 return layer_animation_controller_.get(); | |
| 55 } | |
| 56 | |
| 57 void CreateLayerAnimationController(int layer_id); | 53 void CreateLayerAnimationController(int layer_id); |
| 58 void DestroyLayerAnimationController(); | 54 void DestroyLayerAnimationController(); |
| 59 | 55 |
| 60 void LayerRegistered(int layer_id, LayerTreeType tree_type); | 56 void LayerRegistered(int layer_id, LayerTreeType tree_type); |
| 61 void LayerUnregistered(int layer_id, LayerTreeType tree_type); | 57 void LayerUnregistered(int layer_id, LayerTreeType tree_type); |
| 62 | 58 |
| 63 bool has_active_value_observer_for_testing() const { | 59 bool has_active_value_observer_for_testing() const { |
| 64 return !!active_value_observer_; | 60 return !!active_value_observer_; |
| 65 } | 61 } |
| 66 bool has_pending_value_observer_for_testing() const { | 62 bool has_pending_value_observer_for_testing() const { |
| 67 return !!pending_value_observer_; | 63 return !!pending_value_observer_; |
| 68 } | 64 } |
| 69 | 65 |
| 70 void AddPlayer(AnimationPlayer* player); | 66 void AddPlayer(AnimationPlayer* player); |
| 71 void RemovePlayer(AnimationPlayer* player); | 67 void RemovePlayer(AnimationPlayer* player); |
| 72 bool IsEmpty() const; | 68 bool IsEmpty() const; |
| 73 | 69 |
| 74 typedef base::LinkedList<AnimationPlayer> PlayersList; | 70 typedef base::LinkedList<AnimationPlayer> PlayersList; |
| 75 typedef base::LinkNode<AnimationPlayer> PlayersListNode; | 71 typedef base::LinkNode<AnimationPlayer> PlayersListNode; |
| 76 const PlayersList& players_list() const { return *players_list_.get(); } | 72 const PlayersList& players_list() const { return *players_list_.get(); } |
| 77 | 73 |
| 78 void PushPropertiesTo(ElementAnimations* element_animations_impl); | 74 void PushPropertiesTo(ElementAnimations* element_animations_impl); |
| 79 | 75 |
| 76 void AddAnimation(std::unique_ptr<Animation> animation); |
| 77 void PauseAnimation(int animation_id, base::TimeDelta time_offset); |
| 78 void RemoveAnimation(int animation_id); |
| 79 void AbortAnimation(int animation_id); |
| 80 void AbortAnimations(TargetProperty::Type target_property, |
| 81 bool needs_completion = false); |
| 82 |
| 83 // Returns the active animation animating the given property that is either |
| 84 // running, or is next to run, if such an animation exists. |
| 85 Animation* GetAnimation(TargetProperty::Type target_property) const; |
| 86 |
| 87 // Returns the active animation for the given unique animation id. |
| 88 Animation* GetAnimationById(int animation_id) const; |
| 89 |
| 90 void AddEventObserver(LayerAnimationEventObserver* observer); |
| 91 void RemoveEventObserver(LayerAnimationEventObserver* observer); |
| 92 |
| 80 private: | 93 private: |
| 94 // TODO(loyso): Erase this when LAC merged into ElementAnimations. |
| 95 friend class AnimationHost; |
| 96 |
| 81 explicit ElementAnimations(AnimationHost* host); | 97 explicit ElementAnimations(AnimationHost* host); |
| 82 | 98 |
| 83 void SetFilterMutated(LayerTreeType tree_type, | 99 void SetFilterMutated(LayerTreeType tree_type, |
| 84 const FilterOperations& filters); | 100 const FilterOperations& filters); |
| 85 void SetOpacityMutated(LayerTreeType tree_type, float opacity); | 101 void SetOpacityMutated(LayerTreeType tree_type, float opacity); |
| 86 void SetTransformMutated(LayerTreeType tree_type, | 102 void SetTransformMutated(LayerTreeType tree_type, |
| 87 const gfx::Transform& transform); | 103 const gfx::Transform& transform); |
| 88 void SetScrollOffsetMutated(LayerTreeType tree_type, | 104 void SetScrollOffsetMutated(LayerTreeType tree_type, |
| 89 const gfx::ScrollOffset& scroll_offset); | 105 const gfx::ScrollOffset& scroll_offset); |
| 90 void SetTransformIsPotentiallyAnimatingChanged(LayerTreeType tree_type, | 106 void SetTransformIsPotentiallyAnimatingChanged(LayerTreeType tree_type, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // LAC is owned by ElementAnimations (1:1 relationship). | 139 // LAC is owned by ElementAnimations (1:1 relationship). |
| 124 scoped_refptr<LayerAnimationController> layer_animation_controller_; | 140 scoped_refptr<LayerAnimationController> layer_animation_controller_; |
| 125 AnimationHost* animation_host_; | 141 AnimationHost* animation_host_; |
| 126 | 142 |
| 127 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); | 143 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); |
| 128 }; | 144 }; |
| 129 | 145 |
| 130 } // namespace cc | 146 } // namespace cc |
| 131 | 147 |
| 132 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ | 148 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ |
| OLD | NEW |