SVGAnimatedType should support SVGAnimatedIntegerOptionalInteger animation
authorzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 08:30:45 +0000 (08:30 +0000)
committerzimmermann@webkit.org <zimmermann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Mar 2012 08:30:45 +0000 (08:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67563

Reviewed by Dirk Schulze.

Source/WebCore:

Add SVGAnimatedIntegerOptionalInteger type handling animation of pair<int, int> objects
as used for the SVG properties 'filterRes' and 'order'. They're currently animated as
SVGAnimatedNumberOptionalNumber - but that won't work for animVal support. Fix that
and enable animVal support for SVGAnimatedInteger(OptionalInteger).

Use 'int' as datatype for SVGAnimatedInteger instead of 'long' for consistency, and
move SVGAnimatedEnumeration from 'int' to 'unsigned short', to make them distinguishable.

Test: svg/animations/svginteger-animation-2.html

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* svg/SVGAllInOne.cpp:
* svg/SVGAnimatedEnumeration.h:
(WebCore):
* svg/SVGAnimatedInteger.cpp:
(WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
(WebCore):
(WebCore::SVGAnimatedIntegerAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedIntegerAnimator::animValWillChange):
(WebCore::SVGAnimatedIntegerAnimator::animValDidChange):
(WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedInteger):
(WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
* svg/SVGAnimatedInteger.h:
(WebCore):
(SVGAnimatedIntegerAnimator):
* svg/SVGAnimatedIntegerOptionalInteger.cpp: Added.
(WebCore):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::SVGAnimatedIntegerOptionalIntegerAnimator):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::stopAnimValAnimation):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::animValWillChange):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::animValDidChange):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateFromAndToValues):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateFromAndByValues):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateDistance):
* svg/SVGAnimatedIntegerOptionalInteger.h: Copied from Source/WebCore/svg/SVGAnimatedInteger.h.
(WebCore):
(SVGAnimatedIntegerOptionalIntegerAnimator):
(WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::~SVGAnimatedIntegerOptionalIntegerAnimator):
* svg/SVGAnimatedNumberOptionalNumber.cpp:
(WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::~SVGAnimatedType):
(WebCore::SVGAnimatedType::createIntegerOptionalInteger):
(WebCore):
(WebCore::SVGAnimatedType::integerOptionalInteger):
(WebCore::SVGAnimatedType::valueAsString):
(WebCore::SVGAnimatedType::setValueAsString):
(WebCore::SVGAnimatedType::supportsAnimVal):
* svg/SVGAnimatedType.h:
(SVGAnimatedType):
* svg/SVGAnimatorFactory.h:
(WebCore::SVGAnimatorFactory::create):
* svg/SVGFilterElement.cpp:
(WebCore::SVGFilterElement::setFilterRes):
* svg/SVGFilterElement.h:
(SVGFilterElement):
* svg/SVGPathElement.cpp:
(WebCore::SVGPathElement::getPathSegAtLength):
* svg/SVGPathElement.h:
(SVGPathElement):
* svg/SVGPathParserFactory.cpp:
(WebCore::SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathByteStream):
* svg/SVGPathParserFactory.h:
(SVGPathParserFactory):
* svg/SVGPathTraversalStateBuilder.cpp:
(WebCore::SVGPathTraversalStateBuilder::pathSegmentIndex):
* svg/SVGPathTraversalStateBuilder.h:
(SVGPathTraversalStateBuilder):
* svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
(WebCore::SVGAnimatedEnumerationPropertyTearOff::setBaseVal):
(WebCore::SVGAnimatedEnumerationPropertyTearOff::create):
(WebCore::SVGAnimatedEnumerationPropertyTearOff::currentAnimatedValue):
(WebCore::SVGAnimatedEnumerationPropertyTearOff::SVGAnimatedEnumerationPropertyTearOff):
* svg/properties/SVGPropertyInfo.h:
* svg/properties/SVGPropertyTraits.h:

LayoutTests:

Extend SVGAnimatedInteger tests to cover animVal support.

* svg/animations/script-tests/svginteger-animation-1.js:
(sample1):
(sample2):
(sample3):
* svg/animations/script-tests/svginteger-animation-2.js: Copied from LayoutTests/svg/animations/script-tests/svginteger-animation-1.js.
(sample1):
(sample2):
(sample3):
(executeTest):
* svg/animations/svginteger-animation-1-expected.txt:
* svg/animations/svginteger-animation-2-expected.txt: Added.
* svg/animations/svginteger-animation-2.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@112224 268f45cc-cd09-0410-ab3c-d52691b4dbfc

33 files changed:
LayoutTests/ChangeLog
LayoutTests/svg/animations/script-tests/svginteger-animation-1.js
LayoutTests/svg/animations/script-tests/svginteger-animation-2.js [new file with mode: 0644]
LayoutTests/svg/animations/svginteger-animation-1-expected.txt
LayoutTests/svg/animations/svginteger-animation-2-expected.txt [new file with mode: 0644]
LayoutTests/svg/animations/svginteger-animation-2.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/svg/SVGAllInOne.cpp
Source/WebCore/svg/SVGAnimatedEnumeration.h
Source/WebCore/svg/SVGAnimatedInteger.cpp
Source/WebCore/svg/SVGAnimatedInteger.h
Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp [new file with mode: 0644]
Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.h [new file with mode: 0644]
Source/WebCore/svg/SVGAnimatedType.cpp
Source/WebCore/svg/SVGAnimatedType.h
Source/WebCore/svg/SVGAnimatorFactory.h
Source/WebCore/svg/SVGFilterElement.cpp
Source/WebCore/svg/SVGFilterElement.h
Source/WebCore/svg/SVGPathElement.cpp
Source/WebCore/svg/SVGPathElement.h
Source/WebCore/svg/SVGPathParserFactory.cpp
Source/WebCore/svg/SVGPathParserFactory.h
Source/WebCore/svg/SVGPathTraversalStateBuilder.cpp
Source/WebCore/svg/SVGPathTraversalStateBuilder.h
Source/WebCore/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h
Source/WebCore/svg/properties/SVGPropertyInfo.h
Source/WebCore/svg/properties/SVGPropertyTraits.h

index c5087c1..25e40da 100644 (file)
@@ -1,3 +1,25 @@
+2012-03-27  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        SVGAnimatedType should support SVGAnimatedIntegerOptionalInteger animation
+        https://bugs.webkit.org/show_bug.cgi?id=67563
+
+        Reviewed by Dirk Schulze.
+
+        Extend SVGAnimatedInteger tests to cover animVal support.
+
+        * svg/animations/script-tests/svginteger-animation-1.js:
+        (sample1):
+        (sample2):
+        (sample3):
+        * svg/animations/script-tests/svginteger-animation-2.js: Copied from LayoutTests/svg/animations/script-tests/svginteger-animation-1.js.
+        (sample1):
+        (sample2):
+        (sample3):
+        (executeTest):
+        * svg/animations/svginteger-animation-1-expected.txt:
+        * svg/animations/svginteger-animation-2-expected.txt: Added.
+        * svg/animations/svginteger-animation-2.html: Added.
+
 2012-03-25  Nikolas Zimmermann  <nzimmermann@rim.com>
 
         Enable animVal support for SVGAngle
index 6a55f01..7d939cd 100644 (file)
@@ -37,17 +37,17 @@ feConvlveMatrix.appendChild(animate);
 // Setup animation test
 function sample1() {
     shouldBeCloseEnough("feConvolveMatrix.targetX.animVal", "0");
-    // shouldBe("feConvolveMatrix.targetX.baseVal", "0");
+    shouldBe("feConvolveMatrix.targetX.baseVal", "0");
 }
 
 function sample2() {
     shouldBeCloseEnough("feConvolveMatrix.targetX.animVal", "1");
-    // shouldBe("feConvolveMatrix.targetX.baseVal", "0");
+    shouldBe("feConvolveMatrix.targetX.baseVal", "0");
 }
 
 function sample3() {
     shouldBeCloseEnough("feConvolveMatrix.targetX.animVal", "2");
-    // shouldBe("feConvolveMatrix.targetX.baseVal", "0");
+    shouldBe("feConvolveMatrix.targetX.baseVal", "0");
 }
 
 function executeTest() {
diff --git a/LayoutTests/svg/animations/script-tests/svginteger-animation-2.js b/LayoutTests/svg/animations/script-tests/svginteger-animation-2.js
new file mode 100644 (file)
index 0000000..dc5cab4
--- /dev/null
@@ -0,0 +1,70 @@
+description("Test animation of SVGInteger.");
+createSVGTestCase();
+
+// Setup test document
+var defs = createSVGElement("defs");
+rootSVGElement.appendChild(defs);
+
+var filter = createSVGElement("filter");
+filter.setAttribute("id", "filter");
+defs.appendChild(filter);
+
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("width", "200");
+rect.setAttribute("height", "200");
+rect.setAttribute("fill", "green");
+rect.setAttribute("filter", "url(#filter)");
+rect.setAttribute("onclick", "executeTest()");
+rootSVGElement.appendChild(rect);
+
+var feConvolveMatrix = createSVGElement("feConvolveMatrix");
+feConvolveMatrix.setAttribute("id", "feConvlveMatrix");
+feConvolveMatrix.setAttribute("order", "3 1");
+feConvolveMatrix.setAttribute("kernelMatrix", "0 0 1");
+filter.appendChild(feConvolveMatrix);
+
+var animate = createSVGElement("animate");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "order");
+animate.setAttribute("begin", "rect.click");
+animate.setAttribute("dur", "4s");
+animate.setAttribute("from", "3 1");
+animate.setAttribute("to", "1 3");
+feConvlveMatrix.appendChild(animate);
+
+// Setup animation test
+function sample1() {
+    shouldBeCloseEnough("feConvolveMatrix.orderX.animVal", "3");
+    shouldBeCloseEnough("feConvolveMatrix.orderY.animVal", "1");
+    shouldBe("feConvolveMatrix.orderX.baseVal", "3");
+    shouldBe("feConvolveMatrix.orderY.baseVal", "1");
+}
+
+function sample2() {
+    shouldBeCloseEnough("feConvolveMatrix.orderX.animVal", "2");
+    shouldBeCloseEnough("feConvolveMatrix.orderY.animVal", "2");
+    shouldBe("feConvolveMatrix.orderX.baseVal", "3");
+    shouldBe("feConvolveMatrix.orderY.baseVal", "1");
+}
+
+function sample3() {
+    shouldBeCloseEnough("feConvolveMatrix.orderX.animVal", "1");
+    shouldBeCloseEnough("feConvolveMatrix.orderY.animVal", "3");
+    shouldBe("feConvolveMatrix.orderX.baseVal", "3");
+    shouldBe("feConvolveMatrix.orderY.baseVal", "1");
+}
+
+function executeTest() {
+    const expectedValues = [
+        // [animationId, time, sampleCallback]
+        ["animation", 0.0,   sample1],
+        ["animation", 2.0,   sample2],
+        ["animation", 3.999, sample3],
+        ["animation", 4.001, sample1]
+    ];
+
+    runAnimationTest(expectedValues);
+}
+
+var successfullyParsed = true;
index 3d37a73..f09b58d 100644 (file)
@@ -6,9 +6,13 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS feConvolveMatrix.targetX.animVal is 0
+PASS feConvolveMatrix.targetX.baseVal is 0
 PASS feConvolveMatrix.targetX.animVal is 1
+PASS feConvolveMatrix.targetX.baseVal is 0
 PASS feConvolveMatrix.targetX.animVal is 2
+PASS feConvolveMatrix.targetX.baseVal is 0
 PASS feConvolveMatrix.targetX.animVal is 0
+PASS feConvolveMatrix.targetX.baseVal is 0
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/svg/animations/svginteger-animation-2-expected.txt b/LayoutTests/svg/animations/svginteger-animation-2-expected.txt
new file mode 100644 (file)
index 0000000..ea01d0c
--- /dev/null
@@ -0,0 +1,27 @@
+SVG 1.1 dynamic animation tests
+
+Test animation of SVGInteger.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS feConvolveMatrix.orderX.animVal is 3
+PASS feConvolveMatrix.orderY.animVal is 1
+PASS feConvolveMatrix.orderX.baseVal is 3
+PASS feConvolveMatrix.orderY.baseVal is 1
+PASS feConvolveMatrix.orderX.animVal is 2
+PASS feConvolveMatrix.orderY.animVal is 2
+PASS feConvolveMatrix.orderX.baseVal is 3
+PASS feConvolveMatrix.orderY.baseVal is 1
+PASS feConvolveMatrix.orderX.animVal is 1
+PASS feConvolveMatrix.orderY.animVal is 3
+PASS feConvolveMatrix.orderX.baseVal is 3
+PASS feConvolveMatrix.orderY.baseVal is 1
+PASS feConvolveMatrix.orderX.animVal is 3
+PASS feConvolveMatrix.orderY.animVal is 1
+PASS feConvolveMatrix.orderX.baseVal is 3
+PASS feConvolveMatrix.orderY.baseVal is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/animations/svginteger-animation-2.html b/LayoutTests/svg/animations/svginteger-animation-2.html
new file mode 100644 (file)
index 0000000..973f0b3
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../dynamic-updates/resources/SVGTestCase.js"></script>
+<script src="resources/SVGAnimationTestCase.js"></script>
+</head>
+<body onload="runSMILTest()">
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/svginteger-animation-2.js"></script>
+</body>
+</html>
index 5f977f8..1b6a23e 100644 (file)
@@ -1768,6 +1768,7 @@ IF (ENABLE_SVG)
         svg/SVGAnimatedBoolean.cpp
         svg/SVGAnimatedColor.cpp
         svg/SVGAnimatedInteger.cpp
+        svg/SVGAnimatedIntegerOptionalInteger.cpp
         svg/SVGAnimatedLength.cpp
         svg/SVGAnimatedLengthList.cpp
         svg/SVGAnimatedNumber.cpp
index 749ae00..7c8648f 100644 (file)
@@ -1,3 +1,96 @@
+2012-03-27  Nikolas Zimmermann  <nzimmermann@rim.com>
+
+        SVGAnimatedType should support SVGAnimatedIntegerOptionalInteger animation
+        https://bugs.webkit.org/show_bug.cgi?id=67563
+
+        Reviewed by Dirk Schulze.
+
+        Add SVGAnimatedIntegerOptionalInteger type handling animation of pair<int, int> objects
+        as used for the SVG properties 'filterRes' and 'order'. They're currently animated as
+        SVGAnimatedNumberOptionalNumber - but that won't work for animVal support. Fix that
+        and enable animVal support for SVGAnimatedInteger(OptionalInteger).
+
+        Use 'int' as datatype for SVGAnimatedInteger instead of 'long' for consistency, and
+        move SVGAnimatedEnumeration from 'int' to 'unsigned short', to make them distinguishable.
+
+        Test: svg/animations/svginteger-animation-2.html
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * Target.pri:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * svg/SVGAllInOne.cpp:
+        * svg/SVGAnimatedEnumeration.h:
+        (WebCore):
+        * svg/SVGAnimatedInteger.cpp:
+        (WebCore::SVGAnimatedIntegerAnimator::startAnimValAnimation):
+        (WebCore):
+        (WebCore::SVGAnimatedIntegerAnimator::stopAnimValAnimation):
+        (WebCore::SVGAnimatedIntegerAnimator::resetAnimValToBaseVal):
+        (WebCore::SVGAnimatedIntegerAnimator::animValWillChange):
+        (WebCore::SVGAnimatedIntegerAnimator::animValDidChange):
+        (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedInteger):
+        (WebCore::SVGAnimatedIntegerAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedInteger.h:
+        (WebCore):
+        (SVGAnimatedIntegerAnimator):
+        * svg/SVGAnimatedIntegerOptionalInteger.cpp: Added.
+        (WebCore):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::SVGAnimatedIntegerOptionalIntegerAnimator):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::stopAnimValAnimation):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::animValWillChange):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::animValDidChange):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateFromAndToValues):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateFromAndByValues):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::calculateDistance):
+        * svg/SVGAnimatedIntegerOptionalInteger.h: Copied from Source/WebCore/svg/SVGAnimatedInteger.h.
+        (WebCore):
+        (SVGAnimatedIntegerOptionalIntegerAnimator):
+        (WebCore::SVGAnimatedIntegerOptionalIntegerAnimator::~SVGAnimatedIntegerOptionalIntegerAnimator):
+        * svg/SVGAnimatedNumberOptionalNumber.cpp:
+        (WebCore::SVGAnimatedNumberOptionalNumberAnimator::calculateAnimatedValue):
+        * svg/SVGAnimatedType.cpp:
+        (WebCore::SVGAnimatedType::~SVGAnimatedType):
+        (WebCore::SVGAnimatedType::createIntegerOptionalInteger):
+        (WebCore):
+        (WebCore::SVGAnimatedType::integerOptionalInteger):
+        (WebCore::SVGAnimatedType::valueAsString):
+        (WebCore::SVGAnimatedType::setValueAsString):
+        (WebCore::SVGAnimatedType::supportsAnimVal):
+        * svg/SVGAnimatedType.h:
+        (SVGAnimatedType):
+        * svg/SVGAnimatorFactory.h:
+        (WebCore::SVGAnimatorFactory::create):
+        * svg/SVGFilterElement.cpp:
+        (WebCore::SVGFilterElement::setFilterRes):
+        * svg/SVGFilterElement.h:
+        (SVGFilterElement):
+        * svg/SVGPathElement.cpp:
+        (WebCore::SVGPathElement::getPathSegAtLength):
+        * svg/SVGPathElement.h:
+        (SVGPathElement):
+        * svg/SVGPathParserFactory.cpp:
+        (WebCore::SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathByteStream):
+        * svg/SVGPathParserFactory.h:
+        (SVGPathParserFactory):
+        * svg/SVGPathTraversalStateBuilder.cpp:
+        (WebCore::SVGPathTraversalStateBuilder::pathSegmentIndex):
+        * svg/SVGPathTraversalStateBuilder.h:
+        (SVGPathTraversalStateBuilder):
+        * svg/properties/SVGAnimatedEnumerationPropertyTearOff.h:
+        (WebCore::SVGAnimatedEnumerationPropertyTearOff::setBaseVal):
+        (WebCore::SVGAnimatedEnumerationPropertyTearOff::create):
+        (WebCore::SVGAnimatedEnumerationPropertyTearOff::currentAnimatedValue):
+        (WebCore::SVGAnimatedEnumerationPropertyTearOff::SVGAnimatedEnumerationPropertyTearOff):
+        * svg/properties/SVGPropertyInfo.h:
+        * svg/properties/SVGPropertyTraits.h:
+
 2012-03-25  Nikolas Zimmermann  <nzimmermann@rim.com>
 
         Enable animVal support for SVGAngle
index dbad014..b86818a 100644 (file)
@@ -4128,6 +4128,8 @@ webcore_sources += \
        Source/WebCore/svg/SVGAnimatedEnumeration.h \
        Source/WebCore/svg/SVGAnimatedInteger.cpp \
        Source/WebCore/svg/SVGAnimatedInteger.h \
+       Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp \
+       Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.h \
        Source/WebCore/svg/SVGAnimatedLength.cpp \
        Source/WebCore/svg/SVGAnimatedLength.h \
        Source/WebCore/svg/SVGAnimatedLengthList.cpp \
index 2cf36fb..f03affe 100644 (file)
@@ -2604,6 +2604,7 @@ HEADERS += \
     svg/SVGAnimatedColor.h \
     svg/SVGAnimatedEnumeration.h \
     svg/SVGAnimatedInteger.h \
+    svg/SVGAnimatedIntegerOptionalInteger.h \
     svg/SVGAnimatedLength.h \
     svg/SVGAnimatedLengthList.h \
     svg/SVGAnimatedNumber.h \
@@ -3506,6 +3507,7 @@ contains(DEFINES, ENABLE_SVG=1) {
                   svg/SVGAnimatedBoolean.cpp \
                   svg/SVGAnimatedColor.cpp \
                   svg/SVGAnimatedInteger.cpp \
+                  svg/SVGAnimatedIntegerOptionalInteger.cpp \
                   svg/SVGAnimatedLength.cpp \
                   svg/SVGAnimatedLengthList.cpp \
                   svg/SVGAnimatedNumber.cpp \
index 3d2ef79..908034d 100644 (file)
             'svg/SVGAnimatedColor.h',
             'svg/SVGAnimatedEnumeration.h',
             'svg/SVGAnimatedInteger.h',
+            'svg/SVGAnimatedIntegerOptionalInteger.h',
             'svg/SVGAnimatedLength.h',
             'svg/SVGAnimatedLengthList.h',
             'svg/SVGAnimatedNumber.h',
             'svg/SVGAnimatedBoolean.cpp',
             'svg/SVGAnimatedColor.cpp',
             'svg/SVGAnimatedInteger.cpp',
+            'svg/SVGAnimatedIntegerOptionalInteger.cpp',
             'svg/SVGAnimatedLength.cpp',
             'svg/SVGAnimatedLengthList.cpp',
             'svg/SVGAnimatedNumber.cpp',
index 08ee780..a3fbe15 100755 (executable)
                                >
                        </File>
                        <File
+                               RelativePath="..\svg\SVGAnimatedIntegerOptionalInteger.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\svg\SVGAnimatedLength.h"
                                >
                        </File>
index f5f5e30..03e973f 100644 (file)
                7134496E146941B300720312 /* SVGLengthContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 7134496C146941B300720312 /* SVGLengthContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                71537A01146BD9D7008BD615 /* SVGPathData.h in Headers */ = {isa = PBXBuildFile; fileRef = 715379FF146BD9D6008BD615 /* SVGPathData.h */; };
                7157F062150B6564006EAABD /* SVGAnimatedTransformList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */; };
+               71E623D0151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 71E623CE151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.cpp */; };
+               71E623D1151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h in Headers */ = {isa = PBXBuildFile; fileRef = 71E623CF151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h */; };
                71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */; settings = {ATTRIBUTES = (Private, ); }; };
                72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; };
                750D029311D0E7F300BD1B27 /* RenderInputSpeech.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */; };
                715379FE146BD9D6008BD615 /* SVGPathData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGPathData.cpp; sourceTree = "<group>"; };
                715379FF146BD9D6008BD615 /* SVGPathData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathData.h; sourceTree = "<group>"; };
                7157F061150B6564006EAABD /* SVGAnimatedTransformList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedTransformList.cpp; sourceTree = "<group>"; };
+               71E623CE151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedIntegerOptionalInteger.cpp; sourceTree = "<group>"; };
+               71E623CF151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedIntegerOptionalInteger.h; sourceTree = "<group>"; };
                71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedEnumerationPropertyTearOff.h; sourceTree = "<group>"; };
                72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; };
                750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderInputSpeech.cpp; sourceTree = "<group>"; };
                                43F6FD9513BCD0B100224052 /* SVGAnimatedInteger.cpp */,
                                0823D158127AD6AC000EBC95 /* SVGAnimatedInteger.h */,
                                B22277E90D00BF1F0071B782 /* SVGAnimatedInteger.idl */,
+                               71E623CE151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.cpp */,
+                               71E623CF151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h */,
                                4381763A13A697D4007D1187 /* SVGAnimatedLength.cpp */,
                                089021A8126EF5DE0092D5EA /* SVGAnimatedLength.h */,
                                B22277EA0D00BF1F0071B782 /* SVGAnimatedLength.idl */,
                                E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */,
                                977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */,
                                FD537353137B651800008DCE /* ZeroPole.h in Headers */,
+                               71E623D1151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
                                977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
                                FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
+                               71E623D0151F72A60036E2F4 /* SVGAnimatedIntegerOptionalInteger.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 4f09d5c..b8d2fc9 100644 (file)
@@ -36,6 +36,7 @@
 #include "SVGAnimatedBoolean.cpp"
 #include "SVGAnimatedColor.cpp"
 #include "SVGAnimatedInteger.cpp"
+#include "SVGAnimatedIntegerOptionalInteger.cpp"
 #include "SVGAnimatedLength.cpp"
 #include "SVGAnimatedLengthList.cpp"
 #include "SVGAnimatedNumber.cpp"
index 0ad75ba..863c87f 100644 (file)
@@ -26,7 +26,7 @@
 
 namespace WebCore {
 
-typedef SVGAnimatedStaticPropertyTearOff<int> SVGAnimatedEnumeration;
+typedef SVGAnimatedStaticPropertyTearOff<unsigned short> SVGAnimatedEnumeration;
 
 // Helper macros to declare/define a SVGAnimatedEnumeration object
 #define DECLARE_ANIMATED_ENUMERATION(UpperProperty, LowerProperty, EnumType) \
index b400b26..f92eb7b 100644 (file)
@@ -40,6 +40,31 @@ PassOwnPtr<SVGAnimatedType> SVGAnimatedIntegerAnimator::constructFromString(cons
     return animtedType.release();
 }
 
+PassOwnPtr<SVGAnimatedType> SVGAnimatedIntegerAnimator::startAnimValAnimation(const Vector<SVGAnimatedProperty*>& properties)
+{
+    return SVGAnimatedType::createInteger(constructFromOneBaseValue<int, SVGAnimatedInteger>(properties));
+}
+
+void SVGAnimatedIntegerAnimator::stopAnimValAnimation(const Vector<SVGAnimatedProperty*>& properties)
+{
+    SVGAnimatedTypeAnimator::stopAnimValAnimationForType<SVGAnimatedInteger>(properties);
+}
+
+void SVGAnimatedIntegerAnimator::resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>& properties, SVGAnimatedType* type)
+{
+    resetFromOneBaseValue<int, SVGAnimatedInteger>(properties, type, &SVGAnimatedType::integer);
+}
+
+void SVGAnimatedIntegerAnimator::animValWillChange(const Vector<SVGAnimatedProperty*>& properties)
+{
+    animValWillChangeForType<SVGAnimatedInteger>(properties);
+}
+
+void SVGAnimatedIntegerAnimator::animValDidChange(const Vector<SVGAnimatedProperty*>& properties)
+{
+    animValDidChangeForType<SVGAnimatedInteger>(properties);
+}
+
 void SVGAnimatedIntegerAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
 {
     ASSERT(m_contextElement);
@@ -64,6 +89,13 @@ void SVGAnimatedIntegerAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType
     to->integer() += from->integer();
 }
 
+void SVGAnimatedIntegerAnimator::calculateAnimatedInteger(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, int& animatedNumber, int fromNumber, int toNumber)
+{
+    float animatedFloat = animatedNumber;
+    SVGAnimatedNumberAnimator::calculateAnimatedNumber(animationElement, percentage, repeatCount, animatedFloat, fromNumber, toNumber);
+    animatedNumber = static_cast<int>(roundf(animatedFloat));
+}
+
 void SVGAnimatedIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount,
                                                         OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
 {
@@ -77,10 +109,8 @@ void SVGAnimatedIntegerAnimator::calculateAnimatedValue(float percentage, unsign
     int& animatedInt = animated->integer();
     if (animationMode == ToAnimation)
         from->integer() = animatedInt;
-    
-    float result = animatedInt;
-    SVGAnimatedNumberAnimator::calculateAnimatedNumber(animationElement, percentage, repeatCount, result, from->integer(), to->integer());
-    animatedInt = static_cast<int>(roundf(result));
+
+    calculateAnimatedInteger(animationElement, percentage, repeatCount, animatedInt, from->integer(), to->integer());
 }
 
 float SVGAnimatedIntegerAnimator::calculateDistance(const String& fromString, const String& toString)
index 512d7c2..95cceb9 100644 (file)
 
 namespace WebCore {
 
-typedef SVGAnimatedStaticPropertyTearOff<long> SVGAnimatedInteger;
+typedef SVGAnimatedStaticPropertyTearOff<int> SVGAnimatedInteger;
 
 // Helper macros to declare/define a SVGAnimatedInteger object
 #define DECLARE_ANIMATED_INTEGER(UpperProperty, LowerProperty) \
-DECLARE_ANIMATED_PROPERTY(SVGAnimatedInteger, long, UpperProperty, LowerProperty)
+DECLARE_ANIMATED_PROPERTY(SVGAnimatedInteger, int, UpperProperty, LowerProperty)
 
 #define DEFINE_ANIMATED_INTEGER(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
 DEFINE_ANIMATED_PROPERTY(AnimatedInteger, OwnerType, DOMAttribute, DOMAttribute.localName(), UpperProperty, LowerProperty)
 
-// FIXME: This currently animates as number-optional-number, instead of integer-optional-integer, which is missing.
 #define DEFINE_ANIMATED_INTEGER_MULTIPLE_WRAPPERS(OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty) \
-DEFINE_ANIMATED_PROPERTY(AnimatedNumberOptionalNumber, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty)
+DEFINE_ANIMATED_PROPERTY(AnimatedIntegerOptionalInteger, OwnerType, DOMAttribute, SVGDOMAttributeIdentifier, UpperProperty, LowerProperty)
 
 class SVGAnimationElement;
 
@@ -48,10 +47,15 @@ public:
     SVGAnimatedIntegerAnimator(SVGAnimationElement*, SVGElement*);
     virtual ~SVGAnimatedIntegerAnimator() { }
     
-    static void calculateAnimatedNumber(SVGAnimationElement*, float percentage, unsigned repeatCount, float& animatedNumber, float fromNumber, float toNumber);
-    
+    static void calculateAnimatedInteger(SVGAnimationElement*, float percentage, unsigned repeatCount, int& animatedNumber, int fromNumber, int toNumber);
+
     virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&);
-    
+    virtual PassOwnPtr<SVGAnimatedType> startAnimValAnimation(const Vector<SVGAnimatedProperty*>&);
+    virtual void stopAnimValAnimation(const Vector<SVGAnimatedProperty*>&);
+    virtual void resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>&, SVGAnimatedType*);
+    virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
+    virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
+
     virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
     virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
     virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
diff --git a/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp b/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.cpp
new file mode 100644 (file)
index 0000000..931d824
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) Research In Motion Limited 2012. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#if ENABLE(SVG)
+#include "SVGAnimatedIntegerOptionalInteger.h"
+
+#include "SVGAnimateElement.h"
+#include "SVGAnimatedInteger.h"
+#include "SVGParserUtilities.h"
+
+namespace WebCore {
+
+SVGAnimatedIntegerOptionalIntegerAnimator::SVGAnimatedIntegerOptionalIntegerAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
+    : SVGAnimatedTypeAnimator(AnimatedIntegerOptionalInteger, animationElement, contextElement)
+{
+}
+
+PassOwnPtr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::constructFromString(const String& string)
+{
+    OwnPtr<SVGAnimatedType> animtedType = SVGAnimatedType::createIntegerOptionalInteger(new pair<int, int>);
+    pair<int, int>& animatedInteger = animtedType->integerOptionalInteger();
+    float firstNumber = 0;
+    float secondNumber = 0;
+    if (!parseNumberOptionalNumber(string, firstNumber, secondNumber)) {
+        animatedInteger.first = 0;
+        animatedInteger.second = 0;
+    } else {
+        animatedInteger.first = static_cast<int>(roundf(firstNumber));
+        animatedInteger.second = static_cast<int>(roundf(secondNumber));
+    }
+    return animtedType.release();
+}
+
+PassOwnPtr<SVGAnimatedType> SVGAnimatedIntegerOptionalIntegerAnimator::startAnimValAnimation(const Vector<SVGAnimatedProperty*>& properties)
+{
+    return SVGAnimatedType::createIntegerOptionalInteger(constructFromTwoBaseValues<pair<int, int>, int, SVGAnimatedInteger>(properties));
+}
+
+void SVGAnimatedIntegerOptionalIntegerAnimator::stopAnimValAnimation(const Vector<SVGAnimatedProperty*>& properties)
+{
+    SVGAnimatedTypeAnimator::stopAnimValAnimationForType<SVGAnimatedInteger>(properties);
+}
+
+void SVGAnimatedIntegerOptionalIntegerAnimator::resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>& properties, SVGAnimatedType* type)
+{
+    resetFromTwoBaseValues<pair<int, int>, int, SVGAnimatedInteger>(properties, type, &SVGAnimatedType::integerOptionalInteger);
+}
+
+void SVGAnimatedIntegerOptionalIntegerAnimator::animValWillChange(const Vector<SVGAnimatedProperty*>& properties)
+{
+    animValWillChangeForType<SVGAnimatedInteger>(properties);
+}
+
+void SVGAnimatedIntegerOptionalIntegerAnimator::animValDidChange(const Vector<SVGAnimatedProperty*>& properties)
+{
+    animValDidChangeForType<SVGAnimatedInteger>(properties);
+}
+
+void SVGAnimatedIntegerOptionalIntegerAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+{
+    ASSERT(m_contextElement);
+    ASSERT(m_animationElement);
+    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
+    animationElement->determinePropertyValueTypes(fromString, toString);
+    
+    from = constructFromString(fromString);
+    to = constructFromString(toString);
+}
+
+void SVGAnimatedIntegerOptionalIntegerAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
+{
+    ASSERT(m_contextElement);
+    ASSERT(m_animationElement);
+    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
+    animationElement->determinePropertyValueTypes(fromString, byString);
+    
+    from = constructFromString(fromString);
+    to = constructFromString(byString);
+
+    pair<int, int>& fromNumberPair = from->integerOptionalInteger();
+    pair<int, int>& toNumberPair = to->integerOptionalInteger();
+    
+    toNumberPair.first += fromNumberPair.first;
+    toNumberPair.second += fromNumberPair.second;
+}
+
+void SVGAnimatedIntegerOptionalIntegerAnimator::calculateAnimatedValue(float percentage, unsigned repeatCount,
+                                                       OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, OwnPtr<SVGAnimatedType>& animated)
+{
+    ASSERT(m_animationElement);
+    ASSERT(m_contextElement);
+
+    SVGAnimateElement* animationElement = static_cast<SVGAnimateElement*>(m_animationElement);
+    AnimationMode animationMode = animationElement->animationMode();
+
+    // To animation uses contributions from the lower priority animations as the base value.
+    pair<int, int>& fromNumberPair = from->integerOptionalInteger();
+    pair<int, int>& animatedNumberPair = animated->integerOptionalInteger();
+    if (animationMode == ToAnimation)
+        fromNumberPair = animatedNumberPair;
+
+    pair<int, int>& toNumberPair = to->integerOptionalInteger();
+    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(animationElement, percentage, repeatCount, animatedNumberPair.first, fromNumberPair.first, toNumberPair.first);
+    SVGAnimatedIntegerAnimator::calculateAnimatedInteger(animationElement, percentage, repeatCount, animatedNumberPair.second, fromNumberPair.second, toNumberPair.second);
+}
+
+float SVGAnimatedIntegerOptionalIntegerAnimator::calculateDistance(const String&, const String&)
+{
+    // FIXME: Distance calculation is not possible for SVGIntegerOptionalInteger right now. We need the distance for every single value.
+    return -1;
+}
+
+}
+
+#endif // ENABLE(SVG)
diff --git a/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.h b/Source/WebCore/svg/SVGAnimatedIntegerOptionalInteger.h
new file mode 100644 (file)
index 0000000..544565d
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) Research In Motion Limited 2012. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGAnimatedIntegerOptionalInteger_h
+#define SVGAnimatedIntegerOptionalInteger_h
+
+#if ENABLE(SVG)
+#include "SVGAnimatedTypeAnimator.h"
+
+namespace WebCore {
+
+class SVGAnimationElement;
+
+class SVGAnimatedIntegerOptionalIntegerAnimator : public SVGAnimatedTypeAnimator {
+public:
+    SVGAnimatedIntegerOptionalIntegerAnimator(SVGAnimationElement*, SVGElement*);
+    virtual ~SVGAnimatedIntegerOptionalIntegerAnimator() { }
+    
+    virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&);
+    virtual PassOwnPtr<SVGAnimatedType> startAnimValAnimation(const Vector<SVGAnimatedProperty*>&);
+    virtual void stopAnimValAnimation(const Vector<SVGAnimatedProperty*>&);
+    virtual void resetAnimValToBaseVal(const Vector<SVGAnimatedProperty*>&, SVGAnimatedType*);
+    virtual void animValWillChange(const Vector<SVGAnimatedProperty*>&);
+    virtual void animValDidChange(const Vector<SVGAnimatedProperty*>&);
+
+    virtual void calculateFromAndToValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& toString);
+    virtual void calculateFromAndByValues(OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, const String& fromString, const String& byString);
+    virtual void calculateAnimatedValue(float percentage, unsigned repeatCount,
+                                        OwnPtr<SVGAnimatedType>& fromValue, OwnPtr<SVGAnimatedType>& toValue, OwnPtr<SVGAnimatedType>& animatedValue);
+    virtual float calculateDistance(const String& fromString, const String& toString);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SVG)
+#endif
index 0272093..4bfb5fc 100644 (file)
@@ -55,9 +55,16 @@ SVGAnimatedType::~SVGAnimatedType()
     case AnimatedColor:
         delete m_data.color;
         break;
+    case AnimatedEnumeration:
+        // FIXME: AnimatedEnumeration is left todo.
+        ASSERT_NOT_REACHED();
+        break;
     case AnimatedInteger:
         delete m_data.integer;
         break;
+    case AnimatedIntegerOptionalInteger:
+        delete m_data.integerOptionalInteger;
+        break;
     case AnimatedLength:
         delete m_data.length;
         break;
@@ -91,7 +98,7 @@ SVGAnimatedType::~SVGAnimatedType()
     case AnimatedTransformList:
         delete m_data.transformList;
         break;
-    default:
+    case AnimatedUnknown:
         ASSERT_NOT_REACHED();
         break;
     }
@@ -129,6 +136,14 @@ PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createInteger(int* integer)
     return animatedType.release();
 }
 
+PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createIntegerOptionalInteger(pair<int, int>* integerOptionalInteger)
+{
+    ASSERT(integerOptionalInteger);
+    OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(AnimatedIntegerOptionalInteger));
+    animatedType->m_data.integerOptionalInteger = integerOptionalInteger;
+    return animatedType.release();
+}
+
 PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createLength(SVGLength* length)
 {
     ASSERT(length);
@@ -241,6 +256,12 @@ int& SVGAnimatedType::integer()
     return *m_data.integer;
 }
 
+pair<int, int>& SVGAnimatedType::integerOptionalInteger()
+{
+    ASSERT(m_type == AnimatedIntegerOptionalInteger);
+    return *m_data.integerOptionalInteger;        
+}
+
 SVGLength& SVGAnimatedType::length()
 {
     ASSERT(m_type == AnimatedLength);
@@ -322,6 +343,9 @@ String SVGAnimatedType::valueAsString()
     case AnimatedInteger:
         ASSERT(m_data.integer);
         return String::number(*m_data.integer);
+    case AnimatedIntegerOptionalInteger:
+        ASSERT(m_data.integerOptionalInteger);
+        return String::number(m_data.integerOptionalInteger->first) + ' ' + String::number(m_data.integerOptionalInteger->second);
     case AnimatedLength:
         ASSERT(m_data.length);
         return m_data.length->valueAsString();
@@ -359,7 +383,11 @@ String SVGAnimatedType::valueAsString()
      case AnimatedTransformList:
         ASSERT(m_data.transformList);
         return m_data.transformList->valueAsString();
-    default:
+    case AnimatedEnumeration:
+        // FIXME: AnimatedEnumeration is left todo.
+        ASSERT_NOT_REACHED();
+        break;
+    case AnimatedUnknown:
         break;
     }
     ASSERT_NOT_REACHED();
@@ -382,14 +410,10 @@ bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const Stri
         ASSERT(m_data.color);
         *m_data.color = value.isEmpty() ? Color() : SVGColor::colorFromRGBColorString(value);
         break;
-    case AnimatedInteger: {
-        ASSERT(m_data.integer);
-        bool ok;
-        *m_data.integer = value.toIntStrict(&ok);
-        if (!ok)
-            ec = 1; // Arbitary value > 0, it doesn't matter as we don't report the exception code.
+    case AnimatedEnumeration:
+        // FIXME: AnimatedEnumeration is left todo.
+        ASSERT_NOT_REACHED();
         break;
-    }
     case AnimatedLength:
         ASSERT(m_data.length);
         m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName), ec);
@@ -402,14 +426,6 @@ bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const Stri
         ASSERT(m_data.number);
         parseNumberFromString(value, *m_data.number);
         break;
-    case AnimatedNumberList:
-        ASSERT(m_data.numberList);
-        m_data.numberList->parse(value);
-        break;
-    case AnimatedNumberOptionalNumber:
-        ASSERT(m_data.numberOptionalNumber);
-        parseNumberOptionalNumber(value, m_data.numberOptionalNumber->first, m_data.numberOptionalNumber->second);
-        break;
     case AnimatedPath: {
         ASSERT(m_data.path);
         OwnPtr<SVGPathByteStream> pathByteStream = adoptPtr(m_data.path);
@@ -435,8 +451,15 @@ bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const Stri
         ASSERT(m_data.string);
         *m_data.string = value;
         break;
+
+    // These types don't appear in the table in SVGStyledElement::cssPropertyToTypeMap() and thus don't need setValueAsString() support. 
+    case AnimatedNumberList:
+    case AnimatedNumberOptionalNumber:
+    case AnimatedInteger:
+    case AnimatedIntegerOptionalInteger:
     case AnimatedTransformList:
-    default:
+    case AnimatedUnknown:
+        // Only SVG DOM animations use these property types - that means setValueAsString() is never used for those.
         ASSERT_NOT_REACHED();
         break;
     }
@@ -454,6 +477,8 @@ bool SVGAnimatedType::supportsAnimVal(AnimatedPropertyType type)
     // FIXME: This lists the current state of our animVal support.
     switch (type) {
     case AnimatedAngle:
+    case AnimatedInteger:
+    case AnimatedIntegerOptionalInteger:
     case AnimatedLength:
     case AnimatedLengthList:
     case AnimatedNumber:
@@ -464,7 +489,6 @@ bool SVGAnimatedType::supportsAnimVal(AnimatedPropertyType type)
     case AnimatedBoolean:
     case AnimatedColor:
     case AnimatedEnumeration:
-    case AnimatedInteger:
     case AnimatedPath:
     case AnimatedPoints:
     case AnimatedPreserveAspectRatio:
index 9ff19a5..46379d3 100644 (file)
@@ -45,6 +45,7 @@ public:
     static PassOwnPtr<SVGAnimatedType> createBoolean(bool*);
     static PassOwnPtr<SVGAnimatedType> createColor(Color*);
     static PassOwnPtr<SVGAnimatedType> createInteger(int*);
+    static PassOwnPtr<SVGAnimatedType> createIntegerOptionalInteger(std::pair<int, int>*);
     static PassOwnPtr<SVGAnimatedType> createLength(SVGLength*);
     static PassOwnPtr<SVGAnimatedType> createLengthList(SVGLengthList*);
     static PassOwnPtr<SVGAnimatedType> createNumber(float*);
@@ -64,6 +65,7 @@ public:
     bool& boolean();
     Color& color();
     int& integer();
+    std::pair<int, int>& integerOptionalInteger();
     SVGLength& length();
     SVGLengthList& lengthList();
     float& number();
@@ -97,6 +99,7 @@ private:
         bool* boolean;
         Color* color;
         int* integer;
+        std::pair<int, int>* integerOptionalInteger;
         SVGLength* length;
         SVGLengthList* lengthList;
         float* number;
index 028daf6..95c3732 100644 (file)
@@ -25,6 +25,7 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedColor.h"
 #include "SVGAnimatedInteger.h"
+#include "SVGAnimatedIntegerOptionalInteger.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedLengthList.h"
 #include "SVGAnimatedNumber.h"
@@ -57,6 +58,8 @@ public:
             return adoptPtr(new SVGAnimatedColorAnimator(animationElement, contextElement));
         case AnimatedInteger:
             return adoptPtr(new SVGAnimatedIntegerAnimator(animationElement, contextElement));
+        case AnimatedIntegerOptionalInteger:
+            return adoptPtr(new SVGAnimatedIntegerOptionalIntegerAnimator(animationElement, contextElement));
         case AnimatedLength:
             return adoptPtr(new SVGAnimatedLengthAnimator(animationElement, contextElement));
         case AnimatedLengthList:
index 99550a3..9f871c9 100644 (file)
@@ -93,7 +93,7 @@ const AtomicString& SVGFilterElement::filterResYIdentifier()
     return s_identifier;
 }
 
-void SVGFilterElement::setFilterRes(unsigned long filterResX, unsigned long filterResY)
+void SVGFilterElement::setFilterRes(unsigned filterResX, unsigned filterResY)
 {
     setFilterResXBaseValue(filterResX);
     setFilterResYBaseValue(filterResY);
index 48b6766..e865a51 100644 (file)
@@ -43,7 +43,7 @@ class SVGFilterElement : public SVGStyledElement,
 public:
     static PassRefPtr<SVGFilterElement> create(const QualifiedName&, Document*);
 
-    void setFilterRes(unsigned long filterResX, unsigned long filterResY);
+    void setFilterRes(unsigned filterResX, unsigned filterResY);
 
 private:
     SVGFilterElement(const QualifiedName&, Document*);
index ccf8036..ddaabee 100644 (file)
@@ -101,9 +101,9 @@ FloatPoint SVGPathElement::getPointAtLength(float length)
     return point;
 }
 
-unsigned long SVGPathElement::getPathSegAtLength(float length)
+unsigned SVGPathElement::getPathSegAtLength(float length)
 {
-    unsigned long pathSeg = 0;
+    unsigned pathSeg = 0;
     SVGPathParserFactory::self()->getSVGPathSegAtLengthFromSVGPathByteStream(m_pathByteStream.get(), length, pathSeg);
     return pathSeg;
 }
index 0ade5bc..26cc36b 100644 (file)
@@ -62,7 +62,7 @@ public:
     
     float getTotalLength();
     FloatPoint getPointAtLength(float distance);
-    unsigned long getPathSegAtLength(float distance);
+    unsigned getPathSegAtLength(float distance);
 
     PassRefPtr<SVGPathSegClosePath> createSVGPathSegClosePath(SVGPathSegRole role = PathSegUndefinedRole);
     PassRefPtr<SVGPathSegMovetoAbs> createSVGPathSegMovetoAbs(float x, float y, SVGPathSegRole role = PathSegUndefinedRole);
index 01097a7..d848516 100644 (file)
@@ -262,7 +262,7 @@ bool SVGPathParserFactory::buildAnimatedSVGPathByteStream(SVGPathByteStream* fro
     return ok;
 }
 
-bool SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream* stream, float length, unsigned long& pathSeg)
+bool SVGPathParserFactory::getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream* stream, float length, unsigned& pathSeg)
 {
     ASSERT(stream);
     if (stream->isEmpty())
index 894e24e..6593825 100644 (file)
@@ -53,7 +53,7 @@ public:
     bool buildSVGPathSegListFromByteStream(SVGPathByteStream*, SVGPathElement*, SVGPathSegList&, PathParsingMode);
 
     bool buildAnimatedSVGPathByteStream(SVGPathByteStream*, SVGPathByteStream*, OwnPtr<SVGPathByteStream>&, float);
-    bool getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream*, float length, unsigned long& pathSeg);
+    bool getSVGPathSegAtLengthFromSVGPathByteStream(SVGPathByteStream*, float length, unsigned& pathSeg);
     bool getTotalLengthOfSVGPathByteStream(SVGPathByteStream*, float& totalLength);
     bool getPointAtLengthOfSVGPathByteStream(SVGPathByteStream*, float length, FloatPoint&);
 
index 2bca5a2..2bd98e5 100644 (file)
@@ -76,7 +76,7 @@ void SVGPathTraversalStateBuilder::incrementPathSegmentCount()
     ++m_traversalState->m_segmentIndex;
 }
 
-unsigned long SVGPathTraversalStateBuilder::pathSegmentIndex()
+unsigned SVGPathTraversalStateBuilder::pathSegmentIndex()
 {
     ASSERT(m_traversalState);
     return m_traversalState->m_segmentIndex;
index 1726165..b262ddf 100644 (file)
@@ -32,7 +32,7 @@ class SVGPathTraversalStateBuilder : public SVGPathConsumer {
 public:
     SVGPathTraversalStateBuilder();
 
-    unsigned long pathSegmentIndex();
+    unsigned pathSegmentIndex();
     float totalLength();
     FloatPoint currentPoint();
 
index 7e5a626..056768d 100644 (file)
 namespace WebCore {
 
 template<typename EnumType>
-class SVGAnimatedEnumerationPropertyTearOff : public SVGAnimatedStaticPropertyTearOff<int> {
+class SVGAnimatedEnumerationPropertyTearOff : public SVGAnimatedStaticPropertyTearOff<unsigned short> {
 public:
-    virtual void setBaseVal(const int& property, ExceptionCode& ec)
+    virtual void setBaseVal(const unsigned short& property, ExceptionCode& ec)
     {
         // All SVG enumeration values, that are allowed to be set via SVG DOM start with 1, 0 corresponds to unknown and is not settable through SVG DOM.
         if (property <= 0 || property > SVGPropertyTraits<EnumType>::highestEnumValue()) {
             ec = SVGException::SVG_INVALID_VALUE_ERR;
             return;
         }
-        SVGAnimatedStaticPropertyTearOff<int>::setBaseVal(property, ec);
+        SVGAnimatedStaticPropertyTearOff<unsigned short>::setBaseVal(property, ec);
     }
 
     static PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<EnumType> > create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, EnumType& property)
     {
         ASSERT(contextElement);
-        return adoptRef(new SVGAnimatedEnumerationPropertyTearOff<EnumType>(contextElement, attributeName, animatedPropertyType, reinterpret_cast<int&>(property)));
+        return adoptRef(new SVGAnimatedEnumerationPropertyTearOff<EnumType>(contextElement, attributeName, animatedPropertyType, reinterpret_cast<unsigned short&>(property)));
     }
 
-    EnumType& currentAnimatedValue() { return reinterpret_cast<EnumType&>(SVGAnimatedStaticPropertyTearOff<int>::currentAnimatedValue()); }
+    EnumType& currentAnimatedValue() { return reinterpret_cast<EnumType&>(SVGAnimatedStaticPropertyTearOff<unsigned short>::currentAnimatedValue()); }
 
 private:
-    SVGAnimatedEnumerationPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, int& property)
-        : SVGAnimatedStaticPropertyTearOff<int>(contextElement, attributeName, animatedPropertyType, property)
+    SVGAnimatedEnumerationPropertyTearOff(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, unsigned short& property)
+        : SVGAnimatedStaticPropertyTearOff<unsigned short>(contextElement, attributeName, animatedPropertyType, property)
     {
     }
 };
index 19ac2a5..5793128 100644 (file)
@@ -34,6 +34,7 @@ enum AnimatedPropertyType {
     AnimatedColor,
     AnimatedEnumeration,
     AnimatedInteger,
+    AnimatedIntegerOptionalInteger,
     AnimatedLength,
     AnimatedLengthList,
     AnimatedNumber,
index 0ed9339..b6f20db 100644 (file)
@@ -36,15 +36,15 @@ struct SVGPropertyTraits<bool> {
 };
 
 template<>
-struct SVGPropertyTraits<int> {
-    static int initialValue() { return 0; }
-    static String toString(int type) { return String::number(type); }
+struct SVGPropertyTraits<unsigned short> {
+    static unsigned short initialValue() { return 0; }
+    static String toString(unsigned short type) { return String::number(type); }
 };
 
 template<>
-struct SVGPropertyTraits<long> {
-    static long initialValue() { return 0; }
-    static String toString(long type) { return String::number(type); }
+struct SVGPropertyTraits<int> {
+    static int initialValue() { return 0; }
+    static String toString(int type) { return String::number(type); }
 };
 
 template<>