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 PassRefPtr<AngleSVGInterpolation> create(SVGPropertyBase* start, SVGP
ropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute) |
18 { | 18 { |
19 return adoptRefWillBeNoop(new AngleSVGInterpolation(toInterpolableValue(
start), toInterpolableValue(end), attribute)); | 19 return adoptRef(new AngleSVGInterpolation(toInterpolableValue(start), to
InterpolableValue(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 PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement&) const
final | 27 PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement&) const
final |
28 { | 28 { |
29 return fromInterpolableValue(m_cachedValue.get()); | 29 return fromInterpolableValue(m_cachedValue.get()); |
30 } | 30 } |
31 | 31 |
32 DEFINE_INLINE_VIRTUAL_TRACE() | |
33 { | |
34 SVGInterpolation::trace(visitor); | |
35 } | |
36 | |
37 private: | 32 private: |
38 AngleSVGInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassO
wnPtrWillBeRawPtr<InterpolableValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedProp
ertyBase> attribute) | 33 AngleSVGInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Interp
olableValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute) |
39 : SVGInterpolation(start, end, attribute) | 34 : SVGInterpolation(start, end, attribute) |
40 { | 35 { |
41 } | 36 } |
42 | 37 |
43 static PassOwnPtrWillBeRawPtr<InterpolableValue> toInterpolableValue(SVGProp
ertyBase* value) | 38 static PassOwnPtr<InterpolableValue> toInterpolableValue(SVGPropertyBase* va
lue) |
44 { | 39 { |
45 return InterpolableNumber::create(toSVGAngle(value)->value()); | 40 return InterpolableNumber::create(toSVGAngle(value)->value()); |
46 } | 41 } |
47 | 42 |
48 static PassRefPtrWillBeRawPtr<SVGAngle> fromInterpolableValue(InterpolableVa
lue* value) | 43 static PassRefPtrWillBeRawPtr<SVGAngle> fromInterpolableValue(InterpolableVa
lue* value) |
49 { | 44 { |
50 double doubleValue = toInterpolableNumber(value)->value(); | 45 double doubleValue = toInterpolableNumber(value)->value(); |
51 RefPtrWillBeRawPtr<SVGAngle> result = SVGAngle::create(); | 46 RefPtrWillBeRawPtr<SVGAngle> result = SVGAngle::create(); |
52 result->newValueSpecifiedUnits(SVGAngle::SVG_ANGLETYPE_DEG, doubleValue)
; | 47 result->newValueSpecifiedUnits(SVGAngle::SVG_ANGLETYPE_DEG, doubleValue)
; |
53 return result.release(); | 48 return result.release(); |
54 } | 49 } |
55 }; | 50 }; |
56 | 51 |
57 } | 52 } |
58 | 53 |
59 #endif // AngleSVGInterpolation_h | 54 #endif // AngleSVGInterpolation_h |
OLD | NEW |