File: font-display-feature-policy-02.tentative.html

package info (click to toggle)
thunderbird 1%3A143.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,703,968 kB
  • sloc: cpp: 7,770,492; javascript: 5,943,842; ansic: 3,918,754; python: 1,418,263; xml: 653,354; asm: 474,045; java: 183,079; sh: 111,238; makefile: 20,410; perl: 14,359; objc: 13,059; yacc: 4,583; pascal: 3,405; lex: 1,720; ruby: 999; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 69; csh: 10
file content (46 lines) | stat: -rw-r--r-- 1,609 bytes parent folder | download | duplicates (26)
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
<!DOCTYPE html>
<html class="reftest-wait">
<title>Test for font-display-late-swap feature policy behavior when set to report-only</title>
<link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md">
<link rel="match" href="font-display-feature-policy-02.tentative-ref.html">
<style>
</style>
<p>None of the font-display values should be changed</p>
<table id="container">
 <tr>
  <th>not-set</th>
  <th>auto</th>
  <th>block</th>
  <th>swap</th>
  <th>fallback</th>
  <th>optional</th>
 </tr>
</table>
<script>
const fontDisplayValues = ['', 'auto', 'block', 'swap', 'fallback', 'optional'];
const table = document.getElementById('container');

function makeFontFaceDeclaration(family, display) {
    url = '/fonts/Ahem.ttf?pipe=trickle(d1)'; // Before the swap period is over
    return '@font-face { font-family: ' + family + '; src: url("' + url + '"); font-display: ' + display + '; }';
}

window.onload = () => {
    let tr = document.createElement('tr');
    for (let display of fontDisplayValues) {
        const family = display + '-face';
        const rule = makeFontFaceDeclaration(family, display);
        document.styleSheets[0].insertRule(rule, 0);
        let td = document.createElement('td');
        td.textContent = 'a';
        td.style.fontFamily = family + ', Arial';
        tr.appendChild(td);
    }
    table.appendChild(tr);
    const timeoutMilliSec = 1500; // After the font is loaded
    setTimeout(() => {
        document.documentElement.classList.remove("reftest-wait");
    }, timeoutMilliSec);
}
</script>
</html>