| 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 #ifndef SVGInterpolation_h | 5 #ifndef SVGInterpolation_h |
| 6 #define SVGInterpolation_h | 6 #define SVGInterpolation_h |
| 7 | 7 |
| 8 #include "core/animation/Interpolation.h" | 8 #include "core/animation/Interpolation.h" |
| 9 #include "core/animation/PropertyHandle.h" | 9 #include "core/animation/PropertyHandle.h" |
| 10 #include "core/svg/properties/SVGAnimatedProperty.h" | 10 #include "core/svg/properties/SVGAnimatedProperty.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class SVGInterpolation : public Interpolation { | 14 class SVGInterpolation : public Interpolation { |
| 15 public: | 15 public: |
| 16 bool isSVGInterpolation() const final { return true; } | 16 bool isSVGInterpolation() const final { return true; } |
| 17 | 17 |
| 18 SVGAnimatedPropertyBase* attribute() const { return m_attribute.get(); } | 18 SVGAnimatedPropertyBase* attribute() const { return m_attribute.get(); } |
| 19 | 19 |
| 20 const QualifiedName& attributeName() const { return m_attribute->attributeNa
me(); } | 20 const QualifiedName& attributeName() const { return m_attribute->attributeNa
me(); } |
| 21 | 21 |
| 22 PropertyHandle property() const final | 22 PropertyHandle property() const final |
| 23 { | 23 { |
| 24 return PropertyHandle(attributeName()); | 24 return PropertyHandle(attributeName()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void apply(SVGElement&) const; | 27 void apply(SVGElement& targetElement) const |
| 28 { |
| 29 targetElement.setWebAnimatedAttribute(attributeName(), interpolatedValue
(targetElement)); |
| 30 } |
| 28 | 31 |
| 29 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement
&) const = 0; | 32 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement
&) const = 0; |
| 30 | 33 |
| 31 protected: | 34 protected: |
| 32 SVGInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpolabl
eValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute) | 35 SVGInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interpolabl
eValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute) |
| 33 : Interpolation(start, end) | 36 : Interpolation(start, end) |
| 34 , m_attribute(attribute) | 37 , m_attribute(attribute) |
| 35 { | 38 { |
| 36 } | 39 } |
| 37 | 40 |
| 38 RefPtrWillBePersistent<SVGAnimatedPropertyBase> m_attribute; | 41 RefPtrWillBePersistent<SVGAnimatedPropertyBase> m_attribute; |
| 39 }; | 42 }; |
| 40 | 43 |
| 41 DEFINE_TYPE_CASTS(SVGInterpolation, Interpolation, value, value->isSVGInterpolat
ion(), value.isSVGInterpolation()); | 44 DEFINE_TYPE_CASTS(SVGInterpolation, Interpolation, value, value->isSVGInterpolat
ion(), value.isSVGInterpolation()); |
| 42 | 45 |
| 43 } | 46 } |
| 44 | 47 |
| 45 #endif // SVGInterpolation_h | 48 #endif // SVGInterpolation_h |
| OLD | NEW |