LibWeb: Ignore negative margins for margin box rect
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

Negative margins are processed through the `offset` in layout state, and
should not contribute to the margin box' rect's size or position.

Fixes #4249.
This commit is contained in:
Jelle Raaijmakers 2025-04-10 13:36:15 +02:00 committed by Tim Ledbetter
commit 8257788a20
Notes: github-actions[bot] 2025-04-11 01:35:32 +00:00
3 changed files with 30 additions and 4 deletions

View file

@ -1828,12 +1828,12 @@ CSSPixels FormattingContext::box_baseline(Box const& box) const
{
return {
{
-used_values.margin_box_left(),
-used_values.margin_box_top(),
-max(used_values.margin_box_left(), 0),
-max(used_values.margin_box_top(), 0),
},
{
used_values.margin_box_left() + used_values.content_width() + used_values.margin_box_right(),
used_values.margin_box_top() + used_values.content_height() + used_values.margin_box_bottom(),
max(used_values.margin_box_left(), 0) + used_values.content_width() + max(used_values.margin_box_right(), 0),
max(used_values.margin_box_top(), 0) + used_values.content_height() + max(used_values.margin_box_bottom(), 0),
},
};
}