mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibWeb: Always include floats when computing height:auto for blocks
I'm not sure why we had two modes for this, but floats should always be included in the auto height AFAICT.
This commit is contained in:
parent
6478b460fb
commit
56df05ae44
3 changed files with 18 additions and 24 deletions
|
@ -206,7 +206,7 @@ static Gfx::FloatSize solve_replaced_size_constraint(FormattingState const& stat
|
|||
return { w, h };
|
||||
}
|
||||
|
||||
float FormattingContext::compute_auto_height_for_block_level_element(FormattingState const& state, Box const& box, ConsiderFloats consider_floats)
|
||||
float FormattingContext::compute_auto_height_for_block_level_element(FormattingState const& state, Box const& box)
|
||||
{
|
||||
Optional<float> top;
|
||||
Optional<float> bottom;
|
||||
|
@ -250,24 +250,22 @@ float FormattingContext::compute_auto_height_for_block_level_element(FormattingS
|
|||
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
if (consider_floats == ConsiderFloats::Yes) {
|
||||
// In addition, if the element has any floating descendants
|
||||
// whose bottom margin edge is below the element's bottom content edge,
|
||||
// then the height is increased to include those edges.
|
||||
box.for_each_child_of_type<Box>([&](Layout::Box& child_box) {
|
||||
if (!child_box.is_floating())
|
||||
return IterationDecision::Continue;
|
||||
|
||||
auto const& child_box_state = state.get(child_box);
|
||||
|
||||
float child_box_bottom = child_box_state.offset.y() + child_box_state.content_height + child_box_state.margin_box_bottom();
|
||||
|
||||
if (!bottom.has_value() || child_box_bottom > bottom.value())
|
||||
bottom = child_box_bottom;
|
||||
|
||||
// In addition, if the element has any floating descendants
|
||||
// whose bottom margin edge is below the element's bottom content edge,
|
||||
// then the height is increased to include those edges.
|
||||
box.for_each_child_of_type<Box>([&](Layout::Box& child_box) {
|
||||
if (!child_box.is_floating())
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
auto const& child_box_state = state.get(child_box);
|
||||
|
||||
float child_box_bottom = child_box_state.offset.y() + child_box_state.content_height + child_box_state.margin_box_bottom();
|
||||
|
||||
if (!bottom.has_value() || child_box_bottom > bottom.value())
|
||||
bottom = child_box_bottom;
|
||||
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
return bottom.value_or(0) - top.value_or(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue