[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:23:45 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 9c8348b378bb0701b445d4f4b0872e3ad4aabf18
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 5 15:28:37 2009 +0000

    2009-11-05  Jeff Schiller  <codedread at gmail.com>
    
            Reviewed by Simon Fraser.
    
            Added test to ensure proper order of matrix multiplication with SVGMatrix.
            https://bugs.webkit.org/show_bug.cgi?id=16062
    
            * svg/dom/SVGMatrix-interface-expected.txt: Added.
            * svg/dom/SVGMatrix-interface.xhtml: Added.
    2009-11-05  Jeff Schiller  <codedread at gmail.com>
    
            Reviewed by Simon Fraser.
    
            Correct order of matrix multiplication for SVGMatrix.
            https://bugs.webkit.org/show_bug.cgi?id=16062
    
            Test: svg/dom/SVGMatrix-interface.xhtml
    
            * bindings/js/JSSVGMatrixCustom.cpp:
            (WebCore::JSSVGMatrix::multiply):
            * svg/SVGMatrix.idl:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50561 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 69b1332..a22aba0 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-11-05  Jeff Schiller  <codedread at gmail.com>
+
+        Reviewed by Simon Fraser.
+
+        Added test to ensure proper order of matrix multiplication with SVGMatrix.
+        https://bugs.webkit.org/show_bug.cgi?id=16062
+
+        * svg/dom/SVGMatrix-interface-expected.txt: Added.
+        * svg/dom/SVGMatrix-interface.xhtml: Added.
+
 2009-11-03  Justin Garcia  <justin.garcia at apple.com>
 
         Reviewed by Adele Peterson.
diff --git a/LayoutTests/svg/dom/SVGMatrix-interface-expected.txt b/LayoutTests/svg/dom/SVGMatrix-interface-expected.txt
new file mode 100644
index 0000000..a4e75bd
--- /dev/null
+++ b/LayoutTests/svg/dom/SVGMatrix-interface-expected.txt
@@ -0,0 +1,192 @@
+This test exercises the SVGMatrix interface
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+SVGMatrix constructors
+PASS default constructor
+
+Test attributes on default matrix
+PASS m.a is 1
+PASS m.b is 0
+PASS m.c is 0
+PASS m.d is 1
+PASS m.e is 0
+PASS m.f is 0
+
+Test attributes on translate() and accumulation
+PASS m2.a is 1
+PASS m2.b is 0
+PASS m2.c is 0
+PASS m2.d is 1
+PASS m2.e is 100
+PASS m2.f is 50
+
+Test immutability of translate()
+PASS parseFloat(m.a) is 1
+PASS parseFloat(m.b) is 0
+PASS parseFloat(m.c) is 0
+PASS parseFloat(m.d) is 1
+PASS parseFloat(m.e) is 0
+PASS parseFloat(m.f) is 0
+
+Test attributes on scale()
+PASS m3.a is 5
+PASS m3.b is 0
+PASS m3.c is 0
+PASS m3.d is 5
+PASS m3.e is 100
+PASS m3.f is 50
+
+Test immutability of scale()
+PASS parseFloat(m2.a) is 1
+PASS parseFloat(m2.b) is 0
+PASS parseFloat(m2.c) is 0
+PASS parseFloat(m2.d) is 1
+PASS parseFloat(m2.e) is 100
+PASS parseFloat(m2.f) is 50
+
+Test attributes on scaleNonUniform()
+PASS m4.a is 10
+PASS m4.b is 0
+PASS m4.c is 0
+PASS m4.d is 5
+PASS m4.e is 100
+PASS m4.f is 50
+
+Test immutability of scaleNonUniform()
+PASS parseFloat(m3.a) is 5
+PASS parseFloat(m3.b) is 0
+PASS parseFloat(m3.c) is 0
+PASS parseFloat(m3.d) is 5
+PASS parseFloat(m3.e) is 100
+PASS parseFloat(m3.f) is 50
+
+Test rotate()
+PASS parseFloat(m2.a.toPrecision(6)) is 0.984808
+PASS parseFloat(m2.b.toPrecision(6)) is 0.173648
+PASS parseFloat(m2.c.toPrecision(6)) is -0.173648
+PASS parseFloat(m2.d.toPrecision(6)) is 0.984808
+PASS m.e is 0
+PASS m.f is 0
+
+Test immutability of rotate()
+PASS parseFloat(m.a) is 1
+PASS parseFloat(m.b) is 0
+PASS parseFloat(m.c) is 0
+PASS parseFloat(m.d) is 1
+PASS parseFloat(m.e) is 0
+PASS parseFloat(m.f) is 0
+
+Test flipX()
+PASS m4.a is -5
+PASS m4.b is 0
+PASS m4.c is 0
+PASS m4.d is 5
+PASS m4.e is 100
+PASS m4.f is 50
+
+Test immutability of flipX()
+PASS parseFloat(m3.a) is 5
+PASS parseFloat(m3.b) is 0
+PASS parseFloat(m3.c) is 0
+PASS parseFloat(m3.d) is 5
+PASS parseFloat(m3.e) is 100
+PASS parseFloat(m3.f) is 50
+
+Test flipY()
+PASS m4.a is 5
+PASS m4.b is 0
+PASS m4.c is 0
+PASS m4.d is -5
+PASS m4.e is 100
+PASS m4.f is 50
+
+Test immutability of flipY()
+PASS parseFloat(m3.a) is 5
+PASS parseFloat(m3.b) is 0
+PASS parseFloat(m3.c) is 0
+PASS parseFloat(m3.d) is 5
+PASS parseFloat(m3.e) is 100
+PASS parseFloat(m3.f) is 50
+
+Test skewX()
+PASS m2.a is 1
+PASS m2.b is 0
+PASS parseFloat(m2.c.toPrecision(6)) is 0.577350
+PASS m2.d is 1
+PASS m2.e is 0
+PASS m2.f is 0
+
+Test immutability of skewX()
+PASS parseFloat(m.a) is 1
+PASS parseFloat(m.b) is 0
+PASS parseFloat(m.c) is 0
+PASS parseFloat(m.d) is 1
+PASS parseFloat(m.e) is 0
+PASS parseFloat(m.f) is 0
+
+Test skewY()
+PASS m2.a is 1
+PASS parseFloat(m2.b.toPrecision(6)) is 0.577350
+PASS m2.c is 0
+PASS m2.d is 1
+PASS m2.e is 0
+PASS m2.f is 0
+
+Test immutability of skewY()
+PASS parseFloat(m.a) is 1
+PASS parseFloat(m.b) is 0
+PASS parseFloat(m.c) is 0
+PASS parseFloat(m.d) is 1
+PASS parseFloat(m.e) is 0
+PASS parseFloat(m.f) is 0
+
+Test multiply
+PASS m.a is 2
+PASS m.b is 0
+PASS m.c is 0
+PASS m.d is 1
+PASS m.e is 100
+PASS m.f is 0
+
+Test immutability of multiply
+PASS tx.a is 1
+PASS tx.b is 0
+PASS tx.c is 0
+PASS tx.d is 1
+PASS tx.e is 100
+PASS tx.f is 0
+PASS sx.a is 2
+PASS sx.b is 0
+PASS sx.c is 0
+PASS sx.d is 1
+PASS sx.e is 0
+PASS sx.f is 0
+
+Test multiply with missing argument
+PASS m is null
+
+Test inverse
+PASS parseFloat(m2.a) is 0.5
+PASS parseFloat(m2.b) is 0
+PASS parseFloat(m2.c) is 0
+PASS parseFloat(m2.d) is 0.5
+PASS parseFloat(m2.e) is -5
+PASS parseFloat(m2.f) is -10
+
+Test immutability of inverse
+PASS parseFloat(m.a) is 2
+PASS parseFloat(m.b) is 0
+PASS parseFloat(m.c) is 0
+PASS parseFloat(m.d) is 2
+PASS parseFloat(m.e) is 10
+PASS parseFloat(m.f) is 20
+
+Test throwing exception from inverse
+PASS m.inverse() threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/svg/dom/SVGMatrix-interface.xhtml b/LayoutTests/svg/dom/SVGMatrix-interface.xhtml
new file mode 100644
index 0000000..fbeea79
--- /dev/null
+++ b/LayoutTests/svg/dom/SVGMatrix-interface.xhtml
@@ -0,0 +1,267 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"/>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+
+description("This test exercises the SVGMatrix interface");
+
+debug("");
+debug("SVGMatrix constructors");
+
+var svgroot = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
+var m = null;
+m = svgroot.createSVGMatrix();
+if (m)
+  testPassed("default constructor");
+else
+  testFailed("default constructor");
+
+debug("");
+debug("Test attributes on default matrix");
+shouldBe('m.a', '1');
+shouldBe('m.b', '0');
+shouldBe('m.c', '0');
+shouldBe('m.d', '1');
+shouldBe('m.e', '0');
+shouldBe('m.f', '0');
+
+debug("");
+debug("Test attributes on translate() and accumulation");
+var m2 = m.translate(50,0);
+m2 = m2.translate(50,50);
+shouldBe('m2.a', '1');
+shouldBe('m2.b', '0');
+shouldBe('m2.c', '0');
+shouldBe('m2.d', '1');
+shouldBe('m2.e', '100');
+shouldBe('m2.f', '50');
+
+debug("");
+debug("Test immutability of translate()");
+shouldBe('parseFloat(m.a)', '1');
+shouldBe('parseFloat(m.b)', '0');
+shouldBe('parseFloat(m.c)', '0');
+shouldBe('parseFloat(m.d)', '1');
+shouldBe('parseFloat(m.e)', '0');
+shouldBe('parseFloat(m.f)', '0');
+
+debug("");
+debug("Test attributes on scale()");
+var m3 = m2.scale(5);
+shouldBe('m3.a', '5');
+shouldBe('m3.b', '0');
+shouldBe('m3.c', '0');
+shouldBe('m3.d', '5');
+shouldBe('m3.e', '100');
+shouldBe('m3.f', '50');
+
+debug("");
+debug("Test immutability of scale()");
+shouldBe('parseFloat(m2.a)', '1');
+shouldBe('parseFloat(m2.b)', '0');
+shouldBe('parseFloat(m2.c)', '0');
+shouldBe('parseFloat(m2.d)', '1');
+shouldBe('parseFloat(m2.e)', '100');
+shouldBe('parseFloat(m2.f)', '50');
+
+debug("");
+debug("Test attributes on scaleNonUniform()");
+var m4 = m3.scaleNonUniform(2,1);
+shouldBe('m4.a', '10');
+shouldBe('m4.b', '0');
+shouldBe('m4.c', '0');
+shouldBe('m4.d', '5');
+shouldBe('m4.e', '100');
+shouldBe('m4.f', '50');
+
+debug("");
+debug("Test immutability of scaleNonUniform()");
+shouldBe('parseFloat(m3.a)', '5');
+shouldBe('parseFloat(m3.b)', '0');
+shouldBe('parseFloat(m3.c)', '0');
+shouldBe('parseFloat(m3.d)', '5');
+shouldBe('parseFloat(m3.e)', '100');
+shouldBe('parseFloat(m3.f)', '50');
+
+debug("");
+debug("Test rotate()");
+m = svgroot.createSVGMatrix();
+m2 = m.rotate(10);
+shouldBe('parseFloat(m2.a.toPrecision(6))', '0.984808');
+shouldBe('parseFloat(m2.b.toPrecision(6))', '0.173648');
+shouldBe('parseFloat(m2.c.toPrecision(6))', '-0.173648');
+shouldBe('parseFloat(m2.d.toPrecision(6))', '0.984808');
+shouldBe('m.e', '0');
+shouldBe('m.f', '0');
+
+debug("");
+debug("Test immutability of rotate()");
+shouldBe('parseFloat(m.a)', '1');
+shouldBe('parseFloat(m.b)', '0');
+shouldBe('parseFloat(m.c)', '0');
+shouldBe('parseFloat(m.d)', '1');
+shouldBe('parseFloat(m.e)', '0');
+shouldBe('parseFloat(m.f)', '0');
+
+// TODO: write tests for rotateFromVector() and immutability
+
+debug("");
+debug("Test flipX()");
+m4 = m3.flipX();
+shouldBe('m4.a', '-5');
+shouldBe('m4.b', '0');
+shouldBe('m4.c', '0');
+shouldBe('m4.d', '5');
+shouldBe('m4.e', '100');
+shouldBe('m4.f', '50');
+
+debug("");
+debug("Test immutability of flipX()");
+shouldBe('parseFloat(m3.a)', '5');
+shouldBe('parseFloat(m3.b)', '0');
+shouldBe('parseFloat(m3.c)', '0');
+shouldBe('parseFloat(m3.d)', '5');
+shouldBe('parseFloat(m3.e)', '100');
+shouldBe('parseFloat(m3.f)', '50');
+
+debug("");
+debug("Test flipY()");
+m4 = m3.flipY();
+shouldBe('m4.a', '5');
+shouldBe('m4.b', '0');
+shouldBe('m4.c', '0');
+shouldBe('m4.d', '-5');
+shouldBe('m4.e', '100');
+shouldBe('m4.f', '50');
+
+debug("");
+debug("Test immutability of flipY()");
+shouldBe('parseFloat(m3.a)', '5');
+shouldBe('parseFloat(m3.b)', '0');
+shouldBe('parseFloat(m3.c)', '0');
+shouldBe('parseFloat(m3.d)', '5');
+shouldBe('parseFloat(m3.e)', '100');
+shouldBe('parseFloat(m3.f)', '50');
+
+debug("");
+debug("Test skewX()");
+m = svgroot.createSVGMatrix();
+m2 = m.skewX(30);
+shouldBe('m2.a', '1');
+shouldBe('m2.b', '0');
+shouldBe('parseFloat(m2.c.toPrecision(6))', '0.577350');
+shouldBe('m2.d', '1');
+shouldBe('m2.e', '0');
+shouldBe('m2.f', '0');
+
+debug("");
+debug("Test immutability of skewX()");
+shouldBe('parseFloat(m.a)', '1');
+shouldBe('parseFloat(m.b)', '0');
+shouldBe('parseFloat(m.c)', '0');
+shouldBe('parseFloat(m.d)', '1');
+shouldBe('parseFloat(m.e)', '0');
+shouldBe('parseFloat(m.f)', '0');
+
+debug("");
+debug("Test skewY()");
+m = svgroot.createSVGMatrix();
+m2 = m.skewY(30);
+shouldBe('m2.a', '1');
+shouldBe('parseFloat(m2.b.toPrecision(6))', '0.577350');
+shouldBe('m2.c', '0');
+shouldBe('m2.d', '1');
+shouldBe('m2.e', '0');
+shouldBe('m2.f', '0');
+
+debug("");
+debug("Test immutability of skewY()");
+shouldBe('parseFloat(m.a)', '1');
+shouldBe('parseFloat(m.b)', '0');
+shouldBe('parseFloat(m.c)', '0');
+shouldBe('parseFloat(m.d)', '1');
+shouldBe('parseFloat(m.e)', '0');
+shouldBe('parseFloat(m.f)', '0');
+
+debug("");
+debug("Test multiply");
+var tx = svgroot.createSVGMatrix();
+var sx = svgroot.createSVGMatrix();
+tx = tx.translate(100,0);
+sx = sx.scaleNonUniform(2,1);
+m = tx.multiply(sx);
+shouldBe('m.a', '2');
+shouldBe('m.b', '0');
+shouldBe('m.c', '0');
+shouldBe('m.d', '1');
+shouldBe('m.e', '100');
+shouldBe('m.f', '0');
+
+debug("")
+debug("Test immutability of multiply");
+shouldBe('tx.a', '1');
+shouldBe('tx.b', '0');
+shouldBe('tx.c', '0');
+shouldBe('tx.d', '1');
+shouldBe('tx.e', '100');
+shouldBe('tx.f', '0');
+shouldBe('sx.a', '2');
+shouldBe('sx.b', '0');
+shouldBe('sx.c', '0');
+shouldBe('sx.d', '1');
+shouldBe('sx.e', '0');
+shouldBe('sx.f', '0');
+
+debug("");
+debug("Test multiply with missing argument");
+m = null;
+try {
+    m = tx.multiply();
+} catch(e) {}
+shouldBe('m', 'null');
+
+debug("");
+debug("Test inverse");
+m = svgroot.createSVGMatrix();
+m = m.translate(10,20);
+m = m.scale(2);
+m2 = m.inverse();
+
+shouldBe('parseFloat(m2.a)', '0.5');
+shouldBe('parseFloat(m2.b)', '0');
+shouldBe('parseFloat(m2.c)', '0');
+shouldBe('parseFloat(m2.d)', '0.5');
+shouldBe('parseFloat(m2.e)', '-5');
+shouldBe('parseFloat(m2.f)', '-10');
+
+debug("");
+debug("Test immutability of inverse");
+shouldBe('parseFloat(m.a)', '2');
+shouldBe('parseFloat(m.b)', '0');
+shouldBe('parseFloat(m.c)', '0');
+shouldBe('parseFloat(m.d)', '2');
+shouldBe('parseFloat(m.e)', '10');
+shouldBe('parseFloat(m.f)', '20');
+
+debug("");
+debug("Test throwing exception from inverse");
+m = new WebKitCSSMatrix("matrix(0, 0, 0, 0, 0, 0)"); // not invertible
+shouldThrow('m.inverse()');
+
+debug("");
+successfullyParsed = true;
+
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+
+<script>
+</script>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index cf9032e..b99dc2a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-11-05  Jeff Schiller  <codedread at gmail.com>
+
+        Reviewed by Simon Fraser.
+
+        Correct order of matrix multiplication for SVGMatrix.
+        https://bugs.webkit.org/show_bug.cgi?id=16062
+
+        Test: svg/dom/SVGMatrix-interface.xhtml
+
+        * bindings/js/JSSVGMatrixCustom.cpp:
+        (WebCore::JSSVGMatrix::multiply):
+        * svg/SVGMatrix.idl:
+
 2009-11-04  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/bindings/js/JSSVGMatrixCustom.cpp b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
index 35390b2..a9d0e54 100644
--- a/WebCore/bindings/js/JSSVGMatrixCustom.cpp
+++ b/WebCore/bindings/js/JSSVGMatrixCustom.cpp
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007, 2008 Nikolas Zimmermann <zimmermann at kde.org>
+ * Copyright (C) 2009 Jeff Schiller <codedread at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -24,11 +25,30 @@
 
 #include "TransformationMatrix.h"
 #include "SVGException.h"
+#include <runtime/Error.h>
 
 using namespace JSC;
 
 namespace WebCore {
 
+JSValue JSSVGMatrix::multiply(ExecState* exec, const ArgList& args)
+{
+    if (args.size() < 1)
+        return throwError(exec, SyntaxError, "Not enough arguments");
+
+    if (!args.at(0).inherits(&JSSVGMatrix::s_info))
+        return throwError(exec, TypeError, "secondMatrix argument was not a SVGMatrix");
+
+    JSSVGMatrix* matrixObj = static_cast<JSSVGMatrix*>(asObject(args.at(0)));
+
+    TransformationMatrix m1(*impl());
+    TransformationMatrix m2(*(matrixObj->impl()));
+
+    JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)).get(), m_context.get());
+
+    return result;
+}
+
 JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&)
 {
     TransformationMatrix imp(*impl());
diff --git a/WebCore/svg/SVGMatrix.idl b/WebCore/svg/SVGMatrix.idl
index cb8c08b..f5a41d6 100644
--- a/WebCore/svg/SVGMatrix.idl
+++ b/WebCore/svg/SVGMatrix.idl
@@ -34,7 +34,7 @@ module svg {
         attribute double e;
         attribute double f;
 
-        [Immutable] SVGMatrix multiply(in SVGMatrix secondMatrix);
+        [Custom] SVGMatrix multiply(in SVGMatrix secondMatrix);
         [Custom] SVGMatrix inverse()
             raises(SVGException);
         [Immutable] SVGMatrix translate(in float x, in float y);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list