| Index: third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp
|
| diff --git a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp
|
| index 98da652e884906c89192cc9dd7512703b5131882..bc46f1c38fcf1ee8cb902e2a29a1f8a01d1c8763 100644
|
| --- a/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp
|
| +++ b/third_party/WebKit/Source/core/animation/SVGLengthInterpolationType.cpp
|
| @@ -76,21 +76,17 @@ LengthInterpolatedUnit convertToInterpolatedUnit(CSSPrimitiveValue::UnitType uni
|
|
|
| } // namespace
|
|
|
| -PassOwnPtr<InterpolationValue> SVGLengthInterpolationType::maybeConvertNeutral(const UnderlyingValue&, ConversionCheckers&) const
|
| +InterpolationComponent neutralInterpolableSVGLength()
|
| {
|
| OwnPtr<InterpolableList> listOfValues = InterpolableList::create(numLengthInterpolatedUnits);
|
| for (size_t i = 0; i < numLengthInterpolatedUnits; ++i)
|
| listOfValues->set(i, InterpolableNumber::create(0));
|
|
|
| - return InterpolationValue::create(*this, listOfValues.release());
|
| + return InterpolationComponent(listOfValues.release());
|
| }
|
|
|
| -PassOwnPtr<InterpolationValue> SVGLengthInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const
|
| +InterpolationComponent interpolableSVGLength(const SVGLength& length)
|
| {
|
| - if (svgValue.type() != AnimatedLength)
|
| - return nullptr;
|
| -
|
| - const SVGLength& length = toSVGLength(svgValue);
|
| double value = length.valueInSpecifiedUnits();
|
| LengthInterpolatedUnit unitType = convertToInterpolatedUnit(length.typeWithCalcResolved(), value);
|
|
|
| @@ -101,17 +97,10 @@ PassOwnPtr<InterpolationValue> SVGLengthInterpolationType::maybeConvertSVGValue(
|
| for (size_t i = 0; i < numLengthInterpolatedUnits; ++i)
|
| listOfValues->set(i, InterpolableNumber::create(values[i]));
|
|
|
| - return InterpolationValue::create(*this, listOfValues.release());
|
| -}
|
| -
|
| -PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGLengthInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue*) const
|
| -{
|
| - ASSERT_NOT_REACHED();
|
| - // This function is no longer called, because apply has been overridden.
|
| - return nullptr;
|
| + return InterpolationComponent(listOfValues.release());
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGLengthInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue*, const SVGLengthContext& lengthContext) const
|
| +PassRefPtrWillBeRawPtr<SVGLength> applyInterpolableSVGLength(const InterpolableValue& interpolableValue, const SVGLengthContext& lengthContext, const SVGLengthMode& unitMode, bool negativeValuesForbidden)
|
| {
|
| const InterpolableList& listOfValues = toInterpolableList(interpolableValue);
|
|
|
| @@ -139,23 +128,46 @@ PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGLengthInterpolationType::appliedSVGVa
|
| for (size_t i = 0; i < numLengthInterpolatedUnits; i++) {
|
| double entry = toInterpolableNumber(listOfValues.get(i))->value();
|
| if (entry)
|
| - value += lengthContext.convertValueToUserUnits(entry, m_unitMode, unitTypes[i]);
|
| + value += lengthContext.convertValueToUserUnits(entry, unitMode, unitTypes[i]);
|
| }
|
| }
|
|
|
| - if (m_negativeValuesForbidden && value < 0)
|
| + if (negativeValuesForbidden && value < 0)
|
| value = 0;
|
|
|
| - RefPtrWillBeRawPtr<SVGLength> result = SVGLength::create(m_unitMode); // defaults to the length 0
|
| + RefPtrWillBeRawPtr<SVGLength> result = SVGLength::create(unitMode); // defaults to the length 0
|
| result->newValueSpecifiedUnits(unitType, value);
|
| return result.release();
|
| }
|
|
|
| +PassOwnPtr<InterpolationValue> SVGLengthInterpolationType::maybeConvertNeutral(const UnderlyingValue&, ConversionCheckers&) const
|
| +{
|
| + InterpolationComponent component = neutralInterpolableSVGLength();
|
| + return InterpolationValue::create(*this, component);
|
| +}
|
| +
|
| +PassOwnPtr<InterpolationValue> SVGLengthInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const
|
| +{
|
| + if (svgValue.type() != AnimatedLength)
|
| + return nullptr;
|
| +
|
| + const SVGLength& length = toSVGLength(svgValue);
|
| + InterpolationComponent component = interpolableSVGLength(length);
|
| + return InterpolationValue::create(*this, component);
|
| +}
|
| +
|
| +PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGLengthInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue*) const
|
| +{
|
| + ASSERT_NOT_REACHED();
|
| + // This function is no longer called, because apply has been overridden.
|
| + return nullptr;
|
| +}
|
| +
|
| void SVGLengthInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const
|
| {
|
| SVGElement& element = environment.svgElement();
|
| SVGLengthContext lengthContext(&element);
|
| - element.setWebAnimatedAttribute(attribute(), appliedSVGValue(interpolableValue, nonInterpolableValue, lengthContext));
|
| + element.setWebAnimatedAttribute(attribute(), applyInterpolableSVGLength(interpolableValue, lengthContext, m_unitMode, m_negativeValuesForbidden));
|
| }
|
|
|
| } // namespace blink
|
|
|