diff options
author | Andreas Kling <kling@serenityos.org> | 2022-07-20 22:07:26 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-21 01:46:25 +0200 |
commit | e095b9c6f987570b0bba097a02e367ebf409c6d9 (patch) | |
tree | e5b30507f1b0eeb10f8ae20dcad5c0cc14edea07 /Userland | |
parent | da0cc9d40174835b1d0c58fead911593180a3bce (diff) | |
download | serenity-e095b9c6f987570b0bba097a02e367ebf409c6d9.zip |
LibWeb: Resolve `auto` containing block sizes before intrinsic sizing
Before performing intrinsic sizing layout on a box, we now check if its
containing block has automatic size in the relevant axis, and if so,
we fetch the size of the nearest containing block ancestor with a size.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/FormattingContext.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp index fa016533dd..82756ea68a 100644 --- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -872,6 +872,8 @@ float FormattingContext::calculate_min_content_width(Layout::Box const& box) con if (!containing_block.has_definite_height()) containing_block_state.set_content_height(INFINITY); + else if (containing_block.computed_values().height().is_auto()) + containing_block_state.set_content_height(containing_block_height_for(containing_block)); auto& box_state = throwaway_state.get_mutable(box); box_state.width_constraint = SizeConstraint::MinContent; @@ -912,6 +914,8 @@ float FormattingContext::calculate_max_content_width(Layout::Box const& box) con if (!containing_block.has_definite_height()) containing_block_state.set_content_height(INFINITY); + else if (containing_block.computed_values().height().is_auto()) + containing_block_state.set_content_height(containing_block_height_for(containing_block)); auto& box_state = throwaway_state.get_mutable(box); box_state.width_constraint = SizeConstraint::MaxContent; @@ -952,6 +956,8 @@ float FormattingContext::calculate_min_content_height(Layout::Box const& box) co if (!containing_block.has_definite_width()) containing_block_state.set_content_width(INFINITY); + else if (containing_block.computed_values().width().is_auto()) + containing_block_state.set_content_width(containing_block_width_for(containing_block)); auto& box_state = throwaway_state.get_mutable(box); box_state.height_constraint = SizeConstraint::MinContent; @@ -992,6 +998,8 @@ float FormattingContext::calculate_max_content_height(Layout::Box const& box) co if (!containing_block.has_definite_width()) containing_block_state.set_content_width(INFINITY); + else if (containing_block.computed_values().width().is_auto()) + containing_block_state.set_content_width(containing_block_width_for(containing_block)); auto& box_state = throwaway_state.get_mutable(box); box_state.height_constraint = SizeConstraint::MaxContent; |