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

LibWeb: Let FormattingContext decide the automatic width of its root

Instead of special-casing FlexFormattingContext in the intrinsic sizing
layout helpers, add FormattingContext::automatic_content_width() and let
each context subclass decide what that means.

No behavior change here, just moving this responsibility.
This commit is contained in:
Andreas Kling 2023-03-19 09:57:31 +01:00
parent e945994877
commit 00999a245c
12 changed files with 42 additions and 18 deletions

View file

@ -38,6 +38,11 @@ BlockFormattingContext::~BlockFormattingContext()
}
}
CSSPixels BlockFormattingContext::automatic_content_width() const
{
return greatest_child_width(root());
}
CSSPixels BlockFormattingContext::automatic_content_height() const
{
return compute_auto_height_for_block_formatting_context_root(root());
@ -925,7 +930,7 @@ BlockFormattingContext::SpaceUsedByFloats BlockFormattingContext::space_used_by_
return space_used_by_floats;
}
CSSPixels BlockFormattingContext::greatest_child_width(Box const& box)
CSSPixels BlockFormattingContext::greatest_child_width(Box const& box) const
{
// Similar to FormattingContext::greatest_child_width()
// but this one takes floats into account!