| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef Animation_h | 31 #ifndef Animation_h |
| 32 #define Animation_h | 32 #define Animation_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ActiveScriptWrappable.h" | 34 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 36 #include "bindings/core/v8/ScriptPromise.h" | 36 #include "bindings/core/v8/ScriptPromise.h" |
| 37 #include "bindings/core/v8/ScriptPromiseProperty.h" | 37 #include "bindings/core/v8/ScriptPromiseProperty.h" |
| 38 #include "core/CSSPropertyNames.h" | 38 #include "core/CSSPropertyNames.h" |
| 39 #include "core/CoreExport.h" | 39 #include "core/CoreExport.h" |
| 40 #include "core/animation/AnimationEffect.h" | 40 #include "core/animation/AnimationEffectReadOnly.h" |
| 41 #include "core/dom/ActiveDOMObject.h" | 41 #include "core/dom/ActiveDOMObject.h" |
| 42 #include "core/dom/DOMException.h" | 42 #include "core/dom/DOMException.h" |
| 43 #include "core/events/EventTarget.h" | 43 #include "core/events/EventTarget.h" |
| 44 #include "platform/animation/CompositorAnimationDelegate.h" | 44 #include "platform/animation/CompositorAnimationDelegate.h" |
| 45 #include "platform/animation/CompositorAnimationPlayerClient.h" | 45 #include "platform/animation/CompositorAnimationPlayerClient.h" |
| 46 #include "platform/heap/Handle.h" | 46 #include "platform/heap/Handle.h" |
| 47 #include "wtf/RefPtr.h" | 47 #include "wtf/RefPtr.h" |
| 48 #include <memory> | 48 #include <memory> |
| 49 | 49 |
| 50 namespace blink { | 50 namespace blink { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 66 public: | 66 public: |
| 67 enum AnimationPlayState { | 67 enum AnimationPlayState { |
| 68 Unset, | 68 Unset, |
| 69 Idle, | 69 Idle, |
| 70 Pending, | 70 Pending, |
| 71 Running, | 71 Running, |
| 72 Paused, | 72 Paused, |
| 73 Finished | 73 Finished |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 static Animation* create(AnimationEffect*, AnimationTimeline*); | 76 static Animation* create(AnimationEffectReadOnly*, AnimationTimeline*); |
| 77 ~Animation(); | 77 ~Animation(); |
| 78 void dispose(); | 78 void dispose(); |
| 79 | 79 |
| 80 // Returns whether the animation is finished. | 80 // Returns whether the animation is finished. |
| 81 bool update(TimingUpdateReason); | 81 bool update(TimingUpdateReason); |
| 82 | 82 |
| 83 // timeToEffectChange returns: | 83 // timeToEffectChange returns: |
| 84 // infinity - if this animation is no longer in effect | 84 // infinity - if this animation is no longer in effect |
| 85 // 0 - if this animation requires an update on the next frame | 85 // 0 - if this animation requires an update on the next frame |
| 86 // n - if this animation requires an update after 'n' units of time | 86 // n - if this animation requires an update after 'n' units of time |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 AnimationTimeline* timeline() { return m_timeline; } | 127 AnimationTimeline* timeline() { return m_timeline; } |
| 128 | 128 |
| 129 double calculateStartTime(double currentTime) const; | 129 double calculateStartTime(double currentTime) const; |
| 130 bool hasStartTime() const { return !isNull(m_startTime); } | 130 bool hasStartTime() const { return !isNull(m_startTime); } |
| 131 double startTime(bool& isNull) const; | 131 double startTime(bool& isNull) const; |
| 132 double startTime() const; | 132 double startTime() const; |
| 133 double startTimeInternal() const { return m_startTime; } | 133 double startTimeInternal() const { return m_startTime; } |
| 134 void setStartTime(double); | 134 void setStartTime(double); |
| 135 void setStartTimeInternal(double); | 135 void setStartTimeInternal(double); |
| 136 | 136 |
| 137 const AnimationEffect* effect() const { return m_content.get(); } | 137 const AnimationEffectReadOnly* effect() const { return m_content.get(); } |
| 138 AnimationEffect* effect() { return m_content.get(); } | 138 AnimationEffectReadOnly* effect() { return m_content.get(); } |
| 139 void setEffect(AnimationEffect*); | 139 void setEffect(AnimationEffectReadOnly*); |
| 140 | 140 |
| 141 void setId(const String& id) { m_id = id; } | 141 void setId(const String& id) { m_id = id; } |
| 142 const String& id() const { return m_id; } | 142 const String& id() const { return m_id; } |
| 143 | 143 |
| 144 // Pausing via this method is not reflected in the value returned by | 144 // Pausing via this method is not reflected in the value returned by |
| 145 // paused() and must never overlap with pausing via pause(). | 145 // paused() and must never overlap with pausing via pause(). |
| 146 void pauseForTesting(double pauseTime); | 146 void pauseForTesting(double pauseTime); |
| 147 void disableCompositedAnimationForTesting(); | 147 void disableCompositedAnimationForTesting(); |
| 148 | 148 |
| 149 // This should only be used for CSS | 149 // This should only be used for CSS |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 184 |
| 185 void invalidateKeyframeEffect(); | 185 void invalidateKeyframeEffect(); |
| 186 | 186 |
| 187 DECLARE_VIRTUAL_TRACE(); | 187 DECLARE_VIRTUAL_TRACE(); |
| 188 | 188 |
| 189 protected: | 189 protected: |
| 190 DispatchEventResult dispatchEventInternal(Event*) override; | 190 DispatchEventResult dispatchEventInternal(Event*) override; |
| 191 void addedEventListener(const AtomicString& eventType, RegisteredEventListen
er&) override; | 191 void addedEventListener(const AtomicString& eventType, RegisteredEventListen
er&) override; |
| 192 | 192 |
| 193 private: | 193 private: |
| 194 Animation(ExecutionContext*, AnimationTimeline&, AnimationEffect*); | 194 Animation(ExecutionContext*, AnimationTimeline&, AnimationEffectReadOnly*); |
| 195 | 195 |
| 196 void clearOutdated(); | 196 void clearOutdated(); |
| 197 | 197 |
| 198 double effectEnd() const; | 198 double effectEnd() const; |
| 199 bool limited(double currentTime) const; | 199 bool limited(double currentTime) const; |
| 200 | 200 |
| 201 AnimationPlayState calculatePlayState(); | 201 AnimationPlayState calculatePlayState(); |
| 202 double calculateCurrentTime() const; | 202 double calculateCurrentTime() const; |
| 203 | 203 |
| 204 void unpauseInternal(); | 204 void unpauseInternal(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 225 double m_playbackRate; | 225 double m_playbackRate; |
| 226 double m_startTime; | 226 double m_startTime; |
| 227 double m_holdTime; | 227 double m_holdTime; |
| 228 | 228 |
| 229 unsigned m_sequenceNumber; | 229 unsigned m_sequenceNumber; |
| 230 | 230 |
| 231 typedef ScriptPromiseProperty<Member<Animation>, Member<Animation>, Member<D
OMException>> AnimationPromise; | 231 typedef ScriptPromiseProperty<Member<Animation>, Member<Animation>, Member<D
OMException>> AnimationPromise; |
| 232 Member<AnimationPromise> m_finishedPromise; | 232 Member<AnimationPromise> m_finishedPromise; |
| 233 Member<AnimationPromise> m_readyPromise; | 233 Member<AnimationPromise> m_readyPromise; |
| 234 | 234 |
| 235 Member<AnimationEffect> m_content; | 235 Member<AnimationEffectReadOnly> m_content; |
| 236 Member<AnimationTimeline> m_timeline; | 236 Member<AnimationTimeline> m_timeline; |
| 237 | 237 |
| 238 // Reflects all pausing, including via pauseForTesting(). | 238 // Reflects all pausing, including via pauseForTesting(). |
| 239 bool m_paused; | 239 bool m_paused; |
| 240 bool m_held; | 240 bool m_held; |
| 241 bool m_isPausedForTesting; | 241 bool m_isPausedForTesting; |
| 242 bool m_isCompositedAnimationDisabledForTesting; | 242 bool m_isCompositedAnimationDisabledForTesting; |
| 243 | 243 |
| 244 // This indicates timing information relevant to the animation's effect | 244 // This indicates timing information relevant to the animation's effect |
| 245 // has changed by means other than the ordinary progression of time | 245 // has changed by means other than the ordinary progression of time |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 bool m_currentTimePending; | 308 bool m_currentTimePending; |
| 309 bool m_stateIsBeingUpdated; | 309 bool m_stateIsBeingUpdated; |
| 310 | 310 |
| 311 bool m_effectSuppressed; | 311 bool m_effectSuppressed; |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 } // namespace blink | 314 } // namespace blink |
| 315 | 315 |
| 316 #endif // Animation_h | 316 #endif // Animation_h |
| OLD | NEW |