| Index: third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp
|
| diff --git a/third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..86702f49f5d519401eb02bb45ed636f4ce8f9da4
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp
|
| @@ -0,0 +1,38 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "config.h"
|
| +#include "core/animation/SVGNumberInterpolationType.h"
|
| +
|
| +#include "core/animation/InterpolationEnvironment.h"
|
| +#include "core/animation/StringKeyframe.h"
|
| +#include "core/svg/SVGNumber.h"
|
| +#include "core/svg/properties/SVGAnimatedProperty.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertNeutral() const
|
| +{
|
| + return InterpolationValue::create(*this, InterpolableNumber::create(0));
|
| +}
|
| +
|
| +PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const
|
| +{
|
| + if (svgValue.type() != AnimatedNumber)
|
| + return nullptr;
|
| + return InterpolationValue::create(*this, InterpolableNumber::create(toSVGNumber(svgValue).value()));
|
| +}
|
| +
|
| +PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
|
| +{
|
| + return maybeConvertSVGValue(environment.svgBaseValue());
|
| +}
|
| +
|
| +RefPtrWillBeRawPtr<SVGPropertyBase> SVGNumberInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue*) const
|
| +{
|
| + double value = toInterpolableNumber(interpolableValue).value();
|
| + return SVGNumber::create(m_isNonNegative && value < 0 ? 0 : value);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|