| 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 ShadowStyleInterpolation_h | 5 #ifndef ShadowStyleInterpolation_h |
| 6 #define ShadowStyleInterpolation_h | 6 #define ShadowStyleInterpolation_h |
| 7 | 7 |
| 8 #include "core/animation/StyleInterpolation.h" | 8 #include "core/animation/StyleInterpolation.h" |
| 9 #include "core/css/CSSShadowValue.h" | 9 #include "core/css/CSSShadowValue.h" |
| 10 #include "core/rendering/style/RenderStyle.h" | 10 #include "core/rendering/style/RenderStyle.h" |
| 11 #include "platform/Length.h" | 11 #include "platform/Length.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class ShadowStyleInterpolation : public StyleInterpolation { | 15 class ShadowStyleInterpolation : public StyleInterpolation { |
| 16 public: | 16 public: |
| 17 static PassRefPtrWillBeRawPtr<ShadowStyleInterpolation> create(const CSSValu
e& start, const CSSValue& end, CSSPropertyID id, bool styleFlag) | 17 typedef bool NonInterpolableType; |
| 18 |
| 19 static bool canCreateFrom(const CSSValue& start, const CSSValue& end); |
| 20 |
| 21 static bool usesDefaultStyleInterpolation(const CSSValue& start, const CSSVa
lue& end); |
| 22 |
| 23 static PassOwnPtrWillBeRawPtr<InterpolableValue> toInterpolableValue(const C
SSValue&, NonInterpolableType&); |
| 24 static PassRefPtrWillBeRawPtr<CSSValue> fromInterpolableValue(const Interpol
ableValue&, NonInterpolableType, InterpolationRange = RangeAll); |
| 25 |
| 26 private: |
| 27 ShadowStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) |
| 28 : StyleInterpolation(start, end, id) |
| 18 { | 29 { |
| 19 return adoptRefWillBeNoop(new ShadowStyleInterpolation(shadowToInterpola
bleValue(start), shadowToInterpolableValue(end), id, styleFlag)); | |
| 20 } | 30 } |
| 21 | 31 |
| 22 static bool canCreateFrom(const CSSValue&); | 32 friend class AnimationShadowStyleInterpolationTest; |
| 23 | 33 |
| 24 virtual void apply(StyleResolverState&) const override; | 34 static PassOwnPtrWillBeRawPtr<InterpolableValue> shadowToInterpolableValue(c
onst CSSValue& value, NonInterpolableType& type) |
| 25 virtual void trace(Visitor*); | 35 { |
| 36 return toInterpolableValue(value, type); |
| 37 } |
| 38 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToShadow(const Inte
rpolableValue& value, NonInterpolableType type, InterpolationRange range = Range
All) |
| 39 { |
| 40 return fromInterpolableValue(value, type, range); |
| 41 } |
| 26 | 42 |
| 27 static PassRefPtrWillBeRawPtr<ShadowStyleInterpolation> maybeCreateFromShado
w(const CSSValue& start, const CSSValue& end, CSSPropertyID); | 43 static PassOwnPtrWillBeRawPtr<InterpolableValue> lengthToInterpolableValue(P
assRefPtrWillBeRawPtr<CSSPrimitiveValue>); |
| 28 private: | 44 static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> interpolableValueToLength(c
onst InterpolableValue*, InterpolationRange = RangeAll); |
| 29 ShadowStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pa
ssOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id, bool styleFlag) | |
| 30 : StyleInterpolation(start, end, id), m_styleFlag(styleFlag) | |
| 31 { } | |
| 32 | |
| 33 bool m_styleFlag; | |
| 34 | |
| 35 static PassOwnPtrWillBeRawPtr<InterpolableValue> shadowToInterpolableValue(c
onst CSSValue&); | |
| 36 static PassRefPtrWillBeRawPtr<CSSValue> interpolableValueToShadow(Interpolab
leValue*, bool styleFlag); | |
| 37 | 45 |
| 38 friend class AnimationShadowStyleInterpolationTest; | 46 friend class AnimationShadowStyleInterpolationTest; |
| 39 }; | 47 }; |
| 40 | 48 |
| 41 } // namespace blink | 49 } // namespace blink |
| 42 | 50 |
| 43 #endif // ShadowStyleInterpolation_h | 51 #endif // ShadowStyleInterpolation_h |
| OLD | NEW |