Commit 57f350e0 authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

[GeometryInterface] add scaleNonUniform method in DOMMatrixReadOnly

DOMMatrix should be alias to SVGMatrix. (It was not implement in blink yet)
SVGMatrix have scaleNonUniform() function. but DOMMatrix was not.
there are some website which is used SVGMatrix.scaleNonUniform().
it would be possible brake some website when DOMMatrix be alias
to SVGMatrix.

Intent to implement and ship:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/BJJKDby5p7w

Bug: 905921
Change-Id: Ic09b8d6e46d0aa822b766bd6cfbc5ce7c2164849
Reviewed-on: https://chromium-review.googlesource.com/c/1341279
Commit-Queue: Hwanseung Lee <hs1217.lee@samsung.com>
Reviewed-by: default avatarPhilip Jägenstedt <foolip@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Reviewed-by: default avatarJinho Bang <jinho.bang@samsung.com>
Cr-Commit-Position: refs/heads/master@{#612473}
parent bc0c4e67
...@@ -243,6 +243,10 @@ DOMMatrix* DOMMatrixReadOnly::scale3d(double scale, ...@@ -243,6 +243,10 @@ DOMMatrix* DOMMatrixReadOnly::scale3d(double scale,
return DOMMatrix::Create(this)->scale3dSelf(scale, ox, oy, oz); return DOMMatrix::Create(this)->scale3dSelf(scale, ox, oy, oz);
} }
DOMMatrix* DOMMatrixReadOnly::scaleNonUniform(double sx, double sy) {
return DOMMatrix::Create(this)->scaleSelf(sx, sy, 1, 0, 0, 0);
}
DOMMatrix* DOMMatrixReadOnly::rotate(double rot_x) { DOMMatrix* DOMMatrixReadOnly::rotate(double rot_x) {
return DOMMatrix::Create(this)->rotateSelf(rot_x); return DOMMatrix::Create(this)->rotateSelf(rot_x);
} }
......
...@@ -100,6 +100,7 @@ class CORE_EXPORT DOMMatrixReadOnly : public ScriptWrappable { ...@@ -100,6 +100,7 @@ class CORE_EXPORT DOMMatrixReadOnly : public ScriptWrappable {
double ox = 0, double ox = 0,
double oy = 0, double oy = 0,
double oz = 0); double oz = 0);
DOMMatrix* scaleNonUniform(double sx = 1, double sy = 1);
DOMMatrix* scale3d(double scale = 1, DOMMatrix* scale3d(double scale = 1,
double ox = 0, double ox = 0,
double oy = 0, double oy = 0,
......
...@@ -53,6 +53,8 @@ ...@@ -53,6 +53,8 @@
optional unrestricted double originX = 0, optional unrestricted double originX = 0,
optional unrestricted double originY = 0, optional unrestricted double originY = 0,
optional unrestricted double originZ = 0); optional unrestricted double originZ = 0);
DOMMatrix scaleNonUniform(optional unrestricted double scaleX = 1,
optional unrestricted double scaleY = 1);
DOMMatrix scale3d(optional unrestricted double scale = 1, DOMMatrix scale3d(optional unrestricted double scale = 1,
optional unrestricted double originX = 0, optional unrestricted double originX = 0,
optional unrestricted double originY = 0, optional unrestricted double originY = 0,
......
...@@ -37,6 +37,12 @@ ...@@ -37,6 +37,12 @@
checkDOMMatrix(matrix, initialMatrix()); checkDOMMatrix(matrix, initialMatrix());
},"test scale() doesn't mutate"); },"test scale() doesn't mutate");
test(function() {
var matrix = initialMatrix();
matrix.scaleNonUniform(1,5);
checkDOMMatrix(matrix, initialMatrix());
},"test scaleNonUniform() doesn't mutate");
test(function() { test(function() {
var matrix = initialMatrix(); var matrix = initialMatrix();
matrix.scale3d(3,2,1,1); matrix.scale3d(3,2,1,1);
......
...@@ -139,6 +139,27 @@ ...@@ -139,6 +139,27 @@
checkDOMMatrix(result, expected); checkDOMMatrix(result, expected);
},"test scale() with offsets"); },"test scale() with offsets");
test(function() {
var result = initialDOMMatrix().scaleNonUniform();
var expected = initialDOMMatrix()
.scale(1, 1, 1, 0, 0, 0);
checkDOMMatrix(result, expected);
},"test scaleNonUniform()");
test(function() {
var result = initialDOMMatrix().scaleNonUniform(6);
var expected = initialDOMMatrix()
.scale(6, 1, 1, 0, 0, 0);
checkDOMMatrix(result, expected);
},"test scaleNonUniform() with sx");
test(function() {
var result = initialDOMMatrix().scaleNonUniform(5, 7);
var expected = initialDOMMatrix()
.scale(5, 7, 1, 0, 0, 0);
checkDOMMatrix(result, expected);
},"test scaleNonUniform() with sx, sy");
test(function() { test(function() {
var result = initialDOMMatrix().scale3d(7, 5, 2, 3); var result = initialDOMMatrix().scale3d(7, 5, 2, 3);
var expected = initialDOMMatrix() var expected = initialDOMMatrix()
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
// Removed members // Removed members
[ [
// https://github.com/w3c/fxtf-drafts/commit/99e3212469026b2f2f50926a41912d110a1741b7 // https://github.com/w3c/fxtf-drafts/commit/99e3212469026b2f2f50926a41912d110a1741b7
['DOMMatrixReadOnly', 'scaleNonUniform'],
['DOMMatrix', 'scaleNonUniformSelf'], ['DOMMatrix', 'scaleNonUniformSelf'],
// https://github.com/w3c/fxtf-drafts/commit/86da3dc961d442f9d8dc7ab59065a9804e109286 // https://github.com/w3c/fxtf-drafts/commit/86da3dc961d442f9d8dc7ab59065a9804e109286
['DOMMatrix', 'multiplyBy'], ['DOMMatrix', 'multiplyBy'],
......
This is a testharness.js-based test. This is a testharness.js-based test.
Found 371 tests; 365 PASS, 6 FAIL, 0 TIMEOUT, 0 NOTRUN. Found 371 tests; 368 PASS, 3 FAIL, 0 TIMEOUT, 0 NOTRUN.
PASS Test driver PASS Test driver
PASS DOMPointReadOnly interface: existence and properties of interface object PASS DOMPointReadOnly interface: existence and properties of interface object
PASS DOMPointReadOnly interface object length PASS DOMPointReadOnly interface object length
...@@ -193,7 +193,7 @@ PASS DOMMatrixReadOnly interface: attribute is2D ...@@ -193,7 +193,7 @@ PASS DOMMatrixReadOnly interface: attribute is2D
PASS DOMMatrixReadOnly interface: attribute isIdentity PASS DOMMatrixReadOnly interface: attribute isIdentity
PASS DOMMatrixReadOnly interface: operation translate(unrestricted double, unrestricted double, unrestricted double) PASS DOMMatrixReadOnly interface: operation translate(unrestricted double, unrestricted double, unrestricted double)
PASS DOMMatrixReadOnly interface: operation scale(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) PASS DOMMatrixReadOnly interface: operation scale(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)
FAIL DOMMatrixReadOnly interface: operation scaleNonUniform(unrestricted double, unrestricted double) assert_own_property: interface prototype object missing non-static operation expected property "scaleNonUniform" missing PASS DOMMatrixReadOnly interface: operation scaleNonUniform(unrestricted double, unrestricted double)
PASS DOMMatrixReadOnly interface: operation scale3d(unrestricted double, unrestricted double, unrestricted double, unrestricted double) PASS DOMMatrixReadOnly interface: operation scale3d(unrestricted double, unrestricted double, unrestricted double, unrestricted double)
PASS DOMMatrixReadOnly interface: operation rotate(unrestricted double, unrestricted double, unrestricted double) PASS DOMMatrixReadOnly interface: operation rotate(unrestricted double, unrestricted double, unrestricted double)
PASS DOMMatrixReadOnly interface: operation rotateFromVector(unrestricted double, unrestricted double) PASS DOMMatrixReadOnly interface: operation rotateFromVector(unrestricted double, unrestricted double)
...@@ -245,8 +245,8 @@ PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property ...@@ -245,8 +245,8 @@ PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property
PASS DOMMatrixReadOnly interface: calling translate(unrestricted double, unrestricted double, unrestricted double) on new DOMMatrixReadOnly() with too few arguments must throw TypeError PASS DOMMatrixReadOnly interface: calling translate(unrestricted double, unrestricted double, unrestricted double) on new DOMMatrixReadOnly() with too few arguments must throw TypeError
PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property "scale(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property "scale(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type
PASS DOMMatrixReadOnly interface: calling scale(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on new DOMMatrixReadOnly() with too few arguments must throw TypeError PASS DOMMatrixReadOnly interface: calling scale(unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double, unrestricted double) on new DOMMatrixReadOnly() with too few arguments must throw TypeError
FAIL DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property "scaleNonUniform(unrestricted double, unrestricted double)" with the proper type assert_inherits: property "scaleNonUniform" not found in prototype chain PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property "scaleNonUniform(unrestricted double, unrestricted double)" with the proper type
FAIL DOMMatrixReadOnly interface: calling scaleNonUniform(unrestricted double, unrestricted double) on new DOMMatrixReadOnly() with too few arguments must throw TypeError assert_inherits: property "scaleNonUniform" not found in prototype chain PASS DOMMatrixReadOnly interface: calling scaleNonUniform(unrestricted double, unrestricted double) on new DOMMatrixReadOnly() with too few arguments must throw TypeError
PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property "scale3d(unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property "scale3d(unrestricted double, unrestricted double, unrestricted double, unrestricted double)" with the proper type
PASS DOMMatrixReadOnly interface: calling scale3d(unrestricted double, unrestricted double, unrestricted double, unrestricted double) on new DOMMatrixReadOnly() with too few arguments must throw TypeError PASS DOMMatrixReadOnly interface: calling scale3d(unrestricted double, unrestricted double, unrestricted double, unrestricted double) on new DOMMatrixReadOnly() with too few arguments must throw TypeError
PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property "rotate(unrestricted double, unrestricted double, unrestricted double)" with the proper type PASS DOMMatrixReadOnly interface: new DOMMatrixReadOnly() must inherit property "rotate(unrestricted double, unrestricted double, unrestricted double)" with the proper type
......
...@@ -6,6 +6,9 @@ PASS DOMMatrix.scale(sx, sy) ...@@ -6,6 +6,9 @@ PASS DOMMatrix.scale(sx, sy)
PASS DOMMatrix.scale(sx, sy) PASS DOMMatrix.scale(sx, sy)
PASS DOMMatrix.scale(sx, sy, sz, ox, oy) PASS DOMMatrix.scale(sx, sy, sz, ox, oy)
PASS DOMMatrix.scale(sx, sy, sz, ox, oy, oz) PASS DOMMatrix.scale(sx, sy, sz, ox, oy, oz)
PASS DOMMatrix.scaleNonUniform()
PASS DOMMatrix.scaleNonUniform(scaleX)
PASS DOMMatrix.scaleNonUniform(scaleX, scaleY)
PASS DOMMatrix.scale3d() PASS DOMMatrix.scale3d()
PASS DOMMatrix.scale3d(scale) PASS DOMMatrix.scale3d(scale)
PASS DOMMatrix.scale3d(scale, ox, oy, oz) PASS DOMMatrix.scale3d(scale, ox, oy, oz)
......
...@@ -53,6 +53,32 @@ test(function() { ...@@ -53,6 +53,32 @@ test(function() {
assert_identity_2d_matrix(matrix); assert_identity_2d_matrix(matrix);
}, "DOMMatrix.scale(sx, sy, sz, ox, oy, oz)"); }, "DOMMatrix.scale(sx, sy, sz, ox, oy, oz)");
test(function() {
var matrix = new DOMMatrix();
assert_identity_2d_matrix(matrix);
var result = matrix.scaleNonUniform();
assert_identity_2d_matrix(result);
assert_identity_2d_matrix(matrix);
}, "DOMMatrix.scaleNonUniform()");
test(function() {
var matrix = new DOMMatrix();
assert_identity_2d_matrix(matrix);
var result = matrix.scaleNonUniform(5);
var expected = matrix.scale(5, 1, 1, 0, 0, 0);
assert_2d_matrix_equals(result, [expected.a, expected.b, expected.c, expected.d, expected.e, expected.f]);
assert_identity_2d_matrix(matrix);
}, "DOMMatrix.scaleNonUniform(scaleX)");
test(function() {
var matrix = new DOMMatrix();
assert_identity_2d_matrix(matrix);
var result = matrix.scaleNonUniform(5, 7);
var expected = matrix.scale(5, 7, 1, 0, 0, 0);
assert_2d_matrix_equals(result, [expected.a, expected.b, expected.c, expected.d, expected.e, expected.f]);
assert_identity_2d_matrix(matrix);
}, "DOMMatrix.scaleNonUniform(scaleX, scaleY)");
test(function() { test(function() {
var matrix = new DOMMatrix(); var matrix = new DOMMatrix();
assert_identity_2d_matrix(matrix); assert_identity_2d_matrix(matrix);
......
...@@ -298,6 +298,7 @@ interface DOMMatrixReadOnly ...@@ -298,6 +298,7 @@ interface DOMMatrixReadOnly
method rotateFromVector method rotateFromVector
method scale method scale
method scale3d method scale3d
method scaleNonUniform
method skewX method skewX
method skewY method skewY
method toFloat32Array method toFloat32Array
......
...@@ -246,6 +246,7 @@ interface DOMMatrixReadOnly ...@@ -246,6 +246,7 @@ interface DOMMatrixReadOnly
method rotateFromVector method rotateFromVector
method scale method scale
method scale3d method scale3d
method scaleNonUniform
method skewX method skewX
method skewY method skewY
method toFloat32Array method toFloat32Array
......
...@@ -225,6 +225,7 @@ Starting worker: resources/global-interface-listing-worker.js ...@@ -225,6 +225,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method rotateFromVector [Worker] method rotateFromVector
[Worker] method scale [Worker] method scale
[Worker] method scale3d [Worker] method scale3d
[Worker] method scaleNonUniform
[Worker] method skewX [Worker] method skewX
[Worker] method skewY [Worker] method skewY
[Worker] method toFloat32Array [Worker] method toFloat32Array
......
...@@ -991,6 +991,7 @@ interface DOMMatrixReadOnly ...@@ -991,6 +991,7 @@ interface DOMMatrixReadOnly
method rotateFromVector method rotateFromVector
method scale method scale
method scale3d method scale3d
method scaleNonUniform
method skewX method skewX
method skewY method skewY
method toFloat32Array method toFloat32Array
......
...@@ -225,6 +225,7 @@ Starting worker: resources/global-interface-listing-worker.js ...@@ -225,6 +225,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method rotateFromVector [Worker] method rotateFromVector
[Worker] method scale [Worker] method scale
[Worker] method scale3d [Worker] method scale3d
[Worker] method scaleNonUniform
[Worker] method skewX [Worker] method skewX
[Worker] method skewY [Worker] method skewY
[Worker] method toFloat32Array [Worker] method toFloat32Array
......
...@@ -253,6 +253,7 @@ Starting worker: resources/global-interface-listing-worker.js ...@@ -253,6 +253,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method rotateFromVector [Worker] method rotateFromVector
[Worker] method scale [Worker] method scale
[Worker] method scale3d [Worker] method scale3d
[Worker] method scaleNonUniform
[Worker] method skewX [Worker] method skewX
[Worker] method skewY [Worker] method skewY
[Worker] method toFloat32Array [Worker] method toFloat32Array
......
...@@ -1298,6 +1298,7 @@ interface DOMMatrixReadOnly ...@@ -1298,6 +1298,7 @@ interface DOMMatrixReadOnly
method rotateFromVector method rotateFromVector
method scale method scale
method scale3d method scale3d
method scaleNonUniform
method skewX method skewX
method skewY method skewY
method toFloat32Array method toFloat32Array
......
...@@ -253,6 +253,7 @@ Starting worker: resources/global-interface-listing-worker.js ...@@ -253,6 +253,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] method rotateFromVector [Worker] method rotateFromVector
[Worker] method scale [Worker] method scale
[Worker] method scale3d [Worker] method scale3d
[Worker] method scaleNonUniform
[Worker] method skewX [Worker] method skewX
[Worker] method skewY [Worker] method skewY
[Worker] method toFloat32Array [Worker] method toFloat32Array
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment