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/StyleInterpolation.h" 9 #include "core/css/resolver/AnimatedStyleBuilder.h" 10 11 namespace blink { 12 13 class LegacyStyleInterpolation : public StyleInterpolation { 14 public: create(PassRefPtrWillBeRawPtr<AnimatableValue> start,PassRefPtrWillBeRawPtr<AnimatableValue> end,CSSPropertyID id)15 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassRefPtrWillBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, CSSPropertyID id) 16 { 17 return adoptRefWillBeNoop(new LegacyStyleInterpolation(InterpolableAnimatableValue::create(start), InterpolableAnimatableValue::create(end), id)); 18 } 19 apply(StyleResolverState & state)20 virtual void apply(StyleResolverState& state) const OVERRIDE 21 { 22 AnimatedStyleBuilder::applyProperty(m_id, state, currentValue().get()); 23 } 24 isLegacyStyleInterpolation()25 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true; } currentValue()26 PassRefPtrWillBeRawPtr<AnimatableValue> currentValue() const 27 { 28 return toInterpolableAnimatableValue(m_cachedValue.get())->value(); 29 } 30 trace(Visitor * visitor)31 virtual void trace(Visitor* visitor) OVERRIDE 32 { 33 StyleInterpolation::trace(visitor); 34 } 35 36 private: LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start,PassOwnPtrWillBeRawPtr<InterpolableValue> end,CSSPropertyID id)37 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id) 38 : StyleInterpolation(start, end, id) 39 { 40 } 41 }; 42 43 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegacyStyleInterpolation(), value.isLegacyStyleInterpolation()); 44 45 } 46 47 #endif 48