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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 static const StylePropertyShorthand& animatableProperties(); | 61 static const StylePropertyShorthand& animatableProperties(); |
62 static bool isAllowedAnimation(CSSPropertyID); | 62 static bool isAllowedAnimation(CSSPropertyID); |
63 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(const Elem
ent* animatingElement, Element&, const LayoutStyle&, LayoutStyle* parentStyle, S
tyleResolver*); | 63 static PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> calculateUpdate(const Elem
ent* animatingElement, Element&, const LayoutStyle&, LayoutStyle* parentStyle, S
tyleResolver*); |
64 | 64 |
65 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m
_pendingUpdate = update; } | 65 void setPendingUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> update) { m
_pendingUpdate = update; } |
66 void maybeApplyPendingUpdate(Element*); | 66 void maybeApplyPendingUpdate(Element*); |
67 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt
y() && !m_pendingUpdate; } | 67 bool isEmpty() const { return m_animations.isEmpty() && m_transitions.isEmpt
y() && !m_pendingUpdate; } |
68 void cancel(); | 68 void cancel(); |
69 | 69 |
70 void trace(Visitor*); | 70 DECLARE_TRACE(); |
71 | 71 |
72 private: | 72 private: |
73 class RunningAnimation final : public RefCountedWillBeGarbageCollectedFinali
zed<RunningAnimation> { | 73 class RunningAnimation final : public RefCountedWillBeGarbageCollectedFinali
zed<RunningAnimation> { |
74 public: | 74 public: |
75 RunningAnimation(PassRefPtrWillBeRawPtr<AnimationPlayer> player, CSSAnim
ationUpdate::NewAnimation animation) | 75 RunningAnimation(PassRefPtrWillBeRawPtr<AnimationPlayer> player, CSSAnim
ationUpdate::NewAnimation animation) |
76 : player(player) | 76 : player(player) |
77 , specifiedTiming(animation.timing) | 77 , specifiedTiming(animation.timing) |
78 , styleRule(animation.styleRule) | 78 , styleRule(animation.styleRule) |
79 , styleRuleVersion(animation.styleRuleVersion) | 79 , styleRuleVersion(animation.styleRuleVersion) |
80 { | 80 { |
81 } | 81 } |
82 | 82 |
83 void update(CSSAnimationUpdate::UpdatedAnimation update) | 83 void update(CSSAnimationUpdate::UpdatedAnimation update) |
84 { | 84 { |
85 styleRule = update.styleRule; | 85 styleRule = update.styleRule; |
86 styleRuleVersion = update.styleRuleVersion; | 86 styleRuleVersion = update.styleRuleVersion; |
87 specifiedTiming = update.specifiedTiming; | 87 specifiedTiming = update.specifiedTiming; |
88 } | 88 } |
89 | 89 |
90 void trace(Visitor* visitor) | 90 DEFINE_INLINE_TRACE() |
91 { | 91 { |
92 visitor->trace(player); | 92 visitor->trace(player); |
93 visitor->trace(styleRule); | 93 visitor->trace(styleRule); |
94 } | 94 } |
95 | 95 |
96 RefPtrWillBeMember<AnimationPlayer> player; | 96 RefPtrWillBeMember<AnimationPlayer> player; |
97 Timing specifiedTiming; | 97 Timing specifiedTiming; |
98 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; | 98 RefPtrWillBeMember<StyleRuleKeyframes> styleRule; |
99 unsigned styleRuleVersion; | 99 unsigned styleRuleVersion; |
100 }; | 100 }; |
101 | 101 |
102 struct RunningTransition { | 102 struct RunningTransition { |
103 ALLOW_ONLY_INLINE_ALLOCATION(); | 103 ALLOW_ONLY_INLINE_ALLOCATION(); |
104 public: | 104 public: |
105 void trace(Visitor* visitor) | 105 DEFINE_INLINE_TRACE() |
106 { | 106 { |
107 visitor->trace(player); | 107 visitor->trace(player); |
108 visitor->trace(from); | 108 visitor->trace(from); |
109 visitor->trace(to); | 109 visitor->trace(to); |
110 } | 110 } |
111 | 111 |
112 RefPtrWillBeMember<AnimationPlayer> player; | 112 RefPtrWillBeMember<AnimationPlayer> player; |
113 RawPtrWillBeMember<const AnimatableValue> from; | 113 RawPtrWillBeMember<const AnimatableValue> from; |
114 RawPtrWillBeMember<const AnimatableValue> to; | 114 RawPtrWillBeMember<const AnimatableValue> to; |
115 }; | 115 }; |
(...skipping 19 matching lines...) Expand all Loading... |
135 public: | 135 public: |
136 AnimationEventDelegate(Element* animationTarget, const AtomicString& nam
e) | 136 AnimationEventDelegate(Element* animationTarget, const AtomicString& nam
e) |
137 : m_animationTarget(animationTarget) | 137 : m_animationTarget(animationTarget) |
138 , m_name(name) | 138 , m_name(name) |
139 , m_previousPhase(AnimationNode::PhaseNone) | 139 , m_previousPhase(AnimationNode::PhaseNone) |
140 , m_previousIteration(nullValue()) | 140 , m_previousIteration(nullValue()) |
141 { | 141 { |
142 } | 142 } |
143 virtual bool requiresIterationEvents(const AnimationNode&) override; | 143 virtual bool requiresIterationEvents(const AnimationNode&) override; |
144 virtual void onEventCondition(const AnimationNode&) override; | 144 virtual void onEventCondition(const AnimationNode&) override; |
145 virtual void trace(Visitor*) override; | 145 DECLARE_VIRTUAL_TRACE(); |
146 | 146 |
147 private: | 147 private: |
148 const Element& animationTarget() const { return *m_animationTarget; } | 148 const Element& animationTarget() const { return *m_animationTarget; } |
149 EventTarget* eventTarget() const; | 149 EventTarget* eventTarget() const; |
150 Document& document() const { return m_animationTarget->document(); } | 150 Document& document() const { return m_animationTarget->document(); } |
151 | 151 |
152 void maybeDispatch(Document::ListenerType, const AtomicString& eventName
, double elapsedTime); | 152 void maybeDispatch(Document::ListenerType, const AtomicString& eventName
, double elapsedTime); |
153 RawPtrWillBeMember<Element> m_animationTarget; | 153 RawPtrWillBeMember<Element> m_animationTarget; |
154 const AtomicString m_name; | 154 const AtomicString m_name; |
155 AnimationNode::Phase m_previousPhase; | 155 AnimationNode::Phase m_previousPhase; |
156 double m_previousIteration; | 156 double m_previousIteration; |
157 }; | 157 }; |
158 | 158 |
159 class TransitionEventDelegate final : public AnimationNode::EventDelegate { | 159 class TransitionEventDelegate final : public AnimationNode::EventDelegate { |
160 public: | 160 public: |
161 TransitionEventDelegate(Element* transitionTarget, CSSPropertyID propert
y) | 161 TransitionEventDelegate(Element* transitionTarget, CSSPropertyID propert
y) |
162 : m_transitionTarget(transitionTarget) | 162 : m_transitionTarget(transitionTarget) |
163 , m_property(property) | 163 , m_property(property) |
164 , m_previousPhase(AnimationNode::PhaseNone) | 164 , m_previousPhase(AnimationNode::PhaseNone) |
165 { | 165 { |
166 } | 166 } |
167 virtual bool requiresIterationEvents(const AnimationNode&) override { re
turn false; } | 167 virtual bool requiresIterationEvents(const AnimationNode&) override { re
turn false; } |
168 virtual void onEventCondition(const AnimationNode&) override; | 168 virtual void onEventCondition(const AnimationNode&) override; |
169 virtual void trace(Visitor*) override; | 169 DECLARE_VIRTUAL_TRACE(); |
170 | 170 |
171 private: | 171 private: |
172 const Element& transitionTarget() const { return *m_transitionTarget; } | 172 const Element& transitionTarget() const { return *m_transitionTarget; } |
173 EventTarget* eventTarget() const; | 173 EventTarget* eventTarget() const; |
174 PseudoId pseudoId() const { return m_transitionTarget->pseudoId(); } | 174 PseudoId pseudoId() const { return m_transitionTarget->pseudoId(); } |
175 Document& document() const { return m_transitionTarget->document(); } | 175 Document& document() const { return m_transitionTarget->document(); } |
176 | 176 |
177 RawPtrWillBeMember<Element> m_transitionTarget; | 177 RawPtrWillBeMember<Element> m_transitionTarget; |
178 const CSSPropertyID m_property; | 178 const CSSPropertyID m_property; |
179 AnimationNode::Phase m_previousPhase; | 179 AnimationNode::Phase m_previousPhase; |
180 }; | 180 }; |
181 }; | 181 }; |
182 | 182 |
183 } // namespace blink | 183 } // namespace blink |
184 | 184 |
185 #endif | 185 #endif |
OLD | NEW |