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

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: Clean up includes Created 5 years, 10 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
114 void snapshotCompositableProperties(const Element*, const RenderStyle&);
115 void updateNeutralKeyframeAnimatableValues(CSSPropertyID, PassRefPtrWillBeRa wPtr<AnimatableValue>);
116 void setNeutralKeyframeEasings(RefPtrWillBeRawPtr<TimingFunction>);
117
112 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); } 118 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); }
113 119
114 protected: 120 protected:
115 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); 121 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes);
116 122
117 // Lazily computes the groups of property-specific keyframes. 123 // Lazily computes the groups of property-specific keyframes.
118 void ensureKeyframeGroups() const; 124 void ensureKeyframeGroups() const;
119 void ensureInterpolationEffect(Element* = nullptr) const; 125 void ensureInterpolationEffect(Element* = nullptr) const;
120 126
121 KeyframeVector m_keyframes; 127 KeyframeVector m_keyframes;
122 // The spec describes filtering the normalized keyframes at sampling time 128 // The spec describes filtering the normalized keyframes at sampling time
123 // to get the 'property-specific keyframes'. For efficiency, we cache the 129 // to get the 'property-specific keyframes'. For efficiency, we cache the
124 // property-specific lists. 130 // property-specific lists.
125 using KeyframeGroupMap = WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember <PropertySpecificKeyframeGroup>>; 131 using KeyframeGroupMap = WillBeHeapHashMap<CSSPropertyID, OwnPtrWillBeMember <PropertySpecificKeyframeGroup>>;
126 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups; 132 mutable OwnPtrWillBeMember<KeyframeGroupMap> m_keyframeGroups;
127 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect; 133 mutable RefPtrWillBeMember<InterpolationEffect> m_interpolationEffect;
128 134
129 mutable bool m_hasSyntheticKeyframes; 135 mutable bool m_hasSyntheticKeyframes;
130 136
131 friend class KeyframeEffectModelTest; 137 friend class KeyframeEffectModelTest;
132 138
133 bool affects(CSSPropertyID property) 139 bool affects(CSSPropertyID property) const
134 { 140 {
135 ensureKeyframeGroups(); 141 ensureKeyframeGroups();
136 return m_keyframeGroups->contains(property); 142 return m_keyframeGroups->contains(property);
137 } 143 }
144
145 void snapshotCompositableProperty(CSSPropertyID, const Element*, const Rende rStyle&);
138 }; 146 };
139 147
140 template <class Keyframe> 148 template <class Keyframe>
141 class KeyframeEffectModel final : public KeyframeEffectModelBase { 149 class KeyframeEffectModel final : public KeyframeEffectModelBase {
142 public: 150 public:
143 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>; 151 using KeyframeVector = WillBeHeapVector<RefPtrWillBeMember<Keyframe>>;
144 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke yframeVector& keyframes) { return adoptRefWillBeNoop(new KeyframeEffectModel(key frames)); } 152 static PassRefPtrWillBeRawPtr<KeyframeEffectModel<Keyframe>> create(const Ke yframeVector& keyframes) { return adoptRefWillBeNoop(new KeyframeEffectModel(key frames)); }
145 153
146 private: 154 private:
147 KeyframeEffectModel(const KeyframeVector& keyframes) 155 KeyframeEffectModel(const KeyframeVector& keyframes)
(...skipping 12 matching lines...) Expand all
160 using AnimatableValueKeyframeEffectModel = KeyframeEffectModel<AnimatableValueKe yframe>; 168 using AnimatableValueKeyframeEffectModel = KeyframeEffectModel<AnimatableValueKe yframe>;
161 using AnimatableValueKeyframeVector = AnimatableValueKeyframeEffectModel::Keyfra meVector; 169 using AnimatableValueKeyframeVector = AnimatableValueKeyframeEffectModel::Keyfra meVector;
162 using AnimatableValuePropertySpecificKeyframeVector = AnimatableValueKeyframeEff ectModel::PropertySpecificKeyframeVector; 170 using AnimatableValuePropertySpecificKeyframeVector = AnimatableValueKeyframeEff ectModel::PropertySpecificKeyframeVector;
163 171
164 using StringKeyframeEffectModel = KeyframeEffectModel<StringKeyframe>; 172 using StringKeyframeEffectModel = KeyframeEffectModel<StringKeyframe>;
165 using StringKeyframeVector = StringKeyframeEffectModel::KeyframeVector; 173 using StringKeyframeVector = StringKeyframeEffectModel::KeyframeVector;
166 using StringPropertySpecificKeyframeVector = StringKeyframeEffectModel::Property SpecificKeyframeVector; 174 using StringPropertySpecificKeyframeVector = StringKeyframeEffectModel::Property SpecificKeyframeVector;
167 175
168 DEFINE_TYPE_CASTS(KeyframeEffectModelBase, AnimationEffect, value, value->isKeyf rameEffectModel(), value.isKeyframeEffectModel()); 176 DEFINE_TYPE_CASTS(KeyframeEffectModelBase, AnimationEffect, value, value->isKeyf rameEffectModel(), value.isKeyframeEffectModel());
169 DEFINE_TYPE_CASTS(AnimatableValueKeyframeEffectModel, KeyframeEffectModelBase, v alue, value->isAnimatableValueKeyframeEffectModel(), value.isAnimatableValueKeyf rameEffectModel()); 177 DEFINE_TYPE_CASTS(AnimatableValueKeyframeEffectModel, KeyframeEffectModelBase, v alue, value->isAnimatableValueKeyframeEffectModel(), value.isAnimatableValueKeyf rameEffectModel());
178 DEFINE_TYPE_CASTS(StringKeyframeEffectModel, KeyframeEffectModelBase, value, val ue->isStringKeyframeEffectModel(), value.isStringKeyframeEffectModel());
170 179
171 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect Model(const AnimationEffect* base) 180 inline const AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffect Model(const AnimationEffect* base)
172 { 181 {
173 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base)) ; 182 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base)) ;
174 } 183 }
175 184
176 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel( AnimationEffect* base) 185 inline AnimatableValueKeyframeEffectModel* toAnimatableValueKeyframeEffectModel( AnimationEffect* base)
177 { 186 {
178 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base)) ; 187 return toAnimatableValueKeyframeEffectModel(toKeyframeEffectModelBase(base)) ;
179 } 188 }
180 189
190 inline const StringKeyframeEffectModel* toStringKeyframeEffectModel(const Animat ionEffect* base)
191 {
192 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base));
193 }
194
195 inline StringKeyframeEffectModel* toStringKeyframeEffectModel(AnimationEffect* b ase)
196 {
197 return toStringKeyframeEffectModel(toKeyframeEffectModelBase(base));
198 }
199
181 template <> 200 template <>
182 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; } 201 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; }
183 202
184 template <> 203 template <>
185 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; } 204 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; }
186 205
187 } // namespace blink 206 } // namespace blink
188 207
189 #endif // KeyframeEffectModel_h 208 #endif // KeyframeEffectModel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698