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 14 matching lines...) Expand all Loading... |
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 Animation_h | 31 #ifndef Animation_h |
32 #define Animation_h | 32 #define Animation_h |
33 | 33 |
34 #include "core/animation/AnimationEffect.h" | 34 #include "core/animation/AnimationEffect.h" |
| 35 #include "core/animation/EffectInput.h" |
35 #include "core/animation/TimedItem.h" | 36 #include "core/animation/TimedItem.h" |
| 37 #include "core/animation/TimingInput.h" |
36 #include "heap/Handle.h" | 38 #include "heap/Handle.h" |
37 #include "wtf/RefPtr.h" | 39 #include "wtf/RefPtr.h" |
38 | 40 |
39 namespace WebCore { | 41 namespace WebCore { |
40 | 42 |
41 class Element; | 43 class Element; |
42 class Dictionary; | 44 class Dictionary; |
43 | 45 |
44 class Animation FINAL : public TimedItem { | 46 class Animation FINAL : public TimedItem { |
45 | 47 |
46 public: | 48 public: |
47 enum Priority { DefaultPriority, TransitionPriority }; | 49 enum Priority { DefaultPriority, TransitionPriority }; |
48 | 50 |
49 static PassRefPtr<Animation> create(PassRefPtr<Element>, PassRefPtrWillBeRaw
Ptr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<Even
tDelegate> = nullptr); | 51 static PassRefPtr<Animation> create(PassRefPtr<Element>, PassRefPtrWillBeRaw
Ptr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<Even
tDelegate> = nullptr); |
50 // Web Animations API Bindings constructors. | 52 // Web Animations API Bindings constructors. |
51 static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDic
tionaryVector, Dictionary timingInput); | 53 static PassRefPtr<Animation> create(Element*, PassRefPtrWillBeRawPtr<Animati
onEffect>, const Dictionary& timingInputDictionary); |
52 static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDic
tionaryVector, double timingInput); | 54 static PassRefPtr<Animation> create(Element*, PassRefPtrWillBeRawPtr<Animati
onEffect>, double duration); |
53 static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDic
tionaryVector); | 55 static PassRefPtr<Animation> create(Element*, PassRefPtrWillBeRawPtr<Animati
onEffect>); |
| 56 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector, const Dictionary& timingInputDictionary); |
| 57 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector, double duration); |
| 58 static PassRefPtr<Animation> create(Element*, const Vector<Dictionary>& keyf
rameDictionaryVector); |
54 | 59 |
55 // FIXME: Move all of these setter methods out of Animation, | 60 // FIXME: Move all of these setter methods out of Animation, |
56 // possibly into a new class (TimingInput?). | 61 // possibly into a new class (TimingInput?). |
57 static void setStartDelay(Timing&, double startDelay); | 62 static void setStartDelay(Timing&, double startDelay); |
58 static void setEndDelay(Timing&, double endDelay); | 63 static void setEndDelay(Timing&, double endDelay); |
59 static void setFillMode(Timing&, String fillMode); | 64 static void setFillMode(Timing&, String fillMode); |
60 static void setIterationStart(Timing&, double iterationStart); | 65 static void setIterationStart(Timing&, double iterationStart); |
61 static void setIterationCount(Timing&, double iterationCount); | 66 static void setIterationCount(Timing&, double iterationCount); |
62 static void setIterationDuration(Timing&, double iterationDuration); | 67 static void setIterationDuration(Timing&, double iterationDuration); |
63 static void setPlaybackRate(Timing&, double playbackRate); | 68 static void setPlaybackRate(Timing&, double playbackRate); |
(...skipping 24 matching lines...) Expand all Loading... |
88 protected: | 93 protected: |
89 void applyEffects(bool previouslyInEffect); | 94 void applyEffects(bool previouslyInEffect); |
90 void clearEffects(); | 95 void clearEffects(); |
91 virtual void updateChildrenAndEffects() const OVERRIDE; | 96 virtual void updateChildrenAndEffects() const OVERRIDE; |
92 virtual void didAttach() OVERRIDE; | 97 virtual void didAttach() OVERRIDE; |
93 virtual void willDetach() OVERRIDE; | 98 virtual void willDetach() OVERRIDE; |
94 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; | 99 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; |
95 | 100 |
96 private: | 101 private: |
97 static void populateTiming(Timing&, Dictionary); | 102 static void populateTiming(Timing&, Dictionary); |
98 // createUnsafe should only be directly called from tests. | |
99 static PassRefPtr<Animation> createUnsafe(Element*, Vector<Dictionary> keyfr
ameDictionaryVector, Dictionary timingInput); | |
100 static PassRefPtr<Animation> createUnsafe(Element*, Vector<Dictionary> keyfr
ameDictionaryVector, double timingInput); | |
101 static PassRefPtr<Animation> createUnsafe(Element*, Vector<Dictionary> keyfr
ameDictionaryVector); | |
102 | 103 |
103 Animation(PassRefPtr<Element>, PassRefPtrWillBeRawPtr<AnimationEffect>, cons
t Timing&, Priority, PassOwnPtr<EventDelegate>); | 104 Animation(PassRefPtr<Element>, PassRefPtrWillBeRawPtr<AnimationEffect>, cons
t Timing&, Priority, PassOwnPtr<EventDelegate>); |
104 | 105 |
105 RefPtr<Element> m_target; | 106 RefPtr<Element> m_target; |
106 RefPtrWillBePersistent<AnimationEffect> m_effect; | 107 RefPtrWillBePersistent<AnimationEffect> m_effect; |
107 | 108 |
108 bool m_activeInAnimationStack; | 109 bool m_activeInAnimationStack; |
109 OwnPtr<AnimationEffect::CompositableValueList> m_compositableValues; | 110 OwnPtr<AnimationEffect::CompositableValueList> m_compositableValues; |
110 | 111 |
111 Priority m_priority; | 112 Priority m_priority; |
112 | 113 |
113 Vector<int> m_compositorAnimationIds; | 114 Vector<int> m_compositorAnimationIds; |
114 | 115 |
115 friend class CSSAnimations; | 116 friend class CSSAnimations; |
116 friend class AnimationAnimationV8Test; | 117 friend class AnimationAnimationV8Test; |
117 friend class AnimationAnimationTimingInputTest; | |
118 }; | 118 }; |
119 | 119 |
120 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); | 120 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); |
121 | 121 |
122 } // namespace WebCore | 122 } // namespace WebCore |
123 | 123 |
124 #endif | 124 #endif |
OLD | NEW |