Index: third_party/WebKit/Source/core/animation/CSSPositionAxisListInterpolationType.cpp |
diff --git a/third_party/WebKit/Source/core/animation/CSSPositionAxisListInterpolationType.cpp b/third_party/WebKit/Source/core/animation/CSSPositionAxisListInterpolationType.cpp |
index 93d79823aaaa3af4b6158a7f75e8120fd7e84fad..2aeb6d294c31527ba17de6d0d1428d1afec6a6a2 100644 |
--- a/third_party/WebKit/Source/core/animation/CSSPositionAxisListInterpolationType.cpp |
+++ b/third_party/WebKit/Source/core/animation/CSSPositionAxisListInterpolationType.cpp |
@@ -12,17 +12,34 @@ |
namespace blink { |
-static InterpolationValue convertPositionAxisCSSValue(const CSSValue& value) |
+InterpolationValue CSSPositionAxisListInterpolationType::convertPositionAxisCSSValue(const CSSValue& value) |
{ |
- if (!value.isValuePair()) |
+ if (value.isValuePair()) { |
+ const CSSValuePair& pair = toCSSValuePair(value); |
+ InterpolationValue result = CSSLengthInterpolationType::maybeConvertCSSValue(pair.second()); |
+ CSSValueID side = toCSSPrimitiveValue(pair.first()).getValueID(); |
+ if (side == CSSValueRight || side == CSSValueBottom) |
+ CSSLengthInterpolationType::subtractFromOneHundredPercent(result); |
+ return result; |
+ } |
+ |
+ const CSSPrimitiveValue& primitveValue = toCSSPrimitiveValue(value); |
+ if (!primitveValue.isValueID()) |
return CSSLengthInterpolationType::maybeConvertCSSValue(value); |
- const CSSValuePair& pair = toCSSValuePair(value); |
- InterpolationValue result = CSSLengthInterpolationType::maybeConvertCSSValue(pair.second()); |
- CSSValueID side = toCSSPrimitiveValue(pair.first()).getValueID(); |
- if (side == CSSValueRight || side == CSSValueBottom) |
- CSSLengthInterpolationType::subtractFromOneHundredPercent(result); |
- return result; |
+ switch (primitveValue.getValueID()) { |
+ case CSSValueLeft: |
+ case CSSValueTop: |
+ return CSSLengthInterpolationType::createInterpolablePercent(0); |
+ case CSSValueRight: |
+ case CSSValueBottom: |
+ return CSSLengthInterpolationType::createInterpolablePercent(100); |
+ case CSSValueCenter: |
+ return CSSLengthInterpolationType::createInterpolablePercent(50); |
+ default: |
+ ASSERT_NOT_REACHED(); |
+ return nullptr; |
+ } |
} |
InterpolationValue CSSPositionAxisListInterpolationType::maybeConvertValue(const CSSValue& value, const StyleResolverState&, ConversionCheckers&) const |