Automatic update from web-platform-tests Make DOMMatrix invertSelf() tests handle -0 as identical to +0 Because the spec[1] treats -0 and +0 as equal, this patch uses checkMatrix() instead of checkDOMMatrix(). checkDOMMatrix() compares them strictly, while checkMatrix() uses a small epsilon and treats them as equal. The test failed because a 4x4 identity matrix inversion can end up with -0 entries. Unlike Firefox and WebKit, Chromium uses a 2D fast path in gfx::Matrix44::GetInverse() if the 4x4 matrix can be represented as a 2D transform. As a result unary operations in that path can turn 0 into -0. The 2D path is an intended optimization. So, the logic is correct. This keeps the 2D fast path. It just fixes the failing test without changing runtime behavior. [1] https://www.w3.org/TR/geometry-1 Bug: 357931029 Change-Id: Ia22abf44d14289693832cb2d7493599499d12244 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6880947 Reviewed-by: Philip Rogers <pdr@chromium.org> Commit-Queue: Philip Rogers <pdr@chromium.org> Reviewed-by: Jinho Bang <zino@chromium.org> Cr-Commit-Position: refs/heads/main@{#1507860} -- wpt-commits: 47beb4bcd05d135e935c871f8555b4901c38b783 wpt-pr: 54578
25 lines
1.2 KiB
HTML
25 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<title>Geometry Interfaces: DOMMatrix and DOMMatrixReadOnly invertSelf</title>
|
|
<link rel="help" href="https://drafts.fxtf.org/geometry/#DOMMatrix">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="support/dommatrix-test-util.js"></script>
|
|
<script>
|
|
[
|
|
[[0, 0, 0, 0, 0, 0], [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]],
|
|
[[1, 1, 1, 1, 1, 1], [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]],
|
|
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
[NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]],
|
|
[[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]],
|
|
].forEach(([actual_array, expected_array]) => {
|
|
test(() => {
|
|
const actual = new DOMMatrix(actual_array);
|
|
const actualInvertSelfReturnValue = actual.invertSelf();
|
|
assert_true(actual === actualInvertSelfReturnValue);
|
|
const expected = new DOMMatrix(expected_array);
|
|
checkMatrix(actual, expected);
|
|
}, `new DOMMatrix([${actual_array}]).invertSelf()`);
|
|
});
|
|
</script>
|