ladybird/Tests/LibWeb/Layout/input/block-and-inline/float-with-inline-contents-hoisted.html
Jelle Raaijmakers 6f800caeaa LibWeb: Don't mess up the order of nodes when wrapping inline contents
Whenever we introduce a block element in a container that at that point
has only had inline children, we create an anonymous wrapper for all the
inline elements so we can keep the invariant that each container
contains either inline or non-inline children. For some reason, we
ignore all the out-of-flow nodes since they are layed out separately and
it was thought that this shouldn't matter.

However, if we are dealing with inline blocks and floating blocks, the
order of the inline contents _including_ out-of-flow nodes becomes very
important: floating blocks need to take the order of nodes into account
when positioning themselves.

Fix this by simply hoisting the out-of-flow nodes into the anonymous
wrapper as well.

Fixes the order of blocks in #4212. The gap is still not present.
2025-04-24 19:12:50 +02:00

26 lines
608 B
HTML

<!DOCTYPE html>
<style>
.a {
display: inline-block;
}
.b {
float: left;
width: 100%;
}
.box {
height: 100px;
width: 100px;
}
.green {
background-color: green;
}
.blue {
background-color: blue;
}
</style>
<body>
<div class="a"><div class="box green"></div></div>
<div class="b"><div class="box blue"></div></div>
<div class="a"><div class="box green"></div></div>
<div class="b"><div class="box blue"></div></div>
<div></div><!-- This last <div> requires hoisting all inline content into an anonymous wrapper -->