blob: 158f4ee12c91436cda7946d5574cd37ddf308876 (
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
|
<!DOCTYPE html>
<meta charset="UTF-8">
<title>CSS Highlight API Test: Highlights using container sizes</title>
<link rel="help" href="https://drafts.csswg.org/css-highlight-api-1/">
<link rel="help" href="https://drafts.csswg.org/css-pseudo/#highlight-styling">
<link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-lengths">
<link rel="match" href="custom-highlight-container-metrics-004-ref.html">
<meta name="assert" value="lengths depending on containers take the correct values inside and outside a container">
<meta name="fuzzy" content="0-60;0-25">
<head>
<style>
.wrapper {
container: wrapper / size;
width: 200px;
height: 100px;
}
::highlight(highlight1) {
text-underline-offset: 2cqw;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 4cqh;
}
</style>
</head>
<body>
<div class="wrapper">
<div>
<div id="h1">With container size</div>
</div>
</div>
<div id="h2">Without container size</div>
<script>
let r1 = new Range();
r1.setStart(h1, 0);
r1.setEnd(h1, 1);
let r2 = new Range();
r2.setStart(h2, 0);
r2.setEnd(h2, 1);
CSS.highlights.set("highlight1", new Highlight(r1, r2));
</script>
</body>
|