1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:47:34 +00:00

LibWeb: Make text justification work between floats

While inline content between floating elements was broken correctly,
text justification was still using the original amount of available
space (without accounting for floats) when justifying fragments.
This commit is contained in:
Andreas Kling 2023-05-16 09:51:33 +02:00
parent bab6796099
commit e938860126
5 changed files with 237 additions and 1 deletions

View file

@ -65,6 +65,7 @@ void LineBuilder::begin_new_line(bool increment_y, bool is_first_break_in_sequen
}
}
recalculate_available_space();
ensure_last_line_box().m_original_available_width = m_available_width_for_current_line;
m_max_height_on_current_line = 0;
m_last_line_needs_update = true;
@ -335,6 +336,8 @@ void LineBuilder::recalculate_available_space()
auto available_at_top_of_line_box = m_context.available_space_for_line(m_current_y);
auto available_at_bottom_of_line_box = m_context.available_space_for_line(m_current_y + current_line_height - 1);
m_available_width_for_current_line = min(available_at_bottom_of_line_box, available_at_top_of_line_box);
if (!m_containing_block_state.line_boxes.is_empty())
m_containing_block_state.line_boxes.last().m_original_available_width = m_available_width_for_current_line;
}
}