diff options
author | Andreas Kling <kling@serenityos.org> | 2022-07-23 01:40:09 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-25 15:03:18 +0200 |
commit | fac4529082eb118e801c8957b326b22bf57afe9c (patch) | |
tree | e37dbba44d84103750c6a7ca8473e95dad816f90 /Userland/Libraries/LibWeb/Layout | |
parent | 050e70cc7e8f1a8b4c4b0c79966cb76c151c8174 (diff) | |
download | serenity-fac4529082eb118e801c8957b326b22bf57afe9c.zip |
LibWeb: Honor flex container sizing constraints in available space
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index a1b9652ccc..71a526cbe0 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -62,6 +62,20 @@ void FlexFormattingContext::run(Box const& run_box, LayoutMode layout_mode) bool cross_is_constrained = false; determine_available_main_and_cross_space(main_is_constrained, cross_is_constrained, main_min_size, main_max_size, cross_min_size, cross_max_size); + if (m_flex_container_state.width_constraint == SizeConstraint::MaxContent || m_flex_container_state.height_constraint == SizeConstraint::MaxContent) { + if (is_row_layout()) + m_available_space->main = INFINITY; + else + m_available_space->cross = INFINITY; + } + + if (m_flex_container_state.width_constraint == SizeConstraint::MinContent || m_flex_container_state.height_constraint == SizeConstraint::MinContent) { + if (is_row_layout()) + m_available_space->main = 0; + else + m_available_space->cross = 0; + } + // 3. Determine the flex base size and hypothetical main size of each item for (auto& flex_item : m_flex_items) { if (flex_item.box.is_replaced_box()) { |