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 15 matching lines...) Expand all Loading... |
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 KeyframeEffectModel_h | 31 #ifndef KeyframeEffectModel_h |
32 #define KeyframeEffectModel_h | 32 #define KeyframeEffectModel_h |
33 | 33 |
34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
35 #include "core/animation/AnimationEffect.h" | 35 #include "core/animation/AnimationEffect.h" |
36 #include "core/animation/AnimationNode.h" | 36 #include "core/animation/EffectModel.h" |
37 #include "core/animation/InterpolationEffect.h" | 37 #include "core/animation/InterpolationEffect.h" |
38 #include "core/animation/PropertyHandle.h" | 38 #include "core/animation/PropertyHandle.h" |
39 #include "core/animation/StringKeyframe.h" | 39 #include "core/animation/StringKeyframe.h" |
40 #include "core/animation/animatable/AnimatableValueKeyframe.h" | 40 #include "core/animation/animatable/AnimatableValueKeyframe.h" |
41 #include "platform/animation/TimingFunction.h" | 41 #include "platform/animation/TimingFunction.h" |
42 #include "platform/heap/Handle.h" | 42 #include "platform/heap/Handle.h" |
43 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
44 #include "wtf/HashSet.h" | 44 #include "wtf/HashSet.h" |
45 #include "wtf/PassOwnPtr.h" | 45 #include "wtf/PassOwnPtr.h" |
46 #include "wtf/PassRefPtr.h" | 46 #include "wtf/PassRefPtr.h" |
47 #include "wtf/RefCounted.h" | 47 #include "wtf/RefCounted.h" |
48 #include "wtf/Vector.h" | 48 #include "wtf/Vector.h" |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 class Element; | 52 class Element; |
53 class KeyframeEffectModelTest; | 53 class KeyframeEffectModelTest; |
54 | 54 |
55 class CORE_EXPORT KeyframeEffectModelBase : public AnimationEffect { | 55 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel { |
56 public: | 56 public: |
57 // FIXME: Implement accumulation. | 57 // FIXME: Implement accumulation. |
58 | 58 |
59 using PropertySpecificKeyframeVector = WillBeHeapVector<OwnPtrWillBeMember<K
eyframe::PropertySpecificKeyframe>>; | 59 using PropertySpecificKeyframeVector = WillBeHeapVector<OwnPtrWillBeMember<K
eyframe::PropertySpecificKeyframe>>; |
60 class PropertySpecificKeyframeGroup : public NoBaseWillBeGarbageCollected<Pr
opertySpecificKeyframeGroup> { | 60 class PropertySpecificKeyframeGroup : public NoBaseWillBeGarbageCollected<Pr
opertySpecificKeyframeGroup> { |
61 public: | 61 public: |
62 void appendKeyframe(PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKey
frame>); | 62 void appendKeyframe(PassOwnPtrWillBeRawPtr<Keyframe::PropertySpecificKey
frame>); |
63 const PropertySpecificKeyframeVector& keyframes() const { return m_keyfr
ames; } | 63 const PropertySpecificKeyframeVector& keyframes() const { return m_keyfr
ames; } |
64 | 64 |
65 DECLARE_TRACE(); | 65 DECLARE_TRACE(); |
(...skipping 14 matching lines...) Expand all Loading... |
80 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; | 80 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; |
81 const KeyframeVector& getFrames() const { return m_keyframes; } | 81 const KeyframeVector& getFrames() const { return m_keyframes; } |
82 void setFrames(KeyframeVector& keyframes); | 82 void setFrames(KeyframeVector& keyframes); |
83 | 83 |
84 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(PropertyH
andle property) const | 84 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(PropertyH
andle property) const |
85 { | 85 { |
86 ensureKeyframeGroups(); | 86 ensureKeyframeGroups(); |
87 return m_keyframeGroups->get(property)->keyframes(); | 87 return m_keyframeGroups->get(property)->keyframes(); |
88 } | 88 } |
89 | 89 |
90 // AnimationEffect implementation. | 90 // EffectModel implementation. |
91 virtual void sample(int iteration, double fraction, double iterationDuration
, OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>>&) cons
t override; | 91 virtual void sample(int iteration, double fraction, double iterationDuration
, OwnPtrWillBeRawPtr<WillBeHeapVector<RefPtrWillBeMember<Interpolation>>>&) cons
t override; |
92 | 92 |
93 virtual bool isKeyframeEffectModel() const override { return true; } | 93 virtual bool isKeyframeEffectModel() const override { return true; } |
94 | 94 |
95 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } | 95 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } |
96 virtual bool isStringKeyframeEffectModel() const { return false; } | 96 virtual bool isStringKeyframeEffectModel() const { return false; } |
97 | 97 |
98 bool hasSyntheticKeyframes() const | 98 bool hasSyntheticKeyframes() const |
99 { | 99 { |
100 ensureKeyframeGroups(); | 100 ensureKeyframeGroups(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 using PropertySpecificKeyframeVector = KeyframeEffectModelBase::PropertySpecific
KeyframeVector; | 170 using PropertySpecificKeyframeVector = KeyframeEffectModelBase::PropertySpecific
KeyframeVector; |
171 | 171 |
172 using AnimatableValueKeyframeEffectModel = KeyframeEffectModel<AnimatableValueKe
yframe>; | 172 using AnimatableValueKeyframeEffectModel = KeyframeEffectModel<AnimatableValueKe
yframe>; |
173 using AnimatableValueKeyframeVector = AnimatableValueKeyframeEffectModel::Keyfra
meVector; | 173 using AnimatableValueKeyframeVector = AnimatableValueKeyframeEffectModel::Keyfra
meVector; |
174 using AnimatableValuePropertySpecificKeyframeVector = AnimatableValueKeyframeEff
ectModel::PropertySpecificKeyframeVector; | 174 using AnimatableValuePropertySpecificKeyframeVector = AnimatableValueKeyframeEff
ectModel::PropertySpecificKeyframeVector; |
175 | 175 |
176 using StringKeyframeEffectModel = KeyframeEffectModel<StringKeyframe>; | 176 using StringKeyframeEffectModel = KeyframeEffectModel<StringKeyframe>; |
177 using StringKeyframeVector = StringKeyframeEffectModel::KeyframeVector; | 177 using StringKeyframeVector = StringKeyframeEffectModel::KeyframeVector; |
178 using StringPropertySpecificKeyframeVector = StringKeyframeEffectModel::Property
SpecificKeyframeVector; | 178 using StringPropertySpecificKeyframeVector = StringKeyframeEffectModel::Property
SpecificKeyframeVector; |
179 | 179 |
180 DEFINE_TYPE_CASTS(KeyframeEffectModelBase, AnimationEffect, value, value->isKeyf
rameEffectModel(), value.isKeyframeEffectModel()); | 180 DEFINE_TYPE_CASTS(KeyframeEffectModelBase, EffectModel, value, value->isKeyframe
EffectModel(), value.isKeyframeEffectModel()); |
181 DEFINE_TYPE_CASTS(AnimatableValueKeyframeEffectModel, KeyframeEffectModelBase, v
alue, value->isAnimatableValueKeyframeEffectModel(), value.isAnimatableValueKeyf
rameEffectModel()); | 181 DEFINE_TYPE_CASTS(AnimatableValueKeyframeEffectModel, KeyframeEffectModelBase, v
alue, value->isAnimatableValueKeyframeEffectModel(), value.isAnimatableValueKeyf
rameEffectModel()); |
182 DEFINE_TYPE_CASTS(StringKeyframeEffectModel, KeyframeEffectModelBase, value, val
ue->isStringKeyframeEffectModel(), value.isStringKeyframeEffectModel()); | 182 DEFINE_TYPE_CASTS(StringKeyframeEffectModel, KeyframeEffectModelBase, value, val
ue->isStringKeyframeEffectModel(), value.isStringKeyframeEffectModel()); |
183 | 183 |
184 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect
Model(const AnimationEffect* base) | 184 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect
Model(const EffectModel* base) |
185 { | 185 { |
186 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; | 186 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; |
187 } | 187 } |
188 | 188 |
189 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel(
AnimationEffect* base) | 189 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel(
EffectModel* base) |
190 { | 190 { |
191 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; | 191 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base))
; |
192 } | 192 } |
193 | 193 |
194 inline const StringKeyframeEffectModel* toStringKeyframeEffectModel(const Animat
ionEffect* base) | 194 inline const StringKeyframeEffectModel* toStringKeyframeEffectModel(const Effect
Model* base) |
195 { | 195 { |
196 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base)); | 196 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base)); |
197 } | 197 } |
198 | 198 |
199 inline StringKeyframeEffectModel* toStringKeyframeEffectModel(AnimationEffect* b
ase) | 199 inline StringKeyframeEffectModel* toStringKeyframeEffectModel(EffectModel* base) |
200 { | 200 { |
201 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base)); | 201 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base)); |
202 } | 202 } |
203 | 203 |
204 template <> | 204 template <> |
205 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } | 205 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } |
206 | 206 |
207 template <> | 207 template <> |
208 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } | 208 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } |
209 | 209 |
210 } // namespace blink | 210 } // namespace blink |
211 | 211 |
212 #endif // KeyframeEffectModel_h | 212 #endif // KeyframeEffectModel_h |
OLD | NEW |