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.
5 #ifndef LegacyStyleInterpolation_h
6 #define LegacyStyleInterpolation_h
8 #include "core/animation/interpolation/StyleInterpolation.h"
9 #include "core/css/resolver/AnimatedStyleBuilder.h"
13 class LegacyStyleInterpolation : public StyleInterpolation {
15 static PassRefPtrWillBeRawPtr<LegacyStyleInterpolation> create(PassRefPtrWillBeRawPtr<AnimatableValue> start, PassRefPtrWillBeRawPtr<AnimatableValue> end, CSSPropertyID id)
17 return adoptRefWillBeNoop(new LegacyStyleInterpolation(InterpolableAnimatableValue::create(start), InterpolableAnimatableValue::create(end), id));
20 virtual void apply(StyleResolverState& state) const OVERRIDE
22 AnimatedStyleBuilder::applyProperty(m_id, state, currentValue().get());
25 virtual bool isLegacyStyleInterpolation() const OVERRIDE FINAL { return true; }
26 PassRefPtrWillBeRawPtr<AnimatableValue> currentValue() const
28 InterpolableAnimatableValue* value = static_cast<InterpolableAnimatableValue*>(m_cachedValue.get());
29 return value->value();
32 virtual void trace(Visitor* visitor) OVERRIDE
34 StyleInterpolation::trace(visitor);
38 LegacyStyleInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end, CSSPropertyID id)
39 : StyleInterpolation(start, end, id)
44 DEFINE_TYPE_CASTS(LegacyStyleInterpolation, Interpolation, value, value->isLegacyStyleInterpolation(), value.isLegacyStyleInterpolation());