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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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 TimedItem_h | 31 #ifndef TimedItem_h |
32 #define TimedItem_h | 32 #define TimedItem_h |
33 | 33 |
| 34 #include "core/animation/TimedItemTiming.h" |
34 #include "core/animation/Timing.h" | 35 #include "core/animation/Timing.h" |
35 #include "wtf/OwnPtr.h" | 36 #include "wtf/OwnPtr.h" |
36 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
37 #include "wtf/RefCounted.h" | 38 #include "wtf/RefCounted.h" |
38 | 39 |
39 namespace WebCore { | 40 namespace WebCore { |
40 | 41 |
41 class Player; | 42 class Player; |
42 class TimedItem; | 43 class TimedItem; |
43 | 44 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 bool isCurrent() const { return ensureCalculated().isCurrent; } | 77 bool isCurrent() const { return ensureCalculated().isCurrent; } |
77 bool isInEffect() const { return ensureCalculated().isInEffect; } | 78 bool isInEffect() const { return ensureCalculated().isInEffect; } |
78 bool isInPlay() const { return ensureCalculated().isInPlay; } | 79 bool isInPlay() const { return ensureCalculated().isInPlay; } |
79 double timeToEffectChange() const { return ensureCalculated().timeToEffectCh
ange; } | 80 double timeToEffectChange() const { return ensureCalculated().timeToEffectCh
ange; } |
80 | 81 |
81 double currentIteration() const { return ensureCalculated().currentIteration
; } | 82 double currentIteration() const { return ensureCalculated().currentIteration
; } |
82 double duration() const { return iterationDuration(); } | 83 double duration() const { return iterationDuration(); } |
83 double activeDuration() const; | 84 double activeDuration() const; |
84 double timeFraction() const { return ensureCalculated().timeFraction; } | 85 double timeFraction() const { return ensureCalculated().timeFraction; } |
85 double startTime() const { return m_startTime; } | 86 double startTime() const { return m_startTime; } |
86 double endTime() const { return startTime() + specified().startDelay + activ
eDuration() + specified().endDelay; } | 87 double endTime() const { return startTime() + specifiedTiming().startDelay +
activeDuration() + specifiedTiming().endDelay; } |
87 | 88 |
88 const Player* player() const { return m_player; } | 89 const Player* player() const { return m_player; } |
89 Player* player() { return m_player; } | 90 Player* player() { return m_player; } |
90 Player* player(bool& isNull) { isNull = !m_player; return m_player; } | 91 Player* player(bool& isNull) { isNull = !m_player; return m_player; } |
91 const Timing& specified() const { return m_specified; } | 92 const Timing& specifiedTiming() const { return m_specified; } |
| 93 PassRefPtr<TimedItemTiming> specified() { return TimedItemTiming::create(thi
s); } |
92 | 94 |
93 double localTime(bool& isNull) const { isNull = !m_player; return ensureCalc
ulated().localTime; } | 95 double localTime(bool& isNull) const { isNull = !m_player; return ensureCalc
ulated().localTime; } |
94 double currentIteration(bool& isNull) const { isNull = !ensureCalculated().i
sInEffect; return ensureCalculated().currentIteration; } | 96 double currentIteration(bool& isNull) const { isNull = !ensureCalculated().i
sInEffect; return ensureCalculated().currentIteration; } |
95 | 97 |
96 protected: | 98 protected: |
97 TimedItem(const Timing&, PassOwnPtr<EventDelegate> = nullptr); | 99 TimedItem(const Timing&, PassOwnPtr<EventDelegate> = nullptr); |
98 | 100 |
99 // When TimedItem receives a new inherited time via updateInheritedTime | 101 // When TimedItem receives a new inherited time via updateInheritedTime |
100 // it will (if necessary) recalculate timings and (if necessary) call | 102 // it will (if necessary) recalculate timings and (if necessary) call |
101 // updateChildrenAndEffects. | 103 // updateChildrenAndEffects. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 mutable bool m_isFirstSample; | 149 mutable bool m_isFirstSample; |
148 mutable bool m_needsUpdate; | 150 mutable bool m_needsUpdate; |
149 mutable double m_lastUpdateTime; | 151 mutable double m_lastUpdateTime; |
150 | 152 |
151 const CalculatedTiming& ensureCalculated() const; | 153 const CalculatedTiming& ensureCalculated() const; |
152 }; | 154 }; |
153 | 155 |
154 } // namespace WebCore | 156 } // namespace WebCore |
155 | 157 |
156 #endif | 158 #endif |
OLD | NEW |