summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-text-decor/invalidation/selection-pseudo-with-decoration-invalidation-002.html
blob: 2abe8c621400611571b661902810c1f62e189faf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<title>CSS Text Decoration Test: Invalidation of text decorations in css-pseudo ::selection</title>
<link rel="help" href="https://drafts.csswg.org/css-text-decor-4/">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/">
<meta name="assert" content="text-decorations should be correctly invalidated on selection change.">
<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org">
<link rel="match" href="reference/selection-pseudo-with-decoration-invalidation-002-ref.html">
<style>
    div {
        display: block;
        margin-top: 10px;
        margin-bottom: 10px;
        line-height: 20px;
        will-change: transform;
    }
    ::selection {
        background: yellow;
        color: currentColor;
        text-decoration-line: underline;
        text-decoration-style: line;
        text-decoration-thickness: 1px;
        text-underline-offset: 10px;
    }
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/rendering-utils.js"></script>
</head>
<body>
<div>
This is one line of text, with an image underneath.
</div>
<image src="../../support/60x60-green.png"/>
<div>
And another line of text.
</div>
</body>
<script>
async function runTest() {
  const selection = window.getSelection();
  const node = document.getElementsByTagName("body")[0];
  let range = document.createRange();
  range.selectNodeContents(node);
  selection.addRange(range);
  waitForAtLeastOneFrame().then(() => { takeScreenshot() });
}

onload = () => {
  waitForAtLeastOneFrame().then(() => { runTest() });
}
</script>
</html>