| 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 PassRefPtr<DoubleStyleInterpolation> create(const CSSValue& start, co
nst CSSValue& end, CSSPropertyID id, bool isNumber, InterpolationRange clamp) | 18 static PassRefPtr<DoubleStyleInterpolation> create(const CSSValue& start, co
nst CSSValue& end, CSSPropertyID id, bool isNumber, InterpolationRange clamp) |
| 19 { | 19 { |
| 20 return adoptRef(new DoubleStyleInterpolation(doubleToInterpolableValue(s
tart), doubleToInterpolableValue(end), id, isNumber, clamp, false)); | 20 return adoptRef(new DoubleStyleInterpolation(doubleToInterpolableValue(s
tart), doubleToInterpolableValue(end), id, isNumber, clamp, false)); |
| 21 } | 21 } |
| 22 | 22 |
| 23 static PassRefPtr<DoubleStyleInterpolation> maybeCreateFromMotionRotation(co
nst CSSValue& start, const CSSValue& end, CSSPropertyID); | 23 static PassRefPtr<DoubleStyleInterpolation> maybeCreateFromMotionRotation(co
nst CSSValue& 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 static PassOwnPtr<InterpolableValue> toInterpolableValue(const CSSValue&, CS
SPropertyID = CSSPropertyInvalid); | 29 static PassOwnPtr<InterpolableValue> toInterpolableValue(const CSSValue&, CS
SPropertyID = CSSPropertyInvalid); |
| 30 static PassRefPtrWillBeRawPtr<CSSValue> fromInterpolableValue(const Interpol
ableValue&, InterpolationRange); | 30 static RawPtr<CSSValue> fromInterpolableValue(const InterpolableValue&, Inte
rpolationRange); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 DoubleStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int
erpolableValue> end, CSSPropertyID id, bool isNumber, InterpolationRange clamp,
bool flag) | 33 DoubleStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Int
erpolableValue> end, CSSPropertyID id, bool isNumber, InterpolationRange clamp,
bool flag) |
| 34 : StyleInterpolation(std::move(start), std::move(end), id) | 34 : StyleInterpolation(std::move(start), std::move(end), id) |
| 35 , m_isNumber(isNumber) | 35 , m_isNumber(isNumber) |
| 36 , m_clamp(clamp) | 36 , m_clamp(clamp) |
| 37 , m_flag(flag) | 37 , m_flag(flag) |
| 38 { } | 38 { } |
| 39 | 39 |
| 40 static PassOwnPtr<InterpolableValue> doubleToInterpolableValue(const CSSValu
e&); | 40 static PassOwnPtr<InterpolableValue> doubleToInterpolableValue(const CSSValu
e&); |
| 41 static PassOwnPtr<InterpolableValue> motionRotationToInterpolableValue(const
CSSValue&); | 41 static PassOwnPtr<InterpolableValue> motionRotationToInterpolableValue(const
CSSValue&); |
| 42 | 42 |
| 43 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToDouble(const Inte
rpolableValue*, bool, InterpolationRange); | 43 static RawPtr<CSSValue> interpolableValueToDouble(const InterpolableValue*,
bool, InterpolationRange); |
| 44 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToMotionRotation(In
terpolableValue*, bool); | 44 static RawPtr<CSSValue> interpolableValueToMotionRotation(InterpolableValue*
, bool); |
| 45 | 45 |
| 46 bool m_isNumber; | 46 bool m_isNumber; |
| 47 InterpolationRange m_clamp; | 47 InterpolationRange m_clamp; |
| 48 bool m_flag; | 48 bool m_flag; |
| 49 | 49 |
| 50 friend class AnimationDoubleStyleInterpolationTest; | 50 friend class AnimationDoubleStyleInterpolationTest; |
| 51 }; | 51 }; |
| 52 } // namespace blink | 52 } // namespace blink |
| 53 #endif | 53 #endif |
| OLD | NEW |