layout: Expand text clipping boundaries based on the largest advance in run (#42403)

Servo does not yet calculate the ink overflow area, as this sort of
thing is usually a result of `contain: paint` which Servo does not
support yet. We just need to ensure that text clipping is large
enough to contain the ink of all of the glyphs in the run. This change
just expands the rectangle based on glyph advances by 2 times the
largest advance, which should be big enough for most glyphs.

This is a big of a workaround until we have support for `contain:
paint`.

Testing:
- This change adds a Servo-specific test to ensure glyphs are fully
inked. While this test would run just fine in other browsers, it isn't
very
useful to them as this is test is very specific to the way that Servo
draws
glyphs.
- This also fixes a variety of existing WPT tests.

Fixes: #41413.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson
2026-02-07 23:12:15 +01:00
committed by GitHub
parent 879f3e1451
commit 36aa8e9c73
25 changed files with 67 additions and 52 deletions

View File

@@ -253,6 +253,19 @@
{}
]
],
"text-advance-less-than-ink-clipping.html": [
"a726bd2881ff7cb29a9e68f8e7f1fae728b9382e",
[
null,
[
[
"/_mozilla/appearance/text-advance-less-than-ink-clipping-ref.html",
"=="
]
],
{}
]
],
"textarea-caret-following-linebreak.html": [
"55bc06e372e9ce8ad4d62d368a644c1f1cd3ffd9",
[
@@ -8324,6 +8337,10 @@
[]
]
},
"text-advance-less-than-ink-clipping-ref.html": [
"af9ec609b175040a66756fb6ce00d81a2e5707ec",
[]
],
"textarea-caret-following-linebreak-ref.html": [
"f424853f243ff0fe4c43506db800b51afc294113",
[]