1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +00:00

LibWeb: Check both top and bottom of float position when looking for fit

We have to check that there's enough space at both the top and bottom of
the float's margin box, otherwise we risk overlapping existing content.
This commit is contained in:
Andreas Kling 2022-09-22 14:07:28 +02:00
parent 82e730eba1
commit 389f47f6fe
2 changed files with 63 additions and 16 deletions

View file

@ -0,0 +1,42 @@
<!DOCTYPE html>
<html class="js" lang="en-US">
<head>
<style>
* {
border: 0px solid black !important;
}
html, body {
margin: 0;
}
#page {
background: cyan;
padding-left: 50px;
padding-top: 50px;
}
#content_box {
float: left;
background: lime;
width: 400px;
height: 150px;
}
.first {
background: pink;
width: 300px;
height: 100px;
float: left;
}
.second {
background: orange;
width: 200px;
height: 50px;
float: left;
}
</style>
</head><body><div id="page"><div id="content_box"><article class="first">first</article><article class="second">second</article> </div></div></body></html>