1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

LibWeb: Dimension inline-block boxes before deciding about line breaks

We won't know if we need to break before the inline-block box until
after we've dimensioned it.
This commit is contained in:
Andreas Kling 2022-01-20 13:46:04 +01:00
parent 67b3f769fb
commit d3adc94ce8
5 changed files with 7 additions and 4 deletions

View file

@ -46,9 +46,10 @@ void LineBuilder::append_text_chunk(TextNode& text_node, size_t offset_in_node,
m_max_height_on_current_line = max(m_max_height_on_current_line, height);
}
void LineBuilder::break_if_needed(LayoutMode layout_mode, float next_item_width)
void LineBuilder::break_if_needed(LayoutMode layout_mode, float next_item_width, bool should_force_break)
{
if (layout_mode == LayoutMode::AllPossibleLineBreaks
|| should_force_break
|| (m_context.containing_block().line_boxes().last().width() + next_item_width) > m_available_width_for_current_line)
break_line();
}