mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 02:17:35 +00:00
LibWeb: Take floats into account when measuring automatic width of IFC
When there are floats present inside an IFC, we must coordinate with the parent BFC to calculate the automatic width of the IFC's block box. This is because the IFC is not directly aware of floats. Only the BFC knows enough about them to account for them in automatic sizing.
This commit is contained in:
parent
610a7603a2
commit
508927cae2
4 changed files with 30 additions and 3 deletions
|
@ -77,15 +77,15 @@ void InlineFormattingContext::run(Box const&, LayoutMode layout_mode, AvailableS
|
|||
m_available_space = available_space;
|
||||
generate_line_boxes(layout_mode);
|
||||
|
||||
CSSPixels max_line_width = 0;
|
||||
CSSPixels content_height = 0;
|
||||
|
||||
for (auto& line_box : m_containing_block_state.line_boxes) {
|
||||
max_line_width = max(max_line_width, line_box.width());
|
||||
content_height += line_box.height();
|
||||
}
|
||||
|
||||
m_automatic_content_width = max_line_width;
|
||||
// NOTE: We ask the parent BFC to calculate the automatic content width of this IFC.
|
||||
// This ensures that any floated boxes are taken into account.
|
||||
m_automatic_content_width = parent().greatest_child_width(containing_block());
|
||||
m_automatic_content_height = content_height;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue