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/TimedItem.h" | 34 #include "core/animation/TimedItem.h" |
| 35 #include "core/events/EventTarget.h" |
35 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
36 | 37 |
37 namespace WebCore { | 38 namespace WebCore { |
38 | 39 |
39 class DocumentTimeline; | 40 class DocumentTimeline; |
40 class ExceptionState; | 41 class ExceptionState; |
41 | 42 |
42 class AnimationPlayer FINAL : public RefCounted<AnimationPlayer> { | 43 class AnimationPlayer FINAL : public RefCounted<AnimationPlayer>, public EventTa
rgetWithInlineData { |
43 | 44 REFCOUNTED_EVENT_TARGET(AnimationPlayer); |
44 public: | 45 public: |
45 ~AnimationPlayer(); | 46 ~AnimationPlayer(); |
46 static PassRefPtr<AnimationPlayer> create(DocumentTimeline&, TimedItem*); | 47 static PassRefPtr<AnimationPlayer> create(DocumentTimeline&, TimedItem*); |
47 | 48 |
48 // Returns whether this player is still current or in effect. | 49 // Returns whether this player is still current or in effect. |
49 bool update(); | 50 bool update(); |
50 | 51 |
51 // timeToEffectChange returns: | 52 // timeToEffectChange returns: |
52 // infinity - if this player is no longer in effect | 53 // infinity - if this player is no longer in effect |
53 // 0 - if this player requires an update on the next frame | 54 // 0 - if this player requires an update on the next frame |
54 // n - if this player requires an update after 'n' units of time | 55 // n - if this player requires an update after 'n' units of time |
55 double timeToEffectChange(); | 56 double timeToEffectChange(); |
56 | 57 |
57 void cancel(); | 58 void cancel(); |
58 | 59 |
59 double currentTime(); | 60 double currentTime(); |
60 void setCurrentTime(double newCurrentTime); | 61 void setCurrentTime(double newCurrentTime); |
61 | 62 |
62 bool paused() const { return m_paused && !m_isPausedForTesting; } | 63 bool paused() const { return m_paused && !m_isPausedForTesting; } |
63 void pause(); | 64 void pause(); |
64 void play(); | 65 void play(); |
65 void reverse(); | 66 void reverse(); |
66 void finish(ExceptionState&); | 67 void finish(ExceptionState&); |
67 bool finished() { return limited(currentTime()); } | 68 bool finished() { return limited(currentTime()); } |
68 | 69 |
| 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish); |
| 71 |
| 72 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 73 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 74 |
69 double playbackRate() const { return m_playbackRate; } | 75 double playbackRate() const { return m_playbackRate; } |
70 void setPlaybackRate(double); | 76 void setPlaybackRate(double); |
71 const DocumentTimeline* timeline() const { return m_timeline; } | 77 const DocumentTimeline* timeline() const { return m_timeline; } |
72 DocumentTimeline* timeline() { return m_timeline; } | 78 DocumentTimeline* timeline() { return m_timeline; } |
73 | 79 |
74 void timelineDestroyed() { m_timeline = 0; } | 80 void timelineDestroyed() { m_timeline = 0; } |
75 | 81 |
76 bool hasStartTime() const { return !isNull(m_startTime); } | 82 bool hasStartTime() const { return !isNull(m_startTime); } |
77 double startTime() const { return m_startTime; } | 83 double startTime() const { return m_startTime; } |
78 void setStartTime(double); | 84 void setStartTime(double); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 bool m_isPausedForTesting; | 149 bool m_isPausedForTesting; |
144 | 150 |
145 // This indicates timing information relevant to the player has changed by | 151 // This indicates timing information relevant to the player has changed by |
146 // means other than the ordinary progression of time | 152 // means other than the ordinary progression of time |
147 bool m_outdated; | 153 bool m_outdated; |
148 }; | 154 }; |
149 | 155 |
150 } // namespace | 156 } // namespace |
151 | 157 |
152 #endif | 158 #endif |
OLD | NEW |