1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:58:11 +00:00

LibWeb: Ensure preceding offset is non-negative in float_box()

When calculating the edge offset of the next floating item based on the
offset of the preceding floating item, we need to ensure that the
preceding offset is always > 0. This isn't explicitly written in the
spec, but all other popular engines do that.

Fixes https://github.com/SerenityOS/serenity/issues/21023
This commit is contained in:
Aliaksandr Kalenik 2023-09-12 00:58:51 +02:00 committed by Andreas Kling
parent 81ddad3fcf
commit d1e542999c
3 changed files with 51 additions and 1 deletions

View file

@ -0,0 +1,22 @@
<!DOCTYPE html><style>
* { outline: 1px solid black; }
body { width: 600px; }
div {
width: 100px;
height: 100px;
float: left;
}
#top {
background: green;
}
#left {
background: pink;
margin-right: -100%;
clear: both;
}
#right {
background: orange;
margin-left: 200px;
margin-right: -100%;
}
</style><body><div id="top">top</div><div id="left">left</div><div id="right">right