mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +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
Notes:
sideshowbarker
2024-07-18 02:48:52 +09:00
Author: https://github.com/TobyAsE Commit: https://github.com/SerenityOS/serenity/commit/9aa720e83ef Pull-request: https://github.com/SerenityOS/serenity/pull/10441
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…
Reference in a new issue