1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02: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

@ -29,7 +29,7 @@ public:
virtual void run(Box const&, LayoutMode, AvailableSpace const&) = 0;
// This function returns the automatic content height of the context's root box.
virtual CSSPixels automatic_content_width() const { return 0; }
virtual CSSPixels automatic_content_width() const = 0;
// This function returns the automatic content height of the context's root box.
virtual CSSPixels automatic_content_height() const = 0;
@ -64,7 +64,7 @@ public:
CSS::Length calculate_inner_width(Layout::Box const&, AvailableSize const&, CSS::Size const& width) const;
CSS::Length calculate_inner_height(Layout::Box const&, AvailableSize const&, CSS::Size const& height) const;
virtual CSSPixels greatest_child_width(Box const&);
virtual CSSPixels greatest_child_width(Box const&) const;
CSSPixels containing_block_width_for(Box const& box) const { return containing_block_width_for(box, m_state); }
CSSPixels containing_block_height_for(Box const& box) const { return containing_block_height_for(box, m_state); }