Skip to content

Commit

Permalink
LibWeb: Fix wrong height:auto computation for block with floating child
Browse files Browse the repository at this point in the history
If an element with height:auto 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.

Before this patch, we were stopping at the bottom *content* edge of
floating descendants.
  • Loading branch information
awesomekling committed Mar 1, 2022
1 parent 884ebc4 commit 6478b46
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ float FormattingContext::compute_auto_height_for_block_level_element(FormattingS

auto const& child_box_state = state.get(child_box);

float child_box_bottom = child_box_state.offset.y() + child_box_state.content_height;
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;
Expand Down

0 comments on commit 6478b46

Please sign in to comment.