| 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 AnimationClock; | |
| 42 class Document; | |
| 43 class SVGElement; | 41 class SVGElement; |
| 44 class SVGSMILElement; | 42 class SVGSMILElement; |
| 45 class SVGSVGElement; | 43 class SVGSVGElement; |
| 46 | 44 |
| 47 class SMILTimeContainer : public RefCounted<SMILTimeContainer> { | 45 class SMILTimeContainer : public RefCounted<SMILTimeContainer> { |
| 48 public: | 46 public: |
| 49 static PassRefPtr<SMILTimeContainer> create(SVGSVGElement* owner) { return a
doptRef(new SMILTimeContainer(owner)); } | 47 static PassRefPtr<SMILTimeContainer> create(SVGSVGElement* owner) { return a
doptRef(new SMILTimeContainer(owner)); } |
| 50 ~SMILTimeContainer(); | 48 ~SMILTimeContainer(); |
| 51 | 49 |
| 52 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&); | 50 void schedule(SVGSMILElement*, SVGElement*, const QualifiedName&); |
| 53 void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&); | 51 void unschedule(SVGSMILElement*, SVGElement*, const QualifiedName&); |
| 54 void notifyIntervalsChanged(); | 52 void notifyIntervalsChanged(); |
| 55 | 53 |
| 56 SMILTime elapsed() const; | 54 SMILTime elapsed() const; |
| 57 | 55 |
| 58 bool isPaused() const; | 56 bool isPaused() const; |
| 59 bool isStarted() const; | 57 bool isStarted() const; |
| 60 | 58 |
| 61 void begin(); | 59 void begin(); |
| 62 void pause(); | 60 void pause(); |
| 63 void resume(); | 61 void resume(); |
| 64 void setElapsed(SMILTime); | 62 void setElapsed(SMILTime); |
| 65 | 63 |
| 66 void serviceAnimations(double monotonicAnimationStartTime); | |
| 67 bool hasAnimations() const; | |
| 68 | |
| 69 void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; } | 64 void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; } |
| 70 | 65 |
| 71 private: | 66 private: |
| 72 SMILTimeContainer(SVGSVGElement* owner); | 67 SMILTimeContainer(SVGSVGElement* owner); |
| 73 | 68 |
| 74 bool isTimelineRunning() const; | 69 bool isTimelineRunning() const; |
| 75 void scheduleAnimationFrame(SMILTime fireTime); | 70 void scheduleAnimationFrame(SMILTime fireTime); |
| 76 void scheduleAnimationFrame(); | 71 void scheduleAnimationFrame(); |
| 77 void cancelAnimationFrame(); | 72 void cancelAnimationFrame(); |
| 78 void wakeupTimerFired(Timer<SMILTimeContainer>*); | 73 void timerFired(Timer<SMILTimeContainer>*); |
| 79 void updateAnimations(SMILTime elapsed, bool seekToTime = false); | 74 void updateAnimations(SMILTime elapsed, bool seekToTime = false); |
| 80 void serviceOnNextFrame(); | |
| 81 | 75 |
| 82 void updateDocumentOrderIndexes(); | 76 void updateDocumentOrderIndexes(); |
| 83 double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_begin
Time; } | 77 double lastResumeTime() const { return m_resumeTime ? m_resumeTime : m_begin
Time; } |
| 84 | 78 |
| 85 Document& document() const; | |
| 86 | |
| 87 double m_beginTime; | 79 double m_beginTime; |
| 88 double m_pauseTime; | 80 double m_pauseTime; |
| 89 double m_resumeTime; | 81 double m_resumeTime; |
| 90 double m_accumulatedActiveTime; | 82 double m_accumulatedActiveTime; |
| 91 double m_presetStartTime; | 83 double m_presetStartTime; |
| 92 | 84 |
| 93 bool m_documentOrderIndexesDirty; | 85 bool m_documentOrderIndexesDirty; |
| 94 bool m_framePending; | |
| 95 | 86 |
| 96 OwnPtr<AnimationClock> m_animationClock; | 87 Timer<SMILTimeContainer> m_timer; |
| 97 Timer<SMILTimeContainer> m_wakeupTimer; | |
| 98 | 88 |
| 99 typedef pair<SVGElement*, QualifiedName> ElementAttributePair; | 89 typedef pair<SVGElement*, QualifiedName> ElementAttributePair; |
| 100 typedef Vector<SVGSMILElement*> AnimationsVector; | 90 typedef Vector<SVGSMILElement*> AnimationsVector; |
| 101 typedef HashMap<ElementAttributePair, OwnPtr<AnimationsVector> > GroupedAnim
ationsMap; | 91 typedef HashMap<ElementAttributePair, OwnPtr<AnimationsVector> > GroupedAnim
ationsMap; |
| 102 GroupedAnimationsMap m_scheduledAnimations; | 92 GroupedAnimationsMap m_scheduledAnimations; |
| 103 | 93 |
| 104 SVGSVGElement* m_ownerSVGElement; | 94 SVGSVGElement* m_ownerSVGElement; |
| 105 | 95 |
| 106 #ifndef NDEBUG | 96 #ifndef NDEBUG |
| 107 bool m_preventScheduledAnimationsChanges; | 97 bool m_preventScheduledAnimationsChanges; |
| 108 #endif | 98 #endif |
| 109 }; | 99 }; |
| 110 } | 100 } |
| 111 | 101 |
| 112 #endif // SMILTimeContainer_h | 102 #endif // SMILTimeContainer_h |
| OLD | NEW |