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 #include "config.h" |
| 6 #include "core/animation/SVGNumberInterpolationType.h" |
| 7 |
| 8 #include "core/animation/InterpolationEnvironment.h" |
| 9 #include "core/animation/StringKeyframe.h" |
| 10 #include "core/svg/SVGNumber.h" |
| 11 #include "core/svg/properties/SVGAnimatedProperty.h" |
| 12 |
| 13 namespace blink { |
| 14 |
| 15 PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertNeutral()
const |
| 16 { |
| 17 return InterpolationValue::create(*this, InterpolableNumber::create(0)); |
| 18 } |
| 19 |
| 20 PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertSVGValue(
const SVGPropertyBase& svgValue) const |
| 21 { |
| 22 if (svgValue.type() != AnimatedNumber) |
| 23 return nullptr; |
| 24 return InterpolationValue::create(*this, InterpolableNumber::create(toSVGNum
ber(svgValue).value())); |
| 25 } |
| 26 |
| 27 PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertUnderlyin
gValue(const InterpolationEnvironment& environment) const |
| 28 { |
| 29 return maybeConvertSVGValue(environment.svgBaseValue()); |
| 30 } |
| 31 |
| 32 RefPtrWillBeRawPtr<SVGPropertyBase> SVGNumberInterpolationType::appliedSVGValue(
const InterpolableValue& interpolableValue, const NonInterpolableValue*) const |
| 33 { |
| 34 double value = toInterpolableNumber(interpolableValue).value(); |
| 35 return SVGNumber::create(m_isNonNegative && value < 0 ? 0 : value); |
| 36 } |
| 37 |
| 38 } // namespace blink |
OLD | NEW |