From 7c00619e47380385bb9595db1bfbf30f1e150b55 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Wed, 23 Nov 2022 22:18:04 +0300 Subject: [PATCH] LibWeb: Use calculate_inner_width to compute min and max widths Use calculate_inner_width that consider box-sizing in compute_width to resolve min_width and max_width. --- Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index d1b80175f9..d1de0c83a2 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -194,7 +194,7 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const& // 2. The tentative used width is greater than 'max-width', the rules above are applied again, // but this time using the computed value of 'max-width' as the computed value for 'width'. if (!computed_values.max_width().is_none()) { - auto max_width = computed_values.max_width().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box); + auto max_width = calculate_inner_width(box, available_space.width, computed_values.max_width()); if (used_width.to_px(box) > max_width.to_px(box)) { used_width = try_compute_width(max_width); } @@ -203,7 +203,7 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const& // 3. If the resulting width is smaller than 'min-width', the rules above are applied again, // but this time using the value of 'min-width' as the computed value for 'width'. if (!computed_values.min_width().is_auto()) { - auto min_width = computed_values.min_width().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box); + auto min_width = calculate_inner_width(box, available_space.width, computed_values.min_width()); if (used_width.to_px(box) < min_width.to_px(box)) { used_width = try_compute_width(min_width); }