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

Unified Diff: third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp

Issue 1418193007: Web Animations: Add SVGNumberOptionalNumberInterpolationType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_svgIntegerInterpolationType
Patch Set: neutralKeyframe 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/SVGNumberOptionalNumberInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4d90fdea7dd7ae6403ce95344dbee173a599c095
--- /dev/null
+++ b/third_party/WebKit/Source/core/animation/SVGNumberOptionalNumberInterpolationType.cpp
@@ -0,0 +1,41 @@
+// 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/SVGNumberOptionalNumberInterpolationType.h"
+
+#include "core/animation/InterpolationEnvironment.h"
+#include "core/svg/SVGNumberOptionalNumber.h"
+
+namespace blink {
+
+PassOwnPtr<InterpolationValue> SVGNumberOptionalNumberInterpolationType::maybeConvertNeutral(const UnderlyingValue&, ConversionCheckers&) const
+{
+ OwnPtr<InterpolableList> result = InterpolableList::create(2);
+ result->set(0, InterpolableNumber::create(0));
+ result->set(1, InterpolableNumber::create(0));
+ return InterpolationValue::create(*this, result.release());
+}
+
+PassOwnPtr<InterpolationValue> SVGNumberOptionalNumberInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const
+{
+ if (svgValue.type() != AnimatedNumberOptionalNumber)
+ return nullptr;
+
+ const SVGNumberOptionalNumber& numberOptionalNumber = toSVGNumberOptionalNumber(svgValue);
+ OwnPtr<InterpolableList> result = InterpolableList::create(2);
+ result->set(0, InterpolableNumber::create(numberOptionalNumber.firstNumber()->value()));
+ result->set(1, InterpolableNumber::create(numberOptionalNumber.secondNumber()->value()));
+ return InterpolationValue::create(*this, result.release());
+}
+
+PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGNumberOptionalNumberInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue*) const
+{
+ const InterpolableList& list = toInterpolableList(interpolableValue);
+ return SVGNumberOptionalNumber::create(
+ SVGNumber::create(toInterpolableNumber(list.get(0))->value()),
+ SVGNumber::create(toInterpolableNumber(list.get(1))->value()));
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698