OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions | |
6 * are met: | |
7 * | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | |
14 * its contributors may be used to endorse or promote products derived | |
15 * from this software without specific prior written permission. | |
16 * | |
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
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 | |
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. | |
27 */ | |
28 | |
29 #ifndef ImplicitAnimation_h | |
30 #define ImplicitAnimation_h | |
31 | |
32 #include "CSSPropertyNames.h" | |
33 #include "core/dom/Document.h" | |
34 #include "core/frame/animation/AnimationBase.h" | |
35 | |
36 namespace WebCore { | |
37 | |
38 // An ImplicitAnimation tracks the state of a transition of a specific CSS prope
rty | |
39 // for a single RenderObject. | |
40 class ImplicitAnimation FINAL : public AnimationBase { | |
41 public: | |
42 static PassRefPtr<ImplicitAnimation> create(const CSSAnimationData* animatio
n, CSSPropertyID animatingProperty, RenderObject& renderer, CompositeAnimation*
compositeAnimation, RenderStyle* fromStyle) | |
43 { | |
44 return adoptRef(new ImplicitAnimation(animation, animatingProperty, rend
erer, compositeAnimation, fromStyle)); | |
45 }; | |
46 | |
47 CSSPropertyID transitionProperty() const { return m_transitionProperty; } | |
48 CSSPropertyID animatingProperty() const { return m_animatingProperty; } | |
49 | |
50 virtual void onAnimationEnd(double elapsedTime) OVERRIDE; | |
51 virtual void startAnimation(double timeOffset) OVERRIDE; | |
52 virtual void pauseAnimation(double /*timeOffset*/) OVERRIDE; | |
53 virtual void endAnimation() OVERRIDE; | |
54 | |
55 virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle*
currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle) OVER
RIDE; | |
56 virtual void getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle) OVERRIDE; | |
57 void reset(RenderStyle* to); | |
58 | |
59 void setOverridden(bool); | |
60 virtual bool overridden() const OVERRIDE { return m_overridden; } | |
61 | |
62 virtual bool affectsProperty(CSSPropertyID) const OVERRIDE; | |
63 | |
64 bool hasStyle() const { return m_fromStyle && m_toStyle; } | |
65 | |
66 bool isTargetPropertyEqual(CSSPropertyID, const RenderStyle*); | |
67 | |
68 void blendPropertyValueInStyle(CSSPropertyID, RenderStyle*); | |
69 | |
70 virtual double timeToNextService() OVERRIDE; | |
71 | |
72 bool active() const { return m_active; } | |
73 void setActive(bool b) { m_active = b; } | |
74 | |
75 protected: | |
76 bool shouldSendEventForListener(Document::ListenerType) const; | |
77 bool sendTransitionEvent(const AtomicString&, double elapsedTime); | |
78 | |
79 void validateTransformFunctionList(); | |
80 void checkForMatchingFilterFunctionLists(); | |
81 | |
82 private: | |
83 ImplicitAnimation(const CSSAnimationData*, CSSPropertyID, RenderObject&, Com
positeAnimation*, RenderStyle*); | |
84 virtual ~ImplicitAnimation(); | |
85 | |
86 CSSPropertyID m_transitionProperty; // Transition property as specified in t
he RenderStyle. | |
87 CSSPropertyID m_animatingProperty; // Specific property for this ImplicitAni
mation | |
88 bool m_overridden; // true when there is a keyframe animation that
overrides the transitioning property | |
89 bool m_active; // used for culling the list of transitions | |
90 | |
91 // The two styles that we are blending. | |
92 RefPtr<RenderStyle> m_fromStyle; | |
93 RefPtr<RenderStyle> m_toStyle; | |
94 }; | |
95 | |
96 } // namespace WebCore | |
97 | |
98 #endif // ImplicitAnimation_h | |
OLD | NEW |