Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp

Issue 1410643011: Web Animations: Add SVGNumberInterpolationType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_propertyHandleFilter
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698