mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:57:44 +00:00
LibWeb: Follow the spec more precisely in Element::getClientRects()
Now, `Element::getBoundingClientRect()` implementation depends on `Element::getClientRects()`, as defined in the specification.
This commit is contained in:
parent
16f1962f10
commit
768b8415f2
3 changed files with 78 additions and 31 deletions
2
Tests/LibWeb/Text/expected/element-get-client-rects.txt
Normal file
2
Tests/LibWeb/Text/expected/element-get-client-rects.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
inline {"0":{"x":8,"y":500,"width":784,"height":150,"top":500,"right":792,"bottom":650,"left":8}}
|
||||
{"0":{"x":8,"y":650,"width":41.296875,"height":17,"top":650,"right":49.296875,"bottom":667,"left":8}}
|
22
Tests/LibWeb/Text/input/element-get-client-rects.html
Normal file
22
Tests/LibWeb/Text/input/element-get-client-rects.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<style type="text/css">
|
||||
#box {
|
||||
margin-top: 500px;
|
||||
padding-top: 100px;
|
||||
background-color: navy;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
}
|
||||
</style>
|
||||
<div id="box"></div>
|
||||
<a id="inline">inline</a>
|
||||
<script src="include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const box_rect = document.getElementById("box").getClientRects();
|
||||
println(JSON.stringify(box_rect));
|
||||
|
||||
const inline_rect = document.getElementById("inline").getClientRects();
|
||||
println(JSON.stringify(inline_rect));
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue