OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "platform/Timer.h" | 31 #include "platform/Timer.h" |
32 #include "wtf/HashMap.h" | 32 #include "wtf/HashMap.h" |
33 #include "wtf/HashSet.h" | 33 #include "wtf/HashSet.h" |
34 #include "wtf/PassRefPtr.h" | 34 #include "wtf/PassRefPtr.h" |
35 #include "wtf/RefCounted.h" | 35 #include "wtf/RefCounted.h" |
36 #include "wtf/text/StringHash.h" | 36 #include "wtf/text/StringHash.h" |
37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
38 | 38 |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
| 41 class Document; |
41 class SVGElement; | 42 class SVGElement; |
42 class SVGSMILElement; | 43 class SVGSMILElement; |
43 class SVGSVGElement; | 44 class SVGSVGElement; |
44 | 45 |
45 class SMILTimeContainer : public RefCounted<SMILTimeContainer> { | 46 class SMILTimeContainer : public RefCounted<SMILTimeContainer> { |
46 public: | 47 public: |
47 static PassRefPtr<SMILTimeContainer> create(SVGSVGElement* owner) { return a
doptRef(new SMILTimeContainer(owner)); } | 48 static PassRefPtr<SMILTimeContainer> create(SVGSVGElement* owner) { return a
doptRef(new SMILTimeContainer(owner)); } |
48 ~SMILTimeContainer(); | 49 ~SMILTimeContainer(); |
49 | 50 |
50 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&); | 51 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&); |
51 void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&); | 52 void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&); |
52 void notifyIntervalsChanged(); | 53 void notifyIntervalsChanged(); |
53 | 54 |
54 SMILTime elapsed() const; | 55 SMILTime elapsed() const; |
55 | 56 |
56 bool isPaused() const; | 57 bool isPaused() const; |
57 bool isStarted() const; | 58 bool isStarted() const; |
58 | 59 |
59 void begin(); | 60 void begin(); |
60 void pause(); | 61 void pause(); |
61 void resume(); | 62 void resume(); |
62 void setElapsed(SMILTime); | 63 void setElapsed(SMILTime); |
63 | 64 |
| 65 void serviceAnimations(double monotonicAnimationStartTime); |
| 66 bool hasAnimations() const; |
| 67 |
64 void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; } | 68 void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; } |
65 | 69 |
66 private: | 70 private: |
67 SMILTimeContainer(SVGSVGElement* owner); | 71 SMILTimeContainer(SVGSVGElement* owner); |
68 | 72 |
69 bool isTimelineRunning() const; | 73 bool isTimelineRunning() const; |
70 void scheduleAnimationFrame(SMILTime fireTime); | 74 void scheduleAnimationFrame(SMILTime fireTime); |
71 void scheduleAnimationFrame(); | 75 void scheduleAnimationFrame(); |
72 void cancelAnimationFrame(); | 76 void cancelAnimationFrame(); |
73 void timerFired(Timer<SMILTimeContainer>*); | 77 void wakeupTimerFired(Timer<SMILTimeContainer>*); |
74 void updateAnimations(SMILTime elapsed, bool seekToTime = false); | 78 void updateAnimations(SMILTime elapsed, bool seekToTime = false); |
| 79 void serviceOnNextFrame(); |
75 | 80 |
76 void updateDocumentOrderIndexes(); | 81 void updateDocumentOrderIndexes(); |
77 double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_begin
Time; } | 82 double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_begin
Time; } |
78 | 83 |
| 84 Document& document() const; |
| 85 |
79 double m_beginTime; | 86 double m_beginTime; |
80 double m_pauseTime; | 87 double m_pauseTime; |
81 double m_resumeTime; | 88 double m_resumeTime; |
82 double m_accumulatedActiveTime; | 89 double m_accumulatedActiveTime; |
83 double m_presetStartTime; | 90 double m_presetStartTime; |
84 | 91 |
85 bool m_documentOrderIndexesDirty; | 92 bool m_documentOrderIndexesDirty; |
| 93 bool m_framePending; |
| 94 bool m_clockFrozen; |
86 | 95 |
87 Timer<SMILTimeContainer> m_timer; | 96 Timer<SMILTimeContainer> m_wakeupTimer; |
88 | 97 |
89 typedef pair<SVGElement*, QualifiedName> ElementAttributePair; | 98 typedef pair<SVGElement*, QualifiedName> ElementAttributePair; |
90 typedef Vector<SVGSMILElement*> AnimationsVector; | 99 typedef Vector<SVGSMILElement*> AnimationsVector; |
91 typedef HashMap<ElementAttributePair, OwnPtr<AnimationsVector> > GroupedAnim
ationsMap; | 100 typedef HashMap<ElementAttributePair, OwnPtr<AnimationsVector> > GroupedAnim
ationsMap; |
92 GroupedAnimationsMap m_scheduledAnimations; | 101 GroupedAnimationsMap m_scheduledAnimations; |
93 | 102 |
94 SVGSVGElement* m_ownerSVGElement; | 103 SVGSVGElement* m_ownerSVGElement; |
95 | 104 |
96 #ifndef NDEBUG | 105 #ifndef NDEBUG |
97 bool m_preventScheduledAnimationsChanges; | 106 bool m_preventScheduledAnimationsChanges; |
98 #endif | 107 #endif |
99 }; | 108 }; |
100 } | 109 } |
101 | 110 |
102 #endif // SMILTimeContainer_h | 111 #endif // SMILTimeContainer_h |
OLD | NEW |