summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-07-22 16:36:17 +0200
committerAndreas Kling <kling@serenityos.org>2022-07-25 15:03:18 +0200
commit050e70cc7e8f1a8b4c4b0c79966cb76c151c8174 (patch)
tree40a619c549835137988b57dd04975fbd70f113e5 /Userland/Libraries/LibWeb/Layout
parent7aa9e03e85072510adf48863a863c2fceec69808 (diff)
downloadserenity-050e70cc7e8f1a8b4c4b0c79966cb76c151c8174.zip
LibWeb: Position abspos children of flex container after parent layout
If we wait until after the parent context has laid out the flex container, abspos children are able to use the final results of the parent sizing the flex container. This makes `height:auto` work on abspos children of a flex container.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp3
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index adbe120da0..a1b9652ccc 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -136,7 +136,10 @@ void FlexFormattingContext::run(Box const& run_box, LayoutMode layout_mode)
// part of the spec, and simply covering up the fact that our inside layout currently
// mutates the height of BFC roots.
copy_dimensions_from_flex_items_to_boxes();
+}
+void FlexFormattingContext::parent_context_did_dimension_child_root_box()
+{
flex_container().for_each_child_of_type<Box>([&](Layout::Box& box) {
if (box.is_absolutely_positioned())
layout_absolutely_positioned_element(box);
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
index ceb9f44346..b02929f34d 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.h
@@ -164,6 +164,8 @@ private:
[[nodiscard]] float calculate_fit_content_main_size(FlexItem const&) const;
[[nodiscard]] float calculate_fit_content_cross_size(FlexItem const&) const;
+ virtual void parent_context_did_dimension_child_root_box() override;
+
CSS::FlexBasisData used_flex_basis_for_item(FlexItem const&) const;
LayoutState::UsedValues& m_flex_container_state;