| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef AnimationPlayer_h | 31 #ifndef AnimationPlayer_h |
| 32 #define AnimationPlayer_h | 32 #define AnimationPlayer_h |
| 33 | 33 |
| 34 #include "core/animation/TimedItem.h" | 34 #include "core/animation/AnimationSource.h" |
| 35 #include "core/events/EventTarget.h" | 35 #include "core/events/EventTarget.h" |
| 36 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
| 37 | 37 |
| 38 namespace WebCore { | 38 namespace WebCore { |
| 39 | 39 |
| 40 class AnimationTimeline; | 40 class AnimationTimeline; |
| 41 class ExceptionState; | 41 class ExceptionState; |
| 42 | 42 |
| 43 class AnimationPlayer FINAL : public RefCountedWillBeRefCountedGarbageCollected<
AnimationPlayer>, public EventTargetWithInlineData { | 43 class AnimationPlayer FINAL : public RefCountedWillBeRefCountedGarbageCollected<
AnimationPlayer>, public EventTargetWithInlineData { |
| 44 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<A
nimationPlayer>); | 44 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<A
nimationPlayer>); |
| 45 public: | 45 public: |
| 46 | 46 |
| 47 ~AnimationPlayer(); | 47 ~AnimationPlayer(); |
| 48 static PassRefPtrWillBeRawPtr<AnimationPlayer> create(AnimationTimeline&, Ti
medItem*); | 48 static PassRefPtrWillBeRawPtr<AnimationPlayer> create(AnimationTimeline&, An
imationSource*); |
| 49 | 49 |
| 50 // Returns whether the player is finished. | 50 // Returns whether the player is finished. |
| 51 bool update(TimingUpdateReason); | 51 bool update(TimingUpdateReason); |
| 52 | 52 |
| 53 // timeToEffectChange returns: | 53 // timeToEffectChange returns: |
| 54 // infinity - if this player is no longer in effect | 54 // infinity - if this player is no longer in effect |
| 55 // 0 - if this player requires an update on the next frame | 55 // 0 - if this player requires an update on the next frame |
| 56 // n - if this player requires an update after 'n' units of time | 56 // n - if this player requires an update after 'n' units of time |
| 57 double timeToEffectChange(); | 57 double timeToEffectChange(); |
| 58 | 58 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 87 #if !ENABLE(OILPAN) | 87 #if !ENABLE(OILPAN) |
| 88 void timelineDestroyed() { m_timeline = nullptr; } | 88 void timelineDestroyed() { m_timeline = nullptr; } |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 bool hasStartTime() const { return !isNull(m_startTime); } | 91 bool hasStartTime() const { return !isNull(m_startTime); } |
| 92 double startTime() const { return m_startTime * 1000; } | 92 double startTime() const { return m_startTime * 1000; } |
| 93 double startTimeInternal() const { return m_startTime; } | 93 double startTimeInternal() const { return m_startTime; } |
| 94 void setStartTime(double startTime) { setStartTimeInternal(startTime / 1000)
; } | 94 void setStartTime(double startTime) { setStartTimeInternal(startTime / 1000)
; } |
| 95 void setStartTimeInternal(double, bool isUpdateFromCompositor = false); | 95 void setStartTimeInternal(double, bool isUpdateFromCompositor = false); |
| 96 | 96 |
| 97 const TimedItem* source() const { return m_content.get(); } | 97 const AnimationSource* source() const { return m_content.get(); } |
| 98 TimedItem* source() { return m_content.get(); } | 98 AnimationSource* source() { return m_content.get(); } |
| 99 TimedItem* source(bool& isNull) { isNull = !m_content; return m_content.get(
); } | 99 AnimationSource* source(bool& isNull) { isNull = !m_content; return m_conten
t.get(); } |
| 100 void setSource(TimedItem*); | 100 void setSource(AnimationSource*); |
| 101 | 101 |
| 102 double timeLag() { return timeLagInternal() * 1000; } | 102 double timeLag() { return timeLagInternal() * 1000; } |
| 103 double timeLagInternal() { return currentTimeWithoutLag() - currentTimeInter
nal(); } | 103 double timeLagInternal() { return currentTimeWithoutLag() - currentTimeInter
nal(); } |
| 104 | 104 |
| 105 // Pausing via this method is not reflected in the value returned by | 105 // Pausing via this method is not reflected in the value returned by |
| 106 // paused() and must never overlap with pausing via pause(). | 106 // paused() and must never overlap with pausing via pause(). |
| 107 void pauseForTesting(double pauseTime); | 107 void pauseForTesting(double pauseTime); |
| 108 // This should only be used for CSS | 108 // This should only be used for CSS |
| 109 void unpause(); | 109 void unpause(); |
| 110 | 110 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // Checks if the AnimationStack is the last reference holder to the Player. | 143 // Checks if the AnimationStack is the last reference holder to the Player. |
| 144 // This won't be needed when AnimationPlayer is moved to Oilpan. | 144 // This won't be needed when AnimationPlayer is moved to Oilpan. |
| 145 bool canFree() const; | 145 bool canFree() const; |
| 146 #endif | 146 #endif |
| 147 | 147 |
| 148 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even
tListener>, bool useCapture = false) OVERRIDE; | 148 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even
tListener>, bool useCapture = false) OVERRIDE; |
| 149 | 149 |
| 150 void trace(Visitor*); | 150 void trace(Visitor*); |
| 151 | 151 |
| 152 private: | 152 private: |
| 153 AnimationPlayer(AnimationTimeline&, TimedItem*); | 153 AnimationPlayer(AnimationTimeline&, AnimationSource*); |
| 154 double sourceEnd() const; | 154 double sourceEnd() const; |
| 155 bool limited(double currentTime) const; | 155 bool limited(double currentTime) const; |
| 156 double currentTimeWithoutLag() const; | 156 double currentTimeWithoutLag() const; |
| 157 double currentTimeWithLag() const; | 157 double currentTimeWithLag() const; |
| 158 void updateTimingState(double newCurrentTime); | 158 void updateTimingState(double newCurrentTime); |
| 159 void updateCurrentTimingState(); | 159 void updateCurrentTimingState(); |
| 160 | 160 |
| 161 double m_playbackRate; | 161 double m_playbackRate; |
| 162 double m_startTime; | 162 double m_startTime; |
| 163 double m_holdTime; | 163 double m_holdTime; |
| 164 double m_storedTimeLag; | 164 double m_storedTimeLag; |
| 165 | 165 |
| 166 SortInfo m_sortInfo; | 166 SortInfo m_sortInfo; |
| 167 | 167 |
| 168 RefPtrWillBeMember<TimedItem> m_content; | 168 RefPtrWillBeMember<AnimationSource> m_content; |
| 169 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 169 RawPtrWillBeMember<AnimationTimeline> m_timeline; |
| 170 // Reflects all pausing, including via pauseForTesting(). | 170 // Reflects all pausing, including via pauseForTesting(). |
| 171 bool m_paused; | 171 bool m_paused; |
| 172 bool m_held; | 172 bool m_held; |
| 173 bool m_isPausedForTesting; | 173 bool m_isPausedForTesting; |
| 174 | 174 |
| 175 // This indicates timing information relevant to the player has changed by | 175 // This indicates timing information relevant to the player has changed by |
| 176 // means other than the ordinary progression of time | 176 // means other than the ordinary progression of time |
| 177 bool m_outdated; | 177 bool m_outdated; |
| 178 | 178 |
| 179 bool m_finished; | 179 bool m_finished; |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 } // namespace | 182 } // namespace |
| 183 | 183 |
| 184 #endif | 184 #endif |
| OLD | NEW |