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 static PassRefPtrWillBeRawPtr<DoubleStyleInterpolation> create(const CSSValu
e& start, const CSSValue& end, CSSPropertyID id, CSSPrimitiveValue::UnitType typ
e, InterpolationRange clamp) | 16 static DoubleStyleInterpolation* create(const CSSValue& start, const CSSValu
e& end, CSSPropertyID id, CSSPrimitiveValue::UnitType type, InterpolationRange c
lamp) |
17 { | 17 { |
18 return adoptRefWillBeNoop(new DoubleStyleInterpolation(doubleToInterpola
bleValue(start), doubleToInterpolableValue(end), id, type == CSSPrimitiveValue::
CSS_NUMBER, clamp, false)); | 18 return new DoubleStyleInterpolation(doubleToInterpolableValue(start), do
ubleToInterpolableValue(end), id, type == CSSPrimitiveValue::CSS_NUMBER, clamp,
false); |
19 } | 19 } |
20 | 20 |
21 static PassRefPtrWillBeRawPtr<DoubleStyleInterpolation> maybeCreateFromMotio
nRotation(const CSSValue& start, const CSSValue& end, CSSPropertyID); | 21 static DoubleStyleInterpolation* maybeCreateFromMotionRotation(const CSSValu
e& start, const CSSValue& end, CSSPropertyID); |
22 | 22 |
23 static bool canCreateFrom(const CSSValue&); | 23 static bool canCreateFrom(const CSSValue&); |
24 | 24 |
25 virtual void apply(StyleResolverState&) const override; | 25 virtual void apply(StyleResolverState&) const override; |
26 | 26 |
27 DECLARE_VIRTUAL_TRACE(); | 27 DECLARE_VIRTUAL_TRACE(); |
28 | 28 |
29 private: | 29 private: |
30 DoubleStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id, bool isNumber, In
terpolationRange clamp, bool flag) | 30 DoubleStyleInterpolation(InterpolableValue* start, InterpolableValue* end, C
SSPropertyID id, bool isNumber, InterpolationRange clamp, bool flag) |
31 : StyleInterpolation(start, end, id) | 31 : StyleInterpolation(start, end, id) |
32 , m_isNumber(isNumber) | 32 , m_isNumber(isNumber) |
33 , m_clamp(clamp) | 33 , m_clamp(clamp) |
34 , m_flag(flag) | 34 , m_flag(flag) |
35 { } | 35 { } |
36 | 36 |
37 static PassOwnPtrWillBeRawPtr<InterpolableValue> doubleToInterpolableValue(c
onst CSSValue&); | 37 static InterpolableValue* doubleToInterpolableValue(const CSSValue&); |
38 static PassOwnPtrWillBeRawPtr<InterpolableValue> motionRotationToInterpolabl
eValue(const CSSValue&); | 38 static InterpolableValue* motionRotationToInterpolableValue(const CSSValue&)
; |
39 | 39 |
40 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToDouble(Interpolab
leValue*, bool, InterpolationRange); | 40 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToDouble(Interpolab
leValue*, bool, InterpolationRange); |
41 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToMotionRotation(In
terpolableValue*, bool); | 41 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToMotionRotation(In
terpolableValue*, bool); |
42 | 42 |
43 bool m_isNumber; | 43 bool m_isNumber; |
44 InterpolationRange m_clamp; | 44 InterpolationRange m_clamp; |
45 bool m_flag; | 45 bool m_flag; |
46 | 46 |
47 friend class AnimationDoubleStyleInterpolationTest; | 47 friend class AnimationDoubleStyleInterpolationTest; |
48 }; | 48 }; |
49 } | 49 } |
50 #endif | 50 #endif |
OLD | NEW |