From e3b8a8f7c8d3e6f9d26c2f11fb1966f557ce3208 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 28 Nov 2022 16:40:15 +0100 Subject: [PATCH] LibWeb: Treat unresolvable percentage width on inline-block as auto --- ...line-block-treat-100pct-width-as-auto.html | 21 +++++++++++++++++++ .../LibWeb/Layout/InlineFormattingContext.cpp | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Base/res/html/tests/inline-block-treat-100pct-width-as-auto.html diff --git a/Base/res/html/tests/inline-block-treat-100pct-width-as-auto.html b/Base/res/html/tests/inline-block-treat-100pct-width-as-auto.html new file mode 100644 index 0000000000..2e3aa27add --- /dev/null +++ b/Base/res/html/tests/inline-block-treat-100pct-width-as-auto.html @@ -0,0 +1,21 @@ + + +
programming
diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index 5d05e561b9..ee16b26964 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -127,7 +127,7 @@ void InlineFormattingContext::dimension_box_on_line(Box const& box, LayoutMode l auto const& width_value = box.computed_values().width(); float unconstrained_width = 0; - if (width_value.is_auto()) { + if (should_treat_width_as_auto(box, *m_available_space)) { auto result = calculate_shrink_to_fit_widths(box); auto available_width = m_available_space->width.to_px()