WebCore/ChangeLog

 12009-11-04 Jeff Schiller <codedread@gmail.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Correct order of matrix multiplication for SVGMatrix.
 6 https://bugs.webkit.org/show_bug.cgi?id=16062
 7
 8 Test: svg/dom/SVGMatrix-interface.xhtml
 9
 10 * bindings/js/JSSVGMatrixCustom.cpp:
 11 (WebCore::JSSVGMatrix::multiply):
 12 * svg/SVGMatrix.idl:
 13
1142009-11-04 Patrick Mueller <Patrick_Mueller@us.ibm.com>
215
316 Reviewed by Timothy Hatcher.

142155 * xml/XMLHttpRequest.cpp:
143156 (WebCore::XMLHttpRequest::callReadyStateChangeListener):
144157
 158>>>>>>> .r50529
1451592009-11-04 Jeremy Orlow <jorlow@chromium.org>
146160
147161 Revert 50519 while I work out what went wrong.
50529

WebCore/bindings/js/JSSVGMatrixCustom.cpp

11/*
22 * Copyright (C) 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
 3 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
34 *
45 * This library is free software; you can redistribute it and/or
56 * modify it under the terms of the GNU Library General Public

2425
2526#include "TransformationMatrix.h"
2627#include "SVGException.h"
 28#include <runtime/Error.h>
2729
2830using namespace JSC;
2931
3032namespace WebCore {
3133
 34JSValue JSSVGMatrix::multiply(ExecState* exec, const ArgList& args)
 35{
 36 if (args.size() < 1)
 37 return throwError(exec, SyntaxError, "Not enough arguments");
 38
 39 if (!args.at(0).inherits(&JSSVGMatrix::s_info))
 40 return throwError(exec, TypeError, "secondMatrix argument was not a SVGMatrix");
 41
 42 JSSVGMatrix* matrixObj = static_cast<JSSVGMatrix*>(asObject(args.at(0)));
 43
 44 TransformationMatrix m1(*impl());
 45 TransformationMatrix m2(*(matrixObj->impl()));
 46
 47 JSC::JSValue result = toJS(exec, deprecatedGlobalObjectForPrototype(exec), JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)).get(), m_context.get());
 48
 49 return result;
 50}
 51
3252JSValue JSSVGMatrix::inverse(ExecState* exec, const ArgList&)
3353{
3454 TransformationMatrix imp(*impl());
50529

WebCore/svg/SVGMatrix.idl

@@module svg {
3434 attribute double e;
3535 attribute double f;
3636
37  [Immutable] SVGMatrix multiply(in SVGMatrix secondMatrix);
 37 [Custom] SVGMatrix multiply(in SVGMatrix secondMatrix);
3838 [Custom] SVGMatrix inverse()
3939 raises(SVGException);
4040 [Immutable] SVGMatrix translate(in float x, in float y);
50529

LayoutTests/ChangeLog

 12009-11-04 Jeff Schiller <codedread@gmail.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Added test to ensure proper order of matrix multiplication with SVGMatrix.
 6 https://bugs.webkit.org/show_bug.cgi?id=16062
 7
 8 * svg/dom/SVGMatrix-interface-expected.txt: Added.
 9 * svg/dom/SVGMatrix-interface.xhtml: Added.
 10
1112009-11-04 Chris Fleizach <cfleizach@apple.com>
212
313 Reviewed by Beth Dakin.

1020 * platform/mac/accessibility/aria-combobox-expected.txt: Added.
1121 * platform/win/Skipped:
1222
 23>>>>>>> .r50529
13242009-11-04 Csaba Osztrogonác <ossy@webkit.org>
1425
1526 Put test into skiplist added in r50489 because
50529

LayoutTests/svg/dom/SVGMatrix-interface-expected.txt

 1This test exercises the SVGMatrix interface
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6SVGMatrix constructors
 7PASS default constructor
 8
 9Test attributes on default matrix
 10PASS m.a is 1
 11PASS m.b is 0
 12PASS m.c is 0
 13PASS m.d is 1
 14PASS m.e is 0
 15PASS m.f is 0
 16
 17Test attributes on translate() and accumulation
 18PASS m2.a is 1
 19PASS m2.b is 0
 20PASS m2.c is 0
 21PASS m2.d is 1
 22PASS m2.e is 100
 23PASS m2.f is 50
 24
 25Test immutability of translate()
 26PASS parseFloat(m.a) is 1
 27PASS parseFloat(m.b) is 0
 28PASS parseFloat(m.c) is 0
 29PASS parseFloat(m.d) is 1
 30PASS parseFloat(m.e) is 0
 31PASS parseFloat(m.f) is 0
 32
 33Test attributes on scale()
 34PASS m3.a is 5
 35PASS m3.b is 0
 36PASS m3.c is 0
 37PASS m3.d is 5
 38PASS m3.e is 100
 39PASS m3.f is 50
 40
 41Test immutability of scale()
 42PASS parseFloat(m2.a) is 1
 43PASS parseFloat(m2.b) is 0
 44PASS parseFloat(m2.c) is 0
 45PASS parseFloat(m2.d) is 1
 46PASS parseFloat(m2.e) is 100
 47PASS parseFloat(m2.f) is 50
 48
 49Test attributes on scaleNonUniform()
 50PASS m4.a is 10
 51PASS m4.b is 0
 52PASS m4.c is 0
 53PASS m4.d is 5
 54PASS m4.e is 100
 55PASS m4.f is 50
 56
 57Test immutability of scaleNonUniform()
 58PASS parseFloat(m3.a) is 5
 59PASS parseFloat(m3.b) is 0
 60PASS parseFloat(m3.c) is 0
 61PASS parseFloat(m3.d) is 5
 62PASS parseFloat(m3.e) is 100
 63PASS parseFloat(m3.f) is 50
 64
 65Test rotate()
 66PASS parseFloat(m2.a.toPrecision(6)) is 0.984808
 67PASS parseFloat(m2.b.toPrecision(6)) is 0.173648
 68PASS parseFloat(m2.c.toPrecision(6)) is -0.173648
 69PASS parseFloat(m2.d.toPrecision(6)) is 0.984808
 70PASS m.e is 0
 71PASS m.f is 0
 72
 73Test immutability of rotate()
 74PASS parseFloat(m.a) is 1
 75PASS parseFloat(m.b) is 0
 76PASS parseFloat(m.c) is 0
 77PASS parseFloat(m.d) is 1
 78PASS parseFloat(m.e) is 0
 79PASS parseFloat(m.f) is 0
 80
 81Test flipX()
 82PASS m4.a is -5
 83PASS m4.b is 0
 84PASS m4.c is 0
 85PASS m4.d is 5
 86PASS m4.e is 100
 87PASS m4.f is 50
 88
 89Test immutability of flipX()
 90PASS parseFloat(m3.a) is 5
 91PASS parseFloat(m3.b) is 0
 92PASS parseFloat(m3.c) is 0
 93PASS parseFloat(m3.d) is 5
 94PASS parseFloat(m3.e) is 100
 95PASS parseFloat(m3.f) is 50
 96
 97Test flipY()
 98PASS m4.a is 5
 99PASS m4.b is 0
 100PASS m4.c is 0
 101PASS m4.d is -5
 102PASS m4.e is 100
 103PASS m4.f is 50
 104
 105Test immutability of flipY()
 106PASS parseFloat(m3.a) is 5
 107PASS parseFloat(m3.b) is 0
 108PASS parseFloat(m3.c) is 0
 109PASS parseFloat(m3.d) is 5
 110PASS parseFloat(m3.e) is 100
 111PASS parseFloat(m3.f) is 50
 112
 113Test skewX()
 114PASS m2.a is 1
 115PASS m2.b is 0
 116PASS parseFloat(m2.c.toPrecision(6)) is 0.577350
 117PASS m2.d is 1
 118PASS m2.e is 0
 119PASS m2.f is 0
 120
 121Test immutability of skewX()
 122PASS parseFloat(m.a) is 1
 123PASS parseFloat(m.b) is 0
 124PASS parseFloat(m.c) is 0
 125PASS parseFloat(m.d) is 1
 126PASS parseFloat(m.e) is 0
 127PASS parseFloat(m.f) is 0
 128
 129Test skewY()
 130PASS m2.a is 1
 131PASS parseFloat(m2.b.toPrecision(6)) is 0.577350
 132PASS m2.c is 0
 133PASS m2.d is 1
 134PASS m2.e is 0
 135PASS m2.f is 0
 136
 137Test immutability of skewY()
 138PASS parseFloat(m.a) is 1
 139PASS parseFloat(m.b) is 0
 140PASS parseFloat(m.c) is 0
 141PASS parseFloat(m.d) is 1
 142PASS parseFloat(m.e) is 0
 143PASS parseFloat(m.f) is 0
 144
 145Test multiply
 146PASS m.a is 2
 147PASS m.b is 0
 148PASS m.c is 0
 149PASS m.d is 1
 150PASS m.e is 100
 151PASS m.f is 0
 152
 153Test immutability of multiply
 154PASS tx.a is 1
 155PASS tx.b is 0
 156PASS tx.c is 0
 157PASS tx.d is 1
 158PASS tx.e is 100
 159PASS tx.f is 0
 160PASS sx.a is 2
 161PASS sx.b is 0
 162PASS sx.c is 0
 163PASS sx.d is 1
 164PASS sx.e is 0
 165PASS sx.f is 0
 166
 167Test multiply with missing argument
 168PASS m is null
 169
 170Test inverse
 171PASS parseFloat(m2.a) is 0.5
 172PASS parseFloat(m2.b) is 0
 173PASS parseFloat(m2.c) is 0
 174PASS parseFloat(m2.d) is 0.5
 175PASS parseFloat(m2.e) is -5
 176PASS parseFloat(m2.f) is -10
 177
 178Test immutability of inverse
 179PASS parseFloat(m.a) is 2
 180PASS parseFloat(m.b) is 0
 181PASS parseFloat(m.c) is 0
 182PASS parseFloat(m.d) is 2
 183PASS parseFloat(m.e) is 10
 184PASS parseFloat(m.f) is 20
 185
 186Test throwing exception from inverse
 187PASS m.inverse() threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
 188
 189PASS successfullyParsed is true
 190
 191TEST COMPLETE
 192
0

LayoutTests/svg/dom/SVGMatrix-interface.xhtml

 1<html xmlns="http://www.w3.org/1999/xhtml">
 2<head>
 3<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"/>
 4<script src="../../fast/js/resources/js-test-pre.js"></script>
 5</head>
 6<body>
 7<div id="description"></div>
 8<div id="console"></div>
 9
 10<script>
 11
 12description("This test exercises the SVGMatrix interface");
 13
 14debug("");
 15debug("SVGMatrix constructors");
 16
 17var svgroot = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
 18var m = null;
 19m = svgroot.createSVGMatrix();
 20if (m)
 21 testPassed("default constructor");
 22else
 23 testFailed("default constructor");
 24
 25debug("");
 26debug("Test attributes on default matrix");
 27shouldBe('m.a', '1');
 28shouldBe('m.b', '0');
 29shouldBe('m.c', '0');
 30shouldBe('m.d', '1');
 31shouldBe('m.e', '0');
 32shouldBe('m.f', '0');
 33
 34debug("");
 35debug("Test attributes on translate() and accumulation");
 36var m2 = m.translate(50,0);
 37m2 = m2.translate(50,50);
 38shouldBe('m2.a', '1');
 39shouldBe('m2.b', '0');
 40shouldBe('m2.c', '0');
 41shouldBe('m2.d', '1');
 42shouldBe('m2.e', '100');
 43shouldBe('m2.f', '50');
 44
 45debug("");
 46debug("Test immutability of translate()");
 47shouldBe('parseFloat(m.a)', '1');
 48shouldBe('parseFloat(m.b)', '0');
 49shouldBe('parseFloat(m.c)', '0');
 50shouldBe('parseFloat(m.d)', '1');
 51shouldBe('parseFloat(m.e)', '0');
 52shouldBe('parseFloat(m.f)', '0');
 53
 54debug("");
 55debug("Test attributes on scale()");
 56var m3 = m2.scale(5);
 57shouldBe('m3.a', '5');
 58shouldBe('m3.b', '0');
 59shouldBe('m3.c', '0');
 60shouldBe('m3.d', '5');
 61shouldBe('m3.e', '100');
 62shouldBe('m3.f', '50');
 63
 64debug("");
 65debug("Test immutability of scale()");
 66shouldBe('parseFloat(m2.a)', '1');
 67shouldBe('parseFloat(m2.b)', '0');
 68shouldBe('parseFloat(m2.c)', '0');
 69shouldBe('parseFloat(m2.d)', '1');
 70shouldBe('parseFloat(m2.e)', '100');
 71shouldBe('parseFloat(m2.f)', '50');
 72
 73debug("");
 74debug("Test attributes on scaleNonUniform()");
 75var m4 = m3.scaleNonUniform(2,1);
 76shouldBe('m4.a', '10');
 77shouldBe('m4.b', '0');
 78shouldBe('m4.c', '0');
 79shouldBe('m4.d', '5');
 80shouldBe('m4.e', '100');
 81shouldBe('m4.f', '50');
 82
 83debug("");
 84debug("Test immutability of scaleNonUniform()");
 85shouldBe('parseFloat(m3.a)', '5');
 86shouldBe('parseFloat(m3.b)', '0');
 87shouldBe('parseFloat(m3.c)', '0');
 88shouldBe('parseFloat(m3.d)', '5');
 89shouldBe('parseFloat(m3.e)', '100');
 90shouldBe('parseFloat(m3.f)', '50');
 91
 92debug("");
 93debug("Test rotate()");
 94m = svgroot.createSVGMatrix();
 95m2 = m.rotate(10);
 96shouldBe('parseFloat(m2.a.toPrecision(6))', '0.984808');
 97shouldBe('parseFloat(m2.b.toPrecision(6))', '0.173648');
 98shouldBe('parseFloat(m2.c.toPrecision(6))', '-0.173648');
 99shouldBe('parseFloat(m2.d.toPrecision(6))', '0.984808');
 100shouldBe('m.e', '0');
 101shouldBe('m.f', '0');
 102
 103debug("");
 104debug("Test immutability of rotate()");
 105shouldBe('parseFloat(m.a)', '1');
 106shouldBe('parseFloat(m.b)', '0');
 107shouldBe('parseFloat(m.c)', '0');
 108shouldBe('parseFloat(m.d)', '1');
 109shouldBe('parseFloat(m.e)', '0');
 110shouldBe('parseFloat(m.f)', '0');
 111
 112// TODO: write tests for rotateFromVector() and immutability
 113
 114debug("");
 115debug("Test flipX()");
 116m4 = m3.flipX();
 117shouldBe('m4.a', '-5');
 118shouldBe('m4.b', '0');
 119shouldBe('m4.c', '0');
 120shouldBe('m4.d', '5');
 121shouldBe('m4.e', '100');
 122shouldBe('m4.f', '50');
 123
 124debug("");
 125debug("Test immutability of flipX()");
 126shouldBe('parseFloat(m3.a)', '5');
 127shouldBe('parseFloat(m3.b)', '0');
 128shouldBe('parseFloat(m3.c)', '0');
 129shouldBe('parseFloat(m3.d)', '5');
 130shouldBe('parseFloat(m3.e)', '100');
 131shouldBe('parseFloat(m3.f)', '50');
 132
 133debug("");
 134debug("Test flipY()");
 135m4 = m3.flipY();
 136shouldBe('m4.a', '5');
 137shouldBe('m4.b', '0');
 138shouldBe('m4.c', '0');
 139shouldBe('m4.d', '-5');
 140shouldBe('m4.e', '100');
 141shouldBe('m4.f', '50');
 142
 143debug("");
 144debug("Test immutability of flipY()");
 145shouldBe('parseFloat(m3.a)', '5');
 146shouldBe('parseFloat(m3.b)', '0');
 147shouldBe('parseFloat(m3.c)', '0');
 148shouldBe('parseFloat(m3.d)', '5');
 149shouldBe('parseFloat(m3.e)', '100');
 150shouldBe('parseFloat(m3.f)', '50');
 151
 152debug("");
 153debug("Test skewX()");
 154m = svgroot.createSVGMatrix();
 155m2 = m.skewX(30);
 156shouldBe('m2.a', '1');
 157shouldBe('m2.b', '0');
 158shouldBe('parseFloat(m2.c.toPrecision(6))', '0.577350');
 159shouldBe('m2.d', '1');
 160shouldBe('m2.e', '0');
 161shouldBe('m2.f', '0');
 162
 163debug("");
 164debug("Test immutability of skewX()");
 165shouldBe('parseFloat(m.a)', '1');
 166shouldBe('parseFloat(m.b)', '0');
 167shouldBe('parseFloat(m.c)', '0');
 168shouldBe('parseFloat(m.d)', '1');
 169shouldBe('parseFloat(m.e)', '0');
 170shouldBe('parseFloat(m.f)', '0');
 171
 172debug("");
 173debug("Test skewY()");
 174m = svgroot.createSVGMatrix();
 175m2 = m.skewY(30);
 176shouldBe('m2.a', '1');
 177shouldBe('parseFloat(m2.b.toPrecision(6))', '0.577350');
 178shouldBe('m2.c', '0');
 179shouldBe('m2.d', '1');
 180shouldBe('m2.e', '0');
 181shouldBe('m2.f', '0');
 182
 183debug("");
 184debug("Test immutability of skewY()");
 185shouldBe('parseFloat(m.a)', '1');
 186shouldBe('parseFloat(m.b)', '0');
 187shouldBe('parseFloat(m.c)', '0');
 188shouldBe('parseFloat(m.d)', '1');
 189shouldBe('parseFloat(m.e)', '0');
 190shouldBe('parseFloat(m.f)', '0');
 191
 192debug("");
 193debug("Test multiply");
 194var tx = svgroot.createSVGMatrix();
 195var sx = svgroot.createSVGMatrix();
 196tx = tx.translate(100,0);
 197sx = sx.scaleNonUniform(2,1);
 198m = tx.multiply(sx);
 199shouldBe('m.a', '2');
 200shouldBe('m.b', '0');
 201shouldBe('m.c', '0');
 202shouldBe('m.d', '1');
 203shouldBe('m.e', '100');
 204shouldBe('m.f', '0');
 205
 206debug("")
 207debug("Test immutability of multiply");
 208shouldBe('tx.a', '1');
 209shouldBe('tx.b', '0');
 210shouldBe('tx.c', '0');
 211shouldBe('tx.d', '1');
 212shouldBe('tx.e', '100');
 213shouldBe('tx.f', '0');
 214shouldBe('sx.a', '2');
 215shouldBe('sx.b', '0');
 216shouldBe('sx.c', '0');
 217shouldBe('sx.d', '1');
 218shouldBe('sx.e', '0');
 219shouldBe('sx.f', '0');
 220
 221debug("");
 222debug("Test multiply with missing argument");
 223m = null;
 224try {
 225 m = tx.multiply();
 226} catch(e) {}
 227shouldBe('m', 'null');
 228
 229debug("");
 230debug("Test inverse");
 231m = svgroot.createSVGMatrix();
 232m = m.translate(10,20);
 233m = m.scale(2);
 234m2 = m.inverse();
 235
 236shouldBe('parseFloat(m2.a)', '0.5');
 237shouldBe('parseFloat(m2.b)', '0');
 238shouldBe('parseFloat(m2.c)', '0');
 239shouldBe('parseFloat(m2.d)', '0.5');
 240shouldBe('parseFloat(m2.e)', '-5');
 241shouldBe('parseFloat(m2.f)', '-10');
 242
 243debug("");
 244debug("Test immutability of inverse");
 245shouldBe('parseFloat(m.a)', '2');
 246shouldBe('parseFloat(m.b)', '0');
 247shouldBe('parseFloat(m.c)', '0');
 248shouldBe('parseFloat(m.d)', '2');
 249shouldBe('parseFloat(m.e)', '10');
 250shouldBe('parseFloat(m.f)', '20');
 251
 252debug("");
 253debug("Test throwing exception from inverse");
 254m = new WebKitCSSMatrix("matrix(0, 0, 0, 0, 0, 0)"); // not invertible
 255shouldThrow('m.inverse()');
 256
 257debug("");
 258successfullyParsed = true;
 259
 260</script>
 261<script src="../../fast/js/resources/js-test-post.js"></script>
 262
 263<script>
 264</script>
 265
 266</body>
 267</html>
0