2011-05-31  Rob Buis  <rbuis@rim.com>

        Reviewed by Dirk Schulze.

        https://bugs.webkit.org/show_bug.cgi?id=34301
        Creating <animateMotion> elements via javascript do not execute

        https://bugs.webkit.org/show_bug.cgi?id=17043
        SVG missing some .idl files

        Add missing idl files.

        Test: svg/animations/animate-mpath-insert.html

        * CMakeLists.txt:
        * CodeGenerators.pri:
        * WebCore.gypi:
        * WebCore.xcodeproj/project.pbxproj:
        * svg/SVGAnimateMotionElement.idl: Added.
        * svg/SVGMPathElement.idl: Added.
2011-05-31  Rob Buis  <rbuis@rim.com>

        Reviewed by Dirk Schulze.

        https://bugs.webkit.org/show_bug.cgi?id=34301
        Creating <animateMotion> elements via javascript do not execute

        https://bugs.webkit.org/show_bug.cgi?id=17043
        SVG missing some .idl files

        Verify that adding mpath via javascript works.

        * svg/animations/animate-mpath-insert-expected.txt: Added.
        * svg/animations/animate-mpath-insert.html: Added.
        * svg/animations/script-tests/animate-mpath-insert.js: Added.
        (mpath.setAttributeNS.animateMotion.appendChild.g.appendChild.rootSVGElement.appendChild.passIfCloseEnough):
        (startSample):
        (endSample):
        (executeTest):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@87746 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0488815..49f9644 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2011-05-31  Rob Buis  <rbuis@rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34301
+        Creating <animateMotion> elements via javascript do not execute
+
+        https://bugs.webkit.org/show_bug.cgi?id=17043
+        SVG missing some .idl files
+
+        Verify that adding mpath via javascript works.
+
+        * svg/animations/animate-mpath-insert-expected.txt: Added.
+        * svg/animations/animate-mpath-insert.html: Added.
+        * svg/animations/script-tests/animate-mpath-insert.js: Added.
+        (mpath.setAttributeNS.animateMotion.appendChild.g.appendChild.rootSVGElement.appendChild.passIfCloseEnough):
+        (startSample):
+        (endSample):
+        (executeTest):
+
 2011-05-31  Abhishek Arya  <inferno@chromium.org>
 
         Reviewed by Dimitri Glazkov.
diff --git a/LayoutTests/svg/animations/animate-mpath-insert-expected.txt b/LayoutTests/svg/animations/animate-mpath-insert-expected.txt
new file mode 100644
index 0000000..444b863
--- /dev/null
+++ b/LayoutTests/svg/animations/animate-mpath-insert-expected.txt
@@ -0,0 +1,15 @@
+SVG 1.1 dynamic animation tests
+
+test to determine whether inserting mpath dynamically works
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rootSVGElement.getBBox().x is 100
+PASS rootSVGElement.getBBox().y is 250
+PASS rootSVGElement.getBBox().x is 400
+PASS rootSVGElement.getBBox().y is 250
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/animations/animate-mpath-insert.html b/LayoutTests/svg/animations/animate-mpath-insert.html
new file mode 100644
index 0000000..a249b01
--- /dev/null
+++ b/LayoutTests/svg/animations/animate-mpath-insert.html
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<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>
+<h1>SVG 1.1 dynamic animation tests</h1>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/animate-mpath-insert.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/svg/animations/script-tests/animate-mpath-insert.js b/LayoutTests/svg/animations/script-tests/animate-mpath-insert.js
new file mode 100644
index 0000000..508fe61
--- /dev/null
+++ b/LayoutTests/svg/animations/script-tests/animate-mpath-insert.js
@@ -0,0 +1,57 @@
+description("test to determine whether inserting mpath dynamically works");
+createSVGTestCase();
+
+rootSVGElement.setAttribute("width", 800)
+
+var defs = createSVGElement("defs")
+var path = createSVGElement("path")
+path.setAttribute("id", "path")
+path.setAttribute("d", "M 100,250 C 100,50 400,50 400,250")
+defs.appendChild(path)
+rootSVGElement.appendChild(defs)
+
+var g = createSVGElement("g")
+
+var rect = createSVGElement("rect")
+rect.setAttribute("id", "rect")
+rect.setAttribute("width", "40")
+rect.setAttribute("height", "40")
+rect.setAttribute("fill", "green")
+rect.setAttribute("onclick", "executeTest()")
+g.appendChild(rect)
+
+var animateMotion = createSVGElement("animateMotion")
+animateMotion.setAttribute("id", "animation")
+animateMotion.setAttribute("dur", "4s")
+animateMotion.setAttribute("repeatCount", "1")
+animateMotion.setAttribute("begin", "click")
+
+var mpath = createSVGElement("mpath");
+mpath.setAttributeNS(xlinkNS, "xlink:href", "#path")
+
+animateMotion.appendChild(mpath)
+g.appendChild(animateMotion)
+rootSVGElement.appendChild(g)
+
+function startSample() {
+    shouldBeCloseEnough("rootSVGElement.getBBox().x", "100", 5);
+    shouldBeCloseEnough("rootSVGElement.getBBox().y", "250", 5);
+}
+
+function endSample() {
+    shouldBeCloseEnough("rootSVGElement.getBBox().x", "400", 5);
+    shouldBeCloseEnough("rootSVGElement.getBBox().y", "250", 5);
+}
+
+function executeTest() {
+    const expectedValues = [
+        ["animation", 0.02, "rect", startSample],
+        ["animation", 3.99, "rect", endSample]
+    ];
+    
+    runAnimationTest(expectedValues);
+}
+
+window.setTimeout("triggerUpdate(10, 40)", 0);
+var successfullyParsed = true;
+
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 8bcaa40..275f0da 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -1781,6 +1781,7 @@
         svg/SVGAltGlyphElement.idl
         svg/SVGAngle.idl
         svg/SVGAnimateColorElement.idl
+        svg/SVGAnimateMotionElement.idl
         svg/SVGAnimateElement.idl
         svg/SVGAnimateTransformElement.idl
         svg/SVGAnimatedAngle.idl
@@ -1856,6 +1857,7 @@
         svg/SVGMatrix.idl
         svg/SVGMetadataElement.idl
         svg/SVGMissingGlyphElement.idl
+        svg/SVGMPathElement.idl
         svg/SVGNumber.idl
         svg/SVGNumberList.idl
         svg/SVGPaint.idl
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index edc3df9..aaf5afa 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2011-05-31  Rob Buis  <rbuis@rim.com>
+
+        Reviewed by Dirk Schulze.
+
+        https://bugs.webkit.org/show_bug.cgi?id=34301
+        Creating <animateMotion> elements via javascript do not execute
+
+        https://bugs.webkit.org/show_bug.cgi?id=17043
+        SVG missing some .idl files
+
+        Add missing idl files.
+
+        Test: svg/animations/animate-mpath-insert.html
+
+        * CMakeLists.txt:
+        * CodeGenerators.pri:
+        * WebCore.gypi:
+        * WebCore.xcodeproj/project.pbxproj:
+        * svg/SVGAnimateMotionElement.idl: Added.
+        * svg/SVGMPathElement.idl: Added.
+
 2011-05-31  Robin Dunn  <robin@alldunn.com>
 
         Reviewed by Kevin Ollivier.
diff --git a/Source/WebCore/CodeGenerators.pri b/Source/WebCore/CodeGenerators.pri
index ae52ed2..1c4decf 100644
--- a/Source/WebCore/CodeGenerators.pri
+++ b/Source/WebCore/CodeGenerators.pri
@@ -389,6 +389,7 @@
     svg/SVGAltGlyphElement.idl \
     svg/SVGAngle.idl \
     svg/SVGAnimateColorElement.idl \
+    svg/SVGAnimateMotionElement.idl \
     svg/SVGAnimatedAngle.idl \
     svg/SVGAnimatedBoolean.idl \
     svg/SVGAnimatedEnumeration.idl \
@@ -464,6 +465,7 @@
     svg/SVGMatrix.idl \
     svg/SVGMetadataElement.idl \
     svg/SVGMissingGlyphElement.idl \
+    svg/SVGMPathElement.idl \
     svg/SVGNumber.idl \
     svg/SVGNumberList.idl \
     svg/SVGPaint.idl \
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index 91a343c..82c302e 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -1458,6 +1458,7 @@
             'svg/SVGAltGlyphElement.idl',
             'svg/SVGAngle.idl',
             'svg/SVGAnimateColorElement.idl',
+            'svg/SVGAnimateMotionElement.idl',
             'svg/SVGAnimateElement.idl',
             'svg/SVGAnimateTransformElement.idl',
             'svg/SVGAnimatedAngle.idl',
@@ -1538,6 +1539,7 @@
             'svg/SVGMatrix.idl',
             'svg/SVGMetadataElement.idl',
             'svg/SVGMissingGlyphElement.idl',
+            'svg/SVGMPathElement.idl',
             'svg/SVGNumber.idl',
             'svg/SVGNumberList.idl',
             'svg/SVGPaint.idl',
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 7411995..d4c45a7 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -982,6 +982,8 @@
 		449B19F50FA72ECE0015CA4A /* HTMLParserQuirks.h in Headers */ = {isa = PBXBuildFile; fileRef = 449B19F30FA72ECE0015CA4A /* HTMLParserQuirks.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		44A28AAC12DFB8AC00AE923B /* MathMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 44A28AAB12DFB8AC00AE923B /* MathMLElementFactory.h */; };
 		44A28AAF12DFB8BF00AE923B /* MathMLNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 44A28AAE12DFB8BF00AE923B /* MathMLNames.h */; };
+		44D8DA99139545BE00337B75 /* SVGMPathElement.idl in Resources */ = {isa = PBXBuildFile; fileRef = 44D8DA98139545BE00337B75 /* SVGMPathElement.idl */; };
+		44D8DA9B139545CD00337B75 /* SVGAnimateMotionElement.idl in Resources */ = {isa = PBXBuildFile; fileRef = 44D8DA9A139545CD00337B75 /* SVGAnimateMotionElement.idl */; };
 		45099C411370A7800058D513 /* IconURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45099C401370A7800058D513 /* IconURL.cpp */; };
 		45BAC2B01360BBAB005DA258 /* IconURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 45BAC2AF1360BBAB005DA258 /* IconURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		4614A1FE0B23A8D600446E1C /* copyCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 4614A1FD0B23A8D600446E1C /* copyCursor.png */; };
@@ -7527,6 +7529,8 @@
 		449B19F30FA72ECE0015CA4A /* HTMLParserQuirks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLParserQuirks.h; sourceTree = "<group>"; };
 		44A28AAB12DFB8AC00AE923B /* MathMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLElementFactory.h; sourceTree = "<group>"; };
 		44A28AAE12DFB8BF00AE923B /* MathMLNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLNames.h; sourceTree = "<group>"; };
+		44D8DA98139545BE00337B75 /* SVGMPathElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGMPathElement.idl; sourceTree = "<group>"; };
+		44D8DA9A139545CD00337B75 /* SVGAnimateMotionElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SVGAnimateMotionElement.idl; sourceTree = "<group>"; };
 		45099C401370A7800058D513 /* IconURL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IconURL.cpp; sourceTree = "<group>"; };
 		45BAC2AF1360BBAB005DA258 /* IconURL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconURL.h; sourceTree = "<group>"; };
 		4614A1FD0B23A8D600446E1C /* copyCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = copyCursor.png; sourceTree = "<group>"; };
@@ -17227,6 +17231,8 @@
 		B22277CA0D00BF1E0071B782 /* svg */ = {
 			isa = PBXGroup;
 			children = (
+				44D8DA9A139545CD00337B75 /* SVGAnimateMotionElement.idl */,
+				44D8DA98139545BE00337B75 /* SVGMPathElement.idl */,
 				E46E97860DAAD61B0071E894 /* animation */,
 				B25598860D00D8B800BB825C /* graphics */,
 				081CDFBD126ECFE800D215CA /* properties */,
diff --git a/Source/WebCore/svg/SVGAnimateMotionElement.idl b/Source/WebCore/svg/SVGAnimateMotionElement.idl
new file mode 100644
index 0000000..c048378
--- /dev/null
+++ b/Source/WebCore/svg/SVGAnimateMotionElement.idl
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+module svg {
+
+    interface [Conditional=SVG&SVG_ANIMATION] SVGAnimateMotionElement : SVGAnimationElement {
+    };
+
+}
diff --git a/Source/WebCore/svg/SVGMPathElement.idl b/Source/WebCore/svg/SVGMPathElement.idl
new file mode 100644
index 0000000..6c8c0bd
--- /dev/null
+++ b/Source/WebCore/svg/SVGMPathElement.idl
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) Research In Motion Limited 2011. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+module svg {
+
+    interface [Conditional=SVG&SVG_ANIMATION] SVGMPathElement : SVGElement,
+                                                                SVGURIReference,
+                                                                SVGExternalResourcesRequired {
+    };
+
+}