author | Kagami Sascha Rosylight <saschanaz@outlook.com> |
Thu, 20 Jun 2019 03:59:59 +0000 | |
changeset 479286 | acfb79396a5be35546cf66045ffce60e2480bbfd |
parent 479285 | 4c6d64a741058690a8799c378384388f6c5a0124 |
child 479287 | cb178f3b180d9550b5141f67b5c76a8c9c81d813 |
push id | 36177 |
push user | rmaries@mozilla.com |
push date | Thu, 20 Jun 2019 09:46:31 +0000 |
treeherder | mozilla-central@a440f0629814 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bzbarsky |
bugs | 1559874 |
milestone | 69.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/DOMMatrix.cpp +++ b/dom/base/DOMMatrix.cpp @@ -37,36 +37,42 @@ JSObject* DOMMatrixReadOnly::WrapObject( JS::Handle<JSObject*> aGivenProto) { return DOMMatrixReadOnly_Binding::Wrap(aCx, this, aGivenProto); } already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::Constructor( const GlobalObject& aGlobal, const Optional<StringOrUnrestrictedDoubleSequence>& aArg, ErrorResult& aRv) { - RefPtr<DOMMatrixReadOnly> rval = - new DOMMatrixReadOnly(aGlobal.GetAsSupports()); if (!aArg.WasPassed()) { + RefPtr<DOMMatrixReadOnly> rval = + new DOMMatrixReadOnly(aGlobal.GetAsSupports()); return rval.forget(); } const auto& arg = aArg.Value(); if (arg.IsString()) { nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(aGlobal.GetAsSupports()); if (!win) { aRv.ThrowTypeError<MSG_ILLEGAL_CONSTRUCTOR>(); return nullptr; } + RefPtr<DOMMatrixReadOnly> rval = + new DOMMatrixReadOnly(aGlobal.GetAsSupports()); rval->SetMatrixValue(arg.GetAsString(), aRv); - } else { - const auto& sequence = arg.GetAsUnrestrictedDoubleSequence(); - SetDataInMatrix(rval, sequence.Elements(), sequence.Length(), aRv); + return rval.forget(); } + const auto& sequence = arg.GetAsUnrestrictedDoubleSequence(); + const int length = sequence.Length(); + const bool is2D = length == 6; + RefPtr<DOMMatrixReadOnly> rval = + new DOMMatrixReadOnly(aGlobal.GetAsSupports(), is2D); + SetDataInMatrix(rval, sequence.Elements(), length, aRv); return rval.forget(); } already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::ReadStructuredClone( nsISupports* aParent, JSStructuredCloneReader* aReader) { uint8_t is2D; if (!JS_ReadBytes(aReader, &is2D, 1)) { @@ -504,39 +510,46 @@ static void SetDataInMatrix(DOMMatrixRea lengthStr.AppendInt(aLength); aRv.ThrowTypeError<MSG_MATRIX_INIT_LENGTH_WRONG>(lengthStr); } } already_AddRefed<DOMMatrix> DOMMatrix::Constructor(const GlobalObject& aGlobal, const Float32Array& aArray32, ErrorResult& aRv) { - RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports()); aArray32.ComputeLengthAndData(); - SetDataInMatrix(obj, aArray32.Data(), aArray32.Length(), aRv); + + const int length = aArray32.Length(); + const bool is2D = length == 6; + RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D); + SetDataInMatrix(obj, aArray32.Data(), length, aRv); return obj.forget(); } already_AddRefed<DOMMatrix> DOMMatrix::Constructor(const GlobalObject& aGlobal, const Float64Array& aArray64, ErrorResult& aRv) { - RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports()); aArray64.ComputeLengthAndData(); - SetDataInMatrix(obj, aArray64.Data(), aArray64.Length(), aRv); + + const int length = aArray64.Length(); + const bool is2D = length == 6; + RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D); + SetDataInMatrix(obj, aArray64.Data(), length, aRv); return obj.forget(); } already_AddRefed<DOMMatrix> DOMMatrix::Constructor( const GlobalObject& aGlobal, const Sequence<double>& aNumberSequence, ErrorResult& aRv) { - RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports()); - SetDataInMatrix(obj, aNumberSequence.Elements(), aNumberSequence.Length(), - aRv); + const int length = aNumberSequence.Length(); + const bool is2D = length == 6; + RefPtr<DOMMatrix> obj = new DOMMatrix(aGlobal.GetAsSupports(), is2D); + SetDataInMatrix(obj, aNumberSequence.Elements(), length, aRv); return obj.forget(); } already_AddRefed<DOMMatrix> DOMMatrix::ReadStructuredClone( nsISupports* aParent, JSStructuredCloneReader* aReader) { uint8_t is2D; @@ -765,17 +778,19 @@ DOMMatrixReadOnly* DOMMatrixReadOnly::Se if (!ServoCSSParser::ParseTransformIntoMatrix( aTransformList, contains3dTransform, transform)) { aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR); return nullptr; } if (!contains3dTransform) { mMatrix3D = nullptr; - mMatrix2D = new gfx::MatrixDouble(); + if (!mMatrix2D) { + mMatrix2D = new gfx::MatrixDouble(); + } SetA(transform._11); SetB(transform._12); SetC(transform._21); SetD(transform._22); SetE(transform._41); SetF(transform._42); } else {
--- a/dom/tests/mochitest/general/test_DOMMatrix.html +++ b/dom/tests/mochitest/general/test_DOMMatrix.html @@ -457,17 +457,17 @@ function testSkewYInPlace() function testCreateMatrix3D() { var m = new DOMMatrix([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]); // Should be initialised to identity cmpMatrix(m, [1, 0, 0, 1, 0, 0], "DOMMatrix should produce identity matrix"); - is(m.is2D, true, "should not produce 3d matrix"); + is(m.is2D, false, "should produce 3d matrix"); m = new DOMMatrix([1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]); // Should be initialised to identity cmpMatrix(m, [1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0], "DOMMatrix should produce identity matrix"); is(m.is2D, false, "should produce 3d matrix"); } @@ -702,26 +702,26 @@ function testParsing() ok(CompareDOMMatrix(m2, m), "string parsing didn't match"); m = new DOMMatrix(); m.setMatrixValue("translate(10px, 20px) scale(.5, 2) rotate(45deg)"); ok(CompareDOMMatrix(m2, m), "string parsing didn't match"); } -function testStringify() { - var m = new DOMMatrix(); - var s = "" + m; - ok(s == "matrix" + formatMatrix(m), "stringifier 1 produced wrong result: " + s); - m.a = 100; - s = "" + m; - ok(s == "matrix" + formatMatrix(m), "stringifier 2 produced wrong result: " + s); - m.m43 = 200; - s = "" + m; - ok(s == "matrix3d" + formatMatrix(m), "stringifier 3 produced wrong result:" + s); +function testStringify() { + var m = new DOMMatrix(); + var s = "" + m; + ok(s == "matrix" + formatMatrix(m), "stringifier 1 produced wrong result: " + s); + m.a = 100; + s = "" + m; + ok(s == "matrix" + formatMatrix(m), "stringifier 2 produced wrong result: " + s); + m.m43 = 200; + s = "" + m; + ok(s == "matrix3d" + formatMatrix(m), "stringifier 3 produced wrong result:" + s); } window.addEventListener("load", main); </script> </pre> </body> </html>
--- a/testing/web-platform/meta/css/geometry/DOMMatrix-001.html.ini +++ b/testing/web-platform/meta/css/geometry/DOMMatrix-001.html.ini @@ -1,79 +1,10 @@ [DOMMatrix-001.html] - [testConstructor0] - expected: FAIL - - [testConstructor1] - expected: FAIL - - [testConstructor2] - expected: FAIL - - [testConstructor3] - expected: FAIL - - [testConstructor4] - expected: FAIL - - [testConstructor5] - expected: FAIL - - [testConstructor6] - expected: FAIL - - [testConstructor7] - expected: FAIL - - [testConstructor8] - expected: FAIL - - [testConstructor9] - expected: FAIL - - [testConstructor10] - expected: FAIL - - [testConstructor12] - expected: FAIL - - [testConstructor13] - expected: FAIL - [new DOMMatrix(undefined)] expected: FAIL - [new DOMMatrix(float32Array) 16 elements] - expected: FAIL - - [new DOMMatrix(float64Array) 16 elements] - expected: FAIL - - [new DOMMatrix(sequence) 16 elements] - expected: FAIL - - [new DOMMatrix(sequence)] - expected: FAIL - - [new DOMMatrix(matrix)] - expected: FAIL - - [new DOMMatrixReadOnly(float32Array) 16 elements] - expected: FAIL - - [new DOMMatrixReadOnly(float64Array) 16 elements] - expected: FAIL - - [new DOMMatrixReadOnly(sequence) 16 elements] - expected: FAIL - - [new DOMMatrixReadOnly(sequence)] - expected: FAIL - - [new DOMMatrixReadOnly(matrix)] - expected: FAIL - [new DOMMatrix("scale(2) translateX(5px) translateY(5px) rotate(5deg) rotate(-5deg)")] expected: FAIL [new DOMMatrixReadOnly("scale(2) translateX(5px) translateY(5px) rotate(5deg) rotate(-5deg)")] expected: FAIL