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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 bool affects(PropertyHandle property) const override | 111 bool affects(PropertyHandle property) const override |
112 { | 112 { |
113 ensureKeyframeGroups(); | 113 ensureKeyframeGroups(); |
114 return m_keyframeGroups->contains(property); | 114 return m_keyframeGroups->contains(property); |
115 } | 115 } |
116 | 116 |
117 bool isTransformRelatedEffect() const override; | 117 bool isTransformRelatedEffect() const override; |
118 | 118 |
119 protected: | 119 protected: |
120 KeyframeEffectModelBase(PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyfra
meEasing) | 120 KeyframeEffectModelBase(PassRefPtr<TimingFunction> neutralKeyframeEasing) |
121 : m_neutralKeyframeEasing(neutralKeyframeEasing) | 121 : m_neutralKeyframeEasing(neutralKeyframeEasing) |
122 { | 122 { |
123 } | 123 } |
124 | 124 |
125 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); | 125 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); |
126 | 126 |
127 // Lazily computes the groups of property-specific keyframes. | 127 // Lazily computes the groups of property-specific keyframes. |
128 void ensureKeyframeGroups() const; | 128 void ensureKeyframeGroups() const; |
129 void ensureInterpolationEffect(Element* = nullptr, const ComputedStyle* base
Style = nullptr) const; | 129 void ensureInterpolationEffect(Element* = nullptr, const ComputedStyle* base
Style = nullptr) const; |
130 void snapshotCompositableProperties(Element&, const ComputedStyle* baseStyle
); | 130 void snapshotCompositableProperties(Element&, const ComputedStyle* baseStyle
); |
131 | 131 |
132 KeyframeVector m_keyframes; | 132 KeyframeVector m_keyframes; |
133 // The spec describes filtering the normalized keyframes at sampling time | 133 // The spec describes filtering the normalized keyframes at sampling time |
134 // to get the 'property-specific keyframes'. For efficiency, we cache the | 134 // to get the 'property-specific keyframes'. For efficiency, we cache the |
135 // property-specific lists. | 135 // property-specific lists. |
136 using KeyframeGroupMap = HashMap<PropertyHandle, OwnPtr<PropertySpecificKeyf
rameGroup>>; | 136 using KeyframeGroupMap = HashMap<PropertyHandle, OwnPtr<PropertySpecificKeyf
rameGroup>>; |
137 mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups; | 137 mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups; |
138 mutable RefPtr<InterpolationEffect> m_interpolationEffect; | 138 mutable RefPtr<InterpolationEffect> m_interpolationEffect; |
139 RefPtr<TimingFunction> m_neutralKeyframeEasing; | 139 RefPtr<TimingFunction> m_neutralKeyframeEasing; |
140 | 140 |
141 mutable bool m_hasSyntheticKeyframes; | 141 mutable bool m_hasSyntheticKeyframes; |
142 | 142 |
143 friend class KeyframeEffectModelTest; | 143 friend class KeyframeEffectModelTest; |
144 }; | 144 }; |
145 | 145 |
146 template <class Keyframe> | 146 template <class Keyframe> |
147 class KeyframeEffectModel final : public KeyframeEffectModelBase { | 147 class KeyframeEffectModel final : public KeyframeEffectModelBase { |
148 public: | 148 public: |
149 using KeyframeVector = Vector<RefPtr<Keyframe>>; | 149 using KeyframeVector = Vector<RefPtr<Keyframe>>; |
150 static KeyframeEffectModel<Keyframe>* create(const KeyframeVector& keyframes
, PassRefPtrWillBeRawPtr<TimingFunction> neutralKeyframeEasing = nullptr) | 150 static KeyframeEffectModel<Keyframe>* create(const KeyframeVector& keyframes
, PassRefPtr<TimingFunction> neutralKeyframeEasing = nullptr) |
151 { | 151 { |
152 return new KeyframeEffectModel(keyframes, neutralKeyframeEasing); | 152 return new KeyframeEffectModel(keyframes, neutralKeyframeEasing); |
153 } | 153 } |
154 | 154 |
155 private: | 155 private: |
156 KeyframeEffectModel(const KeyframeVector& keyframes, PassRefPtrWillBeRawPtr<
TimingFunction> neutralKeyframeEasing) | 156 KeyframeEffectModel(const KeyframeVector& keyframes, PassRefPtr<TimingFuncti
on> neutralKeyframeEasing) |
157 : KeyframeEffectModelBase(neutralKeyframeEasing) | 157 : KeyframeEffectModelBase(neutralKeyframeEasing) |
158 { | 158 { |
159 m_keyframes.appendVector(keyframes); | 159 m_keyframes.appendVector(keyframes); |
160 } | 160 } |
161 | 161 |
162 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } | 162 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } |
163 virtual bool isStringKeyframeEffectModel() const { return false; } | 163 virtual bool isStringKeyframeEffectModel() const { return false; } |
164 }; | 164 }; |
165 | 165 |
166 using KeyframeVector = KeyframeEffectModelBase::KeyframeVector; | 166 using KeyframeVector = KeyframeEffectModelBase::KeyframeVector; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 template <> | 201 template <> |
202 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } | 202 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr
ameEffectModel() const { return true; } |
203 | 203 |
204 template <> | 204 template <> |
205 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } | 205 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c
onst { return true; } |
206 | 206 |
207 } // namespace blink | 207 } // namespace blink |
208 | 208 |
209 #endif // KeyframeEffectModel_h | 209 #endif // KeyframeEffectModel_h |
OLD | NEW |