Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: Source/core/animation/KeyframeEffectModel.h

Issue 851693007: Prepare for responsive CSS animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix timing function layout tests Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 virtual void trace(Visitor*) override; 102 virtual void trace(Visitor*) override;
103 103
104 // FIXME: This is a hack used to resolve CSSValues to AnimatableValues while we have a valid handle on an element. 104 // FIXME: This is a hack used to resolve CSSValues to AnimatableValues while we have a valid handle on an element.
105 // This should be removed once StringKeyframes no longer uses InterpolableAn imatableValues. 105 // This should be removed once StringKeyframes no longer uses InterpolableAn imatableValues.
106 void forceConversionsToAnimatableValues(Element* element) 106 void forceConversionsToAnimatableValues(Element* element)
107 { 107 {
108 ensureKeyframeGroups(); 108 ensureKeyframeGroups();
109 ensureInterpolationEffect(element); 109 ensureInterpolationEffect(element);
110 } 110 }
111 111
112 void setDeferredInterpolationsOutdated() { m_interpolationEffect->setDeferre dInterpolationsOutdated(); }
113 void snapshotCompositableProperties(const Element*, const RenderStyle&);
114 void updateNeutralKeyframeAnimatableValues(CSSPropertyID, PassRefPtrWillBeRa wPtr<AnimatableValue>);
115 void setNeutralKeyframeEasings(RefPtrWillBeRawPtr<TimingFunction>);
116
112 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); } 117 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); }
113 118
114 protected: 119 protected:
115 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); 120 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes);
116 121
117 // Lazily computes the groups of property-specific keyframes. 122 // Lazily computes the groups of property-specific keyframes.
118 void ensureKeyframeGroups() const; 123 void ensureKeyframeGroups() const;
119 void ensureInterpolationEffect(Element* = nullptr) const; 124 void ensureInterpolationEffect(Element* = nullptr) const;
120 125
121 KeyframeVector m_keyframes; 126 KeyframeVector m_keyframes;
122 // The spec describes filtering the normalized keyframes at sampling time 127 // The spec describes filtering the normalized keyframes at sampling time
123 // to get the 'property-specific keyframes'. For efficiency, we cache the 128 // to get the 'property-specific keyframes'. For efficiency, we cache the
124 // property-specific lists. 129 // property-specific lists.
125 using KeyframeGroupMap = WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember <PropertySpecificKeyframeGroup>>; 130 using KeyframeGroupMap = WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember <PropertySpecificKeyframeGroup>>;
126 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; 131 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups;
127 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; 132 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect;
128 133
129 mutable bool m_hasSyntheticKeyframes; 134 mutable bool m_hasSyntheticKeyframes;
130 135
131 friend class KeyframeEffectModelTest; 136 friend class KeyframeEffectModelTest;
132 137
133 bool affects(CSSPropertyID property) 138 bool affects(CSSPropertyID property) const
134 { 139 {
135 ensureKeyframeGroups(); 140 ensureKeyframeGroups();
136 return m_keyframeGroups->contains(property); 141 return m_keyframeGroups->contains(property);
137 } 142 }
143
144 void snapshotCompositableProperty(CSSPropertyID, const Element*, const Rende rStyle&);
138 }; 145 };
139 146
140 template <class Keyframe> 147 template <class Keyframe>
141 class KeyframeEffectModel final : public KeyframeEffectModelBase { 148 class KeyframeEffectModel final : public KeyframeEffectModelBase {
142 public: 149 public:
143 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; 150 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>;
144 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke yframeVector& keyframes) { return adoptRefWillBeNoop(new KeyframeEffectModel(key frames)); } 151 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke yframeVector& keyframes) { return adoptRefWillBeNoop(new KeyframeEffectModel(key frames)); }
145 152
146 private: 153 private:
147 KeyframeEffectModel(const KeyframeVector& keyframes) 154 KeyframeEffectModel(const KeyframeVector& keyframes)
(...skipping 12 matching lines...) Expand all
160 using AnimatableValueKeyframeEffectModel = KeyframeEffectModel<AnimatableValueKe yframe>; 167 using AnimatableValueKeyframeEffectModel = KeyframeEffectModel<AnimatableValueKe yframe>;
161 using AnimatableValueKeyframeVector = AnimatableValueKeyframeEffectModel::Keyfra meVector; 168 using AnimatableValueKeyframeVector = AnimatableValueKeyframeEffectModel::Keyfra meVector;
162 using AnimatableValuePropertySpecificKeyframeVector = AnimatableValueKeyframeEff ectModel::PropertySpecificKeyframeVector; 169 using AnimatableValuePropertySpecificKeyframeVector = AnimatableValueKeyframeEff ectModel::PropertySpecificKeyframeVector;
163 170
164 using StringKeyframeEffectModel = KeyframeEffectModel<StringKeyframe>; 171 using StringKeyframeEffectModel = KeyframeEffectModel<StringKeyframe>;
165 using StringKeyframeVector = StringKeyframeEffectModel::KeyframeVector; 172 using StringKeyframeVector = StringKeyframeEffectModel::KeyframeVector;
166 using StringPropertySpecificKeyframeVector = StringKeyframeEffectModel::Property SpecificKeyframeVector; 173 using StringPropertySpecificKeyframeVector = StringKeyframeEffectModel::Property SpecificKeyframeVector;
167 174
168 DEFINE_TYPE_CASTS(KeyframeEffectModelBase, AnimationEffect, value, value->isKeyf rameEffectModel(), value.isKeyframeEffectModel()); 175 DEFINE_TYPE_CASTS(KeyframeEffectModelBase, AnimationEffect, value, value->isKeyf rameEffectModel(), value.isKeyframeEffectModel());
169 DEFINE_TYPE_CASTS(AnimatableValueKeyframeEffectModel, KeyframeEffectModelBase, v alue, value->isAnimatableValueKeyframeEffectModel(), value.isAnimatableValueKeyf rameEffectModel()); 176 DEFINE_TYPE_CASTS(AnimatableValueKeyframeEffectModel, KeyframeEffectModelBase, v alue, value->isAnimatableValueKeyframeEffectModel(), value.isAnimatableValueKeyf rameEffectModel());
177 DEFINE_TYPE_CASTS(StringKeyframeEffectModel, KeyframeEffectModelBase, value, val ue->isStringKeyframeEffectModel(), value.isStringKeyframeEffectModel());
170 178
171 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect Model(const AnimationEffect* base) 179 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect Model(const AnimationEffect* base)
172 { 180 {
173 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base)) ; 181 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base)) ;
174 } 182 }
175 183
176 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel( AnimationEffect* base) 184 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel( AnimationEffect* base)
177 { 185 {
178 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base)) ; 186 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base)) ;
179 } 187 }
180 188
189 inline const StringKeyframeEffectModel* toStringKeyframeEffectModel(const Animat ionEffect* base)
190 {
191 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base));
192 }
193
194 inline StringKeyframeEffectModel* toStringKeyframeEffectModel(AnimationEffect* b ase)
195 {
196 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base));
197 }
198
181 template <> 199 template <>
182 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; } 200 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; }
183 201
184 template <> 202 template <>
185 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; } 203 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; }
186 204
187 } // namespace blink 205 } // namespace blink
188 206
189 #endif // KeyframeEffectModel_h 207 #endif // KeyframeEffectModel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698