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 26 matching lines...) Expand all Loading... |
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" | |
48 #include "wtf/Vector.h" | 47 #include "wtf/Vector.h" |
49 | 48 |
50 namespace blink { | 49 namespace blink { |
51 | 50 |
52 class Element; | 51 class Element; |
53 class KeyframeEffectModelTest; | 52 class KeyframeEffectModelTest; |
54 | 53 |
55 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel { | 54 class CORE_EXPORT KeyframeEffectModelBase : public EffectModel { |
56 public: | 55 public: |
57 // FIXME: Implement accumulation. | 56 // FIXME: Implement accumulation. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 void ensureKeyframeGroups() const; | 132 void ensureKeyframeGroups() const; |
134 void ensureInterpolationEffect(Element* = nullptr, const ComputedStyle* base
Style = nullptr) const; | 133 void ensureInterpolationEffect(Element* = nullptr, const ComputedStyle* base
Style = nullptr) const; |
135 void snapshotCompositableProperties(Element&, const ComputedStyle* baseStyle
); | 134 void snapshotCompositableProperties(Element&, const ComputedStyle* baseStyle
); |
136 | 135 |
137 KeyframeVector m_keyframes; | 136 KeyframeVector m_keyframes; |
138 // The spec describes filtering the normalized keyframes at sampling time | 137 // The spec describes filtering the normalized keyframes at sampling time |
139 // to get the 'property-specific keyframes'. For efficiency, we cache the | 138 // to get the 'property-specific keyframes'. For efficiency, we cache the |
140 // property-specific lists. | 139 // property-specific lists. |
141 using KeyframeGroupMap = WillBeHeapHashMap<PropertyHandle, OwnPtrWillBeMembe
r<PropertySpecificKeyframeGroup>>; | 140 using KeyframeGroupMap = WillBeHeapHashMap<PropertyHandle, OwnPtrWillBeMembe
r<PropertySpecificKeyframeGroup>>; |
142 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; | 141 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; |
143 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; | 142 mutable Member<InterpolationEffect> m_interpolationEffect; |
144 RefPtr<TimingFunction> m_neutralKeyframeEasing; | 143 RefPtr<TimingFunction> m_neutralKeyframeEasing; |
145 | 144 |
146 mutable bool m_hasSyntheticKeyframes; | 145 mutable bool m_hasSyntheticKeyframes; |
147 | 146 |
148 friend class KeyframeEffectModelTest; | 147 friend class KeyframeEffectModelTest; |
149 }; | 148 }; |
150 | 149 |
151 template <class Keyframe> | 150 template <class Keyframe> |
152 class KeyframeEffectModel final : public KeyframeEffectModelBase { | 151 class KeyframeEffectModel final : public KeyframeEffectModelBase { |
153 public: | 152 public: |
154 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; | 153 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; |
155 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke
yframeVector& keyframes, PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyframeE
asing = nullptr) | 154 static KeyframeEffectModel<Keyframe>* create(const KeyframeVector& keyframes
, PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyframeEasing = nullptr) |
156 { | 155 { |
157 return adoptRefWillBeNoop(new KeyframeEffectModel(keyframes, neutralKeyf
rameEasing)); | 156 return new KeyframeEffectModel(keyframes, neutralKeyframeEasing); |
158 } | 157 } |
159 | 158 |
160 private: | 159 private: |
161 KeyframeEffectModel(const KeyframeVector& keyframes, PassRefPtrWillBeRawPtr<
TimingFunction> neutralKeyframeEasing) | 160 KeyframeEffectModel(const KeyframeVector& keyframes, PassRefPtrWillBeRawPtr<
TimingFunction> neutralKeyframeEasing) |
162 : KeyframeEffectModelBase(neutralKeyframeEasing) | 161 : KeyframeEffectModelBase(neutralKeyframeEasing) |
163 { | 162 { |
164 m_keyframes.appendVector(keyframes); | 163 m_keyframes.appendVector(keyframes); |
165 } | 164 } |
166 | 165 |
167 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } | 166 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 204 |
206 template <> | 205 template <> |
207 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } | 206 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } |
208 | 207 |
209 template <> | 208 template <> |
210 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } | 209 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } |
211 | 210 |
212 } // namespace blink | 211 } // namespace blink |
213 | 212 |
214 #endif // KeyframeEffectModel_h | 213 #endif // KeyframeEffectModel_h |
OLD | NEW |