mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
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
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:
parent
76105d6a02
commit
8257788a20
Notes:
github-actions[bot]
2025-04-11 01:35:32 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/8257788a20d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4308 Reviewed-by: https://github.com/tcl3 ✅
3 changed files with 30 additions and 4 deletions
|
@ -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),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x48 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x0 children: inline
|
||||
BlockContainer <div.r> at (8,-2) content-size 50x50 floating [BFC] children: not-inline
|
||||
TextNode <#text>
|
||||
BlockContainer <div.g> at (58,-2) content-size 50x50 floating [BFC] children: not-inline
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x48]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x0]
|
||||
PaintableWithLines (BlockContainer<DIV>.r) [8,-2 50x50]
|
||||
PaintableWithLines (BlockContainer<DIV>.g) [58,-2 50x50]
|
|
@ -0,0 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
div {
|
||||
margin-top: -10px;
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
float: left;
|
||||
}
|
||||
.r { background: red; }
|
||||
.g { background: green; }
|
||||
</style>
|
||||
<div class="r"></div>
|
||||
<div class="g"></div>
|
Loading…
Add table
Reference in a new issue