| Index: third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp
|
| diff --git a/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d1466b323b05c4597cfc4f3b402e802ad3a014a2
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp
|
| @@ -0,0 +1,44 @@
|
| +// 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/SVGNumberOptionalNumberInterpolationType.h"
|
| +
|
| +#include "core/animation/InterpolationEnvironment.h"
|
| +#include "core/animation/StringKeyframe.h"
|
| +#include "core/svg/SVGNumberOptionalNumber.h"
|
| +#include "core/svg/properties/SVGAnimatedProperty.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PassOwnPtr<InterpolationValue> SVGNumberOptionalNumberInterpolationType::maybeConvertNeutral() const
|
| +{
|
| + return InterpolationValue::create(*this, InterpolableNumber::create(0));
|
| +}
|
| +
|
| +PassOwnPtr<InterpolationValue> SVGNumberOptionalNumberInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const
|
| +{
|
| + if (svgValue.type() != AnimatedNumberOptionalNumber)
|
| + return nullptr;
|
| + const SVGNumberOptionalNumber& numberOptionalNumber = toSVGNumberOptionalNumber(svgValue);
|
| + OwnPtr<InterpolableList> result = InterpolableList::create(2);
|
| + result->set(0, InterpolableNumber::create(numberOptionalNumber.firstNumber()->value()));
|
| + result->set(1, InterpolableNumber::create(numberOptionalNumber.secondNumber()->value()));
|
| + return InterpolationValue::create(*this, result.release());
|
| +}
|
| +
|
| +PassOwnPtr<InterpolationValue> SVGNumberOptionalNumberInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
|
| +{
|
| + return maybeConvertSVGValue(environment.svgBaseValue());
|
| +}
|
| +
|
| +RefPtrWillBeRawPtr<SVGPropertyBase> SVGNumberOptionalNumberInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue*) const
|
| +{
|
| + const InterpolableList& list = toInterpolableList(interpolableValue);
|
| + return SVGNumberOptionalNumber::create(
|
| + SVGNumber::create(toInterpolableNumber(list.get(0))->value()),
|
| + SVGNumber::create(toInterpolableNumber(list.get(1))->value()));
|
| +}
|
| +
|
| +} // namespace blink
|
|
|