1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

LibWeb: Fix three accidental float truncations

We were doing this:

    max(0, some_floating_point_value)

This returns an `int` result based on the type of `0`, oops!
This commit is contained in:
Andreas Kling 2022-09-07 13:25:17 +02:00
parent 21a89b65fc
commit a42506c8b9
2 changed files with 3 additions and 3 deletions

View file

@ -286,7 +286,7 @@ float FormattingContext::compute_auto_height_for_block_level_element(LayoutState
continue;
// FIXME: Handle margin collapsing.
return max(0, child_box_state.offset.y() + child_box_state.content_height() + child_box_state.margin_box_bottom());
return max(0.0f, child_box_state.offset.y() + child_box_state.content_height() + child_box_state.margin_box_bottom());
}
}
@ -354,7 +354,7 @@ float FormattingContext::compute_auto_height_for_block_formatting_context_root(L
return IterationDecision::Continue;
});
return max(0, bottom.value_or(0) - top.value_or(0));
return max(0.0f, bottom.value_or(0) - top.value_or(0));
}
// 10.3.2 Inline, replaced elements, https://www.w3.org/TR/CSS22/visudet.html#inline-replaced-width