layout: Make lines non-phantom if they have inline padding/border/margin (#39058)

According to https://drafts.csswg.org/css-inline/#invisible-line-boxes,
if a line box contains non-zero inline-axis margins, padding or borders,
then it can't be phantom.

Therefore, this patch makes adds a `has_inline_pbm` flag to the line.
Note that we can't use the `has_content` flag, because that would add a
soft wrap opportunity between the padding/border/margin and the first
content of the line.

The patch also renames `InlineFormattingContext::had_inflow_content` to
`has_line_boxes`, which is what we care about for collapsing margins
through.

Testing: Adding new tests
Fixes: #39057

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-09-17 00:18:46 +02:00 committed by GitHub
parent 4451ce0ef1
commit 18b3e5fe21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 416 additions and 15 deletions

View file

@ -210635,6 +210635,86 @@
]
]
},
"model": {
"phantom-line-boxes-001.html": [
"da0e9095b7a37e6b4a897269e753175c68039a34",
[
null,
[
[
"/css/reference/ref-filled-green-200px-square.html",
"=="
]
],
{}
]
],
"phantom-line-boxes-002.html": [
"c180a9bf3b5c4cda3e281d84bb36b6d8b2bae91c",
[
null,
[
[
"/css/reference/ref-filled-green-200px-square.html",
"=="
]
],
{}
]
],
"phantom-line-boxes-003.html": [
"633aa9dfba8d81d515c807c66074b77c73dbfee4",
[
null,
[
[
"/css/reference/ref-filled-green-200px-square.html",
"=="
]
],
{}
]
],
"phantom-line-boxes-004.html": [
"0b4f7737ee21b4490e951ce1677772b9d1ae2d71",
[
null,
[
[
"/css/reference/ref-filled-green-200px-square.html",
"=="
]
],
{}
]
],
"phantom-line-boxes-005.html": [
"dd2620294412fab68af218f30e470a3003255dd4",
[
null,
[
[
"/css/reference/ref-filled-green-200px-square.html",
"=="
]
],
{}
]
],
"phantom-line-boxes-006.html": [
"7b5a43cbf811680087429abe5b0236d1221f28d4",
[
null,
[
[
"/css/reference/ref-filled-green-200px-square.html",
"=="
]
],
{}
]
]
},
"text-box-trim": {
"border-padding-001.html": [
"9c25c42a1def684b364e98dc9d6233cd5c700519",