1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:47:35 +00:00

LibWeb: Fix the x coordinate of a block after a float

The margin from the containing blocks shouldn't be included in the
amount by which we increment x after a float was places. That coordinate
should be relative to the containing block.

Fixes the comments layout on https://lobste.rs.
This commit is contained in:
Andi Gallo 2023-06-13 13:37:15 +00:00 committed by Andreas Kling
parent 0db8ac7465
commit ce186dca70
6 changed files with 86 additions and 19 deletions

View file

@ -107,6 +107,16 @@ protected:
CSSPixels right { 0 };
};
struct SpaceUsedAndContainingMarginForFloats {
// Width for left / right floats, including their own margins.
CSSPixels left_used_space;
CSSPixels right_used_space;
// Left / right total margins from the outermost containing block to the floating element.
// Each block in the containing chain adds its own margin and we store the total here.
CSSPixels left_total_containing_margin;
CSSPixels right_total_containing_margin;
};
struct ShrinkToFitResult {
CSSPixels preferred_width { 0 };
CSSPixels preferred_minimum_width { 0 };