summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html')
-rw-r--r--testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html b/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html
new file mode 100644
index 0000000000..26927bb8c6
--- /dev/null
+++ b/testing/web-platform/tests/document-policy/font-display/override-to-optional.tentative.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<title>Test for no-font-display-late-swap document policy behavior</title>
+<link rel="help" href="https://github.com/w3c/webappsec-feature-policy/blob/master/policies/font-display-late-swap.md">
+<link rel="match" href="override-to-optional.tentative-ref.html">
+<style>
+</style>
+<p>Tests if font-display is set to optional for each option except for when it is set to fallback</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>