1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +00:00

LibWeb: Take size constraints into account in fit-content calculations

Also avoid calculating both min-content and max-content sizes when only
one of them is needed.
This commit is contained in:
Andreas Kling 2022-07-20 17:59:46 +02:00
parent 8f35c9a037
commit 97f53de8a2
3 changed files with 33 additions and 13 deletions

View file

@ -50,8 +50,8 @@ public:
float calculate_min_content_height(Layout::Box const&) const;
float calculate_max_content_height(Layout::Box const&) const;
float calculate_fit_content_height(Layout::Box const&, Optional<float> available_height) const;
float calculate_fit_content_width(Layout::Box const&, Optional<float> available_width) const;
float calculate_fit_content_height(Layout::Box const&, SizeConstraint, Optional<float> available_height) const;
float calculate_fit_content_width(Layout::Box const&, SizeConstraint, Optional<float> available_width) const;
virtual float greatest_child_width(Box const&);
@ -66,7 +66,7 @@ public:
protected:
FormattingContext(Type, LayoutState&, Box const&, FormattingContext* parent = nullptr);
float calculate_fit_content_size(float min_content_size, float max_content_size, Optional<float> available_space) const;
float calculate_fit_content_size(float min_content_size, float max_content_size, SizeConstraint, Optional<float> available_space) const;
OwnPtr<FormattingContext> layout_inside(Box const&, LayoutMode);
void compute_inset(Box const& box);