| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 PhaseBefore, | 68 PhaseBefore, |
| 69 PhaseActive, | 69 PhaseActive, |
| 70 PhaseAfter, | 70 PhaseAfter, |
| 71 PhaseNone, | 71 PhaseNone, |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 class EventDelegate { | 74 class EventDelegate { |
| 75 public: | 75 public: |
| 76 virtual ~EventDelegate() { } | 76 virtual ~EventDelegate() { } |
| 77 virtual void onEventCondition(const AnimationNode*) = 0; | 77 virtual void onEventCondition(const AnimationNode*) = 0; |
| 78 virtual void trace(Visitor*) { } | |
| 79 }; | 78 }; |
| 80 | 79 |
| 81 virtual ~AnimationNode() { } | 80 virtual ~AnimationNode() { } |
| 82 | 81 |
| 83 virtual bool isAnimation() const { return false; } | 82 virtual bool isAnimation() const { return false; } |
| 84 | 83 |
| 85 Phase phase() const { return ensureCalculated().phase; } | 84 Phase phase() const { return ensureCalculated().phase; } |
| 86 bool isCurrent() const { return ensureCalculated().isCurrent; } | 85 bool isCurrent() const { return ensureCalculated().isCurrent; } |
| 87 bool isInEffect() const { return ensureCalculated().isInEffect; } | 86 bool isInEffect() const { return ensureCalculated().isInEffect; } |
| 88 bool isInPlay() const { return ensureCalculated().isInPlay; } | 87 bool isInPlay() const { return ensureCalculated().isInPlay; } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 106 const AnimationPlayer* player() const { return m_player; } | 105 const AnimationPlayer* player() const { return m_player; } |
| 107 AnimationPlayer* player() { return m_player; } | 106 AnimationPlayer* player() { return m_player; } |
| 108 const Timing& specifiedTiming() const { return m_timing; } | 107 const Timing& specifiedTiming() const { return m_timing; } |
| 109 PassRefPtr<AnimationNodeTiming> timing(); | 108 PassRefPtr<AnimationNodeTiming> timing(); |
| 110 void updateSpecifiedTiming(const Timing&); | 109 void updateSpecifiedTiming(const Timing&); |
| 111 | 110 |
| 112 // This method returns time in ms as it is unused except via the API. | 111 // This method returns time in ms as it is unused except via the API. |
| 113 double localTime(bool& isNull) const { isNull = !m_player; return ensureCalc
ulated().localTime * 1000; } | 112 double localTime(bool& isNull) const { isNull = !m_player; return ensureCalc
ulated().localTime * 1000; } |
| 114 double currentIteration(bool& isNull) const { isNull = !ensureCalculated().i
sInEffect; return ensureCalculated().currentIteration; } | 113 double currentIteration(bool& isNull) const { isNull = !ensureCalculated().i
sInEffect; return ensureCalculated().currentIteration; } |
| 115 | 114 |
| 116 virtual void trace(Visitor*); | |
| 117 | |
| 118 protected: | 115 protected: |
| 119 explicit AnimationNode(const Timing&, PassOwnPtr<EventDelegate> = nullptr); | 116 explicit AnimationNode(const Timing&, PassOwnPtr<EventDelegate> = nullptr); |
| 120 | 117 |
| 121 // When AnimationNode receives a new inherited time via updateInheritedTime | 118 // When AnimationNode receives a new inherited time via updateInheritedTime |
| 122 // it will (if necessary) recalculate timings and (if necessary) call | 119 // it will (if necessary) recalculate timings and (if necessary) call |
| 123 // updateChildrenAndEffects. | 120 // updateChildrenAndEffects. |
| 124 void updateInheritedTime(double inheritedTime, TimingUpdateReason) const; | 121 void updateInheritedTime(double inheritedTime, TimingUpdateReason) const; |
| 125 void invalidate() const { m_needsUpdate = true; }; | 122 void invalidate() const { m_needsUpdate = true; }; |
| 126 bool hasEvents() const { return m_eventDelegate; } | 123 bool hasEvents() const { return m_eventDelegate; } |
| 127 void clearEventDelegate() { m_eventDelegate = nullptr; } | 124 void clearEventDelegate() { m_eventDelegate = nullptr; } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } m_calculated; | 161 } m_calculated; |
| 165 mutable bool m_needsUpdate; | 162 mutable bool m_needsUpdate; |
| 166 mutable double m_lastUpdateTime; | 163 mutable double m_lastUpdateTime; |
| 167 | 164 |
| 168 const CalculatedTiming& ensureCalculated() const; | 165 const CalculatedTiming& ensureCalculated() const; |
| 169 }; | 166 }; |
| 170 | 167 |
| 171 } // namespace blink | 168 } // namespace blink |
| 172 | 169 |
| 173 #endif | 170 #endif |
| OLD | NEW |