| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // infinity - if this player is no longer in effect | 58 // infinity - if this player is no longer in effect |
| 59 // 0 - if this player requires an update on the next frame | 59 // 0 - if this player requires an update on the next frame |
| 60 // n - if this player requires an update after 'n' units of time | 60 // n - if this player requires an update after 'n' units of time |
| 61 double timeToEffectChange(); | 61 double timeToEffectChange(); |
| 62 | 62 |
| 63 void cancel(); | 63 void cancel(); |
| 64 | 64 |
| 65 double currentTime(); | 65 double currentTime(); |
| 66 void setCurrentTime(double newCurrentTime); | 66 void setCurrentTime(double newCurrentTime); |
| 67 | 67 |
| 68 double calculateCurrentTime() const; |
| 68 double currentTimeInternal(); | 69 double currentTimeInternal(); |
| 69 void setCurrentTimeInternal(double newCurrentTime); | 70 void setCurrentTimeInternal(double newCurrentTime); |
| 70 | 71 |
| 71 bool paused() const { return m_paused && !m_isPausedForTesting; } | 72 bool paused() const { return m_paused && !m_isPausedForTesting; } |
| 72 void pause(); | 73 void pause(); |
| 73 void play(); | 74 void play(); |
| 74 void reverse(); | 75 void reverse(); |
| 75 void finish(ExceptionState&); | 76 void finish(ExceptionState&); |
| 76 bool finished() { return limited(currentTimeInternal()); } | 77 bool finished() { return limited(currentTimeInternal()); } |
| 77 // FIXME: Resolve whether finished() should just return the flag, and | 78 // FIXME: Resolve whether finished() should just return the flag, and |
| (...skipping 20 matching lines...) Expand all Loading... |
| 98 bool hasStartTime() const { return !isNull(m_startTime); } | 99 bool hasStartTime() const { return !isNull(m_startTime); } |
| 99 double startTime() const { return m_startTime * 1000; } | 100 double startTime() const { return m_startTime * 1000; } |
| 100 double startTimeInternal() const { return m_startTime; } | 101 double startTimeInternal() const { return m_startTime; } |
| 101 void setStartTime(double startTime) { setStartTimeInternal(startTime / 1000)
; } | 102 void setStartTime(double startTime) { setStartTimeInternal(startTime / 1000)
; } |
| 102 void setStartTimeInternal(double, bool isUpdateFromCompositor = false); | 103 void setStartTimeInternal(double, bool isUpdateFromCompositor = false); |
| 103 | 104 |
| 104 const AnimationNode* source() const { return m_content.get(); } | 105 const AnimationNode* source() const { return m_content.get(); } |
| 105 AnimationNode* source() { return m_content.get(); } | 106 AnimationNode* source() { return m_content.get(); } |
| 106 void setSource(AnimationNode*); | 107 void setSource(AnimationNode*); |
| 107 | 108 |
| 108 double timeLag() { return timeLagInternal() * 1000; } | |
| 109 double timeLagInternal() { return currentTimeWithoutLag() - currentTimeInter
nal(); } | |
| 110 | |
| 111 // Pausing via this method is not reflected in the value returned by | 109 // Pausing via this method is not reflected in the value returned by |
| 112 // paused() and must never overlap with pausing via pause(). | 110 // paused() and must never overlap with pausing via pause(). |
| 113 void pauseForTesting(double pauseTime); | 111 void pauseForTesting(double pauseTime); |
| 114 // This should only be used for CSS | 112 // This should only be used for CSS |
| 115 void unpause(); | 113 void unpause(); |
| 116 | 114 |
| 117 void setOutdated(); | 115 void setOutdated(); |
| 118 bool outdated() { return m_outdated; } | 116 bool outdated() { return m_outdated; } |
| 119 | 117 |
| 120 bool canStartAnimationOnCompositor(); | 118 bool canStartAnimationOnCompositor(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 #endif | 150 #endif |
| 153 | 151 |
| 154 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even
tListener>, bool useCapture = false) OVERRIDE; | 152 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even
tListener>, bool useCapture = false) OVERRIDE; |
| 155 | 153 |
| 156 virtual void trace(Visitor*) OVERRIDE; | 154 virtual void trace(Visitor*) OVERRIDE; |
| 157 | 155 |
| 158 private: | 156 private: |
| 159 AnimationPlayer(ExecutionContext*, AnimationTimeline&, AnimationNode*); | 157 AnimationPlayer(ExecutionContext*, AnimationTimeline&, AnimationNode*); |
| 160 double sourceEnd() const; | 158 double sourceEnd() const; |
| 161 bool limited(double currentTime) const; | 159 bool limited(double currentTime) const; |
| 162 double currentTimeWithoutLag() const; | |
| 163 double currentTimeWithLag() const; | |
| 164 void updateTimingState(double newCurrentTime); | |
| 165 void updateCurrentTimingState(); | 160 void updateCurrentTimingState(); |
| 166 | 161 |
| 167 double m_playbackRate; | 162 double m_playbackRate; |
| 168 double m_startTime; | 163 double m_startTime; |
| 169 double m_holdTime; | 164 double m_holdTime; |
| 170 double m_storedTimeLag; | |
| 171 | 165 |
| 172 SortInfo m_sortInfo; | 166 SortInfo m_sortInfo; |
| 173 | 167 |
| 174 RefPtrWillBeMember<AnimationNode> m_content; | 168 RefPtrWillBeMember<AnimationNode> m_content; |
| 175 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 169 RawPtrWillBeMember<AnimationTimeline> m_timeline; |
| 176 // Reflects all pausing, including via pauseForTesting(). | 170 // Reflects all pausing, including via pauseForTesting(). |
| 177 bool m_paused; | 171 bool m_paused; |
| 178 bool m_held; | 172 bool m_held; |
| 179 bool m_isPausedForTesting; | 173 bool m_isPausedForTesting; |
| 180 | 174 |
| 181 // This indicates timing information relevant to the player has changed by | 175 // This indicates timing information relevant to the player's effect |
| 182 // means other than the ordinary progression of time | 176 // has changed by means other than the ordinary progression of time |
| 183 bool m_outdated; | 177 bool m_outdated; |
| 184 | 178 |
| 185 bool m_finished; | 179 bool m_finished; |
| 186 // Holds a 'finished' event queued for asynchronous dispatch via the | 180 // Holds a 'finished' event queued for asynchronous dispatch via the |
| 187 // ScriptedAnimationController. This object remains active until the | 181 // ScriptedAnimationController. This object remains active until the |
| 188 // event is actually dispatched. | 182 // event is actually dispatched. |
| 189 RefPtrWillBeMember<Event> m_pendingFinishedEvent; | 183 RefPtrWillBeMember<Event> m_pendingFinishedEvent; |
| 190 }; | 184 }; |
| 191 | 185 |
| 192 } // namespace | 186 } // namespace |
| 193 | 187 |
| 194 #endif | 188 #endif |
| OLD | NEW |