Files
ladybird/Tests/LibWeb/Text/input/CSSOMView/mouse-event-offset-with-nested-css-transforms.html
Aliaksandr Kalenik 176e3b93b3 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.
2026-01-31 16:56:05 +01:00

35 lines
780 B
HTML

<!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>