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

Unified Diff: Source/core/animation/NumberSVGInterpolation.h

Issue 1068973004: Web Animations: Support animation of SVG number attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 8 months 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: Source/core/animation/NumberSVGInterpolation.h
diff --git a/Source/core/animation/NumberSVGInterpolation.h b/Source/core/animation/NumberSVGInterpolation.h
new file mode 100644
index 0000000000000000000000000000000000000000..1cb970700ec5de40dceec956ed011b8b74f56c57
--- /dev/null
+++ b/Source/core/animation/NumberSVGInterpolation.h
@@ -0,0 +1,63 @@
+// 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.
+
+#ifndef NumberSVGInterpolation_h
+#define NumberSVGInterpolation_h
+
+#include "core/animation/SVGInterpolation.h"
+#include "core/svg/SVGNumber.h"
+#include "core/svg/SVGNumberList.h"
+
+namespace blink {
+
+enum SVGNumberNegativeValuesMode {
+ AllowNegativeNumbers,
+ ForbidNegativeNumbers
+};
+
+class NumberSVGInterpolation : public SVGInterpolation {
+public:
+ typedef SVGNumberList ListType;
+ typedef void NonInterpolableType;
+
+ static PassRefPtrWillBeRawPtr<NumberSVGInterpolation> create(SVGPropertyBase* start, SVGPropertyBase* end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute, SVGNumberNegativeValuesMode negativeValuesMode)
+ {
+ return adoptRefWillBeNoop(new NumberSVGInterpolation(toInterpolableValue(start), toInterpolableValue(end), attribute, negativeValuesMode));
+ }
+
+ static bool canCreateFrom(SVGPropertyBase* value)
+ {
+ return true;
+ }
+
+ virtual PassRefPtrWillBeRawPtr<SVGPropertyBase> interpolatedValue(SVGElement&) const override final
+ {
+ return fromInterpolableValue(*m_cachedValue, m_negativeValuesMode);
+ }
+
+ DEFINE_INLINE_VIRTUAL_TRACE()
+ {
+ SVGInterpolation::trace(visitor);
+ }
+
+ static PassOwnPtrWillBeRawPtr<InterpolableNumber> toInterpolableValue(SVGPropertyBase* value)
+ {
+ return InterpolableNumber::create(toSVGNumber(value)->value());
+ }
+
+ static PassRefPtrWillBeRawPtr<SVGNumber> fromInterpolableValue(const InterpolableValue&, SVGNumberNegativeValuesMode = AllowNegativeNumbers);
+
+private:
+ NumberSVGInterpolation(PassOwnPtrWillBeRawPtr<InterpolableValue> start, PassOwnPtrWillBeRawPtr<InterpolableValue> end, PassRefPtrWillBeRawPtr<SVGAnimatedPropertyBase> attribute, SVGNumberNegativeValuesMode negativeValuesMode)
+ : SVGInterpolation(start, end, attribute)
+ , m_negativeValuesMode(negativeValuesMode)
+ {
+ }
+
+ const SVGNumberNegativeValuesMode m_negativeValuesMode;
+};
+
+}
+
+#endif // NumberSVGInterpolation_h
« no previous file with comments | « Source/core/animation/IntegerOptionalIntegerSVGInterpolation.cpp ('k') | Source/core/animation/NumberSVGInterpolation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698