mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
LibWeb: Make HTMLElement.offset{Left,Top} work on inline elements
Before this change, we were returning (0, 0) for inline elements, due to a bogus paintable type check in box_type_agnostic_position().
This commit is contained in:
parent
79db9c27c6
commit
dea91afba7
3 changed files with 86 additions and 10 deletions
|
@ -0,0 +1,20 @@
|
|||
<style>
|
||||
b, i {
|
||||
position: relative;
|
||||
top: 25px;
|
||||
}
|
||||
</style><span>well <b>hello <i>friends</i></b></span>
|
||||
<div><br><br><br><br><pre id=out></pre></div>
|
||||
|
||||
<script>
|
||||
function println(s) {
|
||||
let out = document.getElementById("out");
|
||||
out.innerHTML += s + "\n";
|
||||
}
|
||||
let i = document.getElementsByTagName("i")[0]
|
||||
let b = document.getElementsByTagName("b")[0]
|
||||
let span = document.getElementsByTagName("span")[0]
|
||||
println("well: " + span.offsetLeft + ", " + span.offsetTop)
|
||||
println("hello: " + b.offsetLeft + ", " + b.offsetTop)
|
||||
println("friends: " + i.offsetLeft + ", " + i.offsetTop)
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue