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

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

Issue 1414413002: SVG Web Animations: Add SVGInterpolationType pipeline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_svgAttributeReference
Patch Set: Move assert to not wrong location Created 5 years, 2 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: third_party/WebKit/Source/core/animation/SVGInterpolationType.cpp
diff --git a/third_party/WebKit/Source/core/animation/SVGInterpolationType.cpp b/third_party/WebKit/Source/core/animation/SVGInterpolationType.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..82435d989bcd424ca7aac04e18fd8814df829d42
--- /dev/null
+++ b/third_party/WebKit/Source/core/animation/SVGInterpolationType.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/SVGInterpolationType.h"
+
+#include "core/animation/InterpolationEnvironment.h"
+#include "core/animation/StringKeyframe.h"
+#include "core/svg/SVGAnimateElement.h"
+
+namespace blink {
+
+PassOwnPtr<InterpolationValue> SVGInterpolationType::maybeConvertSingle(const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const UnderlyingValue&, ConversionCheckers&) const
+{
+ if (keyframe.isNeutral())
+ return maybeConvertNeutral();
+
+ RefPtrWillBeRawPtr<SVGPropertyBase> svgValue = environment.svgBaseValue().cloneForAnimation(toSVGPropertySpecificKeyframe(keyframe).value());
+ return maybeConvertSVGValue(*svgValue);
+}
+
+void SVGInterpolationType::apply(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue, InterpolationEnvironment& environment) const
+{
+ SVGElement& targetElement = environment.svgElement();
+ SVGElement::InstanceUpdateBlocker blocker(&targetElement);
+ RefPtrWillBeRawPtr<SVGPropertyBase> appliedValue = appliedSVGValue(interpolableValue, nonInterpolableValue);
+ for (SVGElement* instance : SVGAnimateElement::findElementInstances(&targetElement)) {
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty = instance->propertyFromAttribute(attribute());
+ if (animatedProperty) {
+ animatedProperty->setAnimatedValue(appliedValue);
+ instance->invalidateSVGAttributes();
+ instance->svgAttributeChanged(attribute());
+ }
+ }
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698