OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef LegacyStyleInterpolation_h |
| 6 #define LegacyStyleInterpolation_h |
| 7 |
| 8 #include "core/animation/Interpolation.h" |
| 9 |
| 10 namespace WebCore { |
| 11 |
| 12 class CSSPrimitiveValue; |
| 13 class Element; |
| 14 |
| 15 class LegacyStyleInterpolation : public StyleInterpolation { |
| 16 public: |
| 17 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(CSSValue& sta
rt, CSSValue& end, CSSPropertyID, Element&); |
| 18 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassOwnPtrWil
lBeRawPtr<InterpolableAnimatableValue> start, PassOwnPtrWillBeRawPtr<Interpolabl
eAnimatableValue> end, CSSPropertyID id) |
| 19 { |
| 20 return adoptRefWillBeNoop(new LegacyStyleInterpolation(start, end, id)); |
| 21 } |
| 22 |
| 23 virtual void apply(StyleResolverState&) const OVERRIDE; |
| 24 |
| 25 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true
; } |
| 26 |
| 27 PassRefPtrWillBeRawPtr<AnimatableValue> currentValue() const |
| 28 { |
| 29 if (m_interpolationRequiresStyleResolve) |
| 30 return nullptr; |
| 31 return toInterpolableAnimatableValue(*m_cachedValue).value(); |
| 32 } |
| 33 |
| 34 static bool interpolationRequiresStyleResolve(const CSSValue&); |
| 35 static bool interpolationRequiresStyleResolve(const CSSPrimitiveValue&); |
| 36 |
| 37 virtual void trace(Visitor*) OVERRIDE; |
| 38 |
| 39 private: |
| 40 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableAnimatableValue>
start, PassOwnPtrWillBeRawPtr<InterpolableAnimatableValue> end, CSSPropertyID i
d) |
| 41 : StyleInterpolation(start, end, id) |
| 42 , m_interpolationRequiresStyleResolve(false) |
| 43 { |
| 44 } |
| 45 |
| 46 LegacyStyleInterpolation(PassRefPtrWillBeRawPtr<CSSValue> start, PassRefPtrW
illBeRawPtr<CSSValue> end, CSSPropertyID id) |
| 47 : StyleInterpolation(InterpolableNumber::create(0), InterpolableNumber::
create(1), id) |
| 48 , m_interpolationRequiresStyleResolve(true) |
| 49 , m_startCSSValue(start) |
| 50 , m_endCSSValue(end) |
| 51 { |
| 52 } |
| 53 |
| 54 const bool m_interpolationRequiresStyleResolve; |
| 55 const RefPtrWillBeMember<CSSValue> m_startCSSValue; |
| 56 const RefPtrWillBeMember<CSSValue> m_endCSSValue; |
| 57 }; |
| 58 |
| 59 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegac
yStyleInterpolation(), value.isLegacyStyleInterpolation()); |
| 60 |
| 61 } |
| 62 |
| 63 #endif |
OLD | NEW |