From 1b5b7e3b0196f404446521fceff4b63a08419ead Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Wed, 16 Nov 2022 03:57:38 +0300 Subject: [PATCH] LibWeb: Solve width for absolute positioned elemenent according to spec https://www.w3.org/TR/css-position-3/#abs-non-replaced-width If left and width are auto and right is not auto, then the width is shrink-to-fit. Then solve for left. --- Userland/Libraries/LibWeb/Layout/FormattingContext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index 0c39901a01..f170c755e3 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -595,9 +595,9 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele // then the width is shrink-to-fit. Then solve for 'left' if (left.is_auto() && width.is_auto() && !right.is_auto()) { auto result = calculate_shrink_to_fit_widths(box); - left = solve_for_left(); auto available_width = solve_for_width(); width = CSS::Length(min(max(result.preferred_minimum_width, available_width.to_px(box)), result.preferred_width), CSS::Length::Type::Px); + left = solve_for_left(); } // 2. 'left' and 'right' are 'auto' and 'width' is not 'auto',