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

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

Issue 2236193002: WIP: Implement CSS transitions on top of InterpolationTypes instead of AnimatableValues (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_environmentStyle
Patch Set: Created 4 years, 4 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return m_keyframeGroups->get(property)->keyframes(); 84 return m_keyframeGroups->get(property)->keyframes();
85 } 85 }
86 86
87 using KeyframeGroupMap = HashMap<PropertyHandle, std::unique_ptr<PropertySpe cificKeyframeGroup>>; 87 using KeyframeGroupMap = HashMap<PropertyHandle, std::unique_ptr<PropertySpe cificKeyframeGroup>>;
88 const KeyframeGroupMap& getPropertySpecificKeyframeGroups() const 88 const KeyframeGroupMap& getPropertySpecificKeyframeGroups() const
89 { 89 {
90 ensureKeyframeGroups(); 90 ensureKeyframeGroups();
91 return *m_keyframeGroups; 91 return *m_keyframeGroups;
92 } 92 }
93 93
94 // EffectModel implementation.
95 bool sample(int iteration, double fraction, double iterationDuration, Vector <RefPtr<Interpolation>>&) const override;
96
97 bool isKeyframeEffectModel() const override { return true; } 94 bool isKeyframeEffectModel() const override { return true; }
98 95
99 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } 96 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; }
100 virtual bool isStringKeyframeEffectModel() const { return false; } 97 virtual bool isStringKeyframeEffectModel() const { return false; }
101 98
102 bool hasSyntheticKeyframes() const 99 bool hasSyntheticKeyframes() const
103 { 100 {
104 ensureKeyframeGroups(); 101 ensureKeyframeGroups();
105 return m_hasSyntheticKeyframes; 102 return m_hasSyntheticKeyframes;
106 } 103 }
107 104
108 bool needsCompositorKeyframesSnapshot() const { return m_needsCompositorKeyf ramesSnapshot; } 105 bool needsCompositorKeyframesSnapshot() const { return m_needsCompositorKeyf ramesSnapshot; }
109 bool snapshotNeutralCompositorKeyframes(Element&, const ComputedStyle& oldSt yle, const ComputedStyle& newStyle, const ComputedStyle* parentStyle) const; 106 bool snapshotNeutralCompositorKeyframes(Element&, const ComputedStyle& oldSt yle, const ComputedStyle& newStyle, const ComputedStyle* parentStyle) const;
110 bool snapshotAllCompositorKeyframes(Element&, const ComputedStyle& baseStyle , const ComputedStyle* parentStyle) const; 107 bool snapshotAllCompositorKeyframes(Element&, const ComputedStyle& baseStyle , const ComputedStyle* parentStyle) const;
111 108
112 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); } 109 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); }
113 110
114 bool affects(PropertyHandle property) const override 111 bool affects(PropertyHandle property) const override
115 { 112 {
116 ensureKeyframeGroups(); 113 ensureKeyframeGroups();
117 return m_keyframeGroups->contains(property); 114 return m_keyframeGroups->contains(property);
118 } 115 }
119 116
120 bool isTransformRelatedEffect() const override;
121
122 protected: 117 protected:
123 KeyframeEffectModelBase(PassRefPtr<TimingFunction> defaultKeyframeEasing) 118 KeyframeEffectModelBase(PassRefPtr<TimingFunction> defaultKeyframeEasing)
124 : m_lastIteration(0) 119 : m_defaultKeyframeEasing(defaultKeyframeEasing)
125 , m_lastFraction(std::numeric_limits<double>::quiet_NaN())
126 , m_lastIterationDuration(0)
127 , m_defaultKeyframeEasing(defaultKeyframeEasing)
128 , m_hasSyntheticKeyframes(false) 120 , m_hasSyntheticKeyframes(false)
129 , m_needsCompositorKeyframesSnapshot(true) 121 , m_needsCompositorKeyframesSnapshot(true)
130 { 122 {
131 } 123 }
132 124
125 void sampleImpl(int iteration, double fraction, double iterationDuration, Ve ctor<RefPtr<Interpolation>>&) const final;
126
133 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); 127 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes);
134 128
135 // Lazily computes the groups of property-specific keyframes. 129 // Lazily computes the groups of property-specific keyframes.
136 void ensureKeyframeGroups() const; 130 void ensureKeyframeGroups() const;
137 void ensureInterpolationEffectPopulated() const; 131 void ensureInterpolationEffectPopulated() const;
138 132
139 KeyframeVector m_keyframes; 133 KeyframeVector m_keyframes;
140 // The spec describes filtering the normalized keyframes at sampling time 134 // The spec describes filtering the normalized keyframes at sampling time
141 // to get the 'property-specific keyframes'. For efficiency, we cache the 135 // to get the 'property-specific keyframes'. For efficiency, we cache the
142 // property-specific lists. 136 // property-specific lists.
143 mutable std::unique_ptr<KeyframeGroupMap> m_keyframeGroups; 137 mutable std::unique_ptr<KeyframeGroupMap> m_keyframeGroups;
144 mutable InterpolationEffect m_interpolationEffect; 138 mutable InterpolationEffect m_interpolationEffect;
145 mutable int m_lastIteration;
146 mutable double m_lastFraction;
147 mutable double m_lastIterationDuration;
148 RefPtr<TimingFunction> m_defaultKeyframeEasing; 139 RefPtr<TimingFunction> m_defaultKeyframeEasing;
149 140
150 mutable bool m_hasSyntheticKeyframes; 141 mutable bool m_hasSyntheticKeyframes;
151 mutable bool m_needsCompositorKeyframesSnapshot; 142 mutable bool m_needsCompositorKeyframesSnapshot;
152 143
153 friend class KeyframeEffectModelTest; 144 friend class KeyframeEffectModelTest;
154 }; 145 };
155 146
156 // Time independent representation of an Animation's keyframes. 147 // Time independent representation of an Animation's keyframes.
157 template <class Keyframe> 148 template <class Keyframe>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 202
212 template <> 203 template <>
213 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; } 204 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; }
214 205
215 template <> 206 template <>
216 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; } 207 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; }
217 208
218 } // namespace blink 209 } // namespace blink
219 210
220 #endif // KeyframeEffectModel_h 211 #endif // KeyframeEffectModel_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698