Chromium Code Reviews| 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/NumberSVGInterpolation.h" | |
| 7 | |
| 8 namespace blink { | |
| 9 | |
| 10 PassRefPtrWillBeRawPtr<NumberSVGInterpolation> NumberSVGInterpolation::create(SV GPropertyBase* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPr opertyBase> attribute) | |
| 11 { | |
| 12 SVGNumberNegativeValuesMode negativeValuesMode = &attribute->attributeName() == &SVGNames::pathLengthAttr ? ForbidNegativeNumbers : AllowNegativeNumbers; | |
|
alancutter (OOO until 2018)
2015/04/20 07:39:40
It would be more consistent to have this property
Eric Willigers
2015/04/21 00:51:16
Done. Also done for IntegerOptionalInteger.
| |
| 13 return adoptRefWillBeNoop(new NumberSVGInterpolation(toInterpolableValue(sta rt), toInterpolableValue(end), attribute, negativeValuesMode)); | |
| 14 } | |
| 15 | |
| 16 PassRefPtrWillBeRawPtr<SVGNumber> NumberSVGInterpolation::fromInterpolableValue( const InterpolableValue& value, SVGNumberNegativeValuesMode negativeValuesMode) | |
| 17 { | |
| 18 double doubleValue = toInterpolableNumber(value).value(); | |
| 19 if (negativeValuesMode == ForbidNegativeNumbers && doubleValue < 0) | |
| 20 doubleValue = 0; | |
| 21 return SVGNumber::create(doubleValue); | |
| 22 } | |
| 23 | |
| 24 } | |
| OLD | NEW |