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

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

Issue 143573004: [wip] interpolable value refactor. NOT FOR LANDING. Base URL: https://chromium.googlesource.com/chromium/blink.git@interpolationWrap
Patch Set: Created 6 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 15 matching lines...) Expand all
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/animation/AnimatableValue.h" 34 #include "core/animation/AnimatableValue.h"
35 #include "core/animation/AnimationEffect.h" 35 #include "core/animation/AnimationEffect.h"
36 #include "core/animation/InterpolationEffect.h"
36 #include "wtf/HashMap.h" 37 #include "wtf/HashMap.h"
37 #include "wtf/HashSet.h" 38 #include "wtf/HashSet.h"
38 #include "wtf/PassOwnPtr.h" 39 #include "wtf/PassOwnPtr.h"
39 #include "wtf/PassRefPtr.h" 40 #include "wtf/PassRefPtr.h"
40 #include "wtf/RefCounted.h" 41 #include "wtf/RefCounted.h"
41 #include "wtf/Vector.h" 42 #include "wtf/Vector.h"
42 43
43 namespace WebCore { 44 namespace WebCore {
44 45
45 typedef HashSet<CSSPropertyID> PropertySet; 46 typedef HashSet<CSSPropertyID> PropertySet;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return adoptRef(new KeyframeEffectModel(keyframes)); 86 return adoptRef(new KeyframeEffectModel(keyframes));
86 } 87 }
87 88
88 virtual bool affects(CSSPropertyID property) OVERRIDE 89 virtual bool affects(CSSPropertyID property) OVERRIDE
89 { 90 {
90 ensureKeyframeGroups(); 91 ensureKeyframeGroups();
91 return m_keyframeGroups->contains(property); 92 return m_keyframeGroups->contains(property);
92 } 93 }
93 94
94 // AnimationEffect implementation. 95 // AnimationEffect implementation.
95 virtual PassOwnPtr<CompositableValueList> sample(int iteration, double fract ion) const OVERRIDE; 96 virtual PassOwnPtr<Vector<RefPtr<Interpolation> > > sample(int iteration, do uble fraction) const OVERRIDE;
96 97
97 // FIXME: Implement setFrames() 98 // FIXME: Implement setFrames()
98 const KeyframeVector& getFrames() const { return m_keyframes; } 99 const KeyframeVector& getFrames() const { return m_keyframes; }
99 100
100 virtual bool isKeyframeEffectModel() const OVERRIDE { return true; } 101 virtual bool isKeyframeEffectModel() const OVERRIDE { return true; }
101 102
102 PropertySet properties() const; 103 PropertySet properties() const;
103 104
104 class PropertySpecificKeyframe { 105 class PropertySpecificKeyframe {
105 public: 106 public:
(...skipping 23 matching lines...) Expand all
129 130
130 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(CSSProper tyID id) const 131 const PropertySpecificKeyframeVector& getPropertySpecificKeyframes(CSSProper tyID id) const
131 { 132 {
132 ensureKeyframeGroups(); 133 ensureKeyframeGroups();
133 return m_keyframeGroups->get(id)->keyframes(); 134 return m_keyframeGroups->get(id)->keyframes();
134 } 135 }
135 136
136 private: 137 private:
137 KeyframeEffectModel(const KeyframeVector& keyframes); 138 KeyframeEffectModel(const KeyframeVector& keyframes);
138 139
140 KeyframeEffectModel(PassRefPtr<InterpolationEffect> interpolationEffect);
141
139 KeyframeVector normalizedKeyframes() const; 142 KeyframeVector normalizedKeyframes() const;
140 // Lazily computes the groups of property-specific keyframes. 143 // Lazily computes the groups of property-specific keyframes.
141 void ensureKeyframeGroups() const; 144 void ensureKeyframeGroups() const;
145 void ensureInterpolationEffect() const;
142 146
143 KeyframeVector m_keyframes; 147 KeyframeVector m_keyframes;
144 // The spec describes filtering the normalized keyframes at sampling time 148 // The spec describes filtering the normalized keyframes at sampling time
145 // to get the 'property-specific keyframes'. For efficiency, we cache the 149 // to get the 'property-specific keyframes'. For efficiency, we cache the
146 // property-specific lists. 150 // property-specific lists.
147 typedef HashMap<CSSPropertyID, OwnPtr<PropertySpecificKeyframeGroup> > Keyfr ameGroupMap; 151 typedef HashMap<CSSPropertyID, OwnPtr<PropertySpecificKeyframeGroup> > Keyfr ameGroupMap;
148 mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups; 152 mutable OwnPtr<KeyframeGroupMap> m_keyframeGroups;
153
154 mutable RefPtr<InterpolationEffect> m_interpolationEffect;
149 }; 155 };
150 156
151 DEFINE_TYPE_CASTS(KeyframeEffectModel, AnimationEffect, value, value->isKeyframe EffectModel(), value.isKeyframeEffectModel()); 157 DEFINE_TYPE_CASTS(KeyframeEffectModel, AnimationEffect, value, value->isKeyframe EffectModel(), value.isKeyframeEffectModel());
152 158
153 } // namespace WebCore 159 } // namespace WebCore
154 160
155 #endif // KeyframeEffectModel_h 161 #endif // KeyframeEffectModel_h
OLDNEW
« no previous file with comments | « Source/core/animation/InterpolationEffect.cpp ('k') | Source/core/animation/KeyframeEffectModel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698