summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2023-01-07 19:32:12 +0100
committerAndreas Kling <kling@serenityos.org>2023-01-07 19:41:21 +0100
commit15c0efede92980593178fb540b162256b9f69464 (patch)
tree42c868c3bf56394a69798a20c3236ffd58408430 /Userland
parentab2f1053442506c87dd5bc88abea4dc1655c3980 (diff)
downloadserenity-15c0efede92980593178fb540b162256b9f69464.zip
LibWeb: Take used width into account in flex item intrinsic cross sizing
When calculating intrinsic heights of flex items, we should use the used width if available. This primarily matters for item cross sizing, since that happens after we've determined the item's main size.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index a290c85047..6b121f7dd9 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -1868,12 +1868,18 @@ CSSPixels FlexFormattingContext::calculate_max_content_main_size(FlexItem const&
CSSPixels FlexFormattingContext::calculate_min_content_cross_size(FlexItem const& item) const
{
- return is_row_layout() ? calculate_min_content_height(item.box, m_available_space_for_items->space.width) : calculate_min_content_width(item.box);
+ if (is_row_layout()) {
+ return calculate_min_content_height(item.box, item.main_size.has_value() ? AvailableSize::make_definite(item.main_size.value()) : AvailableSize::make_indefinite());
+ }
+ return calculate_min_content_width(item.box);
}
CSSPixels FlexFormattingContext::calculate_max_content_cross_size(FlexItem const& item) const
{
- return is_row_layout() ? calculate_max_content_height(item.box, m_available_space_for_items->space.width) : calculate_max_content_width(item.box);
+ if (is_row_layout()) {
+ return calculate_max_content_height(item.box, item.main_size.has_value() ? AvailableSize::make_definite(item.main_size.value()) : AvailableSize::make_indefinite());
+ }
+ return calculate_max_content_width(item.box);
}
// https://drafts.csswg.org/css-flexbox-1/#stretched