Skip to content

Commit

Permalink
Fix a few edge cases for XRRigidTransform
Browse files Browse the repository at this point in the history
First, for sufficiently large DOMPointInit Values, it was impossible to
normalize the quaternion. This now throws an Invalid State error.

Second, for sufficiently large Translation values, the DCHECK for
IsInvertible, was failing. This triggered tests/debug builds, while on
production builds, it simply returned identity. This DCHECK has been
removed and replaced with a DLOG(ERROR) and an explicit return of an
identity inverse, to match the existing behavior while spec discussions
are ongoing as far as what to do in this case. It is worth noting, that
the "matrix" attribute that the page receives in cases such as this,
contains "invalid" (e.g. Infinity) values (indeed even before reaching
this case), due to the type mismatch, where DOMPointInit/the internal
representation are doubles, and the "matrix" attribute is a
Float32Array.

Bug: 1258611
Change-Id: I572ec27a4c176a0a1a7352c8cbdf92070dcf1080
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3257117
Commit-Queue: Alexander Cooper <[email protected]>
Commit-Queue: Klaus Weidner <[email protected]>
Auto-Submit: Alexander Cooper <[email protected]>
Reviewed-by: Klaus Weidner <[email protected]>
Cr-Commit-Position: refs/heads/main@{#937665}
  • Loading branch information
alcooper91 authored and chromium-wpt-export-bot committed Nov 3, 2021
1 parent bb30d11 commit 8e0e52c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions webxr/xrRigidTransform_constructor.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@
coordDict([1.0, 2.0, 3.0, 1.0]),
coordDict([0, 0, 0, 0])
), "Constructor should throw InvalidStateError for non-normalizeable orientation values");

assert_throws_dom("InvalidStateError", () => new XRRigidTransform(
coordDict([1.0, 2.0, 3.0, 1.0]),
coordDict([-1.7976931348623157e+308, 0, 0, 0])
), "Constructor should throw InvalidStateError for non-normalizeable orientation values");
resolve();
});

Expand Down

0 comments on commit 8e0e52c

Please sign in to comment.