mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibWeb: Flexbox: Assume container size before layouting children
Before layouting the children of a flex container we now either assume the parent's size or the specified size of the container.
This commit is contained in:
parent
e9ce1a8d83
commit
9aa720e83e
1 changed files with 11 additions and 2 deletions
|
@ -309,8 +309,17 @@ void FlexFormattingContext::run(Box& box, LayoutMode)
|
|||
// This is particularly important since we take references to the items stored in flex_items
|
||||
// later, whose addresses won't be stable if we added or removed any items.
|
||||
Vector<FlexItem> flex_items;
|
||||
if (!box.has_definite_width())
|
||||
box.set_width(box.width_of_logical_containing_block());
|
||||
if (!box.has_definite_width()) {
|
||||
box.set_width(box.containing_block()->width());
|
||||
} else {
|
||||
box.set_width(box.computed_values().width().resolved_or_zero(box, box.containing_block()->width()).to_px(box));
|
||||
}
|
||||
|
||||
if (!box.has_definite_height()) {
|
||||
box.set_height(box.containing_block()->height());
|
||||
} else {
|
||||
box.set_height(box.computed_values().height().resolved_or_zero(box, box.containing_block()->height()).to_px(box));
|
||||
}
|
||||
|
||||
box.for_each_child_of_type<Box>([&](Box& child_box) {
|
||||
layout_inside(child_box, LayoutMode::Default);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue