LibWeb: Make MouseEvent.offsetX/Y ignore transforms

That is what the spec calls it, at least.
In code, this manifests as making the offset very aware
of the element's transform, because the click position comes
relative to the viewport, not to the transformed element.
This commit is contained in:
Psychpsyo 2024-11-19 22:26:00 +01:00 committed by Jelle Raaijmakers
commit 4dc65c57a0
Notes: github-actions[bot] 2024-12-13 06:19:51 +00:00
3 changed files with 58 additions and 4 deletions

View file

@ -0,0 +1,21 @@
<!DOCTYPE html>
<style>
div {
width: 100px;
height: 100px;
background-color: gray;
transform: rotate(45deg);
}
</style>
<div onClick="
println(`offsetX: ${event.offsetX}`);
println(`offsetY: ${event.offsetY}`);
"></div>
<script src="../include.js"></script>
<script>
test(() => {
internals.click(50, 60);
});
</script>