summaryrefslogtreecommitdiffstats
path: root/layout/reftests/font-features
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/font-features')
-rw-r--r--layout/reftests/font-features/1376231-vertical-gpos-adjustments-ref.html47
-rw-r--r--layout/reftests/font-features/1376231-vertical-gpos-adjustments.html75
-rw-r--r--layout/reftests/font-features/alternates-order-ref.html30
-rw-r--r--layout/reftests/font-features/alternates-order.html116
-rw-r--r--layout/reftests/font-features/annotations-ref.html71
-rw-r--r--layout/reftests/font-features/annotations.html51
-rw-r--r--layout/reftests/font-features/caps-fallback-allpetitecaps.html30
-rw-r--r--layout/reftests/font-features/caps-fallback-allsmallcaps.html30
-rw-r--r--layout/reftests/font-features/caps-fallback-default.html29
-rw-r--r--layout/reftests/font-features/caps-fallback-petitecaps.html30
-rw-r--r--layout/reftests/font-features/caps-fallback-smallcaps1.html30
-rw-r--r--layout/reftests/font-features/caps-fallback-smallcaps2.html30
-rw-r--r--layout/reftests/font-features/caps-fallback-smcp.html30
-rw-r--r--layout/reftests/font-features/caps-fallback-smcpc2sc.html30
-rw-r--r--layout/reftests/font-features/font-features-across-space-1-ref.html44
-rw-r--r--layout/reftests/font-features/font-features-across-space-1.html44
-rw-r--r--layout/reftests/font-features/font-features-hlig-2.html19
-rw-r--r--layout/reftests/font-features/font-features-hlig-3.html20
-rw-r--r--layout/reftests/font-features/font-features-hlig-4.html20
-rw-r--r--layout/reftests/font-features/font-features-hlig-5.html20
-rw-r--r--layout/reftests/font-features/font-features-hlig.html19
-rw-r--r--layout/reftests/font-features/font-features-ligatures-none.html20
-rw-r--r--layout/reftests/font-features/font-features-noliga.html19
-rw-r--r--layout/reftests/font-features/font-features-order-1.html20
-rw-r--r--layout/reftests/font-features/font-features-order-2.html20
-rw-r--r--layout/reftests/font-features/font-features-order-3.html22
-rw-r--r--layout/reftests/font-features/font-features-order-4.html22
-rw-r--r--layout/reftests/font-features/font-features-order-5.html24
-rw-r--r--layout/reftests/font-features/font-features-ref.html18
-rw-r--r--layout/reftests/font-features/font-features-turkish-override-1.html19
-rw-r--r--layout/reftests/font-features/font-features-turkish-override-2.html19
-rw-r--r--layout/reftests/font-features/font-features-turkish-override-3.html19
-rw-r--r--layout/reftests/font-features/font-features-turkish-override-4.html19
-rw-r--r--layout/reftests/font-features/font-features-turkish-override-5.html20
-rw-r--r--layout/reftests/font-features/font-features-turkish-ref.html18
-rw-r--r--layout/reftests/font-features/font-features-turkish.html18
-rw-r--r--layout/reftests/font-features/font-kerning-1.html26
-rw-r--r--layout/reftests/font-features/font-kerning-2.html26
-rw-r--r--layout/reftests/font-features/font-kerning-3.html23
-rw-r--r--layout/reftests/font-features/font-kerning-auto.html23
-rw-r--r--layout/reftests/font-features/font-kerning-kern.html23
-rw-r--r--layout/reftests/font-features/font-kerning-nokern.html23
-rw-r--r--layout/reftests/font-features/font-kerning-none.html23
-rw-r--r--layout/reftests/font-features/font-kerning-normal.html23
-rw-r--r--layout/reftests/font-features/font-kerning-table-none.html24
-rw-r--r--layout/reftests/font-features/font-kerning-table-normal.html23
-rw-r--r--layout/reftests/font-features/font-variant-alternates-ref.html20
-rw-r--r--layout/reftests/font-features/font-variant-alternates.html20
-rw-r--r--layout/reftests/font-features/font-variant-caps-ref.html16
-rw-r--r--layout/reftests/font-features/font-variant-caps.html16
-rw-r--r--layout/reftests/font-features/font-variant-debug.html16
-rw-r--r--layout/reftests/font-features/font-variant-east-asian-ref.html16
-rw-r--r--layout/reftests/font-features/font-variant-east-asian.html16
-rw-r--r--layout/reftests/font-features/font-variant-features.css66
-rw-r--r--layout/reftests/font-features/font-variant-features.js287
-rw-r--r--layout/reftests/font-features/font-variant-ligatures-ref.html16
-rw-r--r--layout/reftests/font-features/font-variant-ligatures.html16
-rw-r--r--layout/reftests/font-features/font-variant-numeric-ref.html16
-rw-r--r--layout/reftests/font-features/font-variant-numeric.html16
-rw-r--r--layout/reftests/font-features/font-variant-position-ref.html16
-rw-r--r--layout/reftests/font-features/font-variant-position.html16
-rw-r--r--layout/reftests/font-features/font-variant-ref.html16
-rw-r--r--layout/reftests/font-features/font-variant.html16
-rw-r--r--layout/reftests/font-features/fwid-spaces-ref.html37
-rw-r--r--layout/reftests/font-features/fwid-spaces.html39
-rw-r--r--layout/reftests/font-features/kerning-sanity-check-default.html37
-rw-r--r--layout/reftests/font-features/kerning-sanity-check-kern.html38
-rw-r--r--layout/reftests/font-features/kerning-sanity-check-nokern.html38
-rw-r--r--layout/reftests/font-features/kerning-spaces-arial-default.html44
-rw-r--r--layout/reftests/font-features/kerning-spaces-arial-kern.html45
-rw-r--r--layout/reftests/font-features/kerning-spaces-arial-nokern.html45
-rw-r--r--layout/reftests/font-features/kerning-spaces-tnr-default.html46
-rw-r--r--layout/reftests/font-features/kerning-spaces-tnr-kern.html47
-rw-r--r--layout/reftests/font-features/kerning-spaces-tnr-nokern.html47
-rw-r--r--layout/reftests/font-features/reftest.list125
-rw-r--r--layout/reftests/font-features/small-caps-missing-capital-ref.html23
-rw-r--r--layout/reftests/font-features/small-caps-missing-capital.html25
-rw-r--r--layout/reftests/font-features/spacelookups-ref.html33
-rw-r--r--layout/reftests/font-features/spacelookups-wordcache-ref.html81
-rw-r--r--layout/reftests/font-features/spacelookups-wordcache.html76
-rw-r--r--layout/reftests/font-features/spacelookups.html82
-rw-r--r--layout/reftests/font-features/subsuper-fallback-notref1.html32
-rw-r--r--layout/reftests/font-features/subsuper-fallback-notref2.html32
-rw-r--r--layout/reftests/font-features/subsuper-fallback-notref3.html41
-rw-r--r--layout/reftests/font-features/subsuper-fallback-omega-notref.html30
-rw-r--r--layout/reftests/font-features/subsuper-fallback-omega.html32
-rw-r--r--layout/reftests/font-features/subsuper-fallback-ref.html34
-rw-r--r--layout/reftests/font-features/subsuper-fallback-size-ref.html36
-rw-r--r--layout/reftests/font-features/subsuper-fallback-size.html37
-rw-r--r--layout/reftests/font-features/subsuper-fallback.html34
-rw-r--r--layout/reftests/font-features/subsuper-nofallback-notref.html34
-rw-r--r--layout/reftests/font-features/subsuper-nofallback-ref1.html43
-rw-r--r--layout/reftests/font-features/subsuper-nofallback-ref2.html35
-rw-r--r--layout/reftests/font-features/subsuper-nofallback.html36
94 files changed, 3314 insertions, 0 deletions
diff --git a/layout/reftests/font-features/1376231-vertical-gpos-adjustments-ref.html b/layout/reftests/font-features/1376231-vertical-gpos-adjustments-ref.html
new file mode 100644
index 0000000000..7e5108e480
--- /dev/null
+++ b/layout/reftests/font-features/1376231-vertical-gpos-adjustments-ref.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/NotoSansCJKjp-Regular.subset.otf);
+}
+body {
+ font-family: test, serif;
+ line-height: 2em;
+}
+p {
+ margin: 1em;
+}
+span {
+ display: inline-block;
+ inline-size: 9em; /* length of 9 standard CJK chars */
+}
+.v {
+ writing-mode: vertical-rl;
+}
+.green {
+ color: green;
+ background: green;
+}
+.overlay {
+ position: relative;
+ inset-block-start: -3em;
+}
+</style>
+</head>
+<body>
+There should be no red:
+<div>
+ <p><span>&nbsp;</p>
+ <p class="overlay"><span class="green">&nbsp;</p>
+ <p><span>&nbsp;</p>
+ <p class="overlay"><span class="green">&nbsp;</p>
+</div>
+<div class="v">
+ <p><span>&nbsp;</p>
+ <p class="overlay"><span class="green">&nbsp;</p>
+ <p><span>&nbsp;</p>
+ <p class="overlay"><span class="green">&nbsp;</p>
+</div>
diff --git a/layout/reftests/font-features/1376231-vertical-gpos-adjustments.html b/layout/reftests/font-features/1376231-vertical-gpos-adjustments.html
new file mode 100644
index 0000000000..0b0f9b9da2
--- /dev/null
+++ b/layout/reftests/font-features/1376231-vertical-gpos-adjustments.html
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/NotoSansCJKjp-Regular.subset.otf);
+}
+body {
+ font-family: test, serif;
+ line-height: 2em;
+}
+p {
+ margin: 1em;
+}
+span {
+ display: inline-block;
+}
+.v {
+ writing-mode: vertical-rl;
+}
+.halt {
+ font-feature-settings: "halt";
+ /* there are 3 characters in the text that should be affected by 'halt',
+ so if we add 1.5em of padding, the overall width will be the same */
+ padding-inline-end: 1.5em;
+}
+.palt {
+ font-feature-settings: "palt";
+ /* 'palt' results in even tighter spacing than 'halt', so we can add a
+ little more padding and the result should still be obscured by the
+ overlaid 'halt' span. (We don't try for an exact match as this involves
+ fractional pixel widths and would be very fragile.) */
+ padding-inline-end: 1.6em;
+}
+.vhal {
+ font-feature-settings: "vhal";
+ padding-inline-end: 1.5em;
+}
+.vpal {
+ font-feature-settings: "vpal";
+ padding-inline-end: 1.6em;
+}
+.red {
+ color: red;
+ background: red;
+}
+.green {
+ color: green;
+ background: green;
+}
+.overlay {
+ position: relative;
+ inset-block-start: -3em;
+}
+</style>
+</head>
+<body>
+There should be no red:
+<div>
+ <!-- check that the red 'halt' span is entirely hidden by the green default span -->
+ <p><span class="halt red">&#x3084;&#x3063;&#x307B;&#x3046;&#x3001;&#x300C;&#x4E16;&#x754C;&#x300D;</p>
+ <p class="overlay"><span class="green">&#x3084;&#x3063;&#x307B;&#x3046;&#x3001;&#x300C;&#x4E16;&#x754C;&#x300D;</p>
+ <!-- check that the red 'palt' span is entirely hidden by the green default span -->
+ <p><span class="palt red">&#x3084;&#x3063;&#x307B;&#x3046;&#x3001;&#x300C;&#x4E16;&#x754C;&#x300D;</p>
+ <p class="overlay"><span class="green">&#x3084;&#x3063;&#x307B;&#x3046;&#x3001;&#x300C;&#x4E16;&#x754C;&#x300D;</p>
+</div>
+<div class="v">
+ <!-- check the equivalent vertical-mode features -->
+ <p><span class="vhal red">&#x3084;&#x3063;&#x307B;&#x3046;&#x3001;&#x300C;&#x4E16;&#x754C;&#x300D;</p>
+ <p class="overlay"><span class="green">&#x3084;&#x3063;&#x307B;&#x3046;&#x3001;&#x300C;&#x4E16;&#x754C;&#x300D;</p>
+ <p><span class="vpal red">&#x3084;&#x3063;&#x307B;&#x3046;&#x3001;&#x300C;&#x4E16;&#x754C;&#x300D;</p>
+ <p class="overlay"><span class="green">&#x3084;&#x3063;&#x307B;&#x3046;&#x3001;&#x300C;&#x4E16;&#x754C;&#x300D;</p>
+</div>
diff --git a/layout/reftests/font-features/alternates-order-ref.html b/layout/reftests/font-features/alternates-order-ref.html
new file mode 100644
index 0000000000..6af3a76abe
--- /dev/null
+++ b/layout/reftests/font-features/alternates-order-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 800%;
+ line-height: 1.2em;
+}
+
+div { margin: 0 20px; }
+span {
+ font-feature-settings: "ss05"; /* crossed W */
+}
+
+/* tests that should NOT use the feature, due to case-sensitivity of font-feature-values names */
+#test2, #test3 { font-feature-settings: "ss05" off; }
+
+</style>
+</head>
+<body lang="en">
+<div><span id="test1">W</span> <span id="test2">W</span> <span id="test3">W</span></div>
+<div><span id="test4">W</span> <span id="test5">W</span> <span id="test6">W</span></div>
+<div><span id="test7">W</span> <span id="test8">W</span> <span id="test9">W</span></div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/alternates-order.html b/layout/reftests/font-features/alternates-order.html
new file mode 100644
index 0000000000..f7d073abfd
--- /dev/null
+++ b/layout/reftests/font-features/alternates-order.html
@@ -0,0 +1,116 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+
+@font-face {
+ font-family: fontA;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "ss05" on;
+}
+
+@font-face {
+ font-family: fontB;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "ss05" off;
+}
+
+@font-feature-values libertine {
+ @styleset {
+ crossed-doubleu: 5;
+ somethingElse: 4;
+ }
+}
+
+@font-feature-values fontA {
+ @styleset { aLtW: 5; }
+}
+
+@font-feature-values fontB {
+ @styleset { crossedW: 5; several: 1 3 5; }
+ @styleset { altW: 4; }
+}
+
+@font-feature-values fontB {
+ @styleset {
+ AlTw: 5;
+ defined-for-fontB: 5;
+ scriptJ: 3;
+ }
+}
+
+body {
+ font-family: libertine, sans-serif;
+ font-size: 800%;
+ line-height: 1.2em;
+}
+
+/* font-feature-settings: "ss05"; crossed W */
+
+div { margin: 0 20px; }
+
+#test1 {
+ font-variant-alternates: styleset(crossed-doubleu);
+}
+
+#test2 {
+ /* testing case-sensitivity of styleset name */
+ font-family: fontB;
+ font-variant-alternates: styleset(altW);
+}
+
+#test3 {
+ /* testing case-sensitivity of styleset name */
+ font-family: fontB;
+ font-variant-alternates: styleset(ALTW);
+}
+
+#test4 {
+ /* testing escapes in styleset name */
+ font-family: fontB;
+ font-variant-alternates: styleset(\41 lTw);
+}
+
+#test5 {
+ /* testing font-specificity of feature value rule */
+ font-family: fontA;
+ font-variant-alternates: styleset(defined-for-fontB);
+}
+
+#test6 {
+ /* testing one feature doesn't affect another */
+ font-variant-alternates: styleset(somethingElse);
+ font-feature-settings: "ss05" on;
+}
+
+#test7 {
+ /* testing font-specificity of feature value rule */
+ font-family: fontA;
+ font-variant-alternates: styleset(scriptJ);
+ font-feature-settings: "ss06";
+}
+
+#test8 {
+ /* testing that an undefined value doesn't affect the results */
+ font-family: fontB;
+ font-variant-alternates: styleset(scriptJ, somethingUndefined, defined-for-fontB);
+}
+
+#test9 {
+ /* testing matching of font name with escape */
+ font-family: font\62 ;
+ font-variant-alternates: styleset(defined-for-fontB);
+}
+
+</style>
+</head>
+<body lang="en">
+<div><span id="test1">W</span> <span id="test2">W</span> <span id="test3">W</span></div>
+<div><span id="test4">W</span> <span id="test5">W</span> <span id="test6">W</span></div>
+<div><span id="test7">W</span> <span id="test8">W</span> <span id="test9">W</span></div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/annotations-ref.html b/layout/reftests/font-features/annotations-ref.html
new file mode 100644
index 0000000000..a21ea28fc5
--- /dev/null
+++ b/layout/reftests/font-features/annotations-ref.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Annotations test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 20px;
+ font-size: 800%;
+ font-family: Hiragino Maru Gothic ProN, Meiryo;
+}
+
+/* for platforms without these fonts the default glyphs will show */
+
+@font-face {
+ font-family: testMeiryo-circled;
+ src: local(Meiryo);
+ font-feature-settings: "nalt" 4;
+}
+
+@font-face {
+ font-family: testMeiryo-black-circled;
+ src: local(Meiryo);
+ font-feature-settings: "nalt" 5;
+}
+
+@font-face {
+ font-family: testMeiryo-rounded-box;
+ src: local(Meiryo);
+ font-feature-settings: "nalt" 9;
+}
+
+@font-face {
+ font-family: testHiraginoMaru-circled;
+ src: local(HiraMaruProN-W4), local(Hiragino Maru Gothic ProN W4);
+ font-feature-settings: "nalt" 1;
+}
+
+@font-face {
+ font-family: testHiraginoMaru-black-circled;
+ src: local(HiraMaruProN-W4), local(Hiragino Maru Gothic ProN W4);
+ font-feature-settings: "nalt" 4;
+}
+
+@font-face {
+ font-family: testHiraginoMaru-rounded-box;
+ src: local(HiraMaruProN-W4), local(Hiragino Maru Gothic ProN W4);
+ font-feature-settings: "nalt" 10;
+}
+
+#test1 {
+ font-family: testHiraginoMaru-circled, testMeiryo-circled;
+}
+
+#test2 {
+ font-family: testHiraginoMaru-black-circled, testMeiryo-black-circled;
+}
+
+#test3 {
+ font-family: testHiraginoMaru-rounded-box, testMeiryo-rounded-box;
+}
+
+</style>
+
+</head>
+<body>
+<div><span id="test1">1</span> <span id="test2">2</span> <span id="test3">3</span></div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/annotations.html b/layout/reftests/font-features/annotations.html
new file mode 100644
index 0000000000..24574cf54b
--- /dev/null
+++ b/layout/reftests/font-features/annotations.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Annotations test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 20px;
+ font-size: 800%;
+ font-family: Hiragino Maru Gothic ProN, Meiryo;
+}
+
+/* for platforms without these fonts the default glyphs will show */
+
+@font-feature-values Hiragino Maru Gothic ProN {
+ @annotation { circled: 1; }
+ @annotation { black-circled: 4; }
+ @annotation { black-box: 8; }
+ @annotation { black-rounded-box: 10; }
+}
+
+@font-feature-values Meiryo {
+ @annotation {
+ circled: 4;
+ black-circled: 5;
+ black-box: 7;
+ black-rounded-box: 9;
+ }
+}
+
+#test1 {
+ font-variant-alternates: annotation(circled);
+}
+
+#test2 {
+ font-variant-alternates: annotation(black-circled);
+}
+
+#test3 {
+ font-variant-alternates: annotation(black-rounded-box);
+}
+
+</style>
+
+</head>
+<body>
+<div><span id="test1">1</span> <span id="test2">2</span> <span id="test3">3</span></div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/caps-fallback-allpetitecaps.html b/layout/reftests/font-features/caps-fallback-allpetitecaps.html
new file mode 100644
index 0000000000..9bfc703989
--- /dev/null
+++ b/layout/reftests/font-features/caps-fallback-allpetitecaps.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-caps fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* Fira Sans only supports smcp/c2sc, not pcap/c2pc */
+@font-face {
+ font-family: firasans;
+ src: url(../fonts/fira/FiraSans-Regular.otf);
+}
+
+body {
+ margin: 20px;
+ font-family: firasans, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+
+.allpetitecaps { font-variant-caps: all-petite-caps; }
+</style>
+</head>
+<body>
+<p class=allpetitecaps>Aa Bb Gg Δδ Γγ Σσ Бб Фф</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/caps-fallback-allsmallcaps.html b/layout/reftests/font-features/caps-fallback-allsmallcaps.html
new file mode 100644
index 0000000000..76db1c46fb
--- /dev/null
+++ b/layout/reftests/font-features/caps-fallback-allsmallcaps.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-caps fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* Fira Sans only supports smcp/c2sc, not pcap/c2pc */
+@font-face {
+ font-family: firasans;
+ src: url(../fonts/fira/FiraSans-Regular.otf);
+}
+
+body {
+ margin: 20px;
+ font-family: firasans, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+
+.allsmallcaps { font-variant-caps: all-small-caps; }
+</style>
+</head>
+<body>
+<p class=allsmallcaps>Aa Bb Gg Δδ Γγ Σσ Бб Фф</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/caps-fallback-default.html b/layout/reftests/font-features/caps-fallback-default.html
new file mode 100644
index 0000000000..790c974022
--- /dev/null
+++ b/layout/reftests/font-features/caps-fallback-default.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-caps fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* Fira Sans only supports smcp/c2sc, not pcap/c2pc */
+@font-face {
+ font-family: firasans;
+ src: url(../fonts/fira/FiraSans-Regular.otf);
+}
+
+body {
+ margin: 20px;
+ font-family: firasans, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+
+</style>
+</head>
+<body>
+<p class=default>Aa Bb Gg Δδ Γγ Σσ Бб Фф</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/caps-fallback-petitecaps.html b/layout/reftests/font-features/caps-fallback-petitecaps.html
new file mode 100644
index 0000000000..3dbaa15205
--- /dev/null
+++ b/layout/reftests/font-features/caps-fallback-petitecaps.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-caps fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* Fira Sans only supports smcp/c2sc, not pcap/c2pc */
+@font-face {
+ font-family: firasans;
+ src: url(../fonts/fira/FiraSans-Regular.otf);
+}
+
+body {
+ margin: 20px;
+ font-family: firasans, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+
+.petitecaps { font-variant-caps: petite-caps; }
+</style>
+</head>
+<body>
+<p class=petitecaps>Aa Bb Gg Δδ Γγ Σσ Бб Фф</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/caps-fallback-smallcaps1.html b/layout/reftests/font-features/caps-fallback-smallcaps1.html
new file mode 100644
index 0000000000..9d5d71e0a5
--- /dev/null
+++ b/layout/reftests/font-features/caps-fallback-smallcaps1.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-caps fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* Fira Sans only supports smcp/c2sc, not pcap/c2pc */
+@font-face {
+ font-family: firasans;
+ src: url(../fonts/fira/FiraSans-Regular.otf);
+}
+
+body {
+ margin: 20px;
+ font-family: firasans, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+
+.smallcaps1 { font-variant: small-caps; }
+</style>
+</head>
+<body>
+<p class=smallcaps1>Aa Bb Gg Δδ Γγ Σσ Бб Фф</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/caps-fallback-smallcaps2.html b/layout/reftests/font-features/caps-fallback-smallcaps2.html
new file mode 100644
index 0000000000..665773fbae
--- /dev/null
+++ b/layout/reftests/font-features/caps-fallback-smallcaps2.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-caps fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* Fira Sans only supports smcp/c2sc, not pcap/c2pc */
+@font-face {
+ font-family: firasans;
+ src: url(../fonts/fira/FiraSans-Regular.otf);
+}
+
+body {
+ margin: 20px;
+ font-family: firasans, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+
+.smallcaps2 { font-variant-caps: small-caps; }
+</style>
+</head>
+<body>
+<p class=smallcaps2>Aa Bb Gg Δδ Γγ Σσ Бб Фф</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/caps-fallback-smcp.html b/layout/reftests/font-features/caps-fallback-smcp.html
new file mode 100644
index 0000000000..ee29a4a813
--- /dev/null
+++ b/layout/reftests/font-features/caps-fallback-smcp.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-caps fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* Fira Sans only supports smcp/c2sc, not pcap/c2pc */
+@font-face {
+ font-family: firasans;
+ src: url(../fonts/fira/FiraSans-Regular.otf);
+}
+
+body {
+ margin: 20px;
+ font-family: firasans, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+
+.smcp { font-feature-settings: "smcp" on; }
+</style>
+</head>
+<body>
+<p class=smcp>Aa Bb Gg Δδ Γγ Σσ Бб Фф</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/caps-fallback-smcpc2sc.html b/layout/reftests/font-features/caps-fallback-smcpc2sc.html
new file mode 100644
index 0000000000..3b2ed841db
--- /dev/null
+++ b/layout/reftests/font-features/caps-fallback-smcpc2sc.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-caps fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* Fira Sans only supports smcp/c2sc, not pcap/c2pc */
+@font-face {
+ font-family: firasans;
+ src: url(../fonts/fira/FiraSans-Regular.otf);
+}
+
+body {
+ margin: 20px;
+ font-family: firasans, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+
+.smcpc2sc { font-feature-settings: "smcp" on, "c2sc" on; }
+</style>
+</head>
+<body>
+<p class=smcpc2sc>Aa Bb Gg Δδ Γγ Σσ Бб Фф</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-across-space-1-ref.html b/layout/reftests/font-features/font-features-across-space-1-ref.html
new file mode 100644
index 0000000000..110ab16ae7
--- /dev/null
+++ b/layout/reftests/font-features/font-features-across-space-1-ref.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>ligature-across-space test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style type="text/css">
+@font-face {
+ font-family: ligsym;
+ src: url(../fonts/LigatureSymbolsWithSpaces.woff);
+}
+
+td {
+ padding: 10px 5px;
+}
+
+.test {
+ font-family: ligsym;
+ font-size: 150%;
+ -webkit-font-feature-settings: "liga" on;
+ -o-font-feature-settings: "liga" on;
+ font-feature-settings: "liga" on;
+}
+</style>
+</head>
+
+<body>
+
+<table>
+<tr><td>calendar</td><td class="test">&#xe15e;</td></tr>
+<tr><td>daily calendar</td><td class="test">&#xe025;</td></tr>
+<tr><td>align left</td><td class="test">&#xe005;</td></tr>
+<tr><td>align center</td><td class="test">&#xe004;</td></tr>
+<tr><td>align right</td><td class="test">&#xe006;</td></tr>
+<tr><td>volume</td><td class="test">&#xe13b;</td></tr>
+<tr><td>volume down</td><td class="test">&#xe13c;</td></tr>
+<tr><td>volume up</td><td class="test">&#xe13d;</td></tr>
+<tr><td>zoom in</td><td class="test">&#xe142;</td></tr>
+<tr><td>zoom out</td><td class="test">&#xe143;</td></tr>
+<tr><td>heart</td><td class="test">&#xe06e;</td></tr>
+<tr><td>heart empty</td><td class="test">&#xe06f;</td></tr>
+</table>
+
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/font-features-across-space-1.html b/layout/reftests/font-features/font-features-across-space-1.html
new file mode 100644
index 0000000000..1f60e3d2c5
--- /dev/null
+++ b/layout/reftests/font-features/font-features-across-space-1.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>ligature-across-space test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<style type="text/css">
+@font-face {
+ font-family: ligsym;
+ src: url(../fonts/LigatureSymbolsWithSpaces.woff);
+}
+
+td {
+ padding: 10px 5px;
+}
+
+.test {
+ font-family: ligsym;
+ font-size: 150%;
+ -webkit-font-feature-settings: "liga" on;
+ -o-font-feature-settings: "liga" on;
+ font-feature-settings: "liga" on;
+}
+</style>
+</head>
+
+<body>
+
+<table>
+<tr><td>calendar</td><td class="test">calendar</td></tr>
+<tr><td>daily calendar</td><td class="test">daily calendar</td></tr>
+<tr><td>align left</td><td class="test">align left</td></tr>
+<tr><td>align center</td><td class="test">align center</td></tr>
+<tr><td>align right</td><td class="test">align right</td></tr>
+<tr><td>volume</td><td class="test">volume</td></tr>
+<tr><td>volume down</td><td class="test">volume down</td></tr>
+<tr><td>volume up</td><td class="test">volume up</td></tr>
+<tr><td>zoom in</td><td class="test">zoom in</td></tr>
+<tr><td>zoom out</td><td class="test">zoom out</td></tr>
+<tr><td>heart</td><td class="test">heart</td></tr>
+<tr><td>heart empty</td><td class="test">heart empty</td></tr>
+</table>
+
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/font-features-hlig-2.html b/layout/reftests/font-features/font-features-hlig-2.html
new file mode 100644
index 0000000000..3fde28f26d
--- /dev/null
+++ b/layout/reftests/font-features/font-features-hlig-2.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "hlig";
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-hlig-3.html b/layout/reftests/font-features/font-features-hlig-3.html
new file mode 100644
index 0000000000..5efa9d13b6
--- /dev/null
+++ b/layout/reftests/font-features/font-features-hlig-3.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "hlig";
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-feature-settings: "hlig" off, "liga" off;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-hlig-4.html b/layout/reftests/font-features/font-features-hlig-4.html
new file mode 100644
index 0000000000..409c7f8085
--- /dev/null
+++ b/layout/reftests/font-features/font-features-hlig-4.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "hlig" off;
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-feature-settings: "hlig" on;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-hlig-5.html b/layout/reftests/font-features/font-features-hlig-5.html
new file mode 100644
index 0000000000..c076f64b9c
--- /dev/null
+++ b/layout/reftests/font-features/font-features-hlig-5.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "hlig";
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-feature-settings: "hlig" off;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-hlig.html b/layout/reftests/font-features/font-features-hlig.html
new file mode 100644
index 0000000000..1b93834fdd
--- /dev/null
+++ b/layout/reftests/font-features/font-features-hlig.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-feature-settings: "hlig" on;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-ligatures-none.html b/layout/reftests/font-features/font-features-ligatures-none.html
new file mode 100644
index 0000000000..418c8c9e2e
--- /dev/null
+++ b/layout/reftests/font-features/font-features-ligatures-none.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "hlig";
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-variant-ligatures: none;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-noliga.html b/layout/reftests/font-features/font-features-noliga.html
new file mode 100644
index 0000000000..c7e8e56b9f
--- /dev/null
+++ b/layout/reftests/font-features/font-features-noliga.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-feature-settings: "liga" 0;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-order-1.html b/layout/reftests/font-features/font-features-order-1.html
new file mode 100644
index 0000000000..a2d97256b8
--- /dev/null
+++ b/layout/reftests/font-features/font-features-order-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-feature-settings: "liga" 0, "liga" 1;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-order-2.html b/layout/reftests/font-features/font-features-order-2.html
new file mode 100644
index 0000000000..2b68c39453
--- /dev/null
+++ b/layout/reftests/font-features/font-features-order-2.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-feature-settings: "liga" 1, "liga" 0;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-order-3.html b/layout/reftests/font-features/font-features-order-3.html
new file mode 100644
index 0000000000..d38f8709f5
--- /dev/null
+++ b/layout/reftests/font-features/font-features-order-3.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "liga" on, "hlig" on;
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ /* font feature settings property should override font setting */
+ font-feature-settings: "liga" off, "hlig" off;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-order-4.html b/layout/reftests/font-features/font-features-order-4.html
new file mode 100644
index 0000000000..b8656e2d97
--- /dev/null
+++ b/layout/reftests/font-features/font-features-order-4.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "liga" on, "hlig" on;
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ /* font variant property should override font setting */
+ font-variant-ligatures: no-common-ligatures no-historical-ligatures;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-order-5.html b/layout/reftests/font-features/font-features-order-5.html
new file mode 100644
index 0000000000..52a8f0ba7f
--- /dev/null
+++ b/layout/reftests/font-features/font-features-order-5.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "liga" on, "hlig" on;
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ /* font variant property should override font setting but font feature
+ settings property should override that */
+ font-variant-ligatures: no-common-ligatures no-historical-ligatures;
+ font-feature-settings: "liga" on, "hlig" on;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-ref.html b/layout/reftests/font-features/font-features-ref.html
new file mode 100644
index 0000000000..89a20372cf
--- /dev/null
+++ b/layout/reftests/font-features/font-features-ref.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-turkish-override-1.html b/layout/reftests/font-features/font-features-turkish-override-1.html
new file mode 100644
index 0000000000..9ba3e603a7
--- /dev/null
+++ b/layout/reftests/font-features/font-features-turkish-override-1.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-language-override: "TRK";
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-turkish-override-2.html b/layout/reftests/font-features/font-features-turkish-override-2.html
new file mode 100644
index 0000000000..165810e189
--- /dev/null
+++ b/layout/reftests/font-features/font-features-turkish-override-2.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-language-override: "TRK";
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+}
+</style>
+</head>
+<body lang="en">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-turkish-override-3.html b/layout/reftests/font-features/font-features-turkish-override-3.html
new file mode 100644
index 0000000000..b2c8c69450
--- /dev/null
+++ b/layout/reftests/font-features/font-features-turkish-override-3.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-language-override: "ENG";
+}
+</style>
+</head>
+<body lang="tr">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-turkish-override-4.html b/layout/reftests/font-features/font-features-turkish-override-4.html
new file mode 100644
index 0000000000..13c379c3d8
--- /dev/null
+++ b/layout/reftests/font-features/font-features-turkish-override-4.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-language-override: "ENG";
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+}
+</style>
+</head>
+<body lang="tr">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-turkish-override-5.html b/layout/reftests/font-features/font-features-turkish-override-5.html
new file mode 100644
index 0000000000..1e847cb1e1
--- /dev/null
+++ b/layout/reftests/font-features/font-features-turkish-override-5.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-language-override: "ENG";
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+ font-language-override: "TRK";
+}
+</style>
+</head>
+<body lang="de">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-turkish-ref.html b/layout/reftests/font-features/font-features-turkish-ref.html
new file mode 100644
index 0000000000..effe8144d7
--- /dev/null
+++ b/layout/reftests/font-features/font-features-turkish-ref.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+}
+</style>
+</head>
+<body lang="en">
+fastest f&zwnj;irefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-features-turkish.html b/layout/reftests/font-features/font-features-turkish.html
new file mode 100644
index 0000000000..816c6006da
--- /dev/null
+++ b/layout/reftests/font-features/font-features-turkish.html
@@ -0,0 +1,18 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ font-family: libertine, sans-serif;
+ font-size: 400%;
+ line-height: 2em;
+}
+</style>
+</head>
+<body lang="tr">
+fastest firefox
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-1.html b/layout/reftests/font-features/font-kerning-1.html
new file mode 100644
index 0000000000..a8450644fb
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-1.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ margin: 10px;
+ font-family: libertine, sans-serif;
+ font-size: 600%;
+ line-height: 1.2em;
+ /* font-feature-settings should take precedence over font-kerning,
+ so kerning should be DISabled here */
+ font-feature-settings: "kern" off;
+ font-kerning: normal;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-2.html b/layout/reftests/font-features/font-kerning-2.html
new file mode 100644
index 0000000000..1c230d28a5
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-2.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ margin: 10px;
+ font-family: libertine, sans-serif;
+ font-size: 600%;
+ line-height: 1.2em;
+ /* font-feature-settings should take precedence over font-kerning,
+ so kerning should be ENabled here. */
+ font-feature-settings: "kern" on;
+ font-kerning: none;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-3.html b/layout/reftests/font-features/font-kerning-3.html
new file mode 100644
index 0000000000..86208f0416
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-3.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+ font-feature-settings: "kern" off;
+}
+body {
+ margin: 10px;
+ font-family: libertine, sans-serif;
+ font-size: 600%;
+ line-height: 1.2em;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-auto.html b/layout/reftests/font-features/font-kerning-auto.html
new file mode 100644
index 0000000000..4be9251b0e
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-auto.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ margin: 10px;
+ font-family: libertine, sans-serif;
+ font-size: 600%;
+ line-height: 1.2em;
+ font-kerning: auto;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-kern.html b/layout/reftests/font-features/font-kerning-kern.html
new file mode 100644
index 0000000000..a37ca038a5
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-kern.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ margin: 10px;
+ font-family: libertine, sans-serif;
+ font-size: 600%;
+ line-height: 1.2em;
+ font-feature-settings: "kern" on;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-nokern.html b/layout/reftests/font-features/font-kerning-nokern.html
new file mode 100644
index 0000000000..87044b89b2
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-nokern.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ margin: 10px;
+ font-family: libertine, sans-serif;
+ font-size: 600%;
+ line-height: 1.2em;
+ font-feature-settings: "kern" off;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-none.html b/layout/reftests/font-features/font-kerning-none.html
new file mode 100644
index 0000000000..b8e66c07ca
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-none.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ margin: 10px;
+ font-family: libertine, sans-serif;
+ font-size: 600%;
+ line-height: 1.2em;
+ font-kerning: none;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-normal.html b/layout/reftests/font-features/font-kerning-normal.html
new file mode 100644
index 0000000000..c368f016b1
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-normal.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff) format("woff");
+}
+body {
+ margin: 10px;
+ font-family: libertine, sans-serif;
+ font-size: 600%;
+ line-height: 1.2em;
+ font-kerning: normal;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-table-none.html b/layout/reftests/font-features/font-kerning-table-none.html
new file mode 100644
index 0000000000..81ce583324
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-table-none.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: gentium;
+ /* font that has an old-style 'kern' table rather than GPOS 'kern' feature */
+ src: url(../fonts/sil/GenR102.ttf);
+}
+body {
+ margin: 10px;
+ font-family: gentium;
+ font-size: 600%;
+ line-height: 1.2em;
+ font-kerning: none;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-kerning-table-normal.html b/layout/reftests/font-features/font-kerning-table-normal.html
new file mode 100644
index 0000000000..fe1ad57e89
--- /dev/null
+++ b/layout/reftests/font-features/font-kerning-table-normal.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: gentium;
+ src: url(../fonts/sil/GenR102.ttf);
+}
+body {
+ margin: 10px;
+ font-family: gentium;
+ font-size: 600%;
+ line-height: 1.2em;
+ font-kerning: normal;
+}
+</style>
+</head>
+<body lang="en">
+<div>Ta To</div>
+<div>AVA</div>
+<div>AWAY</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-alternates-ref.html b/layout/reftests/font-features/font-variant-alternates-ref.html
new file mode 100644
index 0000000000..cd3dd4da65
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-alternates-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-alternates test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+
+<style type="text/css">
+</style>
+
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-alternates", true, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-alternates.html b/layout/reftests/font-features/font-variant-alternates.html
new file mode 100644
index 0000000000..4965305516
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-alternates.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-alternates test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+
+<style type="text/css">
+</style>
+
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-alternates", false, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-caps-ref.html b/layout/reftests/font-features/font-variant-caps-ref.html
new file mode 100644
index 0000000000..1eacf1bf60
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-caps-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-caps test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-caps", true, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-caps.html b/layout/reftests/font-features/font-variant-caps.html
new file mode 100644
index 0000000000..7fa6bf94b1
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-caps.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-caps test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-caps", false, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-debug.html b/layout/reftests/font-features/font-variant-debug.html
new file mode 100644
index 0000000000..9a3953bde4
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-debug.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "all", false, true));
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/font-variant-east-asian-ref.html b/layout/reftests/font-features/font-variant-east-asian-ref.html
new file mode 100644
index 0000000000..be2def6d9a
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-east-asian-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-east-asian test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-east-asian", true, false));
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/font-variant-east-asian.html b/layout/reftests/font-features/font-variant-east-asian.html
new file mode 100644
index 0000000000..15578245a7
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-east-asian.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-east-asian test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-east-asian", false, false));
+</script>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/font-variant-features.css b/layout/reftests/font-features/font-variant-features.css
new file mode 100644
index 0000000000..2035cb458f
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-features.css
@@ -0,0 +1,66 @@
+body { margin: 10px; }
+
+@font-face {
+ font-family: gsub-test;
+ src: url(../fonts/gsubtest/gsubtest-lookup3.otf);
+}
+
+td.prop {
+ font-family: Menlo, monospace;
+ font-weight: normal;
+ text-align: left;
+ font-size: 80%;
+}
+
+td.features {
+ font-family: gsub-test;
+}
+
+.invalid {
+ color: red;
+}
+
+@font-feature-values gsub-test {
+ @styleset { ok-alt-a: 1 3 5; ok-alt-b: 19; }
+ @character-variant { ok-1: 78 2; }
+ @character-variant { ok-3: 23; }
+ @character-variant { not-good: 0 2; }
+ @annotation { ok-4: 1; }
+ @annotation { bogus-font-doesnt-support: 23; }
+ @annotation { circled: 1; }
+ @character-variant { multi-def: 4; }
+ @annotation { multi-def: 3; }
+ @styleset { multi-def2: 3 4 5; }
+ @styleset { MULTI-def2: 2 6; }
+ @styleset { out-of-bounds1: 0; out-of-bounds2: 100; }
+ @styleset { scope-test1: 23; scope-test2: 24 1 }
+ @character-variant { scope-test1: 24; scope-test2: 23 2 }
+ @character-variant { overlap1: 23 1; overlap2: 23 2 }
+}
+
+@font-feature-values bogus-family {
+ @styleset { bogus: 3 4 7; }
+}
+
+@font-feature-values GSUB-tEsT {
+ @styleset { mixed-case: 3 4 7; }
+}
+
+@font-feature-values gSuB-tEsT {
+ @styleset { 3blah: 1 3; }
+}
+
+@font-feature-values gSuB-tEsT {
+ @styleset { moxie: 14; }
+ @styleset { 3blah: 1; }
+}
+
+@font-feature-values gSUB-TeST {
+ @styleset { moxie2: 14; }
+ @bongo { blah: 1; }
+}
+
+@font-feature-values gSUB-TEst {
+ @bongo { blah2: 1; }
+ @styleset { moxie3: 14; }
+}
diff --git a/layout/reftests/font-features/font-variant-features.js b/layout/reftests/font-features/font-variant-features.js
new file mode 100644
index 0000000000..5685663739
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-features.js
@@ -0,0 +1,287 @@
+
+// data associated with gsubtest test font for testing font features
+
+// prefix
+gPrefix = "";
+
+// equivalent properties
+// setting prop: value should match the specific feature settings listed
+//
+// each of these tests evaluate whether a given feature is enabled as required
+// and also whether features that shouldn't be enabled are or not.
+var gPropertyData = [
+ // font-variant (shorthand)
+ // valid values
+ { prop: "font-variant", value: "normal", features: {"smcp": 0} },
+ { prop: "font-variant", value: "small-caps", features: {"smcp": 1, "c2sc": 0} },
+ { prop: "font-variant", value: "none", features: {"liga": 0, "dlig": 0, "clig": 0, "calt": 0, "hlig": 0} },
+ { prop: "font-variant", value: "all-small-caps", features: {"smcp": 1, "c2sc": 1, "pcap": 0} },
+ { prop: "font-variant", value: "common-ligatures no-discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
+ { prop: "font-variant", value: "proportional-nums slashed-zero diagonal-fractions oldstyle-nums ordinal", features: {"frac": 1, "afrc": 0, "tnum": 0, "pnum": 1, "onum": 1, "ordn": 1, "zero": 1} },
+ { prop: "font-variant", value: "all-small-caps traditional", features: {"smcp": 1, "c2sc": 1, "pcap": 0, "trad": 1, "jp04": 0} },
+ { prop: "font-variant", value: "styleset(out-of-bounds1, out-of-bounds2) traditional", features: {"ss00": 0, "ss01": 0, "ss99": 0, "trad": 1} }, // out-of-bounds values but not invalid syntax
+ { prop: "font-variant", value: "styleset(ok-alt-a, ok-alt-b) historical-forms", features: {"ss01": 1, "ss02": 0, "ss03": 1, "ss04": 0, "ss05": 1, "ss19": 1, "ss20": 0, "hist": 1, "hlig": 0} },
+ { prop: "font-variant", value: "traditional historical-forms styleset(ok-alt-a, ok-alt-b)", features: {"trad": 1, "ss01": 1, "ss02": 0, "ss03": 1, "ss04": 0, "ss05": 1, "ss19": 1, "ss20": 0, "hist": 1, "hlig": 0} },
+ { prop: "font-variant", value: "styleset(scope-test2)", features: {"ss23": 0, "ss24": 1, "ss01": 1} },
+ { prop: "font-variant", value: "character-variant(scope-test2)", features: {"cv23": 2, "cv24": 0, "cv01": 0} },
+
+ // invalid values
+ { prop: "font-variant", value: "normal small-caps", features: {"smcp": 0}, invalid: true },
+ { prop: "font-variant", value: "common-ligatures none", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+ { prop: "font-variant", value: "none common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+ { prop: "font-variant", value: "small-caps potato", features: {"smcp": 0}, invalid: true },
+ { prop: "font-variant", value: "common-ligatures traditional no-common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "trad": 0}, invalid: true },
+ { prop: "font-variant", value: "common-ligatures traditional common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "trad": 0}, invalid: true },
+ { prop: "font-variant", value: "small-caps jis83 all-small-caps", features: {"smcp": 0, "c2sc": 0, "jp83": 0}, invalid: true },
+ { prop: "font-variant", value: "lining-nums traditional slashed-zero ordinal normal", features: {"lnum": 0, "onum": 0, "zero": 0, "trad": 0}, invalid: true },
+ { prop: "font-variant", value: "diagonal-fractions stacked-fractions", features: {"frac": 0, "afrc": 0}, invalid: true },
+ { prop: "font-variant", value: "stacked-fractions diagonal-fractions historical-ligatures", features: {"frac": 0, "afrc": 0, "hlig": 0}, invalid: true },
+ { prop: "font-variant", value: "super sub", features: {"subs": 0, "sups": 0}, invalid: true },
+ { prop: "font-variant", value: "super historical-ligatures sub", features: {"subs": 0, "sups": 0, "hlig": 0}, invalid: true },
+ { prop: "font-variant", value: "annotation(circled) annotation(circled)", features: {"nalt": 0, "lnum": 0, "onum": 0, "pnum": 0}, invalid: true },
+
+ // font-variant-alternates
+ // valid values
+ { prop: "font-variant-alternates", value: "normal", features: {"salt": 0, "swsh": 0} },
+ { prop: "font-variant-alternates", value: "historical-forms", features: {"hist": 1, "hlig": 0} },
+ { prop: "font-variant-alternates", value: "styleset(ok-alt-a, ok-alt-b)", features: {"ss01": 1, "ss02": 0, "ss03": 1, "ss04": 0, "ss05": 1, "ss19": 1, "ss20": 0} },
+ { prop: "font-variant-alternates", value: "styleset(ok-alt-a, ok-alt-b) historical-forms", features: {"ss01": 1, "ss02": 0, "ss03": 1, "ss04": 0, "ss05": 1, "ss19": 1, "ss20": 0, "hist": 1, "hlig": 0} },
+ { prop: "font-variant-alternates", value: "historical-forms styleset(ok-alt-a, ok-alt-b)", features: {"ss01": 1, "ss02": 0, "ss03": 1, "ss04": 0, "ss05": 1, "ss19": 1, "ss20": 0, "hist": 1, "hlig": 0} },
+ { prop: "font-variant-alternates", value: "character-variant(ok-1)", features: {"cv78": 2, "cv79": 0, "cv77": 0} },
+ { prop: "font-variant-alternates", value: "character-variant(ok-1, ok-3)", features: {"cv78": 2, "cv79": 0, "cv77": 0, "cv23": 1, "cv22": 0, "cv24": 0} },
+ { prop: "font-variant-alternates", value: "annotation(circled)", features: {"nalt": 1} },
+ { prop: "font-variant-alternates", value: "styleset(out-of-bounds1, out-of-bounds2)", features: {"ss00": 0, "ss01": 0, "ss99": 0} }, // out-of-bounds values but not invalid syntax
+ { prop: "font-variant-alternates", value: "styleset(circled)", features: {"nalt": 0, "ss00": 0, "ss01": 0} }, // circled defined for annotation not styleset
+ { prop: "font-variant-alternates", value: "styleset(scope-test1)", features: {"ss23": 1, "ss24": 0} },
+ { prop: "font-variant-alternates", value: "character-variant(scope-test1)", features: {"cv23": 0, "cv24": 1} },
+ { prop: "font-variant-alternates", value: "styleset(scope-test2)", features: {"ss23": 0, "ss24": 1, "ss01": 1} },
+ { prop: "font-variant-alternates", value: "character-variant(scope-test2)", features: {"cv23": 2, "cv24": 0, "cv01": 0} },
+ { prop: "font-variant-alternates", value: "character-variant(overlap1, overlap2)", features: {"cv23": 2} },
+ { prop: "font-variant-alternates", value: "character-variant(overlap2, overlap1)", features: {"cv23": 1} },
+
+ // invalid values
+ { prop: "font-variant-alternates", value: "historical-forms normal", features: {"hist": 0}, invalid: true },
+ { prop: "font-variant-alternates", value: "historical-forms historical-forms", features: {"hist": 0}, invalid: true },
+ { prop: "font-variant-alternates", value: "swash", features: {"swsh": 0}, invalid: true },
+ { prop: "font-variant-alternates", value: "swash(3)", features: {"swsh": 0}, invalid: true },
+ { prop: "font-variant-alternates", value: "annotation(a, b)", features: {"nalt": 0}, invalid: true },
+ { prop: "font-variant-alternates", value: "ornaments(a,b)", features: {"ornm": 0, "nalt": 0}, invalid: true },
+
+ // font-variant-caps
+ // valid values
+ { prop: "font-variant-caps", value: "normal", features: {"smcp": 0} },
+ { prop: "font-variant-caps", value: "small-caps", features: {"smcp": 1, "c2sc": 0} },
+ { prop: "font-variant-caps", value: "all-small-caps", features: {"smcp": 1, "c2sc": 1, "pcap": 0} },
+ { prop: "font-variant-caps", value: "petite-caps", features: {"pcap": 1, "smcp": 0} },
+ { prop: "font-variant-caps", value: "all-petite-caps", features: {"c2pc": 1, "pcap": 1, "smcp": 0} },
+ { prop: "font-variant-caps", value: "titling-caps", features: {"titl": 1, "smcp": 0} },
+ { prop: "font-variant-caps", value: "unicase", features: {"unic": 1, "titl": 0} },
+
+ // invalid values
+ { prop: "font-variant-caps", value: "normal small-caps", features: {"smcp": 0}, invalid: true },
+ { prop: "font-variant-caps", value: "small-caps potato", features: {"smcp": 0}, invalid: true },
+ { prop: "font-variant-caps", value: "small-caps petite-caps", features: {"smcp": 0, "pcap": 0}, invalid: true },
+ { prop: "font-variant-caps", value: "small-caps all-small-caps", features: {"smcp": 0, "c2sc": 0}, invalid: true },
+ { prop: "font-variant-caps", value: "small-cap", features: {"smcp": 0}, invalid: true },
+
+ // font-variant-east-asian
+ // valid values
+ { prop: "font-variant-east-asian", value: "jis78", features: {"jp78": 1, "jp04": 0} },
+ { prop: "font-variant-east-asian", value: "jis83", features: {"jp83": 1, "jp04": 0} },
+ { prop: "font-variant-east-asian", value: "jis90", features: {"jp90": 1, "jp04": 0} },
+ { prop: "font-variant-east-asian", value: "jis04", features: {"jp04": 1, "jp78": 0} },
+ { prop: "font-variant-east-asian", value: "simplified", features: {"smpl": 1, "jp04": 0} },
+ { prop: "font-variant-east-asian", value: "traditional", features: {"trad": 1, "jp04": 0} },
+ { prop: "font-variant-east-asian", value: "full-width", features: {"fwid": 1, "jp04": 0} },
+ { prop: "font-variant-east-asian", value: "proportional-width", features: {"pwid": 1, "jp04": 0} },
+ { prop: "font-variant-east-asian", value: "ruby", features: {"ruby": 1, "jp04": 0} },
+ { prop: "font-variant-east-asian", value: "jis78 full-width", features: {"jp78": 1, "fwid": 1, "jp83": 0} },
+ { prop: "font-variant-east-asian", value: "jis78 full-width ruby", features: {"jp78": 1, "fwid": 1, "jp83": 0, "ruby": 1} },
+ { prop: "font-variant-east-asian", value: "simplified proportional-width", features: {"smpl": 1, "pwid": 1, "jp83": 0} },
+ { prop: "font-variant-east-asian", value: "ruby simplified", features: {"ruby": 1, "smpl": 1, "trad": 0} },
+
+ // invalid values
+ { prop: "font-variant-east-asian", value: "ruby normal", features: {"ruby": 0}, invalid: true },
+ { prop: "font-variant-east-asian", value: "jis90 jis04", features: {"jp90": 0, "jp04": 0}, invalid: true },
+ { prop: "font-variant-east-asian", value: "simplified traditional", features: {"smpl": 0, "trad": 0}, invalid: true },
+ { prop: "font-variant-east-asian", value: "full-width proportional-width", features: {"fwid": 0, "pwid": 0}, invalid: true },
+ { prop: "font-variant-east-asian", value: "ruby simplified ruby", features: {"ruby": 0, "smpl": 0, "jp04": 0}, invalid: true },
+ { prop: "font-variant-east-asian", value: "jis78 ruby simplified", features: {"ruby": 0, "smpl": 0, "jp78": 0}, invalid: true },
+
+ // font-variant-ligatures
+ // valid values
+ { prop: "font-variant-ligatures", value: "none", features: {"liga": 0, "dlig": 0, "clig": 0, "calt": 0, "hlig": 0} },
+ { prop: "font-variant-ligatures", value: "normal", features: {"liga": 1, "dlig": 0} },
+ { prop: "font-variant-ligatures", value: "common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "no-common-ligatures", features: {"liga": 0, "clig": 0, "dlig": 0, "hlig": 0, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 1, "hlig": 0, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "no-discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "historical-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 1, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "no-historical-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "contextual", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "no-contextual", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 0} },
+ { prop: "font-variant-ligatures", value: "common-ligatures no-discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "historical-ligatures no-common-ligatures", features: {"clig": 0, "liga": 0, "dlig": 0, "hlig": 1, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "no-historical-ligatures discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 1, "hlig": 0, "calt": 1} },
+ { prop: "font-variant-ligatures", value: "common-ligatures no-discretionary-ligatures historical-ligatures no-contextual", features: {"clig": 1, "dlig": 0, "hlig": 1, "liga": 1, "calt": 0} },
+
+ // invalid values
+ { prop: "font-variant-ligatures", value: "common-ligatures none", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+ { prop: "font-variant-ligatures", value: "none common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+ { prop: "font-variant-ligatures", value: "common-ligatures normal", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+ { prop: "font-variant-ligatures", value: "common-ligatures no-common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+ { prop: "font-variant-ligatures", value: "common-ligatures common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+ { prop: "font-variant-ligatures", value: "no-historical-ligatures historical-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0}, invalid: true },
+ { prop: "font-variant-ligatures", value: "no-contextual contextual", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0}, invalid: true },
+ { prop: "font-variant-ligatures", value: "no-discretionary-ligatures discretionary-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+ { prop: "font-variant-ligatures", value: "common-ligatures no-discretionary-ligatures no-common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0}, invalid: true },
+
+ // font-variant-numeric
+ // valid values
+ { prop: "font-variant-numeric", value: "normal", features: {"lnum": 0, "tnum": 0, "pnum": 0, "onum": 0} },
+ { prop: "font-variant-numeric", value: "lining-nums", features: {"lnum": 1, "onum": 0, "pnum": 0} },
+ { prop: "font-variant-numeric", value: "oldstyle-nums", features: {"lnum": 0, "onum": 1, "pnum": 0} },
+ { prop: "font-variant-numeric", value: "proportional-nums", features: {"lnum": 0, "onum": 0, "pnum": 1, "tnum": 0} },
+ { prop: "font-variant-numeric", value: "proportional-nums oldstyle-nums", features: {"lnum": 0, "onum": 1, "pnum": 1, "tnum": 0} },
+ { prop: "font-variant-numeric", value: "tabular-nums", features: {"tnum": 1, "onum": 0, "pnum": 0} },
+ { prop: "font-variant-numeric", value: "diagonal-fractions", features: {"frac": 1, "afrc": 0, "pnum": 0} },
+ { prop: "font-variant-numeric", value: "stacked-fractions", features: {"frac": 0, "afrc": 1, "pnum": 0} },
+ { prop: "font-variant-numeric", value: "slashed-zero", features: {"zero": 1, "pnum": 0} },
+ { prop: "font-variant-numeric", value: "ordinal", features: {"ordn": 1, "pnum": 0} },
+ { prop: "font-variant-numeric", value: "lining-nums diagonal-fractions", features: {"frac": 1, "afrc": 0, "lnum": 1} },
+ { prop: "font-variant-numeric", value: "tabular-nums stacked-fractions", features: {"frac": 0, "afrc": 1, "tnum": 1} },
+ { prop: "font-variant-numeric", value: "tabular-nums slashed-zero stacked-fractions", features: {"frac": 0, "afrc": 1, "tnum": 1, "zero": 1} },
+ { prop: "font-variant-numeric", value: "proportional-nums slashed-zero diagonal-fractions oldstyle-nums ordinal", features: {"frac": 1, "afrc": 0, "tnum": 0, "pnum": 1, "onum": 1, "ordn": 1, "zero": 1} },
+
+ // invalid values
+ { prop: "font-variant-numeric", value: "lining-nums normal", features: {"lnum": 0, "onum": 0}, invalid: true },
+ { prop: "font-variant-numeric", value: "lining-nums oldstyle-nums", features: {"lnum": 0, "onum": 0}, invalid: true },
+ { prop: "font-variant-numeric", value: "lining-nums normal slashed-zero ordinal", features: {"lnum": 0, "onum": 0, "zero": 0}, invalid: true },
+ { prop: "font-variant-numeric", value: "proportional-nums tabular-nums", features: {"pnum": 0, "tnum": 0}, invalid: true },
+ { prop: "font-variant-numeric", value: "diagonal-fractions stacked-fractions", features: {"frac": 0, "afrc": 0}, invalid: true },
+ { prop: "font-variant-numeric", value: "slashed-zero diagonal-fractions slashed-zero", features: {"frac": 0, "afrc": 0, "zero": 0}, invalid: true },
+ { prop: "font-variant-numeric", value: "lining-nums slashed-zero diagonal-fractions oldstyle-nums", features: {"frac": 0, "afrc": 0, "zero": 0, "onum": 0}, invalid: true },
+
+ // font-variant-position
+ // valid values
+ { prop: "font-variant-position", value: "normal", features: {"subs": 0, "sups": 0} },
+
+ // note: because of fallback, can *only* test activated features here
+ { prop: "font-variant-position", value: "super", features: {"sups": 1} },
+ { prop: "font-variant-position", value: "sub", features: {"subs": 1} },
+
+ // invalid values
+ { prop: "font-variant-position", value: "super sub", features: {"subs": 0, "sups": 0}, invalid: true },
+];
+
+// note: the code below requires an array "gFeatures" from :
+// layout/reftests/fonts/gsubtest/gsubtest-features.js
+
+// The font defines feature lookups for all OpenType features for a
+// specific set of PUA codepoints, as listed in the gFeatures array.
+// Using these codepoints and feature combinations, tests can be
+// constructed to detect when certain features are enabled or not.
+
+// return a created table containing tests for a given property
+//
+// Ex: { prop: "font-variant-ligatures", value: "common-ligatures", features: {"liga": 1, "clig": 1, "dlig": 0, "hlig": 0} }
+//
+// This means that for the property 'font-variant-ligatures' with the value 'common-ligatures', the features listed should
+// either be explicitly enabled or disabled.
+
+// propData is the prop/value list with corresponding feature assertions
+// whichProp is either "all" or a specific subproperty (i.e. "font-variant-position")
+// isRef is true when this is the reference
+// debug outputs the prop/value pair along with the tests
+
+// default PASS codepoint used for reference rendering
+// need to use a PUA codepoint to avoid problems related to Freetype auto-hinting
+const kRefCodepoint = 0xe00c;
+
+function createFeatureTestTable(propData, whichProp, isRef, debug)
+{
+ var table = document.createElement("table");
+
+ if (typeof(isRef) == "undefined") {
+ isRef = false;
+ }
+
+ if (typeof(debug) == "undefined") {
+ debug = false;
+ }
+
+ var doAll = (whichProp == "all");
+ for (var i in propData) {
+ var data = propData[i];
+
+ if (!doAll && data.prop != whichProp) continue;
+
+ var row = document.createElement("tr");
+ var invalid = false;
+ if ("invalid" in data) {
+ invalid = true;
+ row.className = "invalid";
+ }
+
+ var cell = document.createElement("td");
+ cell.className = "prop";
+ var styledecl = gPrefix + data.prop + ": " + data.value + ";";
+ cell.innerHTML = styledecl;
+ row.appendChild(cell);
+ if (debug) {
+ table.appendChild(row);
+ }
+
+ row = document.createElement("tr");
+ if (invalid) {
+ row.className = "invalid";
+ }
+
+ cell = document.createElement("td");
+ cell.className = "features";
+ if (!isRef) {
+ cell.style.cssText = styledecl;
+ }
+
+ for (var f in data.features) {
+ var feature = data.features[f];
+
+ var cp, unsupported = "F".charCodeAt(0);
+ var basecp = gFeatures[f];
+
+ if (typeof(basecp) == "undefined") {
+ cp = unsupported;
+ } else {
+ switch(feature) {
+ case 0:
+ cp = basecp;
+ break;
+ case 1:
+ cp = basecp + 1;
+ break;
+ case 2:
+ cp = basecp + 2;
+ break;
+ case 3:
+ cp = basecp + 3;
+ break;
+ default:
+ cp = basecp + 1;
+ break;
+ }
+ }
+
+ var span = document.createElement("span");
+ var cpOut = (isRef ? kRefCodepoint : cp);
+ span.innerHTML = "&#x" + cpOut.toString(16) + ";";
+ span.title = f + "=" + feature;
+ cell.appendChild(span);
+ }
+ row.appendChild(cell);
+ table.appendChild(row);
+ }
+
+ return table;
+}
+
+
diff --git a/layout/reftests/font-features/font-variant-ligatures-ref.html b/layout/reftests/font-features/font-variant-ligatures-ref.html
new file mode 100644
index 0000000000..525f8d50b2
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-ligatures-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-ligatures test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-ligatures", true, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-ligatures.html b/layout/reftests/font-features/font-variant-ligatures.html
new file mode 100644
index 0000000000..7547c48c63
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-ligatures.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-ligatures test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-ligatures", false, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-numeric-ref.html b/layout/reftests/font-features/font-variant-numeric-ref.html
new file mode 100644
index 0000000000..795216b24b
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-numeric-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-numeric test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-numeric", true, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-numeric.html b/layout/reftests/font-features/font-variant-numeric.html
new file mode 100644
index 0000000000..5d40163bac
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-numeric.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-numeric test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-numeric", false, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-position-ref.html b/layout/reftests/font-features/font-variant-position-ref.html
new file mode 100644
index 0000000000..aaf18aec6f
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-position-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-position test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-position", true, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-position.html b/layout/reftests/font-features/font-variant-position.html
new file mode 100644
index 0000000000..f0d63ddb94
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-position.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant-position test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant-position", false, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant-ref.html b/layout/reftests/font-features/font-variant-ref.html
new file mode 100644
index 0000000000..6fd182e879
--- /dev/null
+++ b/layout/reftests/font-features/font-variant-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant shorthand test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant", true, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/font-variant.html b/layout/reftests/font-features/font-variant.html
new file mode 100644
index 0000000000..bde0cd6c27
--- /dev/null
+++ b/layout/reftests/font-features/font-variant.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<html lang="en">
+<head>
+<title>font-variant shorthand test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<script type="text/javascript" src="../fonts/gsubtest/gsubtest-features.js"></script>
+<script type="text/javascript" src="font-variant-features.js"></script>
+<link rel="stylesheet" href="font-variant-features.css" type="text/css"/>
+</head>
+<body>
+<div id="content"></div>
+<script type="text/javascript">
+ document.getElementById("content").appendChild(createFeatureTestTable(gPropertyData, "font-variant", false, false));
+</script>
+</body>
+</html>
diff --git a/layout/reftests/font-features/fwid-spaces-ref.html b/layout/reftests/font-features/fwid-spaces-ref.html
new file mode 100644
index 0000000000..6fa999b45a
--- /dev/null
+++ b/layout/reftests/font-features/fwid-spaces-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html lang="ja">
+<head>
+<title>Full-width variations of regular spaces</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 5px;
+}
+
+#test, #test pre {
+ font: 150% Hiragino Maru Gothic ProN, Meiryo, Yu Gothic, sans-serif;
+}
+
+#test pre span {
+ background-color: red;
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+</style>
+
+</head>
+<body>
+<p>Rows should all be the same length:</p>
+<div id="test">
+<pre><span>&#x3000;&#xff41;&#x3000;&#xff42;&#x3000;&#xff43;&#x3000;&#xff21;&#x3000;&#xff22;&#x3000;&#xff23;&#x3000;</span></pre>
+<pre><span>&#x3000;&#xff41;&#x3000;&#xff42;&#x3000;&#xff43;&#x3000;&#xff21;&#x3000;&#xff22;&#x3000;&#xff23;&#x3000;</span></pre>
+<pre><span>&#xff42;&#xff41;&#x3000;&#xff42;&#xff21;&#x3000;&#xff42;&#xff42;&#x3000;&#xff42;&#xff22;&#x3000;&#xff43;</span></pre>
+<pre><span>&#xff42;&#xff41;&#x3000;&#xff42;&#xff21;&#x3000;&#xff42;&#xff42;&#x3000;&#xff42;&#xff22;&#x3000;&#xff43;</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/fwid-spaces.html b/layout/reftests/font-features/fwid-spaces.html
new file mode 100644
index 0000000000..61f935b254
--- /dev/null
+++ b/layout/reftests/font-features/fwid-spaces.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html lang="ja">
+<head>
+<title>Full-width variations of regular spaces</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 5px;
+}
+
+#test, #test pre {
+ font: 150% Hiragino Maru Gothic ProN, Meiryo, Yu Gothic, sans-serif;
+ -webkit-font-feature-settings: "fwid" on;
+ font-feature-settings: "fwid" on;
+}
+
+#test pre span {
+ background-color: red;
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+</style>
+
+</head>
+<body>
+<p>Rows should all be the same length:</p>
+<div id="test">
+<pre><span> a b c A B C </span></pre>
+<pre><span>&#x3000;a&#x3000;b&#x3000;c&#x3000;A&#x3000;B&#x3000;C&#x3000;</span></pre>
+<pre><span>ba bA bb bB c</span></pre>
+<pre><span>ba&#x3000;bA&#x3000;bb&#x3000;bB&#x3000;c</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-sanity-check-default.html b/layout/reftests/font-features/kerning-sanity-check-default.html
new file mode 100644
index 0000000000..aa2f1afbe1
--- /dev/null
+++ b/layout/reftests/font-features/kerning-sanity-check-default.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>kerning sanity checks</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+@font-face {
+ font-family: LinuxLibertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff);
+}
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Arial, LinuxLibertine, sans-serif;
+ font-size: 300%;
+ line-height: 1.1em;
+ /* font-feature-settings == default */
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>AWAY</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-sanity-check-kern.html b/layout/reftests/font-features/kerning-sanity-check-kern.html
new file mode 100644
index 0000000000..66225cd372
--- /dev/null
+++ b/layout/reftests/font-features/kerning-sanity-check-kern.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>kerning sanity checks</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+@font-face {
+ font-family: LinuxLibertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff);
+}
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Arial, LinuxLibertine, sans-serif;
+ font-size: 300%;
+ line-height: 1.1em;
+ -webkit-font-feature-settings: "kern" on;
+ font-feature-settings: "kern" on;
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>AWAY</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-sanity-check-nokern.html b/layout/reftests/font-features/kerning-sanity-check-nokern.html
new file mode 100644
index 0000000000..1b49441f52
--- /dev/null
+++ b/layout/reftests/font-features/kerning-sanity-check-nokern.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>kerning sanity checks</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+@font-face {
+ font-family: LinuxLibertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff);
+}
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Arial, LinuxLibertine, sans-serif;
+ font-size: 300%;
+ line-height: 1.1em;
+ -webkit-font-feature-settings: "kern" off;
+ font-feature-settings: "kern" off;
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>AWAY</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-spaces-arial-default.html b/layout/reftests/font-features/kerning-spaces-arial-default.html
new file mode 100644
index 0000000000..995184318b
--- /dev/null
+++ b/layout/reftests/font-features/kerning-spaces-arial-default.html
@@ -0,0 +1,44 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>testing contextual kerning with spaces</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Arial, sans-serif;
+ font-size: 150%;
+ line-height: 1.1em;
+ /* font-feature-settings == default */
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>Q A Q</span></pre>
+<pre><span>Q L Q</span></pre>
+<pre><span>Q P Q</span></pre>
+<pre><span>Q T Q</span></pre>
+<pre><span>Q Y Q</span></pre>
+<pre><span>Q Α Q</span></pre>
+<pre><span>Q Δ Q</span></pre>
+<pre><span>Q Λ Q</span></pre>
+<pre><span>Q Ρ Q</span></pre>
+<pre><span>Q Τ Q</span></pre>
+<pre><span>Q Υ Q</span></pre>
+<pre><span>Q Ϋ Q</span></pre>
+<pre><span>Q ’ Q</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-spaces-arial-kern.html b/layout/reftests/font-features/kerning-spaces-arial-kern.html
new file mode 100644
index 0000000000..7b859073d8
--- /dev/null
+++ b/layout/reftests/font-features/kerning-spaces-arial-kern.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>testing contextual kerning with spaces</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Arial, sans-serif;
+ font-size: 150%;
+ line-height: 1.1em;
+ -webkit-font-feature-settings: "kern" on;
+ font-feature-settings: "kern" on;
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>Q A Q</span></pre>
+<pre><span>Q L Q</span></pre>
+<pre><span>Q P Q</span></pre>
+<pre><span>Q T Q</span></pre>
+<pre><span>Q Y Q</span></pre>
+<pre><span>Q Α Q</span></pre>
+<pre><span>Q Δ Q</span></pre>
+<pre><span>Q Λ Q</span></pre>
+<pre><span>Q Ρ Q</span></pre>
+<pre><span>Q Τ Q</span></pre>
+<pre><span>Q Υ Q</span></pre>
+<pre><span>Q Ϋ Q</span></pre>
+<pre><span>Q ’ Q</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-spaces-arial-nokern.html b/layout/reftests/font-features/kerning-spaces-arial-nokern.html
new file mode 100644
index 0000000000..d73007bacc
--- /dev/null
+++ b/layout/reftests/font-features/kerning-spaces-arial-nokern.html
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>testing contextual kerning with spaces</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Arial, sans-serif;
+ font-size: 150%;
+ line-height: 1.1em;
+ -webkit-font-feature-settings: "kern" off;
+ font-feature-settings: "kern" off;
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>Q A Q</span></pre>
+<pre><span>Q L Q</span></pre>
+<pre><span>Q P Q</span></pre>
+<pre><span>Q T Q</span></pre>
+<pre><span>Q Y Q</span></pre>
+<pre><span>Q Α Q</span></pre>
+<pre><span>Q Δ Q</span></pre>
+<pre><span>Q Λ Q</span></pre>
+<pre><span>Q Ρ Q</span></pre>
+<pre><span>Q Τ Q</span></pre>
+<pre><span>Q Υ Q</span></pre>
+<pre><span>Q Ϋ Q</span></pre>
+<pre><span>Q ’ Q</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-spaces-tnr-default.html b/layout/reftests/font-features/kerning-spaces-tnr-default.html
new file mode 100644
index 0000000000..c1b1eeb988
--- /dev/null
+++ b/layout/reftests/font-features/kerning-spaces-tnr-default.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>testing contextual kerning with spaces</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Times New Roman, sans-serif;
+ font-size: 150%;
+ line-height: 1.1em;
+ /* font-feature-settings == default */
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>Q A Q</span></pre>
+<pre><span>Q L Q</span></pre>
+<pre><span>Q P Q</span></pre>
+<pre><span>Q T Q</span></pre>
+<pre><span>Q V Q</span></pre>
+<pre><span>Q W Q</span></pre>
+<pre><span>Q Y Q</span></pre>
+<pre><span>Q Ά Q</span></pre>
+<pre><span>Q Α Q</span></pre>
+<pre><span>Q Δ Q</span></pre>
+<pre><span>Q Λ Q</span></pre>
+<pre><span>Q Τ Q</span></pre>
+<pre><span>Q Υ Q</span></pre>
+<pre><span>Q Ϋ Q</span></pre>
+<pre><span>Q ’ Q</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-spaces-tnr-kern.html b/layout/reftests/font-features/kerning-spaces-tnr-kern.html
new file mode 100644
index 0000000000..18dbc18618
--- /dev/null
+++ b/layout/reftests/font-features/kerning-spaces-tnr-kern.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>testing contextual kerning with spaces</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Times New Roman, sans-serif;
+ font-size: 150%;
+ line-height: 1.1em;
+ -webkit-font-feature-settings: "kern" on;
+ font-feature-settings: "kern" on;
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>Q A Q</span></pre>
+<pre><span>Q L Q</span></pre>
+<pre><span>Q P Q</span></pre>
+<pre><span>Q T Q</span></pre>
+<pre><span>Q V Q</span></pre>
+<pre><span>Q W Q</span></pre>
+<pre><span>Q Y Q</span></pre>
+<pre><span>Q Ά Q</span></pre>
+<pre><span>Q Α Q</span></pre>
+<pre><span>Q Δ Q</span></pre>
+<pre><span>Q Λ Q</span></pre>
+<pre><span>Q Τ Q</span></pre>
+<pre><span>Q Υ Q</span></pre>
+<pre><span>Q Ϋ Q</span></pre>
+<pre><span>Q ’ Q</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/kerning-spaces-tnr-nokern.html b/layout/reftests/font-features/kerning-spaces-tnr-nokern.html
new file mode 100644
index 0000000000..0e033454c0
--- /dev/null
+++ b/layout/reftests/font-features/kerning-spaces-tnr-nokern.html
@@ -0,0 +1,47 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>testing contextual kerning with spaces</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+
+body {
+ margin: 5px;
+}
+
+div#test, div#test pre {
+ font-family: Times New Roman, sans-serif;
+ font-size: 150%;
+ line-height: 1.1em;
+ -webkit-font-feature-settings: "kern" off;
+ font-feature-settings: "kern" off;
+}
+
+pre {
+ margin: 0;
+ padding: 0;
+}
+
+</style>
+</head>
+<body>
+<div id="test">
+<pre><span>Q A Q</span></pre>
+<pre><span>Q L Q</span></pre>
+<pre><span>Q P Q</span></pre>
+<pre><span>Q T Q</span></pre>
+<pre><span>Q V Q</span></pre>
+<pre><span>Q W Q</span></pre>
+<pre><span>Q Y Q</span></pre>
+<pre><span>Q Ά Q</span></pre>
+<pre><span>Q Α Q</span></pre>
+<pre><span>Q Δ Q</span></pre>
+<pre><span>Q Λ Q</span></pre>
+<pre><span>Q Τ Q</span></pre>
+<pre><span>Q Υ Q</span></pre>
+<pre><span>Q Ϋ Q</span></pre>
+<pre><span>Q ’ Q</span></pre>
+</div>
+</body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/font-features/reftest.list b/layout/reftests/font-features/reftest.list
new file mode 100644
index 0000000000..d8d68fc4cd
--- /dev/null
+++ b/layout/reftests/font-features/reftest.list
@@ -0,0 +1,125 @@
+# Tests for opentype font feature control (bug 511339)
+#
+# These rely on the Linux Libertine font (loaded via @font-face)
+# to ensure that features are present.
+
+# check that Turkish language causes a change in rendering (no fi ligature)
+# (also works via Pango)
+!= font-features-turkish.html font-features-ref.html
+
+# check that disabling ligatures causes a change
+!= font-features-noliga.html font-features-ref.html
+
+# check that enabling optional ligatures causes a change
+!= font-features-hlig.html font-features-ref.html
+
+# compare Turkish rendering with reference using ZWNJ to break the ligature
+== font-features-turkish.html font-features-turkish-ref.html
+
+# compare Turkish rendering with explicitly disabled ligatures
+== font-features-turkish.html font-features-noliga.html
+
+# The following should pass even if feature support isn't available,
+# because both testcase and reference will have the default rendering,
+# though they're not really meaningful unless the tests above passed already.
+
+# compare feature specified within @font-face to same feature in style rule
+== font-features-hlig-2.html font-features-hlig.html
+== font-features-hlig-4.html font-features-hlig.html
+!= font-features-hlig-5.html font-features-hlig.html
+== font-features-ligatures-none.html font-features-noliga.html
+
+# check that feature in style rule overrides @font-face
+== font-features-hlig-3.html font-features-noliga.html
+
+# compare font-language-override rendering to lang-tagged rendering
+== font-features-turkish-override-1.html font-features-turkish.html
+== font-features-turkish-override-2.html font-features-turkish.html
+
+# check use of font-language-override to override explicit lang tag
+== font-features-turkish-override-3.html font-features-ref.html
+== font-features-turkish-override-4.html font-features-ref.html
+== font-features-turkish-override-5.html font-features-turkish.html
+
+# check that last value wins if a feature is repeated
+== font-features-order-1.html font-features-ref.html
+== font-features-order-2.html font-features-noliga.html
+
+# check priority of feature settings vs. font-variant subproperty
+== font-features-order-3.html font-features-noliga.html
+== font-features-order-4.html font-features-noliga.html
+== font-features-order-5.html font-features-hlig.html
+
+# check priority involving feature settings and font-variant-alternates
+== alternates-order.html alternates-order-ref.html
+
+# check that font-specific values line up with @font-face feature settings
+skip-if(winWidget) == annotations.html annotations-ref.html # bug 1447257
+
+# font-variant subproperties
+# test for specific features being on and others off, based on prop values
+# (debug problems with font-variant-debug.html which displays all props)
+== font-variant-alternates.html font-variant-alternates-ref.html
+== font-variant-caps.html font-variant-caps-ref.html
+== font-variant-east-asian.html font-variant-east-asian-ref.html
+== font-variant-ligatures.html font-variant-ligatures-ref.html
+== font-variant-numeric.html font-variant-numeric-ref.html
+== font-variant-position.html font-variant-position-ref.html
+
+# font-kerning
+!= font-kerning-normal.html font-kerning-none.html
+!= font-kerning-auto.html font-kerning-none.html
+== font-kerning-auto.html font-kerning-normal.html
+== font-kerning-normal.html font-kerning-kern.html
+== font-kerning-none.html font-kerning-nokern.html
+== font-kerning-1.html font-kerning-none.html
+== font-kerning-2.html font-kerning-normal.html
+== font-kerning-3.html font-kerning-none.html
+!= font-kerning-table-none.html font-kerning-table-normal.html
+
+# sanity check for kerning - with no spaces, kerning should occur
+== kerning-sanity-check-kern.html kerning-sanity-check-default.html
+!= kerning-sanity-check-nokern.html kerning-sanity-check-default.html
+
+# OpenType features should work across inter-word spaces
+== font-features-across-space-1.html font-features-across-space-1-ref.html
+== spacelookups.html spacelookups-ref.html
+# tests whether word cache is in use by testing for ignored space kerns
+== spacelookups-wordcache.html spacelookups-wordcache-ref.html
+# requires Japanese font with feature support, WinXP lacks one
+random-if(!winWidget&&!cocoaWidget) == fwid-spaces.html fwid-spaces-ref.html
+# Arial/Times New Roman on Win7+/OSX 10.6+ have kerning pairs that include spaces
+random-if(!winWidget&&!cocoaWidget) fails-if(winWidget||cocoaWidget) != kerning-spaces-arial-nokern.html kerning-spaces-arial-default.html
+random-if(!winWidget&&!cocoaWidget) fails-if(winWidget||cocoaWidget) == kerning-spaces-arial-kern.html kerning-spaces-arial-default.html
+random-if(!winWidget&&!cocoaWidget) fails-if(winWidget||cocoaWidget) != kerning-spaces-tnr-nokern.html kerning-spaces-tnr-default.html
+random-if(!winWidget&&!cocoaWidget) fails-if(winWidget||cocoaWidget) == kerning-spaces-tnr-kern.html kerning-spaces-tnr-default.html
+
+# font-variant-caps fallback
+# -- sanity check - none of these should look like the default rendering
+!= caps-fallback-smallcaps1.html caps-fallback-default.html
+!= caps-fallback-smallcaps2.html caps-fallback-default.html
+!= caps-fallback-petitecaps.html caps-fallback-default.html
+!= caps-fallback-allsmallcaps.html caps-fallback-default.html
+!= caps-fallback-allpetitecaps.html caps-fallback-default.html
+# -- normal or fallback rendering
+== caps-fallback-smallcaps1.html caps-fallback-smcp.html
+== caps-fallback-smallcaps2.html caps-fallback-smcp.html
+== caps-fallback-petitecaps.html caps-fallback-smcp.html
+== caps-fallback-allsmallcaps.html caps-fallback-smcpc2sc.html
+== caps-fallback-allpetitecaps.html caps-fallback-smcpc2sc.html
+
+== small-caps-missing-capital.html small-caps-missing-capital-ref.html
+
+# font-variant-position fallback
+random-if(cocoaWidget||Android) == subsuper-fallback.html subsuper-fallback-ref.html # bug 1139269
+!= subsuper-fallback.html subsuper-fallback-notref1.html
+!= subsuper-fallback.html subsuper-fallback-notref2.html
+!= subsuper-fallback.html subsuper-fallback-notref3.html
+!= subsuper-fallback-omega.html subsuper-fallback-omega-notref.html
+== subsuper-nofallback.html subsuper-nofallback-ref1.html
+random-if(cocoaWidget) == subsuper-nofallback.html subsuper-nofallback-ref2.html # bug 1139269
+!= subsuper-nofallback.html subsuper-nofallback-notref.html
+== subsuper-fallback-size.html subsuper-fallback-size-ref.html
+
+# GPOS spacing adjustments in vertical mode -- subsetted opentype/cff test font fails to load on Win7
+fuzzy-if(winWidget,0-1,0-70) == 1376231-vertical-gpos-adjustments.html 1376231-vertical-gpos-adjustments-ref.html
diff --git a/layout/reftests/font-features/small-caps-missing-capital-ref.html b/layout/reftests/font-features/small-caps-missing-capital-ref.html
new file mode 100644
index 0000000000..b27620f77e
--- /dev/null
+++ b/layout/reftests/font-features/small-caps-missing-capital-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ /* A font that supports the π symbol, but does not have a capital PI;
+ and supports the µ sign, but does not have a capital MU. */
+ src: url(../fonts/Prototype.ttf);
+}
+.test {
+ font-family: test;
+ font-size: 24px;
+ font-variant: small-caps;
+}
+</style>
+
+<p>The pi symbol must not be missing:</p>
+
+<p class=test><span style="font-variant:normal">π</span>-Test</p>
+
+<p>The micro sign µ must not be missing:</p>
+
+<p class=test>Is <span style="font-variant:normal">10µs</span> the same as 10ms?</p>
diff --git a/layout/reftests/font-features/small-caps-missing-capital.html b/layout/reftests/font-features/small-caps-missing-capital.html
new file mode 100644
index 0000000000..a29349fdbe
--- /dev/null
+++ b/layout/reftests/font-features/small-caps-missing-capital.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ /* A font that supports the π symbol, but does not have a capital PI;
+ and supports the µ sign, but does not have a capital MU. */
+ src: url(../fonts/Prototype.ttf);
+}
+.test {
+ font-family: test;
+ font-size: 24px;
+ font-variant: small-caps;
+}
+</style>
+
+<p>The pi symbol must not be missing:</p>
+
+<p class=test>π-Test</p>
+
+<p>The micro sign µ must not be missing:</p>
+
+<!-- Because we cannot do a fake-small-cap for µ, the complete run
+ "10µs" will be rendered without a small-caps effect. -->
+<p class=test>Is 10µs the same as 10ms?</p>
diff --git a/layout/reftests/font-features/spacelookups-ref.html b/layout/reftests/font-features/spacelookups-ref.html
new file mode 100644
index 0000000000..0206717301
--- /dev/null
+++ b/layout/reftests/font-features/spacelookups-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>contextual substitutions for fonts with spaces in lookups</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com"/>
+<style type="text/css">
+@font-face {
+ font-family: spacelookup-defscr-deflang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-defscr-deflang-deffeat.ttf);
+}
+body {
+ margin: 20px 40px;
+ line-height: 1.2;
+}
+
+div { font-size: 400%; }
+
+.spacelookup-defscr-deflang-deffeat { font-family: spacelookup-defscr-deflang-deffeat; }
+</style>
+
+</head>
+<body>
+<div class="spacelookup-defscr-deflang-deffeat">
+<span>&#xf007;</span>
+<span>&#xf007;</span>
+<span>&#xf007;</span>
+<span>&#xf007;</span>
+<span>&#xf007;</span>
+<span>&#xf007;</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/spacelookups-wordcache-ref.html b/layout/reftests/font-features/spacelookups-wordcache-ref.html
new file mode 100644
index 0000000000..cd6af0cf43
--- /dev/null
+++ b/layout/reftests/font-features/spacelookups-wordcache-ref.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>contextual substitutions for fonts with spaces in lookups</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com"/>
+<style type="text/css">
+
+@font-face {
+ font-family: spacelookup-defscr-deflang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-defscr-deflang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-defscr-deflang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-defscr-deflang-ndeffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-deflang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-deflang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-deflang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-deflang-ndeffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-fralang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-fralang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-fralang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-fralang-ndeffeat.ttf);
+}
+
+body {
+ margin: 20px 40px;
+ line-height: 1.2;
+}
+
+div { font-size: 200%; }
+
+p { margin: 0; line-height: 1.2; }
+
+.spacelookup-defscr-deflang-deffeat { font-family: spacelookup-defscr-deflang-deffeat; }
+.spacelookup-defscr-deflang-ndeffeat { font-family: spacelookup-defscr-deflang-ndeffeat; }
+.spacelookup-latnscr-deflang-deffeat { font-family: spacelookup-latnscr-deflang-deffeat; }
+.spacelookup-latnscr-deflang-ndeffeat { font-family: spacelookup-latnscr-deflang-ndeffeat; }
+.spacelookup-latnscr-fralang-deffeat { font-family: spacelookup-latnscr-fralang-deffeat; }
+.spacelookup-latnscr-fralang-ndeffeat { font-family: spacelookup-latnscr-fralang-ndeffeat; }
+
+p.kern {
+ -webkit-font-feature-settings: "liga" on, "kern" on;
+ font-feature-settings: "liga" on, "kern" on;
+}
+
+p.nokern {
+ -webkit-font-feature-settings: "liga" on, "kern" off;
+ font-feature-settings: "liga" on, "kern" off;
+}
+
+</style>
+
+</head>
+<body>
+<div class="spacelookup-defscr-deflang-deffeat" lang="en">
+<p class="spacelookup-defscr-deflang-deffeat kern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+<p class="spacelookup-latnscr-deflang-deffeat kern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+<p class="spacelookup-latnscr-fralang-deffeat kern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+<p class="spacelookup-defscr-deflang-ndeffeat nokern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+<p class="spacelookup-latnscr-deflang-ndeffeat nokern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+<p class="spacelookup-latnscr-fralang-ndeffeat nokern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+<p class="spacelookup-defscr-deflang-ndeffeat kern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+<p class="spacelookup-latnscr-deflang-ndeffeat kern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+<p class="spacelookup-latnscr-fralang-ndeffeat kern">&#xf002; &#xf001; &#xf004; &#xf003; &#xf006; &#xf005;</p>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/spacelookups-wordcache.html b/layout/reftests/font-features/spacelookups-wordcache.html
new file mode 100644
index 0000000000..a3bd642b26
--- /dev/null
+++ b/layout/reftests/font-features/spacelookups-wordcache.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>contextual substitutions for fonts with spaces in lookups</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com"/>
+<meta name="bug" content="https://bugzilla.mozilla.org/show_bug.cgi?id=921858"/>
+<style type="text/css">
+
+@font-face {
+ font-family: spacelookup-defscr-deflang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-defscr-deflang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-defscr-deflang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-defscr-deflang-ndeffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-deflang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-deflang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-deflang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-deflang-ndeffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-fralang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-fralang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-fralang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-fralang-ndeffeat.ttf);
+}
+
+body {
+ margin: 20px 40px;
+ line-height: 1.2;
+}
+
+div { font-size: 200%; }
+
+p { margin: 0; line-height: 1.2; }
+
+.spacelookup-defscr-deflang-deffeat { font-family: spacelookup-defscr-deflang-deffeat; }
+.spacelookup-defscr-deflang-ndeffeat { font-family: spacelookup-defscr-deflang-ndeffeat; }
+.spacelookup-latnscr-deflang-deffeat { font-family: spacelookup-latnscr-deflang-deffeat; }
+.spacelookup-latnscr-deflang-ndeffeat { font-family: spacelookup-latnscr-deflang-ndeffeat; }
+.spacelookup-latnscr-fralang-deffeat { font-family: spacelookup-latnscr-fralang-deffeat; }
+.spacelookup-latnscr-fralang-ndeffeat { font-family: spacelookup-latnscr-fralang-ndeffeat; }
+
+.dlig {
+ -webkit-font-feature-settings: "dlig" on;
+ font-feature-settings: "dlig" on;
+}
+</style>
+
+</head>
+<body>
+<div class="spacelookup-defscr-deflang-deffeat" lang="en">
+<p class="spacelookup-defscr-deflang-deffeat">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+<p class="spacelookup-latnscr-deflang-deffeat">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+<p class="spacelookup-latnscr-fralang-deffeat">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+<p class="spacelookup-defscr-deflang-ndeffeat">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+<p class="spacelookup-latnscr-deflang-ndeffeat">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+<p class="spacelookup-latnscr-fralang-ndeffeat">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+<p class="spacelookup-defscr-deflang-ndeffeat dlig">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+<p class="spacelookup-latnscr-deflang-ndeffeat dlig">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+<p class="spacelookup-latnscr-fralang-ndeffeat dlig">latn-script default-script fra-lang default-lang non-default-feature default-feature</p>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/spacelookups.html b/layout/reftests/font-features/spacelookups.html
new file mode 100644
index 0000000000..ab22ac9799
--- /dev/null
+++ b/layout/reftests/font-features/spacelookups.html
@@ -0,0 +1,82 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>contextual substitutions for fonts with spaces in lookups</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com"/>
+<link rel="help" href="http://www.w3.org/TR/css-fonts-3/#default-features"/>
+<link rel="help" href="http://www.w3.org/TR/css-fonts-3/#font-feature-settings"/>
+<link rel="match" href="spacelookups-ref.html"/>
+<meta name="flags" content=""/>
+<meta name="assert" content="spaces in contextual lookups should not affect glyph substitutions"/>
+<meta name="bug" content="https://bugzilla.mozilla.org/show_bug.cgi?id=921858"/>
+<style type="text/css">
+/*
+ Fonts below contain different arrangements of features/lookups. All
+ contain substitution rules for words such "default-script". Each individual
+ font has additional substitution rules so that a sequence of words with
+ spaces will end up as a thumbs up icon glyph.
+*/
+
+@font-face {
+ font-family: spacelookup-defscr-deflang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-defscr-deflang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-defscr-deflang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-defscr-deflang-ndeffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-deflang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-deflang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-deflang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-deflang-ndeffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-fralang-deffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-fralang-deffeat.ttf);
+}
+
+@font-face {
+ font-family: spacelookup-latnscr-fralang-ndeffeat;
+ src: url(../fonts/spacelookups/spacelookup-latnscr-fralang-ndeffeat.ttf);
+}
+
+body {
+ margin: 20px 40px;
+ line-height: 1.2;
+}
+
+div { font-size: 400%; }
+
+.spacelookup-defscr-deflang-deffeat { font-family: spacelookup-defscr-deflang-deffeat; }
+.spacelookup-defscr-deflang-ndeffeat { font-family: spacelookup-defscr-deflang-ndeffeat; }
+.spacelookup-latnscr-deflang-deffeat { font-family: spacelookup-latnscr-deflang-deffeat; }
+.spacelookup-latnscr-deflang-ndeffeat { font-family: spacelookup-latnscr-deflang-ndeffeat; }
+.spacelookup-latnscr-fralang-deffeat { font-family: spacelookup-latnscr-fralang-deffeat; }
+.spacelookup-latnscr-fralang-ndeffeat { font-family: spacelookup-latnscr-fralang-ndeffeat; }
+
+.dlig {
+ -webkit-font-feature-settings: "dlig" on;
+ font-feature-settings: "dlig" on;
+}
+</style>
+
+</head>
+<body>
+<div class="spacelookup-defscr-deflang-deffeat">
+<span class="spacelookup-defscr-deflang-deffeat">default-script default-lang default-feature</span>
+<span class="spacelookup-defscr-deflang-ndeffeat dlig">default-script default-lang non-default-feature</span>
+<span class="spacelookup-latnscr-deflang-deffeat">latn-script default-lang default-feature</span>
+<span class="spacelookup-latnscr-deflang-ndeffeat dlig">latn-script default-lang non-default-feature</span>
+<span class="spacelookup-latnscr-fralang-deffeat" lang="fr">latn-script fra-lang default-feature</span>
+<span class="spacelookup-latnscr-fralang-ndeffeat dlig" lang="fr">latn-script fra-lang non-default-feature</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback-notref1.html b/layout/reftests/font-features/subsuper-fallback-notref1.html
new file mode 100644
index 0000000000..375d855fd2
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback-notref1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+h4 { font-weight: normal }
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with synthesized glyphs:</h4>
+<p><span class=sub>3n</span>C<span class=super>2n</span> <span class=sub>n3</span>C<span class=super>n2</span></p>
+<p><span class=sub>3&pi;</span>C<span class=super>2&pi;</span> <span class=sub>&pi;3</span>C<span class=super>&pi;2</span></p>
+<p><span class=sub>3&#x1F4A9;</span>C<span class=super>2&#x1F4A9;</span> <span class=sub>&#x1F4A9;3</span>C<span class=super>&#x1F4A9;2</span></p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback-notref2.html b/layout/reftests/font-features/subsuper-fallback-notref2.html
new file mode 100644
index 0000000000..40a89965bb
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback-notref2.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+h4 { font-weight: normal }
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with synthesized glyphs:</h4>
+<p><span class=sub>&#x2083;n</span>C<span class=super>&#x0b2;n</span> <span class=sub>n&#x2083;</span>C<span class=super>n&#x0b2;</span></p>
+<p><span class=sub>&#x2083;&pi;</span>C<span class=super>&#x0b2;&pi;</span> <span class=sub>&pi;&#x2083;</span>C<span class=super>&pi;&#x0b2;</span></p>
+<p><span class=sub>&#x2083;&#x1F4A9;</span>C<span class=super>&#x0b2;&#x1F4A9;</span> <span class=sub>&#x1F4A9;&#x2083;</span>C<span class=super>&#x1F4A9;&#x0b2;</span></p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback-notref3.html b/layout/reftests/font-features/subsuper-fallback-notref3.html
new file mode 100644
index 0000000000..945c8b8a5a
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback-notref3.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+@font-face {
+ font-family: subsuper-nofeat;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+h4 { font-weight: normal }
+
+.nofeat { font-family: subsuper-nofeat }
+.nofeat span.sub { font-variant-position: sub }
+.nofeat span.super { font-variant-position: super }
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with synthesized glyphs:</h4>
+<p><span class=sub>&#x2083;n</span>C<span class=super>&#x0b2;n</span> <span class=sub>n&#x2083;</span>C<span class=super>n&#x0b2;</span></p>
+<p><span class=sub>&#x2083;&pi;</span>C<span class=super>&#x0b2;&pi;</span> <span class=sub>&pi;&#x2083;</span>C<span class=super>&pi;&#x0b2;</span></p>
+<p class=nofeat><span class=sub>3&#x1F4A9;</span>C<span class=super>2&#x1F4A9;</span> <span class=sub>&#x1F4A9;3</span>C<span class=super>&#x1F4A9;2</span></p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback-omega-notref.html b/layout/reftests/font-features/subsuper-fallback-omega-notref.html
new file mode 100644
index 0000000000..3ecc8a3ff3
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback-omega-notref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper-nofeat.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 200px;
+}
+h4 { font-weight: normal }
+</style>
+</head>
+<body>
+<p>e&#x0b2;</p>
+<p>e&#x2082;</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback-omega.html b/layout/reftests/font-features/subsuper-fallback-omega.html
new file mode 100644
index 0000000000..f27af2d484
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback-omega.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 200px;
+}
+h4 { font-weight: normal }
+span.sub { font-variant-position: sub }
+span.super { font-variant-position: super }
+</style>
+</head>
+<body>
+<p>e<span class=super>2&omega;</span></p>
+<p>e<span class=sub>2&omega;</span></p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback-ref.html b/layout/reftests/font-features/subsuper-fallback-ref.html
new file mode 100644
index 0000000000..32b665a51a
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback-ref.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper-nofeat.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+h4 { font-weight: normal }
+span.sub { font-variant-position: sub }
+span.super { font-variant-position: super }
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with synthesized glyphs:</h4>
+<p><span class=sub>3n</span>C<span class=super>2n</span> <span class=sub>n3</span>C<span class=super>n2</span></p>
+<p><span class=sub>3&pi;</span>C<span class=super>2&pi;</span> <span class=sub>&pi;3</span>C<span class=super>&pi;2</span></p>
+<p><span class=sub>3&#x1F4A9;</span>C<span class=super>2&#x1F4A9;</span> <span class=sub>&#x1F4A9;3</span>C<span class=super>&#x1F4A9;2</span></p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback-size-ref.html b/layout/reftests/font-features/subsuper-fallback-size-ref.html
new file mode 100644
index 0000000000..e6e9111949
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback-size-ref.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 10px;
+ font-size: 50px;
+ line-height: 2;
+ width: -moz-fit-content;
+ background: black;
+}
+h4 { font-weight: normal; }
+span { font-size: 0.667em; } /* see NS_FONT_SUB_SUPER_SIZE_RATIO_LARGE */
+</style>
+</head>
+<body>
+<h4>The black bars should NOT be the same length</h4>
+<p>&nbsp;XXXXXXXXXX&nbsp;</p>
+<p>&nbsp;X<span>XXXXXXXX</span>X&nbsp;</p>
+<p>&nbsp;X<span>XXXXXXXX</span>X&nbsp;</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback-size.html b/layout/reftests/font-features/subsuper-fallback-size.html
new file mode 100644
index 0000000000..e042319cb3
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback-size.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 10px;
+ font-size: 50px;
+ line-height: 2;
+ width: -moz-fit-content;
+ background: black;
+}
+h4 { font-weight: normal; }
+span.sub { font-variant-position: sub; }
+span.super { font-variant-position: super; }
+</style>
+</head>
+<body>
+<h4>The black bars should NOT be the same length</h4>
+<p>&nbsp;XXXXXXXXXX&nbsp;</p>
+<p>&nbsp;X<span class=sub>XXXXXXXX</span>X&nbsp;</p>
+<p>&nbsp;X<span class=super>XXXXXXXX</span>X&nbsp;</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-fallback.html b/layout/reftests/font-features/subsuper-fallback.html
new file mode 100644
index 0000000000..28092d90c1
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-fallback.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 50px;
+}
+h4 { font-weight: normal }
+span.sub { font-variant-position: sub }
+span.super { font-variant-position: super }
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with synthesized glyphs:</h4>
+<p><span class=sub>3n</span>C<span class=super>2n</span> <span class=sub>n3</span>C<span class=super>n2</span></p>
+<p><span class=sub>3&pi;</span>C<span class=super>2&pi;</span> <span class=sub>&pi;3</span>C<span class=super>&pi;2</span></p>
+<p><span class=sub>3&#x1F4A9;</span>C<span class=super>2&#x1F4A9;</span> <span class=sub>&#x1F4A9;3</span>C<span class=super>&#x1F4A9;2</span></p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-nofallback-notref.html b/layout/reftests/font-features/subsuper-nofallback-notref.html
new file mode 100644
index 0000000000..5dfd66218b
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-nofallback-notref.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 75px;
+}
+h4 { font-weight: normal }
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with variant glyphs:</h4>
+<p>
+<span class=sub>3</span>C<span class=super>2</span>
+<span class=sub>(3)</span>C<span class=super>(2)</span>
+<span class=sub>21+3</span>C<span class=super>45</span>
+</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-nofallback-ref1.html b/layout/reftests/font-features/subsuper-nofallback-ref1.html
new file mode 100644
index 0000000000..2c015d026f
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-nofallback-ref1.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 75px;
+}
+h4 { font-weight: normal }
+span.super {
+ -webkit-font-feature-settings: "sups" on;
+ font-feature-settings: "sups" on;
+}
+span.sub {
+ -webkit-font-feature-settings: "subs" on;
+ font-feature-settings: "subs" on;
+}
+
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with variant glyphs:</h4>
+<p>
+<span class=sub>3</span>C<span class=super>2</span>
+<span class=sub>(3)</span>C<span class=super>(2)</span>
+<span class=sub>21+3</span>C<span class=super>45</span>
+</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-nofallback-ref2.html b/layout/reftests/font-features/subsuper-nofallback-ref2.html
new file mode 100644
index 0000000000..332e031777
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-nofallback-ref2.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper-nofeat.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 75px;
+}
+h4 { font-weight: normal }
+
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with variant glyphs:</h4>
+<p>
+<span class=sub>&#x2083;</span>C<span class=super>&#x0b2;</span>
+<span class=sub>&#x208d;&#x2083;&#x208e;</span>C<span class=super>&#x207d;&#x0b2;&#x207e;</span>
+<span class=sub>&#x2082;&#x2081;&#x208a;&#x2083;</span>C<span class=super>&#x2074;&#x2075;</span>
+</p>
+</body>
+</html>
diff --git a/layout/reftests/font-features/subsuper-nofallback.html b/layout/reftests/font-features/subsuper-nofallback.html
new file mode 100644
index 0000000000..92d1ccd3fb
--- /dev/null
+++ b/layout/reftests/font-features/subsuper-nofallback.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>font-variant-position fallback</title>
+<meta charset="UTF-8">
+<style>
+
+/* sups: 0-9 + - ( ) = subs: 0-9 + - ( ) */
+@font-face {
+ font-family: subsuper;
+ src: url(../fonts/subsuper.woff); /* FiraSans with blank omega */
+}
+
+body {
+ margin: 20px;
+ font-family: subsuper, sans-serif;
+}
+
+p {
+ margin: 0;
+ font-size: 75px;
+}
+h4 { font-weight: normal }
+span.sub { font-variant-position: sub }
+span.super { font-variant-position: super }
+</style>
+</head>
+<body>
+<h4>All the subscripts and superscripts should display with variant glyphs:</h4>
+<p>
+<span class=sub>3</span>C<span class=super>2</span>
+<span class=sub>(3)</span>C<span class=super>(2)</span>
+<span class=sub>21+3</span>C<span class=super>45</span>
+</p>
+</body>
+</html>