mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 08:29:58 +00:00
LibWeb: Flexbox: Take parent's width in the flex container for layouting
If our parent in the FlexFormattingContext also was a flex-container, we didn't give our children any meaningful width to play with into layout_inside(), which resulted in way too narrow layouting. Now the width of the parent gets borrowed if the own width isn't specified.
This commit is contained in:
parent
3cc6ffd4a6
commit
2f891fd4b8
|
@ -222,6 +222,9 @@ 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());
|
||||
|
||||
box.for_each_child_of_type<Box>([&](Box& child_box) {
|
||||
layout_inside(child_box, LayoutMode::Default);
|
||||
// Skip anonymous text runs that are only whitespace.
|
||||
|
|
Loading…
Reference in a new issue