blob: e31b31cf595ac5ec656c1d234cf458ffc6720593 [file] [log] [blame]
<!doctype html>
<meta charset="utf-8">
<title>CSS Pseudo-Elements Test: interactions between ::selection and text-decoration</title>
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#highlight-painting">
<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#painting">
<link rel="help" href="https://www.w3.org/TR/CSS22/zindex.html#painting-order">
<link rel="match" href="selection-decoration-p4-ref.html">
<meta name="assert" value="originating decorations on selected parts are painted over ::selection background">
<script src="support/selections.js"></script>
<link rel="stylesheet" href="support/highlights.css">
<style>
/*
This test verifies that originating decorations are correctly
“lifted” to paint over the ::selection background.
Chromium fails this test before /c/2902289.
*/
* {
text-decoration-skip-ink: none;
text-decoration-skip: none;
}
main {
font-size: 7em;
margin: 0.5em;
width: min-content;
text-decoration: 0.125em currentColor solid underline;
/* try to keep decoration between ascent and baseline */
text-underline-offset: -0.5em;
}
main::selection {
background: white;
}
</style>
<p>Test passes if there is a solid line through the “O” below.
<main class="highlight_reftest">O</main>
<script>
const target = document.querySelector("main");
selectRangeWith(range => {
range.selectNodeContents(target);
range.setStart(target.childNodes[0], 0);
range.setEnd(target.childNodes[0], 1);
});
</script>