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 30 matching lines...) Expand all Loading... |
41 class Element; | 41 class Element; |
42 class Dictionary; | 42 class Dictionary; |
43 | 43 |
44 class Animation FINAL : public TimedItem { | 44 class Animation FINAL : public TimedItem { |
45 | 45 |
46 public: | 46 public: |
47 enum Priority { DefaultPriority, TransitionPriority }; | 47 enum Priority { DefaultPriority, TransitionPriority }; |
48 | 48 |
49 static PassRefPtr<Animation> create(PassRefPtr<Element>, PassRefPtrWillBeRaw
Ptr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<Even
tDelegate> = nullptr); | 49 static PassRefPtr<Animation> create(PassRefPtr<Element>, PassRefPtrWillBeRaw
Ptr<AnimationEffect>, const Timing&, Priority = DefaultPriority, PassOwnPtr<Even
tDelegate> = nullptr); |
50 // Web Animations API Bindings constructors. | 50 // Web Animations API Bindings constructors. |
51 static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDic
tionaryVector, Dictionary timingInput); | 51 template<typename E, typename T = double> |
52 static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDic
tionaryVector, double timingInput); | 52 static PassRefPtr<Animation> create(Element* element, E effectInput, T timin
gInput = Timing::initialIterationDuration()) |
53 static PassRefPtr<Animation> create(Element*, Vector<Dictionary> keyframeDic
tionaryVector); | 53 { |
| 54 ASSERT(RuntimeEnabledFeatures::webAnimationsAPIEnabled()); |
| 55 return adoptRef(new Animation(element, convertEffectInput(element, effec
tInput), Timing::convertInput(timingInput), DefaultPriority, nullptr)); |
| 56 } |
54 | 57 |
55 // FIXME: Move all of these setter methods out of Animation, | 58 // FIXME: Move all of these setter methods out of Animation, |
56 // possibly into a new class (TimingInput?). | 59 // possibly into a new class (TimingInput?). |
57 static void setStartDelay(Timing&, double startDelay); | 60 static void setStartDelay(Timing&, double startDelay); |
58 static void setEndDelay(Timing&, double endDelay); | 61 static void setEndDelay(Timing&, double endDelay); |
59 static void setFillMode(Timing&, String fillMode); | 62 static void setFillMode(Timing&, String fillMode); |
60 static void setIterationStart(Timing&, double iterationStart); | 63 static void setIterationStart(Timing&, double iterationStart); |
61 static void setIterationCount(Timing&, double iterationCount); | 64 static void setIterationCount(Timing&, double iterationCount); |
62 static void setIterationDuration(Timing&, double iterationDuration); | 65 static void setIterationDuration(Timing&, double iterationDuration); |
63 static void setPlaybackRate(Timing&, double playbackRate); | 66 static void setPlaybackRate(Timing&, double playbackRate); |
(...skipping 23 matching lines...) Expand all Loading... |
87 | 90 |
88 protected: | 91 protected: |
89 void applyEffects(bool previouslyInEffect); | 92 void applyEffects(bool previouslyInEffect); |
90 void clearEffects(); | 93 void clearEffects(); |
91 virtual void updateChildrenAndEffects() const OVERRIDE; | 94 virtual void updateChildrenAndEffects() const OVERRIDE; |
92 virtual void didAttach() OVERRIDE; | 95 virtual void didAttach() OVERRIDE; |
93 virtual void willDetach() OVERRIDE; | 96 virtual void willDetach() OVERRIDE; |
94 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; | 97 virtual double calculateTimeToEffectChange(bool forwards, double inheritedTi
me, double timeToNextIteration) const OVERRIDE; |
95 | 98 |
96 private: | 99 private: |
| 100 static PassRefPtrWillBeRawPtr<AnimationEffect> convertEffectInput(Element*,
Vector<Dictionary> keyframeDictionaryVector, bool unsafe = false); |
| 101 static PassRefPtrWillBeRawPtr<AnimationEffect> convertEffectInput(Element*,
PassRefPtrWillBeRawPtr<AnimationEffect> effect) { return effect; } |
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 friend class AnimationAnimationTimingInputTest; |
118 }; | 119 }; |
119 | 120 |
120 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); | 121 DEFINE_TYPE_CASTS(Animation, TimedItem, timedItem, timedItem->isAnimation(), tim
edItem.isAnimation()); |
121 | 122 |
122 } // namespace WebCore | 123 } // namespace WebCore |
123 | 124 |
124 #endif | 125 #endif |
OLD | NEW |