Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="UTF-8">
<title>CSS Highlight API Test: </title>
<link rel="match" href="custom-highlight-font-metrics-005-ref.html">
<meta name="assert" value="dynmamic font size changes with highlights and font relative metrics">
<meta name="fuzzy" content="0-80;0-10">
<script src="/common/reftest-wait.js"></script>
<head>
<style>
:root {
font-size: 16px;
}
div {
margin: 50px;
font-size: 40px;
}
#h2 {
font-size: 20px;
}
::highlight(highlight1) {
text-underline-offset: 0.5em;
text-decoration-line: underline;
text-decoration-color: green;
text-decoration-thickness: 0.25rem;
}
</style>
</head>
<body>
<div id="h1">Font relative units with 20px font</div>
<div id="h2">Font relative units with 20px font</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));
requestAnimationFrame(() => {
h1.style.fontSize = "20px";
requestAnimationFrame(() => { takeScreenshot() }
)});
</script>
</body>
</html>