OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 DoubleStyleInterpolation_h | 5 #ifndef DoubleStyleInterpolation_h |
6 #define DoubleStyleInterpolation_h | 6 #define DoubleStyleInterpolation_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/animation/StyleInterpolation.h" | 9 #include "core/animation/StyleInterpolation.h" |
10 #include "core/css/CSSPrimitiveValue.h" | 10 #include "core/css/CSSPrimitiveValue.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class CORE_EXPORT DoubleStyleInterpolation : public StyleInterpolation { | 14 class CORE_EXPORT DoubleStyleInterpolation : public StyleInterpolation { |
15 public: | 15 public: |
16 typedef void NonInterpolableType; | 16 typedef void NonInterpolableType; |
17 | 17 |
18 static PassRefPtrWillBeRawPtr<DoubleStyleInterpolation> create(const CSSValu
e& start, const CSSValue& end, CSSPropertyID id, bool isNumber, InterpolationRan
ge clamp) | 18 static DoubleStyleInterpolation* create(const CSSValue& start, const CSSValu
e& end, CSSPropertyID id, bool isNumber, InterpolationRange clamp) |
19 { | 19 { |
20 return adoptRefWillBeNoop(new DoubleStyleInterpolation(doubleToInterpola
bleValue(start), doubleToInterpolableValue(end), id, isNumber, clamp, false)); | 20 return new DoubleStyleInterpolation(doubleToInterpolableValue(start), do
ubleToInterpolableValue(end), id, isNumber, clamp, false); |
21 } | 21 } |
22 | 22 |
23 static PassRefPtrWillBeRawPtr<DoubleStyleInterpolation> maybeCreateFromMotio
nRotation(const CSSValue& start, const CSSValue& end, CSSPropertyID); | 23 static DoubleStyleInterpolation* maybeCreateFromMotionRotation(const CSSValu
e& start, const CSSValue& end, CSSPropertyID); |
24 | 24 |
25 static bool canCreateFrom(const CSSValue&); | 25 static bool canCreateFrom(const CSSValue&); |
26 | 26 |
27 void apply(StyleResolverState&) const override; | 27 void apply(StyleResolverState&) const override; |
28 | 28 |
29 DECLARE_VIRTUAL_TRACE(); | 29 DECLARE_VIRTUAL_TRACE(); |
30 | 30 |
31 static PassOwnPtrWillBeRawPtr<InterpolableValue> toInterpolableValue(const C
SSValue&, CSSPropertyID = CSSPropertyInvalid); | 31 static InterpolableValue* toInterpolableValue(const CSSValue&, CSSPropertyID
= CSSPropertyInvalid); |
32 static PassRefPtrWillBeRawPtr<CSSValue> fromInterpolableValue(const Interpol
ableValue&, InterpolationRange); | 32 static PassRefPtrWillBeRawPtr<CSSValue> fromInterpolableValue(const Interpol
ableValue&, InterpolationRange); |
33 | 33 |
34 private: | 34 private: |
35 DoubleStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id, bool isNumber, In
terpolationRange clamp, bool flag) | 35 DoubleStyleInterpolation(InterpolableValue* start, InterpolableValue* end, C
SSPropertyID id, bool isNumber, InterpolationRange clamp, bool flag) |
36 : StyleInterpolation(start, end, id) | 36 : StyleInterpolation(start, end, id) |
37 , m_isNumber(isNumber) | 37 , m_isNumber(isNumber) |
38 , m_clamp(clamp) | 38 , m_clamp(clamp) |
39 , m_flag(flag) | 39 , m_flag(flag) |
40 { } | 40 { } |
41 | 41 |
42 static PassOwnPtrWillBeRawPtr<InterpolableValue> doubleToInterpolableValue(c
onst CSSValue&); | 42 static InterpolableValue* doubleToInterpolableValue(const CSSValue&); |
43 static PassOwnPtrWillBeRawPtr<InterpolableValue> motionRotationToInterpolabl
eValue(const CSSValue&); | 43 static InterpolableValue* motionRotationToInterpolableValue(const CSSValue&)
; |
44 | 44 |
45 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToDouble(const Inte
rpolableValue*, bool, InterpolationRange); | 45 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToDouble(const Inte
rpolableValue*, bool, InterpolationRange); |
46 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToMotionRotation(In
terpolableValue*, bool); | 46 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToMotionRotation(In
terpolableValue*, bool); |
47 | 47 |
48 bool m_isNumber; | 48 bool m_isNumber; |
49 InterpolationRange m_clamp; | 49 InterpolationRange m_clamp; |
50 bool m_flag; | 50 bool m_flag; |
51 | 51 |
52 friend class AnimationDoubleStyleInterpolationTest; | 52 friend class AnimationDoubleStyleInterpolationTest; |
53 }; | 53 }; |
54 } | 54 } |
55 #endif | 55 #endif |
OLD | NEW |