From 5efd63741f9b7730d7225be1776f5696d059c42e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 22 Sep 2022 17:05:31 +0200 Subject: [PATCH] LibWeb: Perform horizontal inline alignment based on available space Previously, we were using the full containing block width as a reference for text-align values "right" and "center". This didn't take intruding floats into account. --- Userland/Libraries/LibWeb/Layout/LineBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp index 7e0efc8e1b..8e689918e2 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp @@ -184,7 +184,7 @@ void LineBuilder::update_last_line() float x_offset_bottom = m_context.leftmost_x_offset_at(m_current_y + current_line_height - 1); float x_offset = max(x_offset_top, x_offset_bottom); - float excess_horizontal_space = m_context.effective_containing_block_width() - line_box.width(); + float excess_horizontal_space = m_available_width_for_current_line - line_box.width(); switch (text_align) { case CSS::TextAlign::Center: