1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:47:35 +00:00

LibWeb: Implement getBoundingClientRect() for inline paintables

This fixes the issue that occurred when, after clicking an inline
paintable page would always scroll to the top. The problem was that
`scroll_an_element_into_view()` relies on `get_bounding_client_rect()`
to produce the correct scroll position and for inline paintables we
were always returning zero rect before this change.
This commit is contained in:
Aliaksandr Kalenik 2023-12-14 08:16:45 +01:00 committed by Andreas Kling
parent 874af6048f
commit e464d484c4
5 changed files with 54 additions and 8 deletions

View file

@ -1 +1,2 @@
{"x":8,"y":500,"width":784,"height":150,"top":500,"right":792,"bottom":650,"left":8}
inline {"x":8,"y":500,"width":784,"height":150,"top":500,"right":792,"bottom":650,"left":8}
{"x":8,"y":650,"width":41.296875,"height":17.46875,"top":650,"right":49.296875,"bottom":667.46875,"left":8}

View file

@ -9,10 +9,16 @@
}
</style>
<div id="box"></div>
<a id="inline">inline</a>
<script src="include.js"></script>
<script>
test(() => {
const rect = document.getElementById("box").getBoundingClientRect();
println(JSON.stringify(rect));
});
test(() => {
const rect = document.getElementById("inline").getBoundingClientRect();
println(JSON.stringify(rect));
});
</script>