Files
sousa-gecko/testing/web-platform/tests/css/css-highlight-api/highlight-text-replace-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

18 lines
316 B
HTML

<!DOCTYPE html>
<html>
<head>
<style>
:root {
font-family: monospace;
}
#highlight {
background-color: yellow;
color:green;
}
</style>
</head>
<body>
One<span id="highlight"> </span>t<span id="highlight">w</span>o three
</body>
</html>