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

LibWeb: Move IFC result measurement from IFC to BFC

Before this change, IFC would first generate all of its line boxes
and then measure them. It would then write some of the values into
the state of the IFC's containing block.

We now move that up to BFC::layout_inline_children() instead, which
is a much more natural place to decide metrics for the block.
This commit is contained in:
Andreas Kling 2022-07-08 22:07:42 +02:00
parent fd68be29ab
commit 66d08d2417
2 changed files with 16 additions and 17 deletions

View file

@ -66,24 +66,7 @@ float InlineFormattingContext::available_space_for_line(float y) const
void InlineFormattingContext::run(Box const&, LayoutMode layout_mode)
{
VERIFY(containing_block().children_are_inline());
generate_line_boxes(layout_mode);
float max_line_width = 0;
float content_height = 0;
for (auto& line_box : m_state.get(containing_block()).line_boxes) {
max_line_width = max(max_line_width, line_box.width());
content_height += line_box.height();
}
auto& containing_block_state = m_state.get_mutable(containing_block());
if (layout_mode != LayoutMode::Normal) {
containing_block_state.content_width = max_line_width;
}
containing_block_state.content_height = content_height;
}
void InlineFormattingContext::dimension_box_on_line(Box const& box, LayoutMode layout_mode)