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.
This commit is contained in:
Andreas Kling 2022-09-22 17:05:31 +02:00
parent d43ef27761
commit 5efd63741f
Notes: sideshowbarker 2024-07-17 06:43:39 +09:00

View file

@ -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: