1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:57:35 +00:00

LibWeb: More work on width of position:absolute elements

The shrink-to-fit width algorithm actually works a little bit different
in the absolute positioning context, so it can't share all of its code
with non-absolute positioning.

Also, inline-block elements were always inserting unnecessary line
breaks when splitting, which caused the preferred width to be smaller
than it should be. This patch fixes that as well, by just not breaking
after inline-block elements in LayoutMode::OnlyRequiredLineBreaks.
This commit is contained in:
Andreas Kling 2020-06-18 21:16:29 +02:00
parent cfab53903f
commit 55a3575a7c
2 changed files with 64 additions and 25 deletions

View file

@ -73,7 +73,11 @@ protected:
private:
virtual bool is_block() const override { return true; }
float calculate_shrink_to_fit_width(const Length& margin_left, const Length& border_left, const Length& padding_left, const Length& padding_right, const Length& border_right, const Length& margin_right);
struct ShrinkToFitResult {
float preferred_width { 0 };
float preferred_minimum_width { 0 };
};
ShrinkToFitResult calculate_shrink_to_fit_width();
void compute_width_for_absolutely_positioned_block();