mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
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.
This commit is contained in:
parent
da0cc9d401
commit
e095b9c6f9
1 changed files with 8 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue