From e5a779aecf603ad92522691bf669e3a2aa06fbe4 Mon Sep 17 00:00:00 2001 From: Simon Wanner Date: Mon, 28 Mar 2022 14:41:15 +0200 Subject: [PATCH] LibWeb: Apply the layout_mode argument in BFC::compute_width --- .../LibWeb/Layout/BlockFormattingContext.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index e8072692c2..b96592e53b 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -96,7 +96,19 @@ void BlockFormattingContext::compute_width(Box const& box, LayoutMode layout_mod } auto const& computed_values = box.computed_values(); - float width_of_containing_block = m_state.get(*box.containing_block()).content_width; + float width_of_containing_block; + switch (layout_mode) { + case LayoutMode::Normal: + width_of_containing_block = m_state.get(*box.containing_block()).content_width; + break; + case LayoutMode::MinContent: + width_of_containing_block = 0; + break; + case LayoutMode::MaxContent: + width_of_containing_block = INFINITY; + break; + } + auto width_of_containing_block_as_length = CSS::Length::make_px(width_of_containing_block); auto zero_value = CSS::Length::make_px(0);