Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / animation / NumberSVGInterpolation.h
blob8344b00fa1ce799f3f387bf114848576478d858e
1 // Copyright 2015 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 NumberSVGInterpolation_h
6 #define NumberSVGInterpolation_h
8 #include "core/animation/SVGInterpolation.h"
9 #include "core/svg/SVGNumber.h"
10 #include "core/svg/SVGNumberList.h"
12 namespace blink {
14 enum SVGNumberNegativeValuesMode {
15 AllowNegativeNumbers,
16 ForbidNegativeNumbers
19 class NumberSVGInterpolation : public SVGInterpolation {
20 public:
21 typedef SVGNumberList ListType;
22 typedef void NonInterpolableType;
24 static PassRefPtr<NumberSVGInterpolation> create(SVGPropertyBase* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute, SVGNumberNegativeValuesMode negativeValuesMode)
26 return adoptRef(new NumberSVGInterpolation(toInterpolableValue(start), toInterpolableValue(end), attribute, negativeValuesMode));
29 static bool canCreateFrom(SVGPropertyBase* value)
31 return true;
34 PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement&) const final
36 return fromInterpolableValue(*m_cachedValue, m_negativeValuesMode);
39 static PassOwnPtr<InterpolableNumber> toInterpolableValue(SVGPropertyBase* value)
41 return InterpolableNumber::create(toSVGNumber(value)->value());
44 static PassRefPtrWillBeRawPtr<SVGNumber> fromInterpolableValue(const InterpolableValue&, SVGNumberNegativeValuesMode = AllowNegativeNumbers);
46 private:
47 NumberSVGInterpolation(PassOwnPtr<InterpolableValue> start, PassOwnPtr<InterpolableValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute, SVGNumberNegativeValuesMode negativeValuesMode)
48 : SVGInterpolation(start, end, attribute)
49 , m_negativeValuesMode(negativeValuesMode)
53 const SVGNumberNegativeValuesMode m_negativeValuesMode;
58 #endif // NumberSVGInterpolation_h