LibWeb: Add test for mouse event offset with nested CSS transforms

The test currently produces incorrect offsetX/offsetY values because
compute_mouse_event_offset() only inverts the target element's own
transform, not ancestor transforms.
This commit is contained in:
Aliaksandr Kalenik
2026-01-31 15:17:12 +01:00
committed by Alexander Kalenik
parent ef3991f1ed
commit 176e3b93b3
Notes: github-actions[bot] 2026-02-06 10:51:36 +00:00
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<style>
body {
margin: 0;
}
.outer {
width: 200px;
height: 200px;
transform: translateX(50px);
}
.inner {
width: 100px;
height: 100px;
background-color: gray;
transform: translateX(10px);
}
</style>
<div class="outer">
<div class="inner" onClick="
println(`offsetX: ${event.offsetX}`);
println(`offsetY: ${event.offsetY}`);
"></div>
</div>
<script src="../include.js"></script>
<script>
test(() => {
// Click at (65, 5) which hits the inner div.
// Inner's layout position is (0, 0). It is painted at (60, 0)
// due to outer's translateX(50px) + inner's translateX(10px).
internals.click(65, 5);
});
</script>