Diff
Modified: trunk/LayoutTests/ChangeLog (153886 => 153887)
--- trunk/LayoutTests/ChangeLog 2013-08-09 13:05:37 UTC (rev 153886)
+++ trunk/LayoutTests/ChangeLog 2013-08-09 13:23:26 UTC (rev 153887)
@@ -1,5 +1,21 @@
2013-08-09 Rob Buis <[email protected]>
+ ASSERT_NOT_REACHED() touched in WebCore::SVGAnimatedStringAnimator::addAnimatedTypes
+ https://bugs.webkit.org/show_bug.cgi?id=113224
+
+ Reviewed by Dirk Schulze.
+
+ Add a test for animating non-additive attributes in from-by animations
+
+ * svg/animations/non-additive-type-from-by-animation-expected.txt: Added.
+ * svg/animations/non-additive-type-from-by-animation.html: Added.
+ * svg/animations/resources/non-additive-type-from-by-animation.svg: Added.
+ * svg/animations/script-tests/non-additive-type-from-by-animation.js: Added.
+ (sample):
+ (executeTest):
+
+2013-08-09 Rob Buis <[email protected]>
+
ASSERT(m_type == toSVGTransform.type())
https://bugs.webkit.org/show_bug.cgi?id=113217
Added: trunk/LayoutTests/svg/animations/non-additive-type-from-by-animation-expected.txt (0 => 153887)
--- trunk/LayoutTests/svg/animations/non-additive-type-from-by-animation-expected.txt (rev 0)
+++ trunk/LayoutTests/svg/animations/non-additive-type-from-by-animation-expected.txt 2013-08-09 13:23:26 UTC (rev 153887)
@@ -0,0 +1,62 @@
+SVG 1.1 dynamic animation tests
+
+
+This is a from by animation for all non-additive property types - should have no effect.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS feConvolveMatrix.preserveAlpha.animVal is false
+PASS filter.filterUnits.animVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.animVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.animVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.animVal is ""
+PASS feConvolveMatrix.preserveAlpha.baseVal is false
+PASS filter.filterUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.baseVal is ""
+PASS feConvolveMatrix.preserveAlpha.animVal is false
+PASS filter.filterUnits.animVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.animVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.animVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.animVal is ""
+PASS feConvolveMatrix.preserveAlpha.baseVal is false
+PASS filter.filterUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.baseVal is ""
+PASS feConvolveMatrix.preserveAlpha.animVal is false
+PASS filter.filterUnits.animVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.animVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.animVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.animVal is ""
+PASS feConvolveMatrix.preserveAlpha.baseVal is false
+PASS filter.filterUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.baseVal is ""
+PASS feConvolveMatrix.preserveAlpha.animVal is false
+PASS filter.filterUnits.animVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.animVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.animVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.animVal is ""
+PASS feConvolveMatrix.preserveAlpha.baseVal is false
+PASS filter.filterUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.baseVal is ""
+PASS feConvolveMatrix.preserveAlpha.animVal is false
+PASS filter.filterUnits.animVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.animVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.animVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.animVal is ""
+PASS feConvolveMatrix.preserveAlpha.baseVal is false
+PASS filter.filterUnits.baseVal is SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
+PASS svg.preserveAspectRatio.baseVal.align is SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE
+PASS svg.preserveAspectRatio.baseVal.meetOrSlice is SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET
+PASS feConvolveMatrix.result.baseVal is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/svg/animations/non-additive-type-from-by-animation.html (0 => 153887)
--- trunk/LayoutTests/svg/animations/non-additive-type-from-by-animation.html (rev 0)
+++ trunk/LayoutTests/svg/animations/non-additive-type-from-by-animation.html 2013-08-09 13:23:26 UTC (rev 153887)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body _onload_="runSMILTest()">
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/svg/animations/resources/non-additive-type-from-by-animation.svg (0 => 153887)
--- trunk/LayoutTests/svg/animations/resources/non-additive-type-from-by-animation.svg (rev 0)
+++ trunk/LayoutTests/svg/animations/resources/non-additive-type-from-by-animation.svg 2013-08-09 13:23:26 UTC (rev 153887)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg id="svg" viewBox="0 0 200 200" preserveAspectRatio="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+ <filter id="filter">
+ <feConvolveMatrix id="feConvolveMatrix" kernelMatrix="0 1 0 0 1 0 0 1 0" order="6 6" targetX="5" preserveAlpha="false"/>
+ </filter>
+</defs>
+
+<rect id="rect" y="100" width="100" height="100" fill="black" filter="url(#filter)"/>
+
+<!-- AnimatedBoolean -->
+<animate id="an1" xlink:href="" attributeName="preserveAlpha" begin="0s" dur="4s" from="false" by="true" fill="freeze"/>
+
+<!-- AnimatedEnumeration -->
+<animate xlink:href="" attributeName="filterUnits" begin="0s" dur="4s" from="objectBoundingBox" by="userSpaceOnUse" fill="freeze"/>
+
+<!-- AnimatedPreserveAspectRatio -->
+<animate xlink:href="" attributeName="preserveAspectRatio" begin="0s" dur="4s" from="xMaxYMax meet" by="xMaxYMax slice" fill="freeze"/>
+
+<!-- AnimatedString -->
+<animate xlink:href="" attributeName="result" begin="0s" dur="4s" from="foo" by="test" fill="freeze"/>
+
+</svg>
Added: trunk/LayoutTests/svg/animations/script-tests/non-additive-type-from-by-animation.js (0 => 153887)
--- trunk/LayoutTests/svg/animations/script-tests/non-additive-type-from-by-animation.js (rev 0)
+++ trunk/LayoutTests/svg/animations/script-tests/non-additive-type-from-by-animation.js 2013-08-09 13:23:26 UTC (rev 153887)
@@ -0,0 +1,37 @@
+description("This is a from by animation for all non-additive property types - should have no effect.");
+embedSVGTestCase("resources/non-additive-type-from-by-animation.svg");
+
+// Setup animation test
+function sample() {
+ shouldBe("feConvolveMatrix.preserveAlpha.animVal", "false");
+ shouldBe("filter.filterUnits.animVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");
+ shouldBe("svg.preserveAspectRatio.animVal.align", "SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE");
+ shouldBe("svg.preserveAspectRatio.animVal.meetOrSlice", "SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET");
+ shouldBeEqualToString("feConvolveMatrix.result.animVal", "");
+
+ shouldBe("feConvolveMatrix.preserveAlpha.baseVal", "false");
+ shouldBe("filter.filterUnits.baseVal", "SVGUnitTypes.SVG_UNIT_TYPE_OBJECTBOUNDINGBOX");
+ shouldBe("svg.preserveAspectRatio.baseVal.align", "SVGPreserveAspectRatio.SVG_PRESERVEASPECTRATIO_NONE");
+ shouldBe("svg.preserveAspectRatio.baseVal.meetOrSlice", "SVGPreserveAspectRatio.SVG_MEETORSLICE_MEET");
+ shouldBeEqualToString("feConvolveMatrix.result.baseVal", "");
+}
+
+function executeTest() {
+ filter = rootSVGElement.ownerDocument.getElementsByTagName("filter")[0];
+ feConvolveMatrix = rootSVGElement.ownerDocument.getElementsByTagName("feConvolveMatrix")[0];
+ svg = rootSVGElement.ownerDocument.getElementsByTagName("svg")[0];
+
+ const expectedValues = [
+ // [animationId, time, sampleCallback]
+ ["an1", 0.0, sample],
+ ["an1", 1.999, sample],
+ ["an1", 2.001, sample],
+ ["an1", 3.999, sample],
+ ["an1", 4.001, sample]
+ ];
+
+ runAnimationTest(expectedValues);
+}
+
+window.animationStartsImmediately = true;
+var successfullyParsed = true;
Modified: trunk/Source/WebCore/ChangeLog (153886 => 153887)
--- trunk/Source/WebCore/ChangeLog 2013-08-09 13:05:37 UTC (rev 153886)
+++ trunk/Source/WebCore/ChangeLog 2013-08-09 13:23:26 UTC (rev 153887)
@@ -1,5 +1,22 @@
2013-08-09 Rob Buis <[email protected]>
+ ASSERT_NOT_REACHED() touched in WebCore::SVGAnimatedStringAnimator::addAnimatedTypes
+ https://bugs.webkit.org/show_bug.cgi?id=113224
+
+ Reviewed by Darin Adler.
+
+ Do not perform from-by animations for non-additive attributes.
+
+ Test: svg/animations/non-additive-type-from-by-animation.html
+
+ * svg/SVGAnimateElement.cpp:
+ (WebCore::SVGAnimateElement::calculateFromAndByValues):
+ (WebCore::SVGAnimateElement::animatedPropertyTypeSupportsAddition):
+ (WebCore::SVGAnimateElement::isAdditive):
+ * svg/SVGAnimateElement.h:
+
+2013-08-09 Rob Buis <[email protected]>
+
ASSERT(m_type == toSVGTransform.type())
https://bugs.webkit.org/show_bug.cgi?id=113217
Modified: trunk/Source/WebCore/svg/SVGAnimateElement.cpp (153886 => 153887)
--- trunk/Source/WebCore/svg/SVGAnimateElement.cpp 2013-08-09 13:05:37 UTC (rev 153886)
+++ trunk/Source/WebCore/svg/SVGAnimateElement.cpp 2013-08-09 13:23:26 UTC (rev 153887)
@@ -170,6 +170,10 @@
if (animationMode() == ByAnimation && !isAdditive())
return false;
+ // from-by animation may only be used with attributes that support addition (e.g. most numeric attributes).
+ if (animationMode() == FromByAnimation && !animatedPropertyTypeSupportsAddition())
+ return false;
+
ASSERT(!hasTagName(SVGNames::setTag));
determinePropertyValueTypes(fromString, byString);
@@ -372,21 +376,40 @@
notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName());
}
+bool SVGAnimateElement::animatedPropertyTypeSupportsAddition() const
+{
+ // Spec: http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties.
+ switch (m_animatedPropertyType) {
+ case AnimatedBoolean:
+ case AnimatedEnumeration:
+ case AnimatedPreserveAspectRatio:
+ case AnimatedString:
+ case AnimatedUnknown:
+ return false;
+ case AnimatedAngle:
+ case AnimatedColor:
+ case AnimatedInteger:
+ case AnimatedIntegerOptionalInteger:
+ case AnimatedLength:
+ case AnimatedLengthList:
+ case AnimatedNumber:
+ case AnimatedNumberList:
+ case AnimatedNumberOptionalNumber:
+ case AnimatedPath:
+ case AnimatedPoints:
+ case AnimatedRect:
+ case AnimatedTransformList:
+ return true;
+ }
+
+ ASSERT_NOT_REACHED();
+}
+
bool SVGAnimateElement::isAdditive() const
{
- if (animationMode() == ByAnimation || animationMode() == FromByAnimation) {
- // Spec: http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties.
- switch (m_animatedPropertyType) {
- case AnimatedBoolean:
- case AnimatedEnumeration:
- case AnimatedPreserveAspectRatio:
- case AnimatedString:
- case AnimatedUnknown:
+ if (animationMode() == ByAnimation || animationMode() == FromByAnimation)
+ if (!animatedPropertyTypeSupportsAddition())
return false;
- default:
- break;
- }
- }
return SVGAnimationElement::isAdditive();
}
Modified: trunk/Source/WebCore/svg/SVGAnimateElement.h (153886 => 153887)
--- trunk/Source/WebCore/svg/SVGAnimateElement.h 2013-08-09 13:05:37 UTC (rev 153886)
+++ trunk/Source/WebCore/svg/SVGAnimateElement.h 2013-08-09 13:23:26 UTC (rev 153887)
@@ -62,6 +62,7 @@
private:
void resetAnimatedPropertyType();
SVGAnimatedTypeAnimator* ensureAnimator();
+ bool animatedPropertyTypeSupportsAddition() const;
virtual bool hasValidAttributeType();