Patch by Antoine Quint <ml@graougraou.com>
authorggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Jun 2005 17:41:39 +0000 (17:41 +0000)
committerggaren <ggaren@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Jun 2005 17:41:39 +0000 (17:41 +0000)
-fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3648
quadraticCurveTo() method in <canvas> APIs JS bindings does not exist

        Reviewed by Darin.

        Test cases added:
        * layout-tests/fast/dom/quadraticCurveTo-expected.txt: Added.
        * layout-tests/fast/dom/quadraticCurveTo.xml: Added.

        * khtml/ecma/kjs_html.cpp:

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

LayoutTests/fast/dom/quadraticCurveTo-expected.txt [new file with mode: 0644]
LayoutTests/fast/dom/quadraticCurveTo.xml [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/ecma/kjs_html.cpp

diff --git a/LayoutTests/fast/dom/quadraticCurveTo-expected.txt b/LayoutTests/fast/dom/quadraticCurveTo-expected.txt
new file mode 100644 (file)
index 0000000..db8fa09
--- /dev/null
@@ -0,0 +1,12 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x414
+  RenderBlock {HTML} at (0,0) size 800x414
+    RenderBody {BODY} at (8,16) size 784x18
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {TEXT} at (0,0) size 420x18
+          text run at (0,0) width 358: "\x{9}\x{9}\x{9}This test case should produce a sine-wave stroked with 1"
+          text run at (358,0) width 62: "px black. "
+          text run at (420,0) width 0: "\x{9}\x{9}"
+    RenderBlock (anonymous) at (0,50) size 800x364
+      RenderCanvasImage {CANVAS} at (0,0) size 480x360
diff --git a/LayoutTests/fast/dom/quadraticCurveTo.xml b/LayoutTests/fast/dom/quadraticCurveTo.xml
new file mode 100644 (file)
index 0000000..dd52f6a
--- /dev/null
@@ -0,0 +1,78 @@
+<!DOCTYPE html 
+     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+
+       <head>
+               <title>Context2D.quadraticCurveTo Test Case</title>
+               <script>
+
+                       var ctx;
+                       var current_point;
+                       var current_center;
+
+                       function M (x, y) {
+                               ctx.beginPath();
+                               ctx.moveTo(x,y);
+                               current_point = [x,y];
+                               current_center = [x,y];
+                       }
+
+                       function q (x1, y1, x, y) {
+                               x1 += current_point[0];
+                               y1 += current_point[1];
+                               x += current_point[0];
+                               y += current_point[1];
+                               ctx.quadraticCurveTo(x1, y1, x, y);
+                               current_point = [x,y];
+                               current_center = [x1,y1];
+                       }
+                       
+                       function t (x, y) {
+                               var x1 = current_point[0] * 2 - current_center[0];
+                               var y1 = current_point[1] * 2 - current_center[1];
+                               x += current_point[0];
+                               y += current_point[1];
+                               ctx.quadraticCurveTo(x1, y1, x, y);
+                               current_point = [x,y];
+                               current_center = [x1,y1];
+                       }
+
+                       function z () {
+                               ctx.closePath();
+                       }
+
+                       ////////////////////
+
+                       // setup canvas and context
+                       var canvas = document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas');
+                       canvas.setAttribute('width', 480);
+                       canvas.setAttribute('height', 360);
+                       document.documentElement.appendChild(canvas);
+                       ctx = canvas.getContext('2d');
+
+                       // draw shapes equivalent to SVG path data "M 240 296 q 25 -100 47 0 t 47 0 t 47 0 t 47 0 t 47 0 z"
+                       M(10,60);
+                       q(25,-100,47,0);
+                       t(47,0);
+                       t(47,0);
+                       t(47,0);
+                       t(47,0);
+                       z();
+
+                       // stroke it
+                       ctx.stroke();
+
+               </script>
+       </head>
+
+       <body>
+
+               <p>
+                       This test case should produce a sine-wave stroked with 1px black.   
+               </p>
+
+       </body>
+
+</html>
\ No newline at end of file
index 0a3927f33c1e21dcb8102807d0727cd1f64e3b77..9418af220d800007197372be1e17097be97135b3 100644 (file)
@@ -1,3 +1,18 @@
+2005-06-29  Geoffrey Garen  <ggaren@apple.com>
+
+       Patch by Antoine Quint <ml@graougraou.com>
+
+       -fixes http://bugzilla.opendarwin.org/show_bug.cgi?id=3648
+       quadraticCurveTo() method in <canvas> APIs JS bindings does not exist
+
+        Reviewed by Darin.
+
+        Test cases added: 
+        * layout-tests/fast/dom/quadraticCurveTo-expected.txt: Added.
+        * layout-tests/fast/dom/quadraticCurveTo.xml: Added.
+
+        * khtml/ecma/kjs_html.cpp:
+
 2005-06-29  Geoffrey Garen  <ggaren@apple.com>
 
        Patch by Hanspeter Schaub <Hanspeterschaub@mac.com>
index f69975dfc0f8edf7e9701d3aa76fb373d08313a8..e87987e8f36d319163b8d8db18e2671a81557163 100644 (file)
@@ -4475,7 +4475,7 @@ const ClassInfo Context2D::info = { "Context2D", 0, &Context2DTable, 0 };
   stroke                   Context2D::Stroke                      DontDelete|Function 0
   moveTo                   Context2D::MoveTo                      DontDelete|Function 2
   lineTo                   Context2D::LineTo                      DontDelete|Function 2
-  quadraticCurveToPoint    Context2D::QuadraticCurveTo            DontDelete|Function 4
+  quadraticCurveTo         Context2D::QuadraticCurveTo            DontDelete|Function 4
   bezierCurveTo            Context2D::BezierCurveTo               DontDelete|Function 6
   arcTo                    Context2D::ArcTo                       DontDelete|Function 5
   arc                      Context2D::Arc                         DontDelete|Function 6