Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(867)

Side by Side Diff: Source/core/animation/AnimationPlayer.h

Issue 210363007: Declare onFinish event handler for AnimationPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: AnimationPlayerEvent guarded by WebAnimationsAPI flag Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/dom/ActiveDOMObject.h"
36 #include "core/events/EventTarget.h"
35 #include "wtf/RefPtr.h" 37 #include "wtf/RefPtr.h"
36 38
37 namespace WebCore { 39 namespace WebCore {
38 40
39 class DocumentTimeline; 41 class DocumentTimeline;
40 class ExceptionState; 42 class ExceptionState;
41 43
42 class AnimationPlayer FINAL : public RefCounted<AnimationPlayer> { 44 class AnimationPlayer FINAL : public RefCounted<AnimationPlayer>, public EventTa rgetWithInlineData, public ActiveDOMObject {
dstockwell 2014/03/31 06:32:53 Why does AnimationPlayer become an ActiveDOMObject
Eric Willigers 2014/03/31 08:48:47 Changed to use ContextLifecycleObserver. As an ev
43 45 REFCOUNTED_EVENT_TARGET(AnimationPlayer);
44 public: 46 public:
45 ~AnimationPlayer(); 47 ~AnimationPlayer();
46 static PassRefPtr<AnimationPlayer> create(DocumentTimeline&, TimedItem*); 48 static PassRefPtr<AnimationPlayer> create(ExecutionContext*, DocumentTimelin e&, TimedItem*);
47 49
48 // Returns whether this player is still current or in effect. 50 // Returns whether this player is still current or in effect.
49 bool update(); 51 bool update();
50 52
51 // timeToEffectChange returns: 53 // timeToEffectChange returns:
52 // infinity - if this player is no longer in effect 54 // infinity - if this player is no longer in effect
53 // 0 - if this player requires an update on the next frame 55 // 0 - if this player requires an update on the next frame
54 // 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
55 double timeToEffectChange(); 57 double timeToEffectChange();
56 58
57 void cancel(); 59 void cancel();
58 60
59 double currentTime(); 61 double currentTime();
60 void setCurrentTime(double newCurrentTime); 62 void setCurrentTime(double newCurrentTime);
61 63
62 bool paused() const { return m_paused && !m_isPausedForTesting; } 64 bool paused() const { return m_paused && !m_isPausedForTesting; }
63 void pause(); 65 void pause();
64 void play(); 66 void play();
65 void reverse(); 67 void reverse();
66 void finish(ExceptionState&); 68 void finish(ExceptionState&);
67 bool finished() { return limited(currentTime()); } 69 bool finished() { return limited(currentTime()); }
68 70
71 DEFINE_ATTRIBUTE_EVENT_LISTENER(finish);
72
73 virtual const AtomicString& interfaceName() const OVERRIDE;
74 virtual ExecutionContext* executionContext() const OVERRIDE;
75
69 double playbackRate() const { return m_playbackRate; } 76 double playbackRate() const { return m_playbackRate; }
70 void setPlaybackRate(double); 77 void setPlaybackRate(double);
71 const DocumentTimeline* timeline() const { return m_timeline; } 78 const DocumentTimeline* timeline() const { return m_timeline; }
72 DocumentTimeline* timeline() { return m_timeline; } 79 DocumentTimeline* timeline() { return m_timeline; }
73 80
74 void timelineDestroyed() { m_timeline = 0; } 81 void timelineDestroyed() { m_timeline = 0; }
75 82
76 bool hasStartTime() const { return !isNull(m_startTime); } 83 bool hasStartTime() const { return !isNull(m_startTime); }
77 double startTime() const { return m_startTime; } 84 double startTime() const { return m_startTime; }
78 void setStartTime(double); 85 void setStartTime(double);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 }; 118 };
112 119
113 const SortInfo& sortInfo() const { return m_sortInfo; } 120 const SortInfo& sortInfo() const { return m_sortInfo; }
114 121
115 static bool hasLowerPriority(AnimationPlayer* player1, AnimationPlayer* play er2) 122 static bool hasLowerPriority(AnimationPlayer* player1, AnimationPlayer* play er2)
116 { 123 {
117 return player1->sortInfo() < player2->sortInfo(); 124 return player1->sortInfo() < player2->sortInfo();
118 } 125 }
119 126
120 private: 127 private:
121 AnimationPlayer(DocumentTimeline&, TimedItem*); 128 AnimationPlayer(ExecutionContext*, DocumentTimeline&, TimedItem*);
122 double sourceEnd() const; 129 double sourceEnd() const;
123 bool limited(double currentTime) const; 130 bool limited(double currentTime) const;
124 double currentTimeWithoutLag() const; 131 double currentTimeWithoutLag() const;
125 double currentTimeWithLag() const; 132 double currentTimeWithLag() const;
126 void updateTimingState(double newCurrentTime); 133 void updateTimingState(double newCurrentTime);
127 void updateCurrentTimingState(); 134 void updateCurrentTimingState();
128 135
129 double m_playbackRate; 136 double m_playbackRate;
130 double m_startTime; 137 double m_startTime;
131 double m_holdTime; 138 double m_holdTime;
(...skipping 11 matching lines...) Expand all
143 bool m_isPausedForTesting; 150 bool m_isPausedForTesting;
144 151
145 // This indicates timing information relevant to the player has changed by 152 // This indicates timing information relevant to the player has changed by
146 // means other than the ordinary progression of time 153 // means other than the ordinary progression of time
147 bool m_outdated; 154 bool m_outdated;
148 }; 155 };
149 156
150 } // namespace 157 } // namespace
151 158
152 #endif 159 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698