| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "wtf/RefPtr.h" | 45 #include "wtf/RefPtr.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 | 48 |
| 49 class AnimationTimeline; | 49 class AnimationTimeline; |
| 50 class Element; | 50 class Element; |
| 51 class ExceptionState; | 51 class ExceptionState; |
| 52 class WebCompositorAnimationPlayer; | 52 class WebCompositorAnimationPlayer; |
| 53 | 53 |
| 54 class CORE_EXPORT Animation final | 54 class CORE_EXPORT Animation final |
| 55 : public EventTargetWithInlineData | 55 : public RefCountedGarbageCollectedEventTargetWithInlineData<Animation> |
| 56 , public RefCountedWillBeNoBase<Animation> | |
| 57 , public ActiveDOMObject | 56 , public ActiveDOMObject |
| 58 , public WebCompositorAnimationDelegate | 57 , public WebCompositorAnimationDelegate |
| 59 , public WebCompositorAnimationPlayerClient { | 58 , public WebCompositorAnimationPlayerClient { |
| 60 DEFINE_WRAPPERTYPEINFO(); | 59 DEFINE_WRAPPERTYPEINFO(); |
| 61 REFCOUNTED_EVENT_TARGET(Animation); | 60 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(Animation); |
| 62 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Animation); | 61 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Animation); |
| 63 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(Animation); | |
| 64 public: | 62 public: |
| 65 enum AnimationPlayState { | 63 enum AnimationPlayState { |
| 66 Idle, | 64 Idle, |
| 67 Pending, | 65 Pending, |
| 68 Running, | 66 Running, |
| 69 Paused, | 67 Paused, |
| 70 Finished | 68 Finished |
| 71 }; | 69 }; |
| 72 | 70 |
| 73 ~Animation(); | 71 ~Animation(); |
| 74 static PassRefPtrWillBeRawPtr<Animation> create(AnimationEffect*, AnimationT
imeline*); | 72 static Animation* create(AnimationEffect*, AnimationTimeline*); |
| 75 | 73 |
| 76 // Returns whether the animation is finished. | 74 // Returns whether the animation is finished. |
| 77 bool update(TimingUpdateReason); | 75 bool update(TimingUpdateReason); |
| 78 | 76 |
| 79 // timeToEffectChange returns: | 77 // timeToEffectChange returns: |
| 80 // infinity - if this animation is no longer in effect | 78 // infinity - if this animation is no longer in effect |
| 81 // 0 - if this animation requires an update on the next frame | 79 // 0 - if this animation requires an update on the next frame |
| 82 // n - if this animation requires an update after 'n' units of time | 80 // n - if this animation requires an update after 'n' units of time |
| 83 double timeToEffectChange(); | 81 double timeToEffectChange(); |
| 84 | 82 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 114 const AtomicString& interfaceName() const override; | 112 const AtomicString& interfaceName() const override; |
| 115 ExecutionContext* executionContext() const override; | 113 ExecutionContext* executionContext() const override; |
| 116 bool hasPendingActivity() const override; | 114 bool hasPendingActivity() const override; |
| 117 void stop() override; | 115 void stop() override; |
| 118 | 116 |
| 119 double playbackRate() const; | 117 double playbackRate() const; |
| 120 void setPlaybackRate(double); | 118 void setPlaybackRate(double); |
| 121 const AnimationTimeline* timeline() const { return m_timeline; } | 119 const AnimationTimeline* timeline() const { return m_timeline; } |
| 122 AnimationTimeline* timeline() { return m_timeline; } | 120 AnimationTimeline* timeline() { return m_timeline; } |
| 123 | 121 |
| 124 #if !ENABLE(OILPAN) | |
| 125 void detachFromTimeline(); | |
| 126 #endif | |
| 127 | |
| 128 double calculateStartTime(double currentTime) const; | 122 double calculateStartTime(double currentTime) const; |
| 129 bool hasStartTime() const { return !isNull(m_startTime); } | 123 bool hasStartTime() const { return !isNull(m_startTime); } |
| 130 double startTime(bool& isNull) const; | 124 double startTime(bool& isNull) const; |
| 131 double startTime() const; | 125 double startTime() const; |
| 132 double startTimeInternal() const { return m_startTime; } | 126 double startTimeInternal() const { return m_startTime; } |
| 133 void setStartTime(double); | 127 void setStartTime(double); |
| 134 void setStartTimeInternal(double); | 128 void setStartTimeInternal(double); |
| 135 | 129 |
| 136 double startClip() const { return startClipInternal() * 1000; } | 130 double startClip() const { return startClipInternal() * 1000; } |
| 137 double endClip() const { return endClipInternal() * 1000; } | 131 double endClip() const { return endClipInternal() * 1000; } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 217 |
| 224 AnimationPlayState m_playState; | 218 AnimationPlayState m_playState; |
| 225 double m_playbackRate; | 219 double m_playbackRate; |
| 226 double m_startTime; | 220 double m_startTime; |
| 227 double m_holdTime; | 221 double m_holdTime; |
| 228 double m_startClip; | 222 double m_startClip; |
| 229 double m_endClip; | 223 double m_endClip; |
| 230 | 224 |
| 231 unsigned m_sequenceNumber; | 225 unsigned m_sequenceNumber; |
| 232 | 226 |
| 233 typedef ScriptPromiseProperty<RawPtrWillBeMember<Animation>, RawPtrWillBeMem
ber<Animation>, Member<DOMException>> AnimationPromise; | 227 typedef ScriptPromiseProperty<Member<Animation>, Member<Animation>, Member<D
OMException>> AnimationPromise; |
| 234 PersistentWillBeMember<AnimationPromise> m_finishedPromise; | 228 Member<AnimationPromise> m_finishedPromise; |
| 235 PersistentWillBeMember<AnimationPromise> m_readyPromise; | 229 Member<AnimationPromise> m_readyPromise; |
| 236 | 230 |
| 237 RefPtrWillBeMember<AnimationEffect> m_content; | 231 Member<AnimationEffect> m_content; |
| 238 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 232 Member<AnimationTimeline> m_timeline; |
| 239 // Reflects all pausing, including via pauseForTesting(). | 233 // Reflects all pausing, including via pauseForTesting(). |
| 240 bool m_paused; | 234 bool m_paused; |
| 241 bool m_held; | 235 bool m_held; |
| 242 bool m_isPausedForTesting; | 236 bool m_isPausedForTesting; |
| 243 bool m_isCompositedAnimationDisabledForTesting; | 237 bool m_isCompositedAnimationDisabledForTesting; |
| 244 | 238 |
| 245 // This indicates timing information relevant to the animation's effect | 239 // This indicates timing information relevant to the animation's effect |
| 246 // has changed by means other than the ordinary progression of time | 240 // has changed by means other than the ordinary progression of time |
| 247 bool m_outdated; | 241 bool m_outdated; |
| 248 | 242 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 SetCompositorPendingWithEffectChanged, | 276 SetCompositorPendingWithEffectChanged, |
| 283 DoNotSetCompositorPending, | 277 DoNotSetCompositorPending, |
| 284 }; | 278 }; |
| 285 | 279 |
| 286 class PlayStateUpdateScope { | 280 class PlayStateUpdateScope { |
| 287 STACK_ALLOCATED(); | 281 STACK_ALLOCATED(); |
| 288 public: | 282 public: |
| 289 PlayStateUpdateScope(Animation&, TimingUpdateReason, CompositorPendingCh
ange = SetCompositorPending); | 283 PlayStateUpdateScope(Animation&, TimingUpdateReason, CompositorPendingCh
ange = SetCompositorPending); |
| 290 ~PlayStateUpdateScope(); | 284 ~PlayStateUpdateScope(); |
| 291 private: | 285 private: |
| 292 RawPtrWillBeMember<Animation> m_animation; | 286 Member<Animation> m_animation; |
| 293 AnimationPlayState m_initialPlayState; | 287 AnimationPlayState m_initialPlayState; |
| 294 CompositorPendingChange m_compositorPendingChange; | 288 CompositorPendingChange m_compositorPendingChange; |
| 295 }; | 289 }; |
| 296 | 290 |
| 297 // This mirrors the known compositor state. It is created when a compositor | 291 // This mirrors the known compositor state. It is created when a compositor |
| 298 // animation is started. Updated once the start time is known and each time | 292 // animation is started. Updated once the start time is known and each time |
| 299 // modifications are pushed to the compositor. | 293 // modifications are pushed to the compositor. |
| 300 OwnPtr<CompositorState> m_compositorState; | 294 OwnPtr<CompositorState> m_compositorState; |
| 301 bool m_compositorPending; | 295 bool m_compositorPending; |
| 302 int m_compositorGroup; | 296 int m_compositorGroup; |
| 303 | 297 |
| 304 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; | 298 OwnPtr<WebCompositorAnimationPlayer> m_compositorPlayer; |
| 305 | 299 |
| 306 bool m_currentTimePending; | 300 bool m_currentTimePending; |
| 307 bool m_stateIsBeingUpdated; | 301 bool m_stateIsBeingUpdated; |
| 308 }; | 302 }; |
| 309 | 303 |
| 310 } // namespace blink | 304 } // namespace blink |
| 311 | 305 |
| 312 #endif // Animation_h | 306 #endif // Animation_h |
| OLD | NEW |