diff options
author | Tobias Christiansen <tobyase@serenityos.org> | 2021-09-17 23:44:58 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-17 23:51:03 +0200 |
commit | 2f891fd4b86928e3f50cdac3a77f67cc2dcef9ad (patch) | |
tree | f068356f526717998b3e7f0de1e44950f94a6599 /Userland/Libraries/LibWeb/Layout | |
parent | 3cc6ffd4a6d3e48724953c0fe3cc7704c011301e (diff) | |
download | serenity-2f891fd4b86928e3f50cdac3a77f67cc2dcef9ad.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index db7a82b6d1..50a66d7a99 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -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. |