summaryrefslogtreecommitdiffstats
path: root/layout/reftests/font-loading-api
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/font-loading-api')
-rw-r--r--layout/reftests/font-loading-api/dynamic-insert-1-ref.html9
-rw-r--r--layout/reftests/font-loading-api/dynamic-insert-1.html15
-rw-r--r--layout/reftests/font-loading-api/dynamic-remove-1-ref.html9
-rw-r--r--layout/reftests/font-loading-api/dynamic-remove-1.html24
-rw-r--r--layout/reftests/font-loading-api/ex-unit-1.html12
-rw-r--r--layout/reftests/font-loading-api/multiple-sets-1-ref.html3
-rw-r--r--layout/reftests/font-loading-api/multiple-sets-1.html27
-rw-r--r--layout/reftests/font-loading-api/multiple-sets-frame-ref.html8
-rw-r--r--layout/reftests/font-loading-api/multiple-sets-frame.html2
-rw-r--r--layout/reftests/font-loading-api/name-collision.html79
-rw-r--r--layout/reftests/font-loading-api/order-1.html12
-rw-r--r--layout/reftests/font-loading-api/reftest.list11
-rw-r--r--layout/reftests/font-loading-api/src-list-1.html11
-rw-r--r--layout/reftests/font-loading-api/src-list-2.html11
14 files changed, 233 insertions, 0 deletions
diff --git a/layout/reftests/font-loading-api/dynamic-insert-1-ref.html b/layout/reftests/font-loading-api/dynamic-insert-1-ref.html
new file mode 100644
index 0000000000..caf83dd053
--- /dev/null
+++ b/layout/reftests/font-loading-api/dynamic-insert-1-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<style>
+@font-face {
+ font-family: One;
+ src: url(../fonts/markA.ttf);
+}
+body { font-family: One; }
+</style>
+<p>ABC</p>
diff --git a/layout/reftests/font-loading-api/dynamic-insert-1.html b/layout/reftests/font-loading-api/dynamic-insert-1.html
new file mode 100644
index 0000000000..75adb021ce
--- /dev/null
+++ b/layout/reftests/font-loading-api/dynamic-insert-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<style>
+body { font-family: One; }
+</style>
+<script>
+window.addEventListener("MozReftestInvalidate", function() {
+ var face = new FontFace("One", "url(../fonts/markA.ttf)");
+ face.load().then(function() {
+ document.fonts.add(face);
+ document.documentElement.className = "";
+ });
+});
+</script>
+<p>ABC</p>
diff --git a/layout/reftests/font-loading-api/dynamic-remove-1-ref.html b/layout/reftests/font-loading-api/dynamic-remove-1-ref.html
new file mode 100644
index 0000000000..caf83dd053
--- /dev/null
+++ b/layout/reftests/font-loading-api/dynamic-remove-1-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<style>
+@font-face {
+ font-family: One;
+ src: url(../fonts/markA.ttf);
+}
+body { font-family: One; }
+</style>
+<p>ABC</p>
diff --git a/layout/reftests/font-loading-api/dynamic-remove-1.html b/layout/reftests/font-loading-api/dynamic-remove-1.html
new file mode 100644
index 0000000000..4f099fc5b3
--- /dev/null
+++ b/layout/reftests/font-loading-api/dynamic-remove-1.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<style>
+body { font-family: One; }
+</style>
+<script>
+var f1 = new FontFace("One", "url(../fonts/markA.ttf)");
+var f2 = new FontFace("One", "url(../fonts/mark2A.ttf)");
+
+f1.load();
+f2.load();
+
+Promise.all([f1.load(), f2.load()])
+ .then(function() {
+ document.fonts.add(f1);
+ document.fonts.add(f2);
+ })
+ .then(document.fonts.ready)
+ .then(function() {
+ document.fonts.delete(f2);
+ document.documentElement.className = "";
+ });
+</script>
+<p>ABC</p>
diff --git a/layout/reftests/font-loading-api/ex-unit-1.html b/layout/reftests/font-loading-api/ex-unit-1.html
new file mode 100644
index 0000000000..652cbfda11
--- /dev/null
+++ b/layout/reftests/font-loading-api/ex-unit-1.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<!-- modeled on ../font-face/ex-unit-1.html -->
+<html class="reftest-wait">
+<title>ex unit with Ahem font</title>
+<style>
+html { background: white; }
+body { font-family: Ahhhem; font-size: 50px; height: 2ex; width: 2ex; background: blue; }
+</style>
+<script>
+document.fonts.add(new FontFace("Ahhhem", "url(../fonts/Ahem.ttf)"));
+document.fonts.ready.then(function() { document.documentElement.className = ""; });
+</script>
diff --git a/layout/reftests/font-loading-api/multiple-sets-1-ref.html b/layout/reftests/font-loading-api/multiple-sets-1-ref.html
new file mode 100644
index 0000000000..5a59ff728b
--- /dev/null
+++ b/layout/reftests/font-loading-api/multiple-sets-1-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<iframe id=a src=multiple-sets-frame-ref.html></iframe>
+<iframe id=b src=multiple-sets-frame-ref.html></iframe>
diff --git a/layout/reftests/font-loading-api/multiple-sets-1.html b/layout/reftests/font-loading-api/multiple-sets-1.html
new file mode 100644
index 0000000000..3c4bc7d914
--- /dev/null
+++ b/layout/reftests/font-loading-api/multiple-sets-1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html class=reftest-wait>
+<body onload=step()>
+<iframe id=a src=multiple-sets-frame.html></iframe>
+<iframe id=b src=multiple-sets-frame.html></iframe>
+<script>
+var events = 2; // wait for load event and MozReftestInvalidate
+
+function step() {
+ if (--events == 0) {
+ var a = document.getElementById("a");
+ var b = document.getElementById("b");
+ var a_win = a.contentWindow;
+ var b_win = b.contentWindow;
+ var a_doc = a.contentDocument;
+ var b_doc = b.contentDocument;
+ var face = new a_win.FontFace("Ahem", "url(../fonts/Ahem.ttf)");
+ a_doc.fonts.add(face);
+ b_doc.fonts.add(face);
+ face.load().then(function() {
+ document.documentElement.className = "";
+ });
+ }
+}
+
+window.addEventListener("MozReftestInvalidate", step);
+</script>
diff --git a/layout/reftests/font-loading-api/multiple-sets-frame-ref.html b/layout/reftests/font-loading-api/multiple-sets-frame-ref.html
new file mode 100644
index 0000000000..d8dec9920c
--- /dev/null
+++ b/layout/reftests/font-loading-api/multiple-sets-frame-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<style>
+@font-face {
+ font-family: Ahem;
+ src: url(../fonts/Ahem.ttf);
+}
+</style>
+<p style="font: 16px Ahem">Hello</p>
diff --git a/layout/reftests/font-loading-api/multiple-sets-frame.html b/layout/reftests/font-loading-api/multiple-sets-frame.html
new file mode 100644
index 0000000000..c185959632
--- /dev/null
+++ b/layout/reftests/font-loading-api/multiple-sets-frame.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<p style="font: 16px Ahem">Hello</p>
diff --git a/layout/reftests/font-loading-api/name-collision.html b/layout/reftests/font-loading-api/name-collision.html
new file mode 100644
index 0000000000..50a8fffc60
--- /dev/null
+++ b/layout/reftests/font-loading-api/name-collision.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<!-- modeled after ../font-face/name-collision.html -->
+<html class="reftest-wait">
+<!--
+ Font family names in @font-face rules take precedence over locally-available font families,
+ so none of the names of commonly used platform fonts should match against locally available
+ fonts.
+-->
+<style>
+body { margin: 50px; font-family: fallback; }
+table { font-family: Sample; margin-left: 3em; }
+.sample { font-family: Sample, fallback; }
+table td { font-size: 24pt; }
+
+/* Windows */
+
+.arial { font-family: Arial, fallback; }
+.timesnewroman { font-family: Times New Roman, fallback; }
+.couriernew { font-family: Courier New, fallback; }
+
+/* Mac OS X */
+
+.futura { font-family: Futura, fallback; }
+.helvetica { font-family: Helvetica, fallback; }
+.times { font-family: Times, fallback; }
+.courier { font-family: Courier, fallback; }
+
+/* Linux */
+
+.bitstreamverasans { font-family: Bitstream Vera Sans, fallback; }
+.dejavusans { font-family: DejaVu Sans, fallback; }
+.freesans { font-family: FreeSans, fallback; }
+</style>
+<script>
+function addTestFont(aFamily) {
+ document.fonts.add(new FontFace(aFamily, "url(../fonts/mplus/mplus-1p-black.ttf)", { weight: 900 }));
+}
+
+document.fonts.add(new FontFace("fallback", "url(../fonts/mplus/mplus-1p-regular.ttf)"));
+
+addTestFont("Sample");
+
+/* Windows */
+
+addTestFont("Arial");
+addTestFont("Times New Roman");
+addTestFont("Courier New");
+
+/* Mac OS X */
+
+addTestFont("Futura");
+addTestFont("Helvetica");
+addTestFont("Times");
+addTestFont("Courier");
+
+/* Linux */
+
+addTestFont("Bitstream Vera Sans");
+addTestFont("DejaVu Sans");
+addTestFont("FreeSans");
+
+document.fonts.ready.then(function() { document.documentElement.className = ""; });
+</script>
+
+<p>All text below should appear in the same extra bold font face:</p>
+
+<table>
+<tr class="sample"><td>Sample</td></tr>
+<tr class="arial"><td>Arial</td></tr>
+<tr class="timesnewroman"><td>Times New Roman</td></tr>
+<tr class="couriernew"><td>Courier New</td></tr>
+<tr class="futura"><td>Futura</td></tr>
+<tr class="helvetica"><td>Helvetica</td></tr>
+<tr class="times"><td>Times</td></tr>
+<tr class="courier"><td>Courier</td></tr>
+<tr class="bitstreamverasans"><td>Bitstream Vera Sans</td></tr>
+<tr class="dejavusans"><td>DejaVu Sans</td></tr>
+<tr class="freesans"><td>FreeSans</td></tr>
+</table>
diff --git a/layout/reftests/font-loading-api/order-1.html b/layout/reftests/font-loading-api/order-1.html
new file mode 100644
index 0000000000..3555be0cc9
--- /dev/null
+++ b/layout/reftests/font-loading-api/order-1.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<!-- modeled on ../font-face/order-1.html -->
+<html class="reftest-wait">
+<style>
+body { font-family: "One"; }
+</style>
+<script>
+document.fonts.add(new FontFace("One", "url(../fonts/mark2A.ttf)"));
+document.fonts.add(new FontFace("One", "url(../fonts/markA.ttf)"));
+document.fonts.ready.then(function() { document.documentElement.className = ""; });
+</script>
+<p>ABC</p>
diff --git a/layout/reftests/font-loading-api/reftest.list b/layout/reftests/font-loading-api/reftest.list
new file mode 100644
index 0000000000..2d580a51ea
--- /dev/null
+++ b/layout/reftests/font-loading-api/reftest.list
@@ -0,0 +1,11 @@
+defaults pref(layout.css.font-loading-api.enabled,true)
+
+== dynamic-insert-1.html dynamic-insert-1-ref.html
+== dynamic-remove-1.html dynamic-remove-1-ref.html
+== ex-unit-1.html ../font-face/ex-unit-1-ref.html
+fuzzy(0-2,0-10) == multiple-sets-1.html multiple-sets-1-ref.html
+== name-collision.html ../font-face/name-collision-ref.html
+== order-1.html ../font-face/order-1-ref.html
+== src-list-1.html ../font-face/src-list-1-ref.html
+== src-list-2.html ../font-face/src-list-2-ref.html
+== src-list-data-1.html ../font-face/src-list-data-ref.html
diff --git a/layout/reftests/font-loading-api/src-list-1.html b/layout/reftests/font-loading-api/src-list-1.html
new file mode 100644
index 0000000000..2af1bdc08f
--- /dev/null
+++ b/layout/reftests/font-loading-api/src-list-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<!-- modeled on ../font-face/src-list-1.html -->
+<html class="reftest-wait">
+<style>
+body { font-family: One; }
+</style>
+<script>
+document.fonts.add(new FontFace("One", "url(../fonts/markA.ttf), url(../fonts/mark2A.ttf)"));
+document.fonts.ready.then(function() { document.documentElement.className = ""; });
+</script>
+<p>ABC</p>
diff --git a/layout/reftests/font-loading-api/src-list-2.html b/layout/reftests/font-loading-api/src-list-2.html
new file mode 100644
index 0000000000..9c8c83890b
--- /dev/null
+++ b/layout/reftests/font-loading-api/src-list-2.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<!-- modeled on ../font-face/src-list-2.html -->
+<html class="reftest-wait">
+<style>
+body { font-family: "One"; }
+</style>
+<script>
+document.fonts.add(new FontFace("One", "url(../fonts/markA.ttf), url(../fonts/markB.ttf)"));
+document.fonts.ready.then(function() { document.documentElement.className = ""; });
+</script>
+<p>ABC</p>