OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 12 matching lines...) Expand all Loading... |
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef AnimationBase_h | 29 #ifndef AnimationBase_h |
30 #define AnimationBase_h | 30 #define AnimationBase_h |
31 | 31 |
32 #include "CSSPropertyNames.h" | 32 #include "CSSPropertyNames.h" |
33 #include "core/platform/animation/Animation.h" | 33 #include "core/platform/animation/CSSAnimationData.h" |
34 #include "core/rendering/style/RenderStyleConstants.h" | 34 #include "core/rendering/style/RenderStyleConstants.h" |
35 #include <wtf/HashMap.h> | 35 #include <wtf/HashMap.h> |
36 #include <wtf/HashSet.h> | 36 #include <wtf/HashSet.h> |
37 #include <wtf/RefCounted.h> | 37 #include <wtf/RefCounted.h> |
38 #include <wtf/text/AtomicString.h> | 38 #include <wtf/text/AtomicString.h> |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 class AnimationBase; | 42 class AnimationBase; |
43 class AnimationController; | 43 class AnimationController; |
44 class CompositeAnimation; | 44 class CompositeAnimation; |
45 class Element; | 45 class Element; |
46 class Node; | 46 class Node; |
47 class RenderObject; | 47 class RenderObject; |
48 class RenderStyle; | 48 class RenderStyle; |
49 class TimingFunction; | 49 class TimingFunction; |
50 | 50 |
51 class AnimationBase : public RefCounted<AnimationBase> { | 51 class AnimationBase : public RefCounted<AnimationBase> { |
52 friend class CompositeAnimation; | 52 friend class CompositeAnimation; |
53 friend class CSSPropertyAnimation; | 53 friend class CSSPropertyAnimation; |
54 | 54 |
55 public: | 55 public: |
56 AnimationBase(const Animation* transition, RenderObject* renderer, Composite
Animation* compAnim); | 56 AnimationBase(const CSSAnimationData* transition, RenderObject* renderer, Co
mpositeAnimation* compAnim); |
57 virtual ~AnimationBase() { } | 57 virtual ~AnimationBase() { } |
58 | 58 |
59 RenderObject* renderer() const { return m_object; } | 59 RenderObject* renderer() const { return m_object; } |
60 void clear() | 60 void clear() |
61 { | 61 { |
62 endAnimation(); | 62 endAnimation(); |
63 m_object = 0; | 63 m_object = 0; |
64 m_compAnim = 0; | 64 m_compAnim = 0; |
65 } | 65 } |
66 | 66 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 double progress(double scale, double offset, const TimingFunction*) const; | 134 double progress(double scale, double offset, const TimingFunction*) const; |
135 | 135 |
136 virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle*
/*currentStyle*/, RenderStyle* /*targetStyle*/, RefPtr<RenderStyle>& /*animatedS
tyle*/) = 0; | 136 virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle*
/*currentStyle*/, RenderStyle* /*targetStyle*/, RefPtr<RenderStyle>& /*animatedS
tyle*/) = 0; |
137 virtual void getAnimatedStyle(RefPtr<RenderStyle>& /*animatedStyle*/) = 0; | 137 virtual void getAnimatedStyle(RefPtr<RenderStyle>& /*animatedStyle*/) = 0; |
138 | 138 |
139 virtual bool shouldFireEvents() const { return false; } | 139 virtual bool shouldFireEvents() const { return false; } |
140 | 140 |
141 void fireAnimationEventsIfNeeded(); | 141 void fireAnimationEventsIfNeeded(); |
142 | 142 |
143 bool animationsMatch(const Animation*) const; | 143 bool animationsMatch(const CSSAnimationData*) const; |
144 | 144 |
145 void setAnimation(const Animation* anim) { m_animation = const_cast<Animatio
n*>(anim); } | 145 void setAnimation(const CSSAnimationData* anim) { m_animation = const_cast<C
SSAnimationData*>(anim); } |
146 | 146 |
147 // Return true if this animation is overridden. This will only be the case f
or | 147 // Return true if this animation is overridden. This will only be the case f
or |
148 // ImplicitAnimations and is used to determine whether or not we should forc
e | 148 // ImplicitAnimations and is used to determine whether or not we should forc
e |
149 // set the start time. If an animation is overridden, it will probably not g
et | 149 // set the start time. If an animation is overridden, it will probably not g
et |
150 // back the AnimationStateInputStartTimeSet input. | 150 // back the AnimationStateInputStartTimeSet input. |
151 virtual bool overridden() const { return false; } | 151 virtual bool overridden() const { return false; } |
152 | 152 |
153 // Does this animation/transition involve the given property? | 153 // Does this animation/transition involve the given property? |
154 virtual bool affectsProperty(CSSPropertyID /*property*/) const { return fals
e; } | 154 virtual bool affectsProperty(CSSPropertyID /*property*/) const { return fals
e; } |
155 | 155 |
(...skipping 18 matching lines...) Expand all Loading... |
174 double beginAnimationUpdateTime() const; | 174 double beginAnimationUpdateTime() const; |
175 | 175 |
176 double getElapsedTime() const; | 176 double getElapsedTime() const; |
177 | 177 |
178 void styleAvailable() | 178 void styleAvailable() |
179 { | 179 { |
180 ASSERT(waitingForStyleAvailable()); | 180 ASSERT(waitingForStyleAvailable()); |
181 updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1)
; | 181 updateStateMachine(AnimationBase::AnimationStateInputStyleAvailable, -1)
; |
182 } | 182 } |
183 | 183 |
184 const Animation* animation() const { return m_animation.get(); } | 184 const CSSAnimationData* animation() const { return m_animation.get(); } |
185 | 185 |
186 protected: | 186 protected: |
187 virtual void overrideAnimations() { } | 187 virtual void overrideAnimations() { } |
188 virtual void resumeOverriddenAnimations() { } | 188 virtual void resumeOverriddenAnimations() { } |
189 | 189 |
190 CompositeAnimation* compositeAnimation() { return m_compAnim; } | 190 CompositeAnimation* compositeAnimation() { return m_compAnim; } |
191 | 191 |
192 // These are called when the corresponding timer fires so subclasses can do
any extra work | 192 // These are called when the corresponding timer fires so subclasses can do
any extra work |
193 virtual void onAnimationStart(double /*elapsedTime*/) { } | 193 virtual void onAnimationStart(double /*elapsedTime*/) { } |
194 virtual void onAnimationIteration(double /*elapsedTime*/) { } | 194 virtual void onAnimationIteration(double /*elapsedTime*/) { } |
(...skipping 23 matching lines...) Expand all Loading... |
218 bool m_filterFunctionListsMatch; | 218 bool m_filterFunctionListsMatch; |
219 double m_startTime; | 219 double m_startTime; |
220 double m_pauseTime; | 220 double m_pauseTime; |
221 double m_requestedStartTime; | 221 double m_requestedStartTime; |
222 | 222 |
223 double m_totalDuration; | 223 double m_totalDuration; |
224 double m_nextIterationDuration; | 224 double m_nextIterationDuration; |
225 | 225 |
226 RenderObject* m_object; | 226 RenderObject* m_object; |
227 | 227 |
228 RefPtr<Animation> m_animation; | 228 RefPtr<CSSAnimationData> m_animation; |
229 CompositeAnimation* m_compAnim; | 229 CompositeAnimation* m_compAnim; |
230 }; | 230 }; |
231 | 231 |
232 } // namespace WebCore | 232 } // namespace WebCore |
233 | 233 |
234 #endif // AnimationBase_h | 234 #endif // AnimationBase_h |
OLD | NEW |