| Index: third_party/WebKit/Source/core/animation/SVGInterpolationType.cpp
|
| diff --git a/third_party/WebKit/Source/core/animation/SVGInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGInterpolationType.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..48a7e1c8252d03156d7c5258929d6f17209de600
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/animation/SVGInterpolationType.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/SVGInterpolationType.h"
|
| +
|
| +#include "core/animation/InterpolationEnvironment.h"
|
| +#include "core/animation/StringKeyframe.h"
|
| +#include "core/svg/SVGAnimateElement.h"
|
| +
|
| +namespace blink {
|
| +
|
| +PassOwnPtr<InterpolationValue> SVGInterpolationType::maybeConvertSingle(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const UnderlyingValue&, ConversionCheckers&) const
|
| +{
|
| + if (keyframe.isNeutral())
|
| + return maybeConvertNeutral();
|
| +
|
| + RefPtrWillBeRawPtr<SVGPropertyBase> svgValue = environment.svgValueBase().cloneForAnimation(toSVGPropertySpecificKeyframe(keyframe).value());
|
| + return maybeConvertSVGValue(*svgValue);
|
| +}
|
| +
|
| +void SVGInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const
|
| +{
|
| + SVGElement& targetElement = environment.svgElement();
|
| + SVGElement::InstanceUpdateBlocker blocker(&targetElement);
|
| + RefPtrWillBeRawPtr<SVGPropertyBase> appliedValue = appliedSVGValue(interpolableValue, nonInterpolableValue);
|
| + for (SVGElement* instance : SVGAnimateElement::findElementInstances(&targetElement)) {
|
| + RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = instance->propertyFromAttribute(attribute());
|
| + if (animatedProperty) {
|
| + animatedProperty->setAnimatedValue(appliedValue);
|
| + instance->invalidateSVGAttributes();
|
| + instance->svgAttributeChanged(attribute());
|
| + }
|
| + }
|
| +}
|
| +
|
| +} // namespace blink
|
|
|