layout: Gracefully handle script queries on nodes with uninvertible transforms (#39075)

Instead of panicking when doing a geometry script query on a node with
an uninvertible transform, return a zero-sized rectangle at the
untransformed position. This is similar to what Gecko and Blink do
(though it seems there are some differences in positioning this
zero-sized rectangle). Mostly importantly, do not panic.

Testing: This change adds a new WPT crash test.
Fixes: #38848.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-09-02 06:27:43 -07:00 committed by GitHub
parent 4de84b0ca5
commit efe9ea2306
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 53 additions and 6 deletions

View file

@ -5819,6 +5819,13 @@
{}
]
],
"uninvertible-transform-and-script-queries.html": [
"8a3c88fcb8ade4038ba47a347cf3a5375d521bd4",
[
null,
{}
]
],
"w-crossing-zero-001.html": [
"64ba0e85f24d501e4115d7e697052acb3a84f27a",
[

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<link rel="help" href="https://github.com/servo/servo/issues/38848">
<div style="transform: scale(0)">
<img style="height: 200px; width: 200px; border: solid;" id="img">
<div style="height: 200px; width: 200px; border: solid;" id="div"></div>
</div>
<script>
div.getBoundingClientRect();
div.getClientRects();
img.getBoundingClientRect();
img.getClientRects();
img.height;
img.width;
</script>