1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibWeb: Stop sizing the context root box in formatting contexts

Until now, some formatting contexts (BFC in particular) have been
assigning size to the root box. This is really the responsibility of the
parent formatting context, so let's stop doing it.

To keep position:absolute working, parent formatting contexts now notify
child contexts when the child's root box has been sized. (Note that the
important thing here is for the child root to have its final used height
before it's able to place bottom-relative boxes.)

This breaks flexbox layout in some ways, but we'll have to address those
by improving the spec compliance of FFC.)
This commit is contained in:
Andreas Kling 2022-02-12 19:54:09 +01:00
parent 2f3af71261
commit 0532d7d255
5 changed files with 47 additions and 29 deletions

View file

@ -616,7 +616,7 @@ void FormattingContext::layout_absolutely_positioned_element(Box& box)
auto specified_width = box.computed_values().width().resolved(box, width_of_containing_block).resolved_or_auto(box);
compute_width_for_absolutely_positioned_element(box);
(void)layout_inside(box, LayoutMode::Default);
auto independent_formatting_context = layout_inside(box, LayoutMode::Default);
compute_height_for_absolutely_positioned_element(box);
box_model.margin.left = box.computed_values().margin().left.resolved(box, width_of_containing_block).resolved_or_auto(box).to_px(box);
@ -676,6 +676,9 @@ void FormattingContext::layout_absolutely_positioned_element(Box& box)
}
box.set_offset(used_offset);
if (independent_formatting_context)
independent_formatting_context->parent_context_did_dimension_child_root_box();
}
void FormattingContext::compute_height_for_absolutely_positioned_replaced_element(ReplacedBox& box)