Title: [89993] trunk
Revision
89993
Author
[email protected]
Date
2011-06-28 23:54:22 -0700 (Tue, 28 Jun 2011)

Log Message

2011-06-28  Dirk Schulze  <[email protected]>

        Reviewed by Nikolas Zimmermann.

        SVGAnimatedType should support SVGBoolean animation
        https://bugs.webkit.org/show_bug.cgi?id=63529

        Follow up of "SVGAnimation should use direct unit animation for SVGLength": https://bugs.webkit.org/show_bug.cgi?id=61368
        This patch continues the conversion to the new concept of SVGAnimatorFactory with SVGBoolean.
        
        The new animator does not affect any behavior, since it was animated with SVGAnimatedString before. The new animator is still needed
        to support animVal and baseVal later.

        Test: svg/animations/svgboolean-animation-1.html

        * CMakeLists.txt: Add new file to build system.
        * GNUmakefile.list.am: Ditto.
        * WebCore.gypi: Ditto.
        * WebCore.pro: Ditto.
        * WebCore.xcodeproj/project.pbxproj: Ditto.
        * svg/SVGAllInOne.cpp: Ditto.
        * svg/SVGAnimateElement.cpp: Make use of AnimatedBoolean.
        (WebCore::SVGAnimateElement::determineAnimatedAttributeType):
        (WebCore::SVGAnimateElement::calculateAnimatedValue):
        (WebCore::SVGAnimateElement::calculateFromAndToValues):
        (WebCore::SVGAnimateElement::calculateFromAndByValues):
        (WebCore::SVGAnimateElement::resetToBaseValue):
        (WebCore::SVGAnimateElement::applyResultsToTarget):
        (WebCore::SVGAnimateElement::calculateDistance):
        * svg/SVGAnimatedBoolean.cpp: Added. New animator for SVGBoolean.
        (WebCore::SVGAnimatedBooleanAnimator::SVGAnimatedBooleanAnimator):
        (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
        (WebCore::SVGAnimatedBooleanAnimator::calculateFromAndToValues):
        (WebCore::SVGAnimatedBooleanAnimator::calculateFromAndByValues):
        (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
        (WebCore::SVGAnimatedBooleanAnimator::calculateDistance):
        * svg/SVGAnimatedBoolean.h:
        (WebCore::SVGAnimatedBooleanAnimator::~SVGAnimatedBooleanAnimator):
        * svg/SVGAnimatedType.cpp: Use bool for SVGBoolean.
        (WebCore::SVGAnimatedType::~SVGAnimatedType):
        (WebCore::SVGAnimatedType::createBoolean):
        (WebCore::SVGAnimatedType::boolean):
        (WebCore::SVGAnimatedType::valueAsString):
        (WebCore::SVGAnimatedType::setValueAsString):
        * svg/SVGAnimatedType.h:
        * svg/SVGAnimatorFactory.h: New crate function for SVGAnimatedSVGBooleanAnimator.
        (WebCore::SVGAnimatorFactory::create):
2011-06-28  Dirk Schulze  <[email protected]>

        Reviewed by Nikolas Zimmermann.

        SVGAnimatedType should support SVGBoolean animation
        https://bugs.webkit.org/show_bug.cgi?id=63529
        
        Test animation of SVGBoolean. Add the test to the skip list of wk2.
        Convert animate-number-calcMode-discrete-keyTimes to common style, no change
        on the test itself.

        * platform/mac-wk2/Skipped:
        * svg/animations/animate-number-calcMode-discrete-keyTimes-expected.txt:
        * svg/animations/animate-number-calcMode-discrete-keyTimes.html:
        * svg/animations/script-tests/svgboolean-animation-1.js: Added.
        (sample1):
        (sample2):
        (sample3):
        (executeTest):
        * svg/animations/svgboolean-animation-1-expected.txt: Added.
        * svg/animations/svgboolean-animation-1.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (89992 => 89993)


--- trunk/LayoutTests/ChangeLog	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/LayoutTests/ChangeLog	2011-06-29 06:54:22 UTC (rev 89993)
@@ -1,3 +1,25 @@
+2011-06-28  Dirk Schulze  <[email protected]>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVGAnimatedType should support SVGBoolean animation
+        https://bugs.webkit.org/show_bug.cgi?id=63529
+        
+        Test animation of SVGBoolean. Add the test to the skip list of wk2.
+        Convert animate-number-calcMode-discrete-keyTimes to common style, no change
+        on the test itself.
+
+        * platform/mac-wk2/Skipped:
+        * svg/animations/animate-number-calcMode-discrete-keyTimes-expected.txt:
+        * svg/animations/animate-number-calcMode-discrete-keyTimes.html:
+        * svg/animations/script-tests/svgboolean-animation-1.js: Added.
+        (sample1):
+        (sample2):
+        (sample3):
+        (executeTest):
+        * svg/animations/svgboolean-animation-1-expected.txt: Added.
+        * svg/animations/svgboolean-animation-1.html: Added.
+
 2011-06-28  Ilya Sherman  <[email protected]>
 
         Reviewed by Adam Barth.

Modified: trunk/LayoutTests/platform/mac-wk2/Skipped (89992 => 89993)


--- trunk/LayoutTests/platform/mac-wk2/Skipped	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/LayoutTests/platform/mac-wk2/Skipped	2011-06-29 06:54:22 UTC (rev 89993)
@@ -454,6 +454,7 @@
 svg/animations/svgangle-animation-grad-to-rad.html
 svg/animations/svgangle-animation-rad-to-deg.html
 svg/animations/svgangle-animation-rad-to-grad.html
+svg/animations/svgboolean-animation-1.html
 svg/animations/svglength-animation-LengthModeHeight.html
 svg/animations/svglength-animation-LengthModeOther.html
 svg/animations/svglength-animation-LengthModeWidth.html

Modified: trunk/LayoutTests/svg/animations/animate-number-calcMode-discrete-keyTimes-expected.txt (89992 => 89993)


--- trunk/LayoutTests/svg/animations/animate-number-calcMode-discrete-keyTimes-expected.txt	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/LayoutTests/svg/animations/animate-number-calcMode-discrete-keyTimes-expected.txt	2011-06-29 06:54:22 UTC (rev 89993)
@@ -1,3 +1,5 @@
+SVG 1.1 dynamic animation tests
+
 PASS rect.x.baseVal.value is 100
 PASS rect.x.baseVal.value is 200
 PASS rect.x.baseVal.value is 300

Modified: trunk/LayoutTests/svg/animations/animate-number-calcMode-discrete-keyTimes.html (89992 => 89993)


--- trunk/LayoutTests/svg/animations/animate-number-calcMode-discrete-keyTimes.html	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/LayoutTests/svg/animations/animate-number-calcMode-discrete-keyTimes.html	2011-06-29 06:54:22 UTC (rev 89993)
@@ -1,10 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
 <html>
 <head>
+<link rel="stylesheet" href=""
 <script src=""
 <script src=""
 <script src=""
 </head>
 <body>
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
 <div id="console"></div>
 <script src=""
 </body>

Added: trunk/LayoutTests/svg/animations/script-tests/svgboolean-animation-1.js (0 => 89993)


--- trunk/LayoutTests/svg/animations/script-tests/svgboolean-animation-1.js	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/script-tests/svgboolean-animation-1.js	2011-06-29 06:54:22 UTC (rev 89993)
@@ -0,0 +1,63 @@
+description("Test 'to' animation of SVGBoolean.");
+createSVGTestCase();
+
+// Setup test document
+var defs = createSVGElement("defs");
+rootSVGElement.appendChild(defs);
+
+var filter = createSVGElement("filter");
+filter.setAttribute("id", "filter");
+defs.appendChild(filter);
+
+var feConvolveMatrix = createSVGElement("feConvolveMatrix");
+feConvolveMatrix.setAttribute("id", "effect");
+feConvolveMatrix.setAttribute("kernelMatrix", "0 0 0   0 1 0   0 0 0");
+feConvolveMatrix.setAttribute("preserveAlpha", "false");
+filter.appendChild(feConvolveMatrix);
+
+var rect = createSVGElement("rect");
+rect.setAttribute("id", "rect");
+rect.setAttribute("width", "100");
+rect.setAttribute("height", "100");
+rect.setAttribute("fill", "green");
+rect.setAttribute("filter", "url(#filter)");
+rect.setAttribute("onclick", "executeTest()");
+rootSVGElement.appendChild(rect);
+
+var animate = createSVGElement("animate");
+animate.setAttribute("id", "animation");
+animate.setAttribute("attributeName", "preserveAlpha");
+animate.setAttribute("begin", "rect.click");
+animate.setAttribute("dur", "4s");
+animate.setAttribute("from", "false");
+animate.setAttribute("to", "true");
+feConvolveMatrix.appendChild(animate);
+
+// Setup animation test
+function sample1() {
+	shouldBe("feConvolveMatrix.preserveAlpha.animVal", "false");
+}
+
+function sample2() {
+	shouldBe("feConvolveMatrix.preserveAlpha.animVal", "false");
+}
+
+function sample3() {
+	shouldBe("feConvolveMatrix.preserveAlpha.animVal", "true");
+}
+
+function executeTest() {
+    const expectedValues = [
+        // [animationId, time, elementId, sampleCallback]
+        ["animation", 0.0,    "effect", sample1],
+        ["animation", 2.0,    "effect", sample2],
+        ["animation", 3.9999, "effect", sample3],
+        ["animation", 4.0 ,   "effect", sample1]
+    ];
+
+    runAnimationTest(expectedValues);
+}
+
+// Begin test async
+window.setTimeout("triggerUpdate(50, 50)", 0);
+var successfullyParsed = true;

Added: trunk/LayoutTests/svg/animations/svgboolean-animation-1-expected.txt (0 => 89993)


--- trunk/LayoutTests/svg/animations/svgboolean-animation-1-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/svgboolean-animation-1-expected.txt	2011-06-29 06:54:22 UTC (rev 89993)
@@ -0,0 +1,15 @@
+SVG 1.1 dynamic animation tests
+
+Test 'to' animation of SVGBoolean.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS feConvolveMatrix.preserveAlpha.animVal is false
+PASS feConvolveMatrix.preserveAlpha.animVal is false
+PASS feConvolveMatrix.preserveAlpha.animVal is true
+PASS feConvolveMatrix.preserveAlpha.animVal is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/svg/animations/svgboolean-animation-1.html (0 => 89993)


--- trunk/LayoutTests/svg/animations/svgboolean-animation-1.html	                        (rev 0)
+++ trunk/LayoutTests/svg/animations/svgboolean-animation-1.html	2011-06-29 06:54:22 UTC (rev 89993)
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/CMakeLists.txt (89992 => 89993)


--- trunk/Source/WebCore/CMakeLists.txt	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/CMakeLists.txt	2011-06-29 06:54:22 UTC (rev 89993)
@@ -1657,6 +1657,7 @@
         svg/SVGAngle.cpp
         svg/SVGAnimateColorElement.cpp
         svg/SVGAnimatedAngle.cpp
+        svg/SVGAnimatedBoolean.cpp
         svg/SVGAnimatedColor.cpp
         svg/SVGAnimatedLength.cpp
         svg/SVGAnimatedLengthList.cpp

Modified: trunk/Source/WebCore/ChangeLog (89992 => 89993)


--- trunk/Source/WebCore/ChangeLog	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/ChangeLog	2011-06-29 06:54:22 UTC (rev 89993)
@@ -1,3 +1,51 @@
+2011-06-28  Dirk Schulze  <[email protected]>
+
+        Reviewed by Nikolas Zimmermann.
+
+        SVGAnimatedType should support SVGBoolean animation
+        https://bugs.webkit.org/show_bug.cgi?id=63529
+
+        Follow up of "SVGAnimation should use direct unit animation for SVGLength": https://bugs.webkit.org/show_bug.cgi?id=61368
+        This patch continues the conversion to the new concept of SVGAnimatorFactory with SVGBoolean.
+        
+        The new animator does not affect any behavior, since it was animated with SVGAnimatedString before. The new animator is still needed
+        to support animVal and baseVal later.
+
+        Test: svg/animations/svgboolean-animation-1.html
+
+        * CMakeLists.txt: Add new file to build system.
+        * GNUmakefile.list.am: Ditto.
+        * WebCore.gypi: Ditto.
+        * WebCore.pro: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * svg/SVGAllInOne.cpp: Ditto.
+        * svg/SVGAnimateElement.cpp: Make use of AnimatedBoolean.
+        (WebCore::SVGAnimateElement::determineAnimatedAttributeType):
+        (WebCore::SVGAnimateElement::calculateAnimatedValue):
+        (WebCore::SVGAnimateElement::calculateFromAndToValues):
+        (WebCore::SVGAnimateElement::calculateFromAndByValues):
+        (WebCore::SVGAnimateElement::resetToBaseValue):
+        (WebCore::SVGAnimateElement::applyResultsToTarget):
+        (WebCore::SVGAnimateElement::calculateDistance):
+        * svg/SVGAnimatedBoolean.cpp: Added. New animator for SVGBoolean.
+        (WebCore::SVGAnimatedBooleanAnimator::SVGAnimatedBooleanAnimator):
+        (WebCore::SVGAnimatedBooleanAnimator::constructFromString):
+        (WebCore::SVGAnimatedBooleanAnimator::calculateFromAndToValues):
+        (WebCore::SVGAnimatedBooleanAnimator::calculateFromAndByValues):
+        (WebCore::SVGAnimatedBooleanAnimator::calculateAnimatedValue):
+        (WebCore::SVGAnimatedBooleanAnimator::calculateDistance):
+        * svg/SVGAnimatedBoolean.h:
+        (WebCore::SVGAnimatedBooleanAnimator::~SVGAnimatedBooleanAnimator):
+        * svg/SVGAnimatedType.cpp: Use bool for SVGBoolean.
+        (WebCore::SVGAnimatedType::~SVGAnimatedType):
+        (WebCore::SVGAnimatedType::createBoolean):
+        (WebCore::SVGAnimatedType::boolean):
+        (WebCore::SVGAnimatedType::valueAsString):
+        (WebCore::SVGAnimatedType::setValueAsString):
+        * svg/SVGAnimatedType.h:
+        * svg/SVGAnimatorFactory.h: New crate function for SVGAnimatedSVGBooleanAnimator.
+        (WebCore::SVGAnimatorFactory::create):
+
 2011-06-28  Dimitri Glazkov  <[email protected]>
 
         Reviewed by Adam Barth.

Modified: trunk/Source/WebCore/GNUmakefile.list.am (89992 => 89993)


--- trunk/Source/WebCore/GNUmakefile.list.am	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2011-06-29 06:54:22 UTC (rev 89993)
@@ -3432,6 +3432,7 @@
 	Source/WebCore/svg/SVGAnimateColorElement.h \
 	Source/WebCore/svg/SVGAnimatedAngle.cpp \
 	Source/WebCore/svg/SVGAnimatedAngle.h \
+	Source/WebCore/svg/SVGAnimatedBoolean.cpp \
 	Source/WebCore/svg/SVGAnimatedBoolean.h \
 	Source/WebCore/svg/SVGAnimatedColor.cpp \
 	Source/WebCore/svg/SVGAnimatedColor.h \

Modified: trunk/Source/WebCore/WebCore.gypi (89992 => 89993)


--- trunk/Source/WebCore/WebCore.gypi	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/WebCore.gypi	2011-06-29 06:54:22 UTC (rev 89993)
@@ -5718,6 +5718,7 @@
             'svg/SVGAnimateColorElement.cpp',
             'svg/SVGAnimateColorElement.h',
             'svg/SVGAnimatedAngle.cpp',
+            'svg/SVGAnimatedBoolean.cpp',
             'svg/SVGAnimatedColor.cpp',
             'svg/SVGAnimatedLength.cpp',
             'svg/SVGAnimatedLengthList.cpp',

Modified: trunk/Source/WebCore/WebCore.pro (89992 => 89993)


--- trunk/Source/WebCore/WebCore.pro	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/WebCore.pro	2011-06-29 06:54:22 UTC (rev 89993)
@@ -3332,6 +3332,7 @@
               svg/SVGAngle.cpp \
               svg/SVGAnimateColorElement.cpp \
               svg/SVGAnimatedAngle.cpp \
+              svg/SVGAnimatedBoolean.cpp \
               svg/SVGAnimatedColor.cpp \
               svg/SVGAnimatedLength.cpp \
               svg/SVGAnimatedLengthList.cpp \

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (89992 => 89993)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-06-29 06:54:22 UTC (rev 89993)
@@ -935,6 +935,7 @@
 		431A2F9D13B6F2B0007791E4 /* SVGAnimatedNumberOptionalNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 431A2F9B13B6F2B0007791E4 /* SVGAnimatedNumberOptionalNumber.cpp */; };
 		431A2FD713B7707A007791E4 /* SVGAnimatedLengthList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 431A2FD613B7707A007791E4 /* SVGAnimatedLengthList.cpp */; };
 		431A302113B89DCC007791E4 /* SVGAnimatedPreserveAspectRatio.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 431A302013B89DCC007791E4 /* SVGAnimatedPreserveAspectRatio.cpp */; };
+		431A308813B8F978007791E4 /* SVGAnimatedBoolean.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 431A308713B8F978007791E4 /* SVGAnimatedBoolean.cpp */; };
 		4331AC7813B6870000A9E5AE /* SVGAnimatedNumberList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4331AC7713B6870000A9E5AE /* SVGAnimatedNumberList.cpp */; };
 		4358E86A1360A21600E4748C /* DOMSVGFEDropShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4358E8671360A21600E4748C /* DOMSVGFEDropShadowElement.h */; };
 		4358E86B1360A21600E4748C /* DOMSVGFEDropShadowElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4358E8681360A21600E4748C /* DOMSVGFEDropShadowElement.mm */; };
@@ -7401,6 +7402,7 @@
 		431A2F9B13B6F2B0007791E4 /* SVGAnimatedNumberOptionalNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumberOptionalNumber.cpp; sourceTree = "<group>"; };
 		431A2FD613B7707A007791E4 /* SVGAnimatedLengthList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedLengthList.cpp; sourceTree = "<group>"; };
 		431A302013B89DCC007791E4 /* SVGAnimatedPreserveAspectRatio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedPreserveAspectRatio.cpp; sourceTree = "<group>"; };
+		431A308713B8F978007791E4 /* SVGAnimatedBoolean.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedBoolean.cpp; sourceTree = "<group>"; };
 		4331AC7713B6870000A9E5AE /* SVGAnimatedNumberList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAnimatedNumberList.cpp; sourceTree = "<group>"; };
 		4358E8671360A21600E4748C /* DOMSVGFEDropShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMSVGFEDropShadowElement.h; sourceTree = "<group>"; };
 		4358E8681360A21600E4748C /* DOMSVGFEDropShadowElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMSVGFEDropShadowElement.mm; sourceTree = "<group>"; };
@@ -17403,6 +17405,7 @@
 				4362C7B813AC6F1A00344BEB /* SVGAnimatedAngle.cpp */,
 				087B84951272CEC700A14417 /* SVGAnimatedAngle.h */,
 				B22277E60D00BF1F0071B782 /* SVGAnimatedAngle.idl */,
+				431A308713B8F978007791E4 /* SVGAnimatedBoolean.cpp */,
 				085797081278394C00A8EC5F /* SVGAnimatedBoolean.h */,
 				B22277E70D00BF1F0071B782 /* SVGAnimatedBoolean.idl */,
 				43A625F713B3304000AC94B8 /* SVGAnimatedColor.cpp */,
@@ -25855,6 +25858,7 @@
 				431A2F9D13B6F2B0007791E4 /* SVGAnimatedNumberOptionalNumber.cpp in Sources */,
 				431A2FD713B7707A007791E4 /* SVGAnimatedLengthList.cpp in Sources */,
 				431A302113B89DCC007791E4 /* SVGAnimatedPreserveAspectRatio.cpp in Sources */,
+				431A308813B8F978007791E4 /* SVGAnimatedBoolean.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebCore/svg/SVGAllInOne.cpp (89992 => 89993)


--- trunk/Source/WebCore/svg/SVGAllInOne.cpp	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/svg/SVGAllInOne.cpp	2011-06-29 06:54:22 UTC (rev 89993)
@@ -31,6 +31,7 @@
 #include "SVGAngle.cpp"
 #include "SVGAnimateColorElement.cpp"
 #include "SVGAnimatedAngle.cpp"
+#include "SVGAnimatedBoolean.cpp"
 #include "SVGAnimatedColor.cpp"
 #include "SVGAnimatedLength.cpp"
 #include "SVGAnimatedLengthList.cpp"

Modified: trunk/Source/WebCore/svg/SVGAnimateElement.cpp (89992 => 89993)


--- trunk/Source/WebCore/svg/SVGAnimateElement.cpp	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/svg/SVGAnimateElement.cpp	2011-06-29 06:54:22 UTC (rev 89993)
@@ -104,11 +104,12 @@
     if (type == AnimatedUnknown || (hasTagName(SVGNames::animateColorTag) && type != AnimatedColor))
         return AnimatedUnknown;
 
-    // FIXME: Animator for AnimatedBoolean and AnimatedEnumeration missing.
+    // FIXME: Animator for AnimatedEnumeration missing.
     switch (type) {
     case AnimatedAngle:
         return AnimatedAngle;
     case AnimatedBoolean:
+        return AnimatedBoolean;
     case AnimatedEnumeration:
     case AnimatedString:
         return AnimatedString;
@@ -163,6 +164,7 @@
         return;
     switch (m_animatedAttributeType) {
     case AnimatedAngle:
+    case AnimatedBoolean:
     case AnimatedColor:
     case AnimatedLength:
     case AnimatedLengthList:
@@ -232,6 +234,7 @@
     m_animatedAttributeType = determineAnimatedAttributeType(targetElement);
     switch (m_animatedAttributeType) {
     case AnimatedAngle:
+    case AnimatedBoolean:
     case AnimatedColor:
     case AnimatedLength:
     case AnimatedLengthList:
@@ -262,6 +265,7 @@
     m_animatedAttributeType = determineAnimatedAttributeType(targetElement);
     switch (m_animatedAttributeType) {
     case AnimatedAngle:
+    case AnimatedBoolean:
     case AnimatedColor:
     case AnimatedLength:
     case AnimatedLengthList:
@@ -291,6 +295,7 @@
     m_animatedAttributeType = determineAnimatedAttributeType(targetElement);
     switch (m_animatedAttributeType) {
     case AnimatedAngle:
+    case AnimatedBoolean:
     case AnimatedColor:
     case AnimatedLength:
     case AnimatedLengthList:
@@ -319,6 +324,7 @@
     String valueToApply;
     switch (m_animatedAttributeType) {
     case AnimatedAngle:
+    case AnimatedBoolean:
     case AnimatedColor:
     case AnimatedLength:
     case AnimatedLengthList:
@@ -347,6 +353,7 @@
     m_animatedAttributeType = determineAnimatedAttributeType(targetElement);
     switch (m_animatedAttributeType) {
     case AnimatedAngle:
+    case AnimatedBoolean:
     case AnimatedColor:
     case AnimatedLength:
     case AnimatedLengthList:

Added: trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp (0 => 89993)


--- trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp	                        (rev 0)
+++ trunk/Source/WebCore/svg/SVGAnimatedBoolean.cpp	2011-06-29 06:54:22 UTC (rev 89993)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) Research In Motion Limited 2011. 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) && ENABLE(SVG_ANIMATION)
+#include "SVGAnimatedBoolean.h"
+
+#include "SVGAnimateElement.h"
+
+namespace WebCore {
+
+SVGAnimatedBooleanAnimator::SVGAnimatedBooleanAnimator(SVGAnimationElement* animationElement, SVGElement* contextElement)
+    : SVGAnimatedTypeAnimator(AnimatedBoolean, animationElement, contextElement)
+{
+}
+
+PassOwnPtr<SVGAnimatedType> SVGAnimatedBooleanAnimator::constructFromString(const String& string)
+{
+    DEFINE_STATIC_LOCAL(const String, trueString, ("true"));
+    OwnPtr<SVGAnimatedType> animtedType = SVGAnimatedType::createBoolean(new bool);
+    animtedType->boolean() = string == trueString;
+    return animtedType.release();
+}
+
+void SVGAnimatedBooleanAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toString)
+{
+    ASSERT(m_contextElement);
+    ASSERT(m_animationElement);
+    
+    from = constructFromString(fromString);
+    to = constructFromString(toString);
+}
+
+void SVGAnimatedBooleanAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byString)
+{
+    ASSERT(m_contextElement);
+    ASSERT(m_animationElement);
+    
+    // Not specified what to do on 'by'-animations with boolean. Fallback to 'to'-animation right now. 
+    from = constructFromString(fromString);
+    to = constructFromString(byString);
+}
+
+void SVGAnimatedBooleanAnimator::calculateAnimatedValue(float percentage, unsigned,
+                                                        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();
+    bool& animateString = animated->boolean();
+    if ((animationMode == FromToAnimation && percentage > 0.5) || animationMode == ToAnimation || percentage == 1)
+        animateString = to->boolean();
+    else
+        animateString = from->boolean();
+}
+
+float SVGAnimatedBooleanAnimator::calculateDistance(const String&, const String&)
+{
+    // No paced animations for boolean.
+    return -1;
+}
+
+}
+
+#endif // ENABLE(SVG) && ENABLE(SVG_ANIMATION)

Modified: trunk/Source/WebCore/svg/SVGAnimatedBoolean.h (89992 => 89993)


--- trunk/Source/WebCore/svg/SVGAnimatedBoolean.h	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/svg/SVGAnimatedBoolean.h	2011-06-29 06:54:22 UTC (rev 89993)
@@ -22,6 +22,7 @@
 
 #if ENABLE(SVG)
 #include "SVGAnimatedStaticPropertyTearOff.h"
+#include "SVGAnimatedTypeAnimator.h"
 
 namespace WebCore {
 
@@ -34,6 +35,26 @@
 #define DEFINE_ANIMATED_BOOLEAN(OwnerType, DOMAttribute, UpperProperty, LowerProperty) \
 DEFINE_ANIMATED_PROPERTY(OwnerType, DOMAttribute, DOMAttribute.localName(), SVGAnimatedBoolean, bool, UpperProperty, LowerProperty)
 
+    
+#if ENABLE(SVG_ANIMATION)
+class SVGAnimationElement;
+
+class SVGAnimatedBooleanAnimator : public SVGAnimatedTypeAnimator {
+    
+public:
+    SVGAnimatedBooleanAnimator(SVGAnimationElement*, SVGElement*);
+    virtual ~SVGAnimatedBooleanAnimator() { }
+    
+    virtual PassOwnPtr<SVGAnimatedType> constructFromString(const String&);
+    
+    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);
+};
+#endif // ENABLE(SVG_ANIMATION)
+
 } // namespace WebCore
 
 #endif // ENABLE(SVG)

Modified: trunk/Source/WebCore/svg/SVGAnimatedType.cpp (89992 => 89993)


--- trunk/Source/WebCore/svg/SVGAnimatedType.cpp	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.cpp	2011-06-29 06:54:22 UTC (rev 89993)
@@ -48,6 +48,9 @@
     case AnimatedAngle:
         delete m_data.angle;
         break;
+    case AnimatedBoolean:
+        delete m_data.boolean;
+        break;
     case AnimatedColor:
         delete m_data.color;
         break;
@@ -95,6 +98,14 @@
     return animatedType.release();
 }
 
+PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createBoolean(bool* boolean)
+{
+    ASSERT(boolean);
+    OwnPtr<SVGAnimatedType> animatedType = adoptPtr(new SVGAnimatedType(AnimatedBoolean));
+    animatedType->m_data.boolean = boolean;
+    return animatedType.release();
+}
+
 PassOwnPtr<SVGAnimatedType> SVGAnimatedType::createColor(Color* color)
 {
     ASSERT(color);
@@ -189,6 +200,12 @@
     return *m_data.angle;
 }
 
+bool& SVGAnimatedType::boolean()
+{
+    ASSERT(m_type == AnimatedBoolean);
+    return *m_data.boolean;
+}
+
 Color& SVGAnimatedType::color()
 {
     ASSERT(m_type == AnimatedColor);
@@ -261,6 +278,9 @@
     case AnimatedAngle:
         ASSERT(m_data.angle);
         return m_data.angle->valueAsString();
+    case AnimatedBoolean:
+        ASSERT(m_data.boolean);
+        return *m_data.boolean ? "true" : "false";
     case AnimatedColor:
         ASSERT(m_data.color);
         return m_data.color->serialized();
@@ -313,6 +333,10 @@
         ASSERT(m_data.angle);
         m_data.angle->setValueAsString(value, ec);
         break;
+    case AnimatedBoolean:
+        ASSERT(m_data.boolean);
+        *m_data.boolean = value == "true" ? true : false;
+        break;
     case AnimatedColor:
         ASSERT(m_data.color);
         *m_data.color = value.isEmpty() ? Color() : SVGColor::colorFromRGBColorString(value);

Modified: trunk/Source/WebCore/svg/SVGAnimatedType.h (89992 => 89993)


--- trunk/Source/WebCore/svg/SVGAnimatedType.h	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/svg/SVGAnimatedType.h	2011-06-29 06:54:22 UTC (rev 89993)
@@ -41,6 +41,7 @@
     virtual ~SVGAnimatedType();
 
     static PassOwnPtr<SVGAnimatedType> createAngle(SVGAngle*);
+    static PassOwnPtr<SVGAnimatedType> createBoolean(bool*);
     static PassOwnPtr<SVGAnimatedType> createColor(Color*);
     static PassOwnPtr<SVGAnimatedType> createLength(SVGLength*);
     static PassOwnPtr<SVGAnimatedType> createLengthList(SVGLengthList*);
@@ -56,6 +57,7 @@
     AnimatedAttributeType type() const { return m_type; }
 
     SVGAngle& angle();
+    bool& boolean();
     Color& color();
     SVGLength& length();
     SVGLengthList& lengthList();
@@ -86,6 +88,7 @@
         }
 
         SVGAngle* angle;
+        bool* boolean;
         Color* color;
         SVGLength* length;
         SVGLengthList* lengthList;

Modified: trunk/Source/WebCore/svg/SVGAnimatorFactory.h (89992 => 89993)


--- trunk/Source/WebCore/svg/SVGAnimatorFactory.h	2011-06-29 06:46:56 UTC (rev 89992)
+++ trunk/Source/WebCore/svg/SVGAnimatorFactory.h	2011-06-29 06:54:22 UTC (rev 89993)
@@ -22,6 +22,7 @@
 
 #if ENABLE(SVG) && ENABLE(SVG_ANIMATION)
 #include "SVGAnimatedAngle.h"
+#include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedColor.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedLengthList.h"
@@ -37,7 +38,7 @@
 namespace WebCore {
 
 class SVGAnimationElement;
-    
+
 class SVGAnimatorFactory {
 public:
     static PassOwnPtr<SVGAnimatedTypeAnimator> create(SVGAnimationElement* animationElement, SVGElement* contextElement, AnimatedAttributeType attributeType)
@@ -45,16 +46,18 @@
         ASSERT(animationElement);
         ASSERT(contextElement);
 
-        // FIXME: Add animation support for all SVG units.
         switch (attributeType) {
         case AnimatedAngle:
             return adoptPtr(new SVGAnimatedAngleAnimator(animationElement, contextElement));
+        case AnimatedBoolean:
+            return adoptPtr(new SVGAnimatedBooleanAnimator(animationElement, contextElement));
         case AnimatedColor:
             return adoptPtr(new SVGAnimatedColorAnimator(animationElement, contextElement));
         case AnimatedLength:
             return adoptPtr(new SVGAnimatedLengthAnimator(animationElement, contextElement));
         case AnimatedLengthList:
             return adoptPtr(new SVGAnimatedLengthListAnimator(animationElement, contextElement));
+        case AnimatedInteger: // Integer is animated as Number right now.
         case AnimatedNumber:
             return adoptPtr(new SVGAnimatedNumberAnimator(animationElement, contextElement));
         case AnimatedNumberList:
@@ -71,10 +74,14 @@
             return adoptPtr(new SVGAnimatedRectAnimator(animationElement, contextElement));
         case AnimatedString:
             return adoptPtr(new SVGAnimatedStringAnimator(animationElement, contextElement));
-        default:
-            ASSERT_NOT_REACHED();
-            return nullptr;
+        case AnimatedEnumeration: // FIXME: Implementation needed.
+        case AnimatedTransformList: // FIXME: Implementation needed.
+        case AnimatedUnknown:
+            break;
         }
+
+        ASSERT_NOT_REACHED();
+        return nullptr;
     }
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to