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

Unified Diff: Source/core/animation/css/CSSAnimatableValueFactory.cpp

Issue 55813002: Convert animation and renderer code to know about BorderImageLength (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@length-relative-die-step-1-4
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/css/CSSAnimatableValueFactory.cpp
diff --git a/Source/core/animation/css/CSSAnimatableValueFactory.cpp b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
index 14536319e105387e46af7048e7e751c84ecd5da3..db12ed300d860fda91494d537be0821458d0d645 100644
--- a/Source/core/animation/css/CSSAnimatableValueFactory.cpp
+++ b/Source/core/animation/css/CSSAnimatableValueFactory.cpp
@@ -102,6 +102,22 @@ inline static PassRefPtr<AnimatableValue> createFromDouble(double value, Animata
return AnimatableDouble::create(value, constraint);
}
+static PassRefPtr<AnimatableValue> createFromLengthOrNumber(const LengthOrNumber& lengthOrNumber, const RenderStyle* style)
+{
+ if (lengthOrNumber.isNumber())
+ return createFromDouble(lengthOrNumber.number());
+ return createFromLength(lengthOrNumber.length(), style);
+}
+
+inline static PassRefPtr<AnimatableValue> createFromLengthOrNumberBox(const LengthOrNumberBox& lengthOrNumberBox, const RenderStyle* style)
+{
+ return AnimatableLengthBox::create(
+ createFromLengthOrNumber(lengthOrNumberBox.left(), style),
+ createFromLengthOrNumber(lengthOrNumberBox.right(), style),
+ createFromLengthOrNumber(lengthOrNumberBox.top(), style),
+ createFromLengthOrNumber(lengthOrNumberBox.bottom(), style));
+}
+
inline static PassRefPtr<AnimatableValue> createFromLengthBox(const LengthBox& lengthBox, const RenderStyle* style)
{
return AnimatableLengthBox::create(
@@ -229,13 +245,13 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop
case CSSPropertyBorderBottomWidth:
return createFromDouble(style->borderBottomWidth());
case CSSPropertyBorderImageOutset:
- return createFromLengthBox(style->borderImageOutset(), style);
+ return createFromLengthOrNumberBox(style->borderImageOutset(), style);
case CSSPropertyBorderImageSlice:
return createFromLengthBox(style->borderImageSlices(), style);
case CSSPropertyBorderImageSource:
return createFromStyleImage(style->borderImageSource());
case CSSPropertyBorderImageWidth:
- return createFromLengthBox(style->borderImageWidth(), style);
+ return createFromLengthOrNumberBox(style->borderImageWidth(), style);
case CSSPropertyBorderLeftColor:
return createFromColor(property, style);
case CSSPropertyBorderLeftWidth:
@@ -376,13 +392,13 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop
case CSSPropertyWebkitFilter:
return AnimatableFilterOperations::create(style->filter());
case CSSPropertyWebkitMaskBoxImageOutset:
- return createFromLengthBox(style->maskBoxImageOutset(), style);
+ return createFromLengthOrNumberBox(style->maskBoxImageOutset(), style);
case CSSPropertyWebkitMaskBoxImageSlice:
return createFromLengthBoxAndBool(style->maskBoxImageSlices(), style->maskBoxImageSlicesFill(), style);
case CSSPropertyWebkitMaskBoxImageSource:
return createFromStyleImage(style->maskBoxImageSource());
case CSSPropertyWebkitMaskBoxImageWidth:
- return createFromLengthBox(style->maskBoxImageWidth(), style);
+ return createFromLengthOrNumberBox(style->maskBoxImageWidth(), style);
case CSSPropertyWebkitMaskImage:
return createFromFillLayers<CSSPropertyWebkitMaskImage>(style->maskLayers(), style);
case CSSPropertyWebkitMaskPositionX:
« no previous file with comments | « no previous file | Source/core/css/resolver/AnimatedStyleBuilder.cpp » ('j') | Source/core/frame/animation/CSSPropertyAnimation.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698