| 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 ColorStyleInterpolation_h | 5 #ifndef ColorStyleInterpolation_h |
| 6 #define ColorStyleInterpolation_h | 6 #define ColorStyleInterpolation_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 #include "platform/graphics/Color.h" | 11 #include "platform/graphics/Color.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class CORE_EXPORT ColorStyleInterpolation : public StyleInterpolation { | 15 class CORE_EXPORT ColorStyleInterpolation : public StyleInterpolation { |
| 16 public: | 16 public: |
| 17 static PassRefPtrWillBeRawPtr<ColorStyleInterpolation> create(const CSSValue
& start, const CSSValue& end, CSSPropertyID id) | 17 static PassRefPtr<ColorStyleInterpolation> create(const CSSValue& start, con
st CSSValue& end, CSSPropertyID id) |
| 18 { | 18 { |
| 19 return adoptRefWillBeNoop(new ColorStyleInterpolation(colorToInterpolabl
eValue(start), colorToInterpolableValue(end), id)); | 19 return adoptRef(new ColorStyleInterpolation(colorToInterpolableValue(sta
rt), colorToInterpolableValue(end), id)); |
| 20 } | 20 } |
| 21 | 21 |
| 22 static PassRefPtrWillBeRawPtr<ColorStyleInterpolation> maybeCreateFromColor(
const CSSValue& start, const CSSValue& end, CSSPropertyID); | 22 static PassRefPtr<ColorStyleInterpolation> maybeCreateFromColor(const CSSVal
ue& start, const CSSValue& end, CSSPropertyID); |
| 23 | 23 |
| 24 static bool shouldUseLegacyStyleInterpolation(const CSSValue& start, const C
SSValue& end); | 24 static bool shouldUseLegacyStyleInterpolation(const CSSValue& start, const C
SSValue& end); |
| 25 | 25 |
| 26 static bool canCreateFrom(const CSSValue&); | 26 static bool canCreateFrom(const CSSValue&); |
| 27 | 27 |
| 28 void apply(StyleResolverState&) const override; | 28 void apply(StyleResolverState&) const override; |
| 29 | 29 |
| 30 DECLARE_VIRTUAL_TRACE(); | |
| 31 | |
| 32 private: | 30 private: |
| 33 ColorStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pas
sOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) | 31 ColorStyleInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<Inte
rpolableValue> end, CSSPropertyID id) |
| 34 : StyleInterpolation(start, end, id) | 32 : StyleInterpolation(start, end, id) |
| 35 { | 33 { |
| 36 } | 34 } |
| 37 | 35 |
| 38 static PassOwnPtrWillBeRawPtr<InterpolableValue> colorToInterpolableValue(co
nst CSSValue&); | 36 static PassOwnPtr<InterpolableValue> colorToInterpolableValue(const CSSValue
&); |
| 39 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> interpolableValueToColor(co
nst InterpolableValue&); | 37 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> interpolableValueToColor(co
nst InterpolableValue&); |
| 40 | 38 |
| 41 friend class AnimationColorStyleInterpolationTest; | 39 friend class AnimationColorStyleInterpolationTest; |
| 42 friend class ShadowStyleInterpolation; | 40 friend class ShadowStyleInterpolation; |
| 43 }; | 41 }; |
| 44 } | 42 } |
| 45 | 43 |
| 46 #endif | 44 #endif |
| OLD | NEW |