1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 18:25:06 +00:00
serenity/Tests/LibWeb/Text/input/hit_testing/float-with-inline-sibling-after.html
Andreas Kling 6994ea5885 LibWeb: Skip out-of-flow boxes when wrapping inlines in anonymous block
Out-of-flow boxes (floating and absolutely-positioned elements) were
previously collected and put in the anonymous block wrapper as well, but
this actually made hit testing not able to find them, since they were
breaking expectations about tree structure that hit testing relies on.

After this change, we simply let out-of-flow boxes stay in their
original parent, preserving the author's intended box tree structure.
2023-12-11 13:19:12 +01:00

38 lines
741 B
HTML

<!DOCTYPE html><style>
* {
outline: 1px solid black;
margin: 0;
padding: 0;
}
body {
position: relative;
}
#d_header {
background: pink;
width: 400px;
height: 30px;
}
#d_scene_btns {
float: left;
}
#button {
width: 50px;
height: 50px;
background: orange;
}
#button:hover {
background: red;
}
</style><body><div id="d_header"><div id="d_scene_btns"><div id="button"></div></div> <div class="clear"></div>
<div id="box"></div>
<script src="../include.js"></script>
<script>
test(() => {
println(internals.hitTest(5, 5).node === document.getElementById("button"));
});
</script>