OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "core/animation/SVGInterpolationType.h" | 6 #include "core/animation/SVGInterpolationType.h" |
7 | 7 |
8 #include "core/animation/InterpolationEnvironment.h" | 8 #include "core/animation/InterpolationEnvironment.h" |
9 #include "core/animation/StringKeyframe.h" | 9 #include "core/animation/StringKeyframe.h" |
10 #include "core/svg/SVGAnimateElement.h" | 10 #include "core/svg/SVGElement.h" |
| 11 #include "core/svg/properties/SVGProperty.h" |
11 | 12 |
12 namespace blink { | 13 namespace blink { |
13 | 14 |
14 PassOwnPtr<InterpolationValue> SVGInterpolationType::maybeConvertSingle(const Pr
opertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, c
onst UnderlyingValue& underlyingValue, ConversionCheckers& conversionCheckers) c
onst | 15 PassOwnPtr<InterpolationValue> SVGInterpolationType::maybeConvertSingle(const Pr
opertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, c
onst UnderlyingValue& underlyingValue, ConversionCheckers& conversionCheckers) c
onst |
15 { | 16 { |
16 if (keyframe.isNeutral()) | 17 if (keyframe.isNeutral()) |
17 return maybeConvertNeutral(underlyingValue, conversionCheckers); | 18 return maybeConvertNeutral(underlyingValue, conversionCheckers); |
18 | 19 |
19 RefPtrWillBeRawPtr<SVGPropertyBase> svgValue = environment.svgBaseValue().cl
oneForAnimation(toSVGPropertySpecificKeyframe(keyframe).value()); | 20 RefPtrWillBeRawPtr<SVGPropertyBase> svgValue = environment.svgBaseValue().cl
oneForAnimation(toSVGPropertySpecificKeyframe(keyframe).value()); |
20 return maybeConvertSVGValue(*svgValue); | 21 return maybeConvertSVGValue(*svgValue); |
21 } | 22 } |
22 | 23 |
23 PassOwnPtr<InterpolationValue> SVGInterpolationType::maybeConvertUnderlyingValue
(const InterpolationEnvironment& environment) const | 24 PassOwnPtr<InterpolationValue> SVGInterpolationType::maybeConvertUnderlyingValue
(const InterpolationEnvironment& environment) const |
24 { | 25 { |
25 return maybeConvertSVGValue(environment.svgBaseValue()); | 26 return maybeConvertSVGValue(environment.svgBaseValue()); |
26 } | 27 } |
27 | 28 |
28 void SVGInterpolationType::apply(const InterpolableValue& interpolableValue, con
st NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environ
ment) const | 29 void SVGInterpolationType::apply(const InterpolableValue& interpolableValue, con
st NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environ
ment) const |
29 { | 30 { |
30 SVGElement& targetElement = environment.svgElement(); | 31 environment.svgElement().setWebAnimatedAttribute(attribute(), appliedSVGValu
e(interpolableValue, nonInterpolableValue)); |
31 SVGElement::InstanceUpdateBlocker blocker(&targetElement); | |
32 RefPtrWillBeRawPtr<SVGPropertyBase> appliedValue = appliedSVGValue(interpola
bleValue, nonInterpolableValue); | |
33 for (SVGElement* instance : SVGAnimateElement::findElementInstances(&targetE
lement)) { | |
34 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = instance-
>propertyFromAttribute(attribute()); | |
35 if (animatedProperty) { | |
36 animatedProperty->setAnimatedValue(appliedValue); | |
37 instance->invalidateSVGAttributes(); | |
38 instance->svgAttributeChanged(attribute()); | |
39 } | |
40 } | |
41 } | 32 } |
42 | 33 |
43 } // namespace blink | 34 } // namespace blink |
OLD | NEW |