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

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

Issue 2578043002: Rename apply() in CSSInterpolationType subclasses (Closed)
Patch Set: rebased Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/CSSImageSliceInterpolationType.h" 5 #include "core/animation/CSSImageSliceInterpolationType.h"
6 6
7 #include "core/animation/CSSLengthInterpolationType.h" 7 #include "core/animation/CSSLengthInterpolationType.h"
8 #include "core/animation/ImageSlicePropertyFunctions.h" 8 #include "core/animation/ImageSlicePropertyFunctions.h"
9 #include "core/css/CSSBorderImageSliceValue.h" 9 #include "core/css/CSSBorderImageSliceValue.h"
10 #include "core/css/resolver/StyleResolverState.h" 10 #include "core/css/resolver/StyleResolverState.h"
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 const SliceTypes& types = 253 const SliceTypes& types =
254 toCSSImageSliceNonInterpolableValue(*value.nonInterpolableValue).types(); 254 toCSSImageSliceNonInterpolableValue(*value.nonInterpolableValue).types();
255 255
256 if (underlyingTypes == types) 256 if (underlyingTypes == types)
257 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd( 257 underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(
258 underlyingFraction, *value.interpolableValue); 258 underlyingFraction, *value.interpolableValue);
259 else 259 else
260 underlyingValueOwner.set(*this, value); 260 underlyingValueOwner.set(*this, value);
261 } 261 }
262 262
263 void CSSImageSliceInterpolationType::apply( 263 void CSSImageSliceInterpolationType::applyStandardPropertyValue(
264 const InterpolableValue& interpolableValue, 264 const InterpolableValue& interpolableValue,
265 const NonInterpolableValue* nonInterpolableValue, 265 const NonInterpolableValue* nonInterpolableValue,
266 InterpolationEnvironment& environment) const { 266 StyleResolverState& state) const {
267 ComputedStyle& style = *environment.state().style(); 267 ComputedStyle& style = *state.style();
268 const InterpolableList& list = toInterpolableList(interpolableValue); 268 const InterpolableList& list = toInterpolableList(interpolableValue);
269 const SliceTypes& types = 269 const SliceTypes& types =
270 toCSSImageSliceNonInterpolableValue(nonInterpolableValue)->types(); 270 toCSSImageSliceNonInterpolableValue(nonInterpolableValue)->types();
271 const auto& convertSide = [&types, &list, &style](size_t index) { 271 const auto& convertSide = [&types, &list, &style](size_t index) {
272 float value = 272 float value =
273 clampTo<float>(toInterpolableNumber(list.get(index))->value(), 0); 273 clampTo<float>(toInterpolableNumber(list.get(index))->value(), 0);
274 return types.isNumber[index] ? Length(value * style.effectiveZoom(), Fixed) 274 return types.isNumber[index] ? Length(value * style.effectiveZoom(), Fixed)
275 : Length(value, Percent); 275 : Length(value, Percent);
276 }; 276 };
277 LengthBox box(convertSide(SideTop), convertSide(SideRight), 277 LengthBox box(convertSide(SideTop), convertSide(SideRight),
278 convertSide(SideBottom), convertSide(SideLeft)); 278 convertSide(SideBottom), convertSide(SideLeft));
279 ImageSlicePropertyFunctions::setImageSlice(cssProperty(), style, 279 ImageSlicePropertyFunctions::setImageSlice(cssProperty(), style,
280 ImageSlice(box, types.fill)); 280 ImageSlice(box, types.fill));
281 } 281 }
282 282
283 } // namespace blink 283 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698