mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 15:45:07 +00:00
LibWeb: Dimension inline-block and replaced boxes during splitting
Don't wait until fragment layout to compute width/height of boxes on the line, just do it while we're splitting into lines.
This commit is contained in:
parent
4a9dcd974a
commit
23f70535e2
4 changed files with 6 additions and 10 deletions
|
@ -42,18 +42,17 @@ ReplacedBox::~ReplacedBox()
|
|||
{
|
||||
}
|
||||
|
||||
void ReplacedBox::split_into_lines(InlineFormattingContext& context, LayoutMode)
|
||||
void ReplacedBox::split_into_lines(InlineFormattingContext& context, LayoutMode layout_mode)
|
||||
{
|
||||
auto& containing_block = context.containing_block();
|
||||
|
||||
prepare_for_replaced_layout();
|
||||
auto width = context.compute_width_for_replaced_element(*this);
|
||||
auto height = context.compute_height_for_replaced_element(*this);
|
||||
context.dimension_box_on_line(*this, layout_mode);
|
||||
|
||||
auto* line_box = &containing_block.ensure_last_line_box();
|
||||
if (line_box->width() > 0 && line_box->width() + width > context.available_width_at_line(containing_block.line_boxes().size() - 1))
|
||||
if (line_box->width() > 0 && line_box->width() + width() > context.available_width_at_line(containing_block.line_boxes().size() - 1))
|
||||
line_box = &containing_block.add_line_box();
|
||||
line_box->add_fragment(*this, 0, 0, width, height);
|
||||
line_box->add_fragment(*this, 0, 0, width(), height());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue