OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef NumberSVGInterpolation_h |
| 6 #define NumberSVGInterpolation_h |
| 7 |
| 8 #include "core/animation/SVGInterpolation.h" |
| 9 #include "core/svg/SVGNumber.h" |
| 10 #include "core/svg/SVGNumberList.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 enum SVGNumberNegativeValuesMode { |
| 15 AllowNegativeNumbers, |
| 16 ForbidNegativeNumbers |
| 17 }; |
| 18 |
| 19 class NumberSVGInterpolation : public SVGInterpolation { |
| 20 public: |
| 21 typedef SVGNumberList ListType; |
| 22 typedef void NonInterpolableType; |
| 23 |
| 24 static PassRefPtrWillBeRawPtr<NumberSVGInterpolation> create(SVGPropertyBase
* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> a
ttribute); |
| 25 |
| 26 static bool canCreateFrom(SVGPropertyBase* value) |
| 27 { |
| 28 return true; |
| 29 } |
| 30 |
| 31 virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement
&) const override final |
| 32 { |
| 33 return fromInterpolableValue(*m_cachedValue, m_negativeValuesMode); |
| 34 } |
| 35 |
| 36 DEFINE_INLINE_VIRTUAL_TRACE() |
| 37 { |
| 38 SVGInterpolation::trace(visitor); |
| 39 } |
| 40 |
| 41 static PassOwnPtrWillBeRawPtr<InterpolableNumber> toInterpolableValue(SVGPro
pertyBase* value) |
| 42 { |
| 43 return InterpolableNumber::create(toSVGNumber(value)->value()); |
| 44 } |
| 45 |
| 46 static PassRefPtrWillBeRawPtr<SVGNumber> fromInterpolableValue(const Interpo
lableValue&, SVGNumberNegativeValuesMode = AllowNegativeNumbers); |
| 47 |
| 48 private: |
| 49 NumberSVGInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, Pass
OwnPtrWillBeRawPtr<InterpolableValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedPro
pertyBase> attribute, SVGNumberNegativeValuesMode negativeValuesMode) |
| 50 : SVGInterpolation(start, end, attribute) |
| 51 , m_negativeValuesMode(negativeValuesMode) |
| 52 { |
| 53 } |
| 54 |
| 55 const SVGNumberNegativeValuesMode m_negativeValuesMode; |
| 56 }; |
| 57 |
| 58 } |
| 59 |
| 60 #endif // NumberSVGInterpolation_h |
OLD | NEW |