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

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

Issue 2043273002: Defer compositor keyframe snapshots until the next style resolve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; } 99 virtual bool isAnimatableValueKeyframeEffectModel() const { return false; }
100 virtual bool isStringKeyframeEffectModel() const { return false; } 100 virtual bool isStringKeyframeEffectModel() const { return false; }
101 101
102 bool hasSyntheticKeyframes() const 102 bool hasSyntheticKeyframes() const
103 { 103 {
104 ensureKeyframeGroups(); 104 ensureKeyframeGroups();
105 return m_hasSyntheticKeyframes; 105 return m_hasSyntheticKeyframes;
106 } 106 }
107 107
108 // FIXME: This is a hack used to resolve CSSValues to AnimatableValues while we have a valid handle on an element. 108 bool needsCompositorKeyframesSnapshot() const { return m_needsCompositorKeyf ramesSnapshot; }
109 // This should be removed once AnimatableValues are obsolete. 109 bool snapshotNeutralCompositorKeyframes(Element&, const ComputedStyle& oldSt yle, const ComputedStyle& newStyle, const ComputedStyle* parentStyle) const;
110 void forceConversionsToAnimatableValues(Element&, const ComputedStyle* baseS tyle); 110 bool snapshotAllCompositorKeyframes(Element&, const ComputedStyle& baseStyle , const ComputedStyle* parentStyle) const;
111 bool snapshotNeutralCompositorKeyframes(Element&, const ComputedStyle& oldSt yle, const ComputedStyle& newStyle);
112 bool snapshotAllCompositorKeyframes(Element&, const ComputedStyle* baseStyle );
113 111
114 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); } 112 static KeyframeVector normalizedKeyframesForInspector(const KeyframeVector& keyframes) { return normalizedKeyframes(keyframes); }
115 113
116 bool affects(PropertyHandle property) const override 114 bool affects(PropertyHandle property) const override
117 { 115 {
118 ensureKeyframeGroups(); 116 ensureKeyframeGroups();
119 return m_keyframeGroups->contains(property); 117 return m_keyframeGroups->contains(property);
120 } 118 }
121 119
122 bool isTransformRelatedEffect() const override; 120 bool isTransformRelatedEffect() const override;
123 121
124 protected: 122 protected:
125 KeyframeEffectModelBase(PassRefPtr<TimingFunction> defaultKeyframeEasing) 123 KeyframeEffectModelBase(PassRefPtr<TimingFunction> defaultKeyframeEasing)
126 : m_lastIteration(0) 124 : m_lastIteration(0)
127 , m_lastFraction(std::numeric_limits<double>::quiet_NaN()) 125 , m_lastFraction(std::numeric_limits<double>::quiet_NaN())
128 , m_lastIterationDuration(0) 126 , m_lastIterationDuration(0)
129 , m_defaultKeyframeEasing(defaultKeyframeEasing) 127 , m_defaultKeyframeEasing(defaultKeyframeEasing)
130 , m_hasSyntheticKeyframes(false) 128 , m_hasSyntheticKeyframes(false)
129 , m_needsCompositorKeyframesSnapshot(true)
131 { 130 {
132 } 131 }
133 132
134 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes); 133 static KeyframeVector normalizedKeyframes(const KeyframeVector& keyframes);
135 134
136 // Lazily computes the groups of property-specific keyframes. 135 // Lazily computes the groups of property-specific keyframes.
137 void ensureKeyframeGroups() const; 136 void ensureKeyframeGroups() const;
138 void ensureInterpolationEffectPopulated() const; 137 void ensureInterpolationEffectPopulated() const;
139 138
140 KeyframeVector m_keyframes; 139 KeyframeVector m_keyframes;
141 // The spec describes filtering the normalized keyframes at sampling time 140 // The spec describes filtering the normalized keyframes at sampling time
142 // to get the 'property-specific keyframes'. For efficiency, we cache the 141 // to get the 'property-specific keyframes'. For efficiency, we cache the
143 // property-specific lists. 142 // property-specific lists.
144 mutable std::unique_ptr<KeyframeGroupMap> m_keyframeGroups; 143 mutable std::unique_ptr<KeyframeGroupMap> m_keyframeGroups;
145 mutable InterpolationEffect m_interpolationEffect; 144 mutable InterpolationEffect m_interpolationEffect;
146 mutable int m_lastIteration; 145 mutable int m_lastIteration;
147 mutable double m_lastFraction; 146 mutable double m_lastFraction;
148 mutable double m_lastIterationDuration; 147 mutable double m_lastIterationDuration;
149 RefPtr<TimingFunction> m_defaultKeyframeEasing; 148 RefPtr<TimingFunction> m_defaultKeyframeEasing;
150 149
151 mutable bool m_hasSyntheticKeyframes; 150 mutable bool m_hasSyntheticKeyframes;
151 mutable bool m_needsCompositorKeyframesSnapshot;
152 152
153 friend class KeyframeEffectModelTest; 153 friend class KeyframeEffectModelTest;
154 }; 154 };
155 155
156 // Time independent representation of an Animation's keyframes. 156 // Time independent representation of an Animation's keyframes.
157 template <class Keyframe> 157 template <class Keyframe>
158 class KeyframeEffectModel final : public KeyframeEffectModelBase { 158 class KeyframeEffectModel final : public KeyframeEffectModelBase {
159 public: 159 public:
160 using KeyframeVector = Vector<RefPtr<Keyframe>>; 160 using KeyframeVector = Vector<RefPtr<Keyframe>>;
161 static KeyframeEffectModel<Keyframe>* create(const KeyframeVector& keyframes , PassRefPtr<TimingFunction> defaultKeyframeEasing = nullptr) 161 static KeyframeEffectModel<Keyframe>* create(const KeyframeVector& keyframes , PassRefPtr<TimingFunction> defaultKeyframeEasing = nullptr)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 template <> 212 template <>
213 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; } 213 inline bool KeyframeEffectModel<AnimatableValueKeyframe>::isAnimatableValueKeyfr ameEffectModel() const { return true; }
214 214
215 template <> 215 template <>
216 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; } 216 inline bool KeyframeEffectModel<StringKeyframe>::isStringKeyframeEffectModel() c onst { return true; }
217 217
218 } // namespace blink 218 } // namespace blink
219 219
220 #endif // KeyframeEffectModel_h 220 #endif // KeyframeEffectModel_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/Keyframe.h ('k') | third_party/WebKit/Source/core/animation/KeyframeEffectModel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698