mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-22 08:00:45 +00:00
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.
26 lines
608 B
HTML
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 -->
|