diff options
-rw-r--r-- | Base/res/html/misc/flex.html | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h | 1 |
3 files changed, 13 insertions, 1 deletions
diff --git a/Base/res/html/misc/flex.html b/Base/res/html/misc/flex.html index a487eb1e16..3a6179215f 100644 --- a/Base/res/html/misc/flex.html +++ b/Base/res/html/misc/flex.html @@ -186,6 +186,12 @@ <div class="box" style="flex: 0 0 0;">2</div> <div class="box" style="flex: 0 0 0;">3</div> </div> + <p>flex: 0 0 0; flex-direction: column;</p> + <div class="my-container column" style="width: 500px;"> + <div class="box" style="flex: 0 0 0;">1</div> + <div class="box" style="flex: 0 0 0;">2</div> + <div class="box" style="flex: 0 0 0;">3</div> + </div> <p>flex: 1 2 0;</p> <div class="my-container" style="width: 500px;"> <div class="box" style="flex: 1 2 0;">1</div> diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index 6583c25efb..0070686d2c 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -565,11 +565,16 @@ void FlexFormattingContext::determine_flex_base_size_and_hypothetical_main_size( }(); // The hypothetical main size is the itemโs flex base size clamped according to its used min and max main sizes (and flooring the content box size at zero). - auto clamp_min = has_main_min_size(child_box) ? specified_main_min_size(child_box) : 0; + auto clamp_min = has_main_min_size(child_box) ? specified_main_min_size(child_box) : determine_min_main_size_of_child(child_box); auto clamp_max = has_main_max_size(child_box) ? specified_main_max_size(child_box) : NumericLimits<float>::max(); flex_item.hypothetical_main_size = clamp(flex_item.flex_base_size, clamp_min, clamp_max); } +float FlexFormattingContext::determine_min_main_size_of_child(Box const& box) +{ + return is_row_layout() ? calculate_min_and_max_content_width(box).min_content_size : calculate_min_and_max_content_height(box).min_content_size; +} + // https://www.w3.org/TR/css-flexbox-1/#algo-main-container void FlexFormattingContext::determine_main_size_of_flex_container(bool const main_is_constrained, float const main_min_size, float const main_max_size) { diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h index 2feedbb122..d6d50bb2a1 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h @@ -79,6 +79,7 @@ private: bool has_main_max_size(Box const&) const; bool has_cross_max_size(Box const&) const; float sum_of_margin_padding_border_in_main_axis(Box const&) const; + float determine_min_main_size_of_child(Box const& box); void set_main_size(Box const&, float size); void set_cross_size(Box const&, float size); |