| 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 AngleSVGInterpolation_h | 5 #ifndef AngleSVGInterpolation_h |
| 6 #define AngleSVGInterpolation_h | 6 #define AngleSVGInterpolation_h |
| 7 | 7 |
| 8 #include "core/animation/SVGInterpolation.h" | 8 #include "core/animation/SVGInterpolation.h" |
| 9 #include "core/svg/SVGAngle.h" | 9 #include "core/svg/SVGAngle.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class SVGInteger; | 13 class SVGInteger; |
| 14 | 14 |
| 15 class AngleSVGInterpolation : public SVGInterpolation { | 15 class AngleSVGInterpolation : public SVGInterpolation { |
| 16 public: | 16 public: |
| 17 static PassRefPtrWillBeRawPtr<AngleSVGInterpolation> create(SVGPropertyBase*
start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> at
tribute) | 17 static AngleSVGInterpolation* create(SVGPropertyBase* start, SVGPropertyBase
* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute) |
| 18 { | 18 { |
| 19 return adoptRefWillBeNoop(new AngleSVGInterpolation(toInterpolableValue(
start), toInterpolableValue(end), attribute)); | 19 return new AngleSVGInterpolation(toInterpolableValue(start), toInterpola
bleValue(end), attribute); |
| 20 } | 20 } |
| 21 | 21 |
| 22 static bool canCreateFrom(SVGPropertyBase* value) | 22 static bool canCreateFrom(SVGPropertyBase* value) |
| 23 { | 23 { |
| 24 return toSVGAngle(value)->orientType()->enumValue() == SVGMarkerOrientAn
gle; | 24 return toSVGAngle(value)->orientType()->enumValue() == SVGMarkerOrientAn
gle; |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement
&) const override final | 27 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement
&) const override final |
| 28 { | 28 { |
| 29 return fromInterpolableValue(m_cachedValue.get()); | 29 return fromInterpolableValue(m_cachedValue); |
| 30 } | 30 } |
| 31 | 31 |
| 32 DEFINE_INLINE_VIRTUAL_TRACE() | 32 DEFINE_INLINE_VIRTUAL_TRACE() |
| 33 { | 33 { |
| 34 SVGInterpolation::trace(visitor); | 34 SVGInterpolation::trace(visitor); |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 AngleSVGInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassO
wnPtrWillBeRawPtr<InterpolableValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedProp
ertyBase> attribute) | 38 AngleSVGInterpolation(InterpolableValue* start, InterpolableValue* end, Pass
RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute) |
| 39 : SVGInterpolation(start, end, attribute) | 39 : SVGInterpolation(start, end, attribute) |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 static PassOwnPtrWillBeRawPtr<InterpolableValue> toInterpolableValue(SVGProp
ertyBase* value) | 43 static InterpolableValue* toInterpolableValue(SVGPropertyBase* value) |
| 44 { | 44 { |
| 45 return InterpolableNumber::create(toSVGAngle(value)->value()); | 45 return InterpolableNumber::create(toSVGAngle(value)->value()); |
| 46 } | 46 } |
| 47 | 47 |
| 48 static PassRefPtrWillBeRawPtr<SVGAngle> fromInterpolableValue(InterpolableVa
lue* value) | 48 static PassRefPtrWillBeRawPtr<SVGAngle> fromInterpolableValue(InterpolableVa
lue* value) |
| 49 { | 49 { |
| 50 double doubleValue = toInterpolableNumber(value)->value(); | 50 double doubleValue = toInterpolableNumber(value)->value(); |
| 51 RefPtrWillBeRawPtr<SVGAngle> result = SVGAngle::create(); | 51 RefPtrWillBeRawPtr<SVGAngle> result = SVGAngle::create(); |
| 52 result->newValueSpecifiedUnits(SVGAngle::SVG_ANGLETYPE_DEG, doubleValue)
; | 52 result->newValueSpecifiedUnits(SVGAngle::SVG_ANGLETYPE_DEG, doubleValue)
; |
| 53 return result.release(); | 53 return result.release(); |
| 54 } | 54 } |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } | 57 } |
| 58 | 58 |
| 59 #endif // AngleSVGInterpolation_h | 59 #endif // AngleSVGInterpolation_h |
| OLD | NEW |