1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibWeb: Don't allow resolved width of abspos elements to become negative

We have to clamp the resulting width to 0 when solving for it.
This commit is contained in:
Andreas Kling 2023-03-25 16:00:54 +01:00
parent 8f311c61af
commit 3f6f3966b9
3 changed files with 16 additions and 1 deletions

View file

@ -515,7 +515,7 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
};
auto solve_for_width = [&] {
return CSS::Length::make_px(width_of_containing_block - left.to_px(box) - margin_left.to_px(box) - border_left - padding_left - padding_right - border_right - margin_right.to_px(box) - right.to_px(box));
return CSS::Length::make_px(max(CSSPixels(0), width_of_containing_block - left.to_px(box) - margin_left.to_px(box) - border_left - padding_left - padding_right - border_right - margin_right.to_px(box) - right.to_px(box)));
};
auto solve_for_right = [&] {