| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "cc/animation/animation_export.h" | 14 #include "cc/animation/animation_export.h" |
| 15 #include "cc/animation/animation_observer.h" |
| 15 #include "cc/trees/element_id.h" | 16 #include "cc/trees/element_id.h" |
| 16 #include "cc/trees/property_animation_state.h" | 17 #include "cc/trees/property_animation_state.h" |
| 17 #include "cc/trees/target_property.h" | 18 #include "cc/trees/target_property.h" |
| 18 #include "ui/gfx/geometry/scroll_offset.h" | |
| 19 #include "ui/gfx/transform.h" | 19 #include "ui/gfx/transform.h" |
| 20 | 20 |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 class BoxF; | 22 class BoxF; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace cc { | 25 namespace cc { |
| 26 | 26 |
| 27 class AnimationHost; | 27 class AnimationHost; |
| 28 class AnimationPlayer; | 28 class AnimationPlayer; |
| 29 class FilterOperations; | 29 class FilterOperations; |
| 30 enum class ElementListType; | 30 enum class ElementListType; |
| 31 struct AnimationEvent; | 31 struct AnimationEvent; |
| 32 | 32 |
| 33 enum class UpdateTickingType { NORMAL, FORCE }; | 33 enum class UpdateTickingType { NORMAL, FORCE }; |
| 34 | 34 |
| 35 // An ElementAnimations owns a list of all AnimationPlayers, attached to | 35 // An ElementAnimations owns a list of all AnimationPlayers, attached to |
| 36 // the element. | 36 // the element. |
| 37 // This is a CC counterpart for blink::ElementAnimations (in 1:1 relationship). | 37 // This is a CC counterpart for blink::ElementAnimations (in 1:1 relationship). |
| 38 // No pointer to/from respective blink::ElementAnimations object for now. | 38 // No pointer to/from respective blink::ElementAnimations object for now. |
| 39 class CC_ANIMATION_EXPORT ElementAnimations | 39 class CC_ANIMATION_EXPORT ElementAnimations |
| 40 : public base::RefCounted<ElementAnimations> { | 40 : public base::RefCounted<ElementAnimations>, |
| 41 public AnimationObserver { |
| 41 public: | 42 public: |
| 42 static scoped_refptr<ElementAnimations> Create(); | 43 static scoped_refptr<ElementAnimations> Create(); |
| 43 | 44 |
| 44 ElementId element_id() const { return element_id_; } | 45 ElementId element_id() const { return element_id_; } |
| 45 void SetElementId(ElementId element_id); | 46 void SetElementId(ElementId element_id); |
| 46 | 47 |
| 47 // Parent AnimationHost. | 48 // Parent AnimationHost. |
| 48 AnimationHost* animation_host() { return animation_host_; } | 49 AnimationHost* animation_host() { return animation_host_; } |
| 49 const AnimationHost* animation_host() const { return animation_host_; } | 50 const AnimationHost* animation_host() const { return animation_host_; } |
| 50 void SetAnimationHost(AnimationHost* host); | 51 void SetAnimationHost(AnimationHost* host); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 bool MaximumTargetScale(ElementListType list_type, float* max_scale) const; | 139 bool MaximumTargetScale(ElementListType list_type, float* max_scale) const; |
| 139 | 140 |
| 140 bool ScrollOffsetAnimationWasInterrupted() const; | 141 bool ScrollOffsetAnimationWasInterrupted() const; |
| 141 | 142 |
| 142 void SetNeedsPushProperties(); | 143 void SetNeedsPushProperties(); |
| 143 bool needs_push_properties() const { return needs_push_properties_; } | 144 bool needs_push_properties() const { return needs_push_properties_; } |
| 144 | 145 |
| 145 void UpdateClientAnimationState(); | 146 void UpdateClientAnimationState(); |
| 146 void SetNeedsUpdateImplClientState(); | 147 void SetNeedsUpdateImplClientState(); |
| 147 | 148 |
| 149 // AnimationObserver |
| 148 void NotifyClientOpacityAnimated(float opacity, | 150 void NotifyClientOpacityAnimated(float opacity, |
| 149 bool notify_active_elements, | 151 bool notify_active_elements, |
| 150 bool notify_pending_elements); | 152 bool notify_pending_elements) override; |
| 151 void NotifyClientTransformAnimated(const gfx::Transform& transform, | 153 void NotifyClientTransformOperationsAnimated( |
| 152 bool notify_active_elements, | 154 const TransformOperations& operations, |
| 153 bool notify_pending_elements); | 155 bool notify_active_elements, |
| 156 bool notify_pending_elements) override; |
| 154 void NotifyClientFilterAnimated(const FilterOperations& filter, | 157 void NotifyClientFilterAnimated(const FilterOperations& filter, |
| 155 bool notify_active_elements, | 158 bool notify_active_elements, |
| 156 bool notify_pending_elements); | 159 bool notify_pending_elements) override; |
| 157 void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset, | 160 void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset, |
| 158 bool notify_active_elements, | 161 bool notify_active_elements, |
| 159 bool notify_pending_elements); | 162 bool notify_pending_elements) override; |
| 163 |
| 160 gfx::ScrollOffset ScrollOffsetForAnimation() const; | 164 gfx::ScrollOffset ScrollOffsetForAnimation() const; |
| 161 | 165 |
| 162 private: | 166 private: |
| 163 friend class base::RefCounted<ElementAnimations>; | 167 friend class base::RefCounted<ElementAnimations>; |
| 164 | 168 |
| 165 ElementAnimations(); | 169 ElementAnimations(); |
| 166 ~ElementAnimations(); | 170 ~ElementAnimations() override; |
| 167 | 171 |
| 168 void OnFilterAnimated(ElementListType list_type, | 172 void OnFilterAnimated(ElementListType list_type, |
| 169 const FilterOperations& filters); | 173 const FilterOperations& filters); |
| 170 void OnOpacityAnimated(ElementListType list_type, float opacity); | 174 void OnOpacityAnimated(ElementListType list_type, float opacity); |
| 171 void OnTransformAnimated(ElementListType list_type, | 175 void OnTransformAnimated(ElementListType list_type, |
| 172 const gfx::Transform& transform); | 176 const gfx::Transform& transform); |
| 173 void OnScrollOffsetAnimated(ElementListType list_type, | 177 void OnScrollOffsetAnimated(ElementListType list_type, |
| 174 const gfx::ScrollOffset& scroll_offset); | 178 const gfx::ScrollOffset& scroll_offset); |
| 175 | 179 |
| 176 static TargetProperties GetPropertiesMaskForAnimationState(); | 180 static TargetProperties GetPropertiesMaskForAnimationState(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 191 PropertyAnimationState pending_state_; | 195 PropertyAnimationState pending_state_; |
| 192 | 196 |
| 193 mutable bool needs_update_impl_client_state_; | 197 mutable bool needs_update_impl_client_state_; |
| 194 | 198 |
| 195 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); | 199 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); |
| 196 }; | 200 }; |
| 197 | 201 |
| 198 } // namespace cc | 202 } // namespace cc |
| 199 | 203 |
| 200 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ | 204 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ |
| OLD | NEW |