1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:57:43 +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

@ -169,8 +169,6 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
break;
auto& item = item_opt.value();
line_builder.break_if_needed(layout_mode, item.width);
switch (item.type) {
case InlineLevelIterator::Item::Type::ForcedBreak:
line_builder.break_line();
@ -178,11 +176,13 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
case InlineLevelIterator::Item::Type::Element: {
auto& box = verify_cast<Layout::Box>(*item.node);
dimension_box_on_line(box, layout_mode);
line_builder.break_if_needed(layout_mode, box.width(), item.should_force_break);
line_builder.append_box(box);
break;
}
case InlineLevelIterator::Item::Type::Text: {
auto& text_node = verify_cast<Layout::TextNode>(*item.node);
line_builder.break_if_needed(layout_mode, item.width, item.should_force_break);
line_builder.append_text_chunk(
text_node,
item.offset_in_node,