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 14 matching lines...) Expand all Loading... | |
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/AnimationSource.h" | 34 #include "core/animation/AnimationSource.h" |
35 #include "core/dom/ActiveDOMObject.h" | |
35 #include "core/events/EventTarget.h" | 36 #include "core/events/EventTarget.h" |
36 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 class AnimationTimeline; | 41 class AnimationTimeline; |
41 class ExceptionState; | 42 class ExceptionState; |
42 | 43 |
43 class AnimationPlayer FINAL : public RefCountedWillBeRefCountedGarbageCollected< AnimationPlayer>, public EventTargetWithInlineData { | 44 class AnimationPlayer FINAL : public RefCountedWillBeRefCountedGarbageCollected< AnimationPlayer> |
45 , public ActiveDOMObject | |
46 , public EventTargetWithInlineData { | |
44 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<A nimationPlayer>); | 47 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<A nimationPlayer>); |
45 public: | 48 public: |
46 | 49 |
47 ~AnimationPlayer(); | 50 ~AnimationPlayer(); |
48 static PassRefPtrWillBeRawPtr<AnimationPlayer> create(AnimationTimeline&, An imationSource*); | 51 static PassRefPtrWillBeRawPtr<AnimationPlayer> create(ExecutionContext&, Ani mationTimeline&, AnimationSource*); |
49 | 52 |
50 // Returns whether the player is finished. | 53 // Returns whether the player is finished. |
51 bool update(TimingUpdateReason); | 54 bool update(TimingUpdateReason); |
52 | 55 |
53 // timeToEffectChange returns: | 56 // timeToEffectChange returns: |
54 // infinity - if this player is no longer in effect | 57 // infinity - if this player is no longer in effect |
55 // 0 - if this player requires an update on the next frame | 58 // 0 - if this player requires an update on the next frame |
56 // n - if this player requires an update after 'n' units of time | 59 // n - if this player requires an update after 'n' units of time |
57 double timeToEffectChange(); | 60 double timeToEffectChange(); |
58 | 61 |
(...skipping 12 matching lines...) Expand all Loading... | |
71 void finish(ExceptionState&); | 74 void finish(ExceptionState&); |
72 bool finished() { return limited(currentTimeInternal()); } | 75 bool finished() { return limited(currentTimeInternal()); } |
73 // FIXME: Resolve whether finished() should just return the flag, and | 76 // FIXME: Resolve whether finished() should just return the flag, and |
74 // remove this method. | 77 // remove this method. |
75 bool finishedInternal() const { return m_finished; } | 78 bool finishedInternal() const { return m_finished; } |
76 | 79 |
77 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish); | 80 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish); |
78 | 81 |
79 virtual const AtomicString& interfaceName() const OVERRIDE; | 82 virtual const AtomicString& interfaceName() const OVERRIDE; |
80 virtual ExecutionContext* executionContext() const OVERRIDE; | 83 virtual ExecutionContext* executionContext() const OVERRIDE; |
84 virtual bool hasPendingActivity() const OVERRIDE; | |
85 virtual void stop(); | |
haraken
2014/05/26 01:16:09
Add OVERRIDE.
dstockwell
2014/05/26 01:32:40
Done.
| |
86 virtual bool dispatchEvent(PassRefPtrWillBeRawPtr<Event>) OVERRIDE; | |
81 | 87 |
82 double playbackRate() const { return m_playbackRate; } | 88 double playbackRate() const { return m_playbackRate; } |
83 void setPlaybackRate(double); | 89 void setPlaybackRate(double); |
84 const AnimationTimeline* timeline() const { return m_timeline; } | 90 const AnimationTimeline* timeline() const { return m_timeline; } |
85 AnimationTimeline* timeline() { return m_timeline; } | 91 AnimationTimeline* timeline() { return m_timeline; } |
86 | 92 |
87 #if !ENABLE(OILPAN) | 93 #if !ENABLE(OILPAN) |
88 void timelineDestroyed() { m_timeline = nullptr; } | 94 void timelineDestroyed() { m_timeline = nullptr; } |
89 #endif | 95 #endif |
90 | 96 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 // Checks if the AnimationStack is the last reference holder to the Player. | 149 // Checks if the AnimationStack is the last reference holder to the Player. |
144 // This won't be needed when AnimationPlayer is moved to Oilpan. | 150 // This won't be needed when AnimationPlayer is moved to Oilpan. |
145 bool canFree() const; | 151 bool canFree() const; |
146 #endif | 152 #endif |
147 | 153 |
148 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) OVERRIDE; | 154 virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<Even tListener>, bool useCapture = false) OVERRIDE; |
149 | 155 |
150 void trace(Visitor*); | 156 void trace(Visitor*); |
151 | 157 |
152 private: | 158 private: |
153 AnimationPlayer(AnimationTimeline&, AnimationSource*); | 159 AnimationPlayer(ExecutionContext&, AnimationTimeline&, AnimationSource*); |
154 double sourceEnd() const; | 160 double sourceEnd() const; |
155 bool limited(double currentTime) const; | 161 bool limited(double currentTime) const; |
156 double currentTimeWithoutLag() const; | 162 double currentTimeWithoutLag() const; |
157 double currentTimeWithLag() const; | 163 double currentTimeWithLag() const; |
158 void updateTimingState(double newCurrentTime); | 164 void updateTimingState(double newCurrentTime); |
159 void updateCurrentTimingState(); | 165 void updateCurrentTimingState(); |
160 | 166 |
161 double m_playbackRate; | 167 double m_playbackRate; |
162 double m_startTime; | 168 double m_startTime; |
163 double m_holdTime; | 169 double m_holdTime; |
164 double m_storedTimeLag; | 170 double m_storedTimeLag; |
165 | 171 |
166 SortInfo m_sortInfo; | 172 SortInfo m_sortInfo; |
167 | 173 |
168 RefPtrWillBeMember<AnimationSource> m_content; | 174 RefPtrWillBeMember<AnimationSource> m_content; |
169 RawPtrWillBeMember<AnimationTimeline> m_timeline; | 175 RawPtrWillBeMember<AnimationTimeline> m_timeline; |
170 // Reflects all pausing, including via pauseForTesting(). | 176 // Reflects all pausing, including via pauseForTesting(). |
171 bool m_paused; | 177 bool m_paused; |
172 bool m_held; | 178 bool m_held; |
173 bool m_isPausedForTesting; | 179 bool m_isPausedForTesting; |
174 | 180 |
175 // This indicates timing information relevant to the player has changed by | 181 // This indicates timing information relevant to the player has changed by |
176 // means other than the ordinary progression of time | 182 // means other than the ordinary progression of time |
177 bool m_outdated; | 183 bool m_outdated; |
178 | 184 |
179 bool m_finished; | 185 bool m_finished; |
186 // Holds a 'finished' event queued for asynchronous dispatch via the | |
187 // ScriptedAnimationController. This object remains active until the | |
188 // event is actually dispatched. | |
189 RefPtrWillBeMember<Event> m_pendingFinishedEvent; | |
180 }; | 190 }; |
181 | 191 |
182 } // namespace | 192 } // namespace |
183 | 193 |
184 #endif | 194 #endif |
OLD | NEW |