summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-02-27 10:01:38 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-13 00:04:51 +0100
commit88302b0dca84aaf38acf676eda2ebae5ba3e70b5 (patch)
tree01abb33249e8cbe374c03554e65881ea6a26e23c
parent7c5b578df97a47e9e59933c9b590d127dcea8393 (diff)
downloadserenity-88302b0dca84aaf38acf676eda2ebae5ba3e70b5.zip
LibWeb: Layout inside of flex items at the end of FFC layout
Instead of doing internal child layout incrementally as we go, save it for the end of flex layout. The code will become simpler if we can focus on simply computing the dimensions of each flex item while we're doing the main FFC algorithm.
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 20dd8d6111..2ba33e34e8 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -148,6 +148,18 @@ void FlexFormattingContext::run(Box const& run_box, LayoutMode)
// 16. Align all flex lines (per align-content)
align_all_flex_lines();
+
+ // AD-HOC: Layout the inside of all flex items.
+ for (auto& flex_item : m_flex_items) {
+ auto independent_formatting_context = layout_inside(flex_item.box, LayoutMode::Default);
+ independent_formatting_context->parent_context_did_dimension_child_root_box();
+ }
+
+ // FIXME: We run the "align all flex lines" step *again* here, in order to override any sizes
+ // assigned to the flex item by the "layout inside" step above. This is definitely not
+ // part of the spec, and simply covering up the fact that our inside layout currently
+ // mutates the height of BFC roots.
+ align_all_flex_lines();
}
void FlexFormattingContext::populate_specified_margins(FlexItem& item, CSS::FlexDirection flex_direction) const