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 ColorStyleInterpolation* create(const CSSValue& start, const CSSValue
& end, CSSPropertyID id) |
18 { | 18 { |
19 return adoptRefWillBeNoop(new ColorStyleInterpolation(colorToInterpolabl
eValue(start), colorToInterpolableValue(end), id)); | 19 return new ColorStyleInterpolation(colorToInterpolableValue(start), colo
rToInterpolableValue(end), id); |
20 } | 20 } |
21 | 21 |
22 static PassRefPtrWillBeRawPtr<ColorStyleInterpolation> maybeCreateFromColor(
const CSSValue& start, const CSSValue& end, CSSPropertyID); | 22 static ColorStyleInterpolation* maybeCreateFromColor(const CSSValue& 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 virtual void apply(StyleResolverState&) const override; | 28 virtual void apply(StyleResolverState&) const override; |
29 | 29 |
30 DECLARE_VIRTUAL_TRACE(); | 30 DECLARE_VIRTUAL_TRACE(); |
31 | 31 |
32 private: | 32 private: |
33 ColorStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pas
sOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) | 33 ColorStyleInterpolation(InterpolableValue* start, InterpolableValue* end, CS
SPropertyID id) |
34 : StyleInterpolation(start, end, id) | 34 : StyleInterpolation(start, end, id) |
35 { | 35 { |
36 } | 36 } |
37 | 37 |
38 static PassOwnPtrWillBeRawPtr<InterpolableValue> colorToInterpolableValue(co
nst CSSValue&); | 38 static InterpolableValue* colorToInterpolableValue(const CSSValue&); |
39 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> interpolableValueToColor(co
nst InterpolableValue&); | 39 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> interpolableValueToColor(co
nst InterpolableValue&); |
40 | 40 |
41 friend class AnimationColorStyleInterpolationTest; | 41 friend class AnimationColorStyleInterpolationTest; |
42 friend class ShadowStyleInterpolation; | 42 friend class ShadowStyleInterpolation; |
43 }; | 43 }; |
44 } | 44 } |
45 | 45 |
46 #endif | 46 #endif |
OLD | NEW |