summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-07-04 22:20:09 +0200
committerAndreas Kling <kling@serenityos.org>2022-07-04 22:30:59 +0200
commit13b4d91f66d1dce494d24ed08a845a5ca3060263 (patch)
treea9fcd83e7fe8e89651af5cb8af4e123b1b5c0b76
parent7a7043f821de92a8602ab65b67cc6c522125e356 (diff)
downloadserenity-13b4d91f66d1dce494d24ed08a845a5ca3060263.zip
LibWeb: Always apply min/max cross size constraints to flex items
We were neglecting to apply min-size and max-size constraints in the fast path for flex items with a definite cross size.
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index eb80adeee4..755e6e428e 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -959,7 +959,9 @@ void FlexFormattingContext::determine_hypothetical_cross_size_of_item(FlexItem&
// If we have a definite cross size, this is easy! No need to perform layout, we can just use it as-is.
if (has_definite_cross_size(item.box)) {
- item.hypothetical_cross_size = resolved_definite_cross_size(item.box);
+ auto clamp_min = has_cross_min_size(item.box) ? specified_cross_min_size(item.box) : 0;
+ auto clamp_max = has_cross_max_size(item.box) ? specified_cross_max_size(item.box) : NumericLimits<float>::max();
+ item.hypothetical_cross_size = css_clamp(resolved_definite_cross_size(item.box), clamp_min, clamp_max);
return;
}