diff options
author | Andreas Kling <kling@serenityos.org> | 2022-07-11 17:47:23 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-11 18:57:45 +0200 |
commit | 9cae06de0999e5e6eed94e00410cf082f991f81d (patch) | |
tree | 56fbe87515b049189b18c2bd44c9e5e238a08f67 /Userland | |
parent | 0cacaf025d36ebc46782e21a733359a1d77ab32f (diff) | |
download | serenity-9cae06de0999e5e6eed94e00410cf082f991f81d.zip |
LibWeb: Implement step 9.2.3 of the flexbox layout algorithm
When sizing the flex container under a min-content or a max-content
constraint, flex items with a used flex basis of "content" should be
sized under the same constraint.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index 9fc2481dc9..dcb9249eb9 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -599,11 +599,11 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size( // and the flex container is being sized under a min-content or max-content constraint // (e.g. when performing automatic table layout [CSS21]), size the item under that constraint. // The flex base size is the itemโs resulting main size. - if (used_flex_basis.type == CSS::FlexBasis::Content - // FIXME: && sized under min-content or max-content constraints - && false) { - TODO(); - // Size child_box under the constraints, flex_base_size is then the resulting main_size. + auto flex_container_main_size_constraint = is_row_layout() ? m_flex_container_state.width_constraint : m_flex_container_state.height_constraint; + if (used_flex_basis.type == CSS::FlexBasis::Content && flex_container_main_size_constraint != SizeConstraint::None) { + if (flex_container_main_size_constraint == SizeConstraint::MinContent) + return calculate_min_content_main_size(flex_item); + return calculate_max_content_main_size(flex_item); } // D. Otherwise, if the used flex basis is content or depends on its available space, |