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 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return scroll_offset_animation_was_interrupted_; | 172 return scroll_offset_animation_was_interrupted_; |
173 } | 173 } |
174 void SetScrollOffsetAnimationWasInterrupted(); | 174 void SetScrollOffsetAnimationWasInterrupted(); |
175 | 175 |
176 // TODO(loyso): Erase it, use AnimationPlayer's one. | 176 // TODO(loyso): Erase it, use AnimationPlayer's one. |
177 bool needs_to_start_animations_for_testing() const; | 177 bool needs_to_start_animations_for_testing() const; |
178 | 178 |
179 void SetNeedsPushProperties(); | 179 void SetNeedsPushProperties(); |
180 bool needs_push_properties() const { return needs_push_properties_; } | 180 bool needs_push_properties() const { return needs_push_properties_; } |
181 | 181 |
182 // TODO(loyso): Rework UpdateClientAnimationState to use bitset. | 182 void UpdateClientAnimationState(); |
183 void UpdateClientAnimationState(TargetProperty::Type target_property); | 183 void SetNeedsUpdateImplClientState(); |
184 void UpdateClientAnimationState(bool transform, bool opacity, bool filter); | |
185 void SetNeedsUpdateImplClientState(bool transform, bool opacity, bool filter); | |
186 | 184 |
187 void UpdateActivationNormal(); | 185 void UpdateActivationNormal(); |
188 | 186 |
189 void NotifyClientOpacityAnimated(float opacity, | 187 void NotifyClientOpacityAnimated(float opacity, |
190 bool notify_active_elements, | 188 bool notify_active_elements, |
191 bool notify_pending_elements); | 189 bool notify_pending_elements); |
192 void NotifyClientTransformAnimated(const gfx::Transform& transform, | 190 void NotifyClientTransformAnimated(const gfx::Transform& transform, |
193 bool notify_active_elements, | 191 bool notify_active_elements, |
194 bool notify_pending_elements); | 192 bool notify_pending_elements); |
195 void NotifyClientFilterAnimated(const FilterOperations& filter, | 193 void NotifyClientFilterAnimated(const FilterOperations& filter, |
196 bool notify_active_elements, | 194 bool notify_active_elements, |
197 bool notify_pending_elements); | 195 bool notify_pending_elements); |
198 void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset, | 196 void NotifyClientScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset, |
199 bool notify_active_elements, | 197 bool notify_active_elements, |
200 bool notify_pending_elements); | 198 bool notify_pending_elements); |
201 gfx::ScrollOffset ScrollOffsetForAnimation() const; | 199 gfx::ScrollOffset ScrollOffsetForAnimation() const; |
202 | 200 |
203 private: | 201 private: |
204 friend class base::RefCounted<ElementAnimations>; | 202 friend class base::RefCounted<ElementAnimations>; |
205 | 203 |
206 ElementAnimations(); | 204 ElementAnimations(); |
207 ~ElementAnimations(); | 205 ~ElementAnimations(); |
208 | 206 |
209 enum class ActivationType { NORMAL, FORCE }; | 207 enum class ActivationType { NORMAL, FORCE }; |
210 void UpdateActivation(ActivationType type); | 208 void UpdateActivation(ActivationType type); |
211 | 209 |
212 void UpdateClientAnimationStateInternal(TargetProperty::Type property); | |
213 | |
214 void NotifyClientAnimationChanged( | |
215 TargetProperty::Type property, | |
216 ElementListType list_type, | |
217 bool notify_elements_about_potential_animation, | |
218 bool notify_elements_about_running_animation); | |
219 | |
220 void OnFilterAnimated(ElementListType list_type, | 210 void OnFilterAnimated(ElementListType list_type, |
221 const FilterOperations& filters); | 211 const FilterOperations& filters); |
222 void OnOpacityAnimated(ElementListType list_type, float opacity); | 212 void OnOpacityAnimated(ElementListType list_type, float opacity); |
223 void OnTransformAnimated(ElementListType list_type, | 213 void OnTransformAnimated(ElementListType list_type, |
224 const gfx::Transform& transform); | 214 const gfx::Transform& transform); |
225 void OnScrollOffsetAnimated(ElementListType list_type, | 215 void OnScrollOffsetAnimated(ElementListType list_type, |
226 const gfx::ScrollOffset& scroll_offset); | 216 const gfx::ScrollOffset& scroll_offset); |
227 void IsAnimatingChanged(ElementListType list_type, | |
228 TargetProperty::Type property, | |
229 AnimationChangeType change_type, | |
230 bool is_animating); | |
231 | 217 |
232 void ClearNeedsUpdateImplClientState(); | 218 static TargetProperties GetPropertiesMaskForAnimationState(); |
233 | 219 |
234 std::unique_ptr<PlayersList> players_list_; | 220 std::unique_ptr<PlayersList> players_list_; |
235 AnimationHost* animation_host_; | 221 AnimationHost* animation_host_; |
236 ElementId element_id_; | 222 ElementId element_id_; |
237 | 223 |
238 // This is used to ensure that we don't spam the animation host. | 224 // This is used to ensure that we don't spam the animation host. |
239 bool is_active_; | 225 bool is_active_; |
240 | 226 |
241 base::TimeTicks last_tick_time_; | 227 base::TimeTicks last_tick_time_; |
242 | 228 |
243 bool has_element_in_active_list_; | 229 bool has_element_in_active_list_; |
244 bool has_element_in_pending_list_; | 230 bool has_element_in_pending_list_; |
245 | 231 |
246 bool scroll_offset_animation_was_interrupted_; | 232 bool scroll_offset_animation_was_interrupted_; |
247 | 233 |
248 bool needs_push_properties_; | 234 bool needs_push_properties_; |
249 | 235 |
250 PropertyAnimationState filter_animation_state_; | 236 PropertyAnimationState active_state_; |
251 PropertyAnimationState opacity_animation_state_; | 237 PropertyAnimationState pending_state_; |
252 PropertyAnimationState transform_animation_state_; | |
253 | 238 |
254 bool needs_update_impl_client_state_transform_ : 1; | 239 bool needs_update_impl_client_state_; |
255 bool needs_update_impl_client_state_opacity_ : 1; | |
256 bool needs_update_impl_client_state_filter_ : 1; | |
257 | 240 |
258 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); | 241 DISALLOW_COPY_AND_ASSIGN(ElementAnimations); |
259 }; | 242 }; |
260 | 243 |
261 } // namespace cc | 244 } // namespace cc |
262 | 245 |
263 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ | 246 #endif // CC_ANIMATION_ELEMENT_ANIMATIONS_H_ |
OLD | NEW |