new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/399636-quirks-css.html
@@ -0,0 +1,22 @@
+<html lang="en-US">
+<head>
+ <title>Reftest, bug 399636 (quirks mode, family from CSS)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ /* the first three fonts lack glyphs for P, A, and S */
+ span { font-family: Symbol, Webdings, Wingdings, serif; }
+
+ /* ensure consistent vertical positioning under variation in
+ first-choice font */
+ p { line-height: 50px; font-size: 16px; }
+ span, font { line-height: 25px; }
+
+ </style>
+</head>
+<body>
+
+<p> <span>PASS</span></p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/399636-quirks-html.html
@@ -0,0 +1,19 @@
+<html lang="en-US">
+<head>
+ <title>Reftest, bug 399636 (quirks mode, family from HTML)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ /* ensure consistent vertical positioning under variation in
+ first-choice font */
+ p { line-height: 50px; font-size: 16px; }
+ span, font { line-height: 25px; }
+
+ </style>
+</head>
+<body>
+
+<p> <font face="Symbol, Webdings, Wingdings, serif">PASS</font></p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/399636-quirks-ref.html
@@ -0,0 +1,21 @@
+<html lang="en-US">
+<head>
+ <title>Reftest, bug 399636</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ span { font-family: serif; }
+
+ /* ensure consistent vertical positioning under variation in
+ first-choice font */
+ p { line-height: 50px; font-size: 16px; }
+ span, font { line-height: 25px; }
+
+ </style>
+</head>
+<body>
+
+<p> <span>PASS</span></p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/399636-standards-css.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+ <title>Reftest, bug 399636 (standards mode, family from CSS)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ /* the first three fonts lack glyphs for P, A, and S */
+ span { font-family: Symbol, Webdings, Wingdings, serif; }
+
+ /* ensure consistent vertical positioning under variation in
+ first-choice font */
+ p { line-height: 50px; font-size: 16px; }
+ span, font { line-height: 25px; }
+
+ </style>
+</head>
+<body>
+
+<p> <span>PASS</span></p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/399636-standards-html.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+ <title>Reftest, bug 399636 (standards mode, family from HTML)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ /* ensure consistent vertical positioning under variation in
+ first-choice font */
+ p { line-height: 50px; font-size: 16px; }
+ span, font { line-height: 25px; }
+
+ </style>
+</head>
+<body>
+
+<p> <font face="Symbol, Webdings, Wingdings, serif">PASS</font></p>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/399636-standards-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+ <title>Reftest, bug 399636</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ span { font-family: serif; }
+
+ /* ensure consistent vertical positioning under variation in
+ first-choice font */
+ p { line-height: 50px; font-size: 16px; }
+ span, font { line-height: 25px; }
+
+ </style>
+</head>
+<body>
+
+<p> <span>PASS</span></p>
+
+</body>
+</html>
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -627,16 +627,22 @@ skip-if(MOZ_WIDGET_TOOLKIT!="windows") =
== 398797-1a.html 398797-1-ref.html
== 398797-1b.html 398797-1-ref.html
== 398797-1c.html 398797-1-ref.html
== 398797-1d.html 398797-1-ref.html
== 399209-1.html 399209-1-ref.html
== 399209-2.html 399209-2-ref.html
== 399258-1.html 399258-1-ref.html
== 399384-1.html 399384-1-ref.html
+random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 399636-standards-css.html 399636-standards-ref.html # bug 429022
+random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 399636-standards-html.html 399636-standards-ref.html # bug 429022
+random-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 399636-quirks-css.html 399636-quirks-ref.html # bug 429022
+# We can't rely on this test working on platforms other than Windows and
+# Mac because they need not have a font called "Symbol".
+fails-if(MOZ_WIDGET_TOOLKIT=="windows") fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") random-if(MOZ_WIDGET_TOOLKIT!="cocoa"&&MOZ_WIDGET_TOOLKIT!="windows") != 399636-quirks-html.html 399636-quirks-ref.html # windows failure bug 429017, mac failure bug 429019
== 400081-1.html about:blank
== 400171-1a.html 400171-1-ref.html
== 400171-1b.html 400171-1-ref.html
== 400171-1c.html 400171-1-ref.html
== 400171-2a.html 400171-2-ref.html
== 400171-2b.html 400171-2-ref.html
== 400171-2c.html 400171-2-ref.html
== 400421-1.html 400421-1-ref.html