mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
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:
committed by
Alexander Kalenik
parent
ef3991f1ed
commit
176e3b93b3
Notes:
github-actions[bot]
2026-02-06 10:51:36 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/176e3b93b37 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7701
@@ -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>
|
||||
Reference in New Issue
Block a user