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

Side by Side Diff: third_party/WebKit/Source/core/animation/InvalidatableInterpolation.cpp

Issue 2811253003: Make InterpolationEnvironment virutal (Closed)
Patch Set: protected Created 3 years, 6 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/animation/InvalidatableInterpolation.h" 5 #include "core/animation/InvalidatableInterpolation.h"
6 6
7 #include "core/animation/InterpolationEnvironment.h" 7 #include <memory>
8 #include "core/animation/CSSInterpolationEnvironment.h"
8 #include "core/animation/StringKeyframe.h" 9 #include "core/animation/StringKeyframe.h"
9 #include "core/css/resolver/StyleResolverState.h" 10 #include "core/css/resolver/StyleResolverState.h"
10 #include <memory>
11 11
12 namespace blink { 12 namespace blink {
13 13
14 void InvalidatableInterpolation::Interpolate(int, double fraction) { 14 void InvalidatableInterpolation::Interpolate(int, double fraction) {
15 if (fraction == current_fraction_) 15 if (fraction == current_fraction_)
16 return; 16 return;
17 17
18 if (current_fraction_ == 0 || current_fraction_ == 1 || fraction == 0 || 18 if (current_fraction_ == 0 || current_fraction_ == 1 || fraction == 0 ||
19 fraction == 1) { 19 fraction == 1) {
20 ClearConversionCache(); 20 ClearConversionCache();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ClearConversionCache(); 191 ClearConversionCache();
192 } 192 }
193 interpolation_types_ = latest_interpolation_types; 193 interpolation_types_ = latest_interpolation_types;
194 interpolation_types_version_ = latest_version; 194 interpolation_types_version_ = latest_version;
195 } 195 }
196 196
197 void InvalidatableInterpolation::SetFlagIfInheritUsed( 197 void InvalidatableInterpolation::SetFlagIfInheritUsed(
198 InterpolationEnvironment& environment) const { 198 InterpolationEnvironment& environment) const {
199 if (!property_.IsCSSProperty() && !property_.IsPresentationAttribute()) 199 if (!property_.IsCSSProperty() && !property_.IsPresentationAttribute())
200 return; 200 return;
201 if (!environment.GetState().ParentStyle()) 201 StyleResolverState& state =
202 ToCSSInterpolationEnvironment(environment).GetState();
203 if (!state.ParentStyle())
202 return; 204 return;
203 const CSSValue* start_value = 205 const CSSValue* start_value =
204 ToCSSPropertySpecificKeyframe(*start_keyframe_).Value(); 206 ToCSSPropertySpecificKeyframe(*start_keyframe_).Value();
205 const CSSValue* end_value = 207 const CSSValue* end_value =
206 ToCSSPropertySpecificKeyframe(*end_keyframe_).Value(); 208 ToCSSPropertySpecificKeyframe(*end_keyframe_).Value();
207 if ((start_value && start_value->IsInheritedValue()) || 209 if ((start_value && start_value->IsInheritedValue()) ||
208 (end_value && end_value->IsInheritedValue())) { 210 (end_value && end_value->IsInheritedValue())) {
209 environment.GetState().ParentStyle()->SetHasExplicitlyInheritedProperties(); 211 state.ParentStyle()->SetHasExplicitlyInheritedProperties();
210 } 212 }
211 } 213 }
212 214
213 double InvalidatableInterpolation::UnderlyingFraction() const { 215 double InvalidatableInterpolation::UnderlyingFraction() const {
214 if (current_fraction_ == 0) 216 if (current_fraction_ == 0)
215 return start_keyframe_->UnderlyingFraction(); 217 return start_keyframe_->UnderlyingFraction();
216 if (current_fraction_ == 1) 218 if (current_fraction_ == 1)
217 return end_keyframe_->UnderlyingFraction(); 219 return end_keyframe_->UnderlyingFraction();
218 return cached_pair_conversion_->InterpolateUnderlyingFraction( 220 return cached_pair_conversion_->InterpolateUnderlyingFraction(
219 start_keyframe_->UnderlyingFraction(), 221 start_keyframe_->UnderlyingFraction(),
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 279 }
278 280
279 if (should_apply && underlying_value_owner) 281 if (should_apply && underlying_value_owner)
280 underlying_value_owner.GetType().Apply( 282 underlying_value_owner.GetType().Apply(
281 *underlying_value_owner.Value().interpolable_value, 283 *underlying_value_owner.Value().interpolable_value,
282 underlying_value_owner.Value().non_interpolable_value.Get(), 284 underlying_value_owner.Value().non_interpolable_value.Get(),
283 environment); 285 environment);
284 } 286 }
285 287
286 } // namespace blink 288 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698