| 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 16 matching lines...) Expand all Loading... |
| 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 DocumentTimeline_h | 31 #ifndef DocumentTimeline_h |
| 32 #define DocumentTimeline_h | 32 #define DocumentTimeline_h |
| 33 | 33 |
| 34 #include "core/animation/ActiveAnimations.h" | 34 #include "core/animation/ActiveAnimations.h" |
| 35 #include "core/animation/Player.h" | 35 #include "core/animation/Player.h" |
| 36 #include "core/dom/Element.h" | 36 #include "core/dom/Element.h" |
| 37 #include "core/dom/Event.h" |
| 37 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
| 38 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
| 39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 40 | 41 |
| 41 namespace WebCore { | 42 namespace WebCore { |
| 42 | 43 |
| 43 class Document; | 44 class Document; |
| 44 class TimedItem; | 45 class TimedItem; |
| 45 | 46 |
| 46 // DocumentTimeline is constructed and owned by Document, and tied to its lifecy
cle. | 47 // DocumentTimeline is constructed and owned by Document, and tied to its lifecy
cle. |
| 47 class DocumentTimeline : public RefCounted<DocumentTimeline> { | 48 class DocumentTimeline : public RefCounted<DocumentTimeline> { |
| 48 | 49 |
| 49 public: | 50 public: |
| 50 static PassRefPtr<DocumentTimeline> create(Document*); | 51 static PassRefPtr<DocumentTimeline> create(Document*); |
| 51 void serviceAnimations(double); | 52 void serviceAnimations(double); |
| 52 PassRefPtr<Player> play(TimedItem*); | 53 PassRefPtr<Player> play(TimedItem*); |
| 53 double currentTime() { return m_currentTime; } | 54 double currentTime() { return m_currentTime; } |
| 54 void pauseAnimationsForTesting(double); | 55 void pauseAnimationsForTesting(double); |
| 55 AnimationStack* animationStack(const Element* element) const | 56 AnimationStack* animationStack(const Element* element) const |
| 56 { | 57 { |
| 57 if (ActiveAnimations* animations = element->activeAnimations()) | 58 if (ActiveAnimations* animations = element->activeAnimations()) |
| 58 return animations->defaultStack(); | 59 return animations->defaultStack(); |
| 59 return 0; | 60 return 0; |
| 60 } | 61 } |
| 62 void addEventToDispatch(EventTarget* target, PassRefPtr<Event> event) |
| 63 { |
| 64 m_events.append(EventToDispatch(target, event)); |
| 65 } |
| 61 | 66 |
| 62 private: | 67 private: |
| 63 DocumentTimeline(Document*); | 68 DocumentTimeline(Document*); |
| 69 void dispatchEvents(); |
| 64 double m_currentTime; | 70 double m_currentTime; |
| 65 Document* m_document; | 71 Document* m_document; |
| 66 Vector<RefPtr<Player> > m_players; | 72 Vector<RefPtr<Player> > m_players; |
| 73 |
| 74 struct EventToDispatch { |
| 75 EventToDispatch(EventTarget* target, PassRefPtr<Event> event) |
| 76 : target(target) |
| 77 , event(event) |
| 78 { |
| 79 } |
| 80 RefPtr<EventTarget> target; |
| 81 RefPtr<Event> event; |
| 82 }; |
| 83 Vector<EventToDispatch> m_events; |
| 67 }; | 84 }; |
| 68 | 85 |
| 69 } // namespace | 86 } // namespace |
| 70 | 87 |
| 71 #endif | 88 #endif |
| OLD | NEW |