Files
sousa-gecko/testing/web-platform/tests/css/css-pseudo/target-text-011.html
T
Jan-Niklas Jaeschke 3e0858d723 Bug 2020426 - CSS Highlight API: Refactor highlight text color resolution. r=emilio,layout-reviewers
Refactor GetSelectionTextColors to return a SelectionColors struct instead of
a bool and two out-params. The struct carries distinct flags (mHasBackground,
mOverridesForeground, mHasPaintImpact), where mHasPaintImpact is true whenever
the pseudo has any computed style, not just when colors are set. This ensures
highlights specifying only text-shadow are included in the selection range list
and get their shadow painted.

Also fixes ::target-text incorrectly overriding ::highlight foreground colors
when no author text color is specified, and caches the target-text light/dark
scheme selection to avoid recomputing the contrast ratio.

This also required to allow 1px fuzziness in the test.

Differential Revision: https://phabricator.services.mozilla.com/D285546
2026-03-19 10:04:46 +00:00

15 lines
510 B
HTML

<!doctype html>
<meta charset="utf-8">
<title>CSS Pseudo-Elements Test: ::target-text empty author rule should not suppress default colors</title>
<link rel="help" href="https://drafts.csswg.org/css-pseudo/#selectordef-target-text">
<link rel="match" href="target-text-011-ref.html">
<link rel="stylesheet" type="text/css" href="/fonts/ahem.css">
<style>
.ahem { font-family: Ahem; }
::target-text {}
</style>
<p class="ahem">match me</p>
<script>
window.location.hash = "#:~:text=match%20me";
</script>