1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:17:46 +00:00

LibWeb: Fix DOMMatrix fromMatrix to use complete DOMMatrixInit struct

DOMMatrix fromMatrix was using create_from_dom_matrix_2d_init to make
a DOMMatrix for it's init struct this is wrong because only the 2D
params of the DOMMatrix are put into the new matrix. I have added
a non 2D version of that function that takes the full DOMMatrixInit
so now fromMatrix works correctly again. I also have added some
text tests to test if it works correctly.

I split the dommatrix.html text tests into multiple files because that
file was becoming to big so now every sub function is a seperate file.
This commit is contained in:
Bastiaan van der Plaat 2023-09-07 21:26:21 +02:00 committed by Andrew Kaster
parent 5d37e1c220
commit 67f6a9ee12
14 changed files with 174 additions and 69 deletions

View file

@ -0,0 +1,21 @@
<script src="../include.js"></script>
<script>
test(() => {
let testCounter = 1;
function testPart(part) {
println(`${testCounter++}. ${JSON.stringify(part())}`);
}
// 1. Creating a DOMMatrix
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60]));
// 2. Creating a DOMMatrix with fromMatrix
testPart(() => DOMMatrix.fromMatrix({ a: 10, b: 20, c: 30, d: 40, e: 50, f: 60 }));
// 3. Creating a DOMMatrix
testPart(() => new DOMMatrix([10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160]));
// 4. Creating a DOMMatrix with fromMatrix
testPart(() => DOMMatrix.fromMatrix({ m11: 10, m12: 20, m13: 30, m14: 40, m21: 50, m22: 60, m23: 70, m24: 80, m31: 90, m32: 100, m33: 110, m34: 120, m41: 130, m42: 140, m43: 150, m44: 160 }));
});
</script>