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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..86702f49f5d519401eb02bb45ed636f4ce8f9da4
--- /dev/null
+++ b/third_party/WebKit/Source/core/animation/SVGNumberInterpolationType.cpp
@@ -0,0 +1,38 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/animation/SVGNumberInterpolationType.h"
+
+#include "core/animation/InterpolationEnvironment.h"
+#include "core/animation/StringKeyframe.h"
+#include "core/svg/SVGNumber.h"
+#include "core/svg/properties/SVGAnimatedProperty.h"
+
+namespace blink {
+
+PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertNeutral() const
+{
+ return InterpolationValue::create(*this, InterpolableNumber::create(0));
+}
+
+PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const
+{
+ if (svgValue.type() != AnimatedNumber)
+ return nullptr;
+ return InterpolationValue::create(*this, InterpolableNumber::create(toSVGNumber(svgValue).value()));
+}
+
+PassOwnPtr<InterpolationValue> SVGNumberInterpolationType::maybeConvertUnderlyingValue(const InterpolationEnvironment& environment) const
+{
+ return maybeConvertSVGValue(environment.svgBaseValue());
+}
+
+RefPtrWillBeRawPtr<SVGPropertyBase> SVGNumberInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue*) const
+{
+ double value = toInterpolableNumber(interpolableValue).value();
+ return SVGNumber::create(m_isNonNegative && value < 0 ? 0 : value);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698