1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

LibWeb: Account for negative margins when calculating float intrusion

If a box has a negative margin-left, it may have a negative effective
offset within its parent BFC root coordinate system.

We can account for this when calculating the amount of left-side float
intrusion by flooring the X offset at 0.
This commit is contained in:
Andreas Kling 2023-06-04 12:55:55 +02:00
parent 0e5ec8c0ab
commit 89ba00304c
4 changed files with 28 additions and 2 deletions

View file

@ -51,7 +51,7 @@ CSSPixels InlineFormattingContext::leftmost_x_offset_at(CSSPixels y) const
}
// The left edge of the containing block is to the left of the rightmost left-side float.
// We adjust the inline content insertion point by the overlap between the containing block and the float.
return space.left - box_in_root_rect.x();
return space.left - max(CSSPixels(0), box_in_root_rect.x());
}
CSSPixels InlineFormattingContext::available_space_for_line(CSSPixels y) const