Files
sousa-gecko/testing/web-platform/tests/css/css-highlight-api/highlight-text-across-elements-ref.html
T
Daniel Holbert 47014eccd5 Bug 2003604: Use a monospace font in some css-highlight-api WPTs, to avoid spurious failures from one glyph overlapping the background of the next glyph. r=layout-reviewers,dshin,jfkthame
The paint ordering in these tests (of the highlight-background vs. ink of
adjacent glyphs) is different in the testcase and reference case, at least in
Gecko and WebKit (though not in Chromium[1]).  This creates the potential for
spurious failures in Gecko and WebKit, if the chosen font happens to have
glyphs that draw close together (such that one glyph might have a piece that
protrudes to overlap the bounding-box of the next glyph).

This patch avoids these spurious failures by explicitly using a monospace font;
this reduces the likelihood of glyphs drawing close together and experiencing
the sort of overlap that would reveal the paint-order differences between
the testcase & reference case.

This patch also adds some letter-spacing to one of the testscases; this is
needed to fully avoid overlap in the case of an "O" glyph that's adjacent to a
highlight and is wide enough in the Windows monospace font to still trigger
this problematic overlap (if it weren't for this added letter-spacing).

[1] https://issues.chromium.org/issues/465531995

Differential Revision: https://phabricator.services.mozilla.com/D274954
2025-12-03 19:08:31 +00:00

30 lines
625 B
HTML

<!DOCTYPE html>
<html>
<head>
<style>
:root {
font-family: monospace;
}
#style1 {
background-color: yellow;
color:green;
}
#style2 {
background-color: blue;
color:red;
}
#style3 {
background-color: purple;
color:pink;
}
</style>
</head>
<body>
One <span id="style1">two</span> th<span id="style2">ree
four</span> five <span id="style2">six
seven</span> eigh<span id="style3">t nine
ten eleven twelve
thirteen fou</span>rteen fifteen
</body>
</html>