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:
parent
2f3af71261
commit
0532d7d255
5 changed files with 47 additions and 29 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue