summaryrefslogtreecommitdiffstats
path: root/layout/reftests/text
diff options
context:
space:
mode:
Diffstat (limited to 'layout/reftests/text')
-rw-r--r--layout/reftests/text/1170688-ref.html21
-rw-r--r--layout/reftests/text/1170688.html21
-rw-r--r--layout/reftests/text/1320665-cmap-format-13-ref.html12
-rw-r--r--layout/reftests/text/1320665-cmap-format-13.html22
-rw-r--r--layout/reftests/text/1331339-script-extensions-shaping-1-ref.html28
-rw-r--r--layout/reftests/text/1331339-script-extensions-shaping-1.html34
-rw-r--r--layout/reftests/text/1349308-1.html2
-rw-r--r--layout/reftests/text/1349308-notref.html1
-rw-r--r--layout/reftests/text/1463020-letter-spacing-text-transform-1-ref.html17
-rw-r--r--layout/reftests/text/1463020-letter-spacing-text-transform-1.html23
-rw-r--r--layout/reftests/text/1463020-letter-spacing-text-transform-2-ref.html17
-rw-r--r--layout/reftests/text/1463020-letter-spacing-text-transform-2.html23
-rw-r--r--layout/reftests/text/1507661-spurious-hyphenation-after-explicit-ref.html2
-rw-r--r--layout/reftests/text/1507661-spurious-hyphenation-after-explicit.html2
-rw-r--r--layout/reftests/text/1522857-1-ref.html2
-rw-r--r--layout/reftests/text/1522857-1.html2
-rw-r--r--layout/reftests/text/1637405-pua-shaping-1-notref.html15
-rw-r--r--layout/reftests/text/1637405-pua-shaping-1.html15
-rw-r--r--layout/reftests/text/1655364-1-ref.html2
-rw-r--r--layout/reftests/text/1655364-1.html2
-rw-r--r--layout/reftests/text/1670581-1-ref.html13
-rw-r--r--layout/reftests/text/1670581-1.html13
-rw-r--r--layout/reftests/text/1673098-1-ref.html13
-rw-r--r--layout/reftests/text/1673098-1.html13
-rw-r--r--layout/reftests/text/444656-ref.html12
-rw-r--r--layout/reftests/text/444656.html27
-rw-r--r--layout/reftests/text/449555-1-ref.html33
-rw-r--r--layout/reftests/text/449555-1.html33
-rw-r--r--layout/reftests/text/467722-ref.html10
-rw-r--r--layout/reftests/text/467722.html10
-rw-r--r--layout/reftests/text/475092-pos.html19
-rw-r--r--layout/reftests/text/475092-ref.html19
-rw-r--r--layout/reftests/text/475092-sub.html19
-rw-r--r--layout/reftests/text/476378-soft-hyphen-fallback-ref.html19
-rw-r--r--layout/reftests/text/476378-soft-hyphen-fallback.html19
-rw-r--r--layout/reftests/text/577380-ref.html13
-rw-r--r--layout/reftests/text/577380.html13
-rw-r--r--layout/reftests/text/726392-1-ref.html53
-rw-r--r--layout/reftests/text/726392-1.html66
-rw-r--r--layout/reftests/text/726392-2-ref.html53
-rw-r--r--layout/reftests/text/726392-2.html66
-rw-r--r--layout/reftests/text/726392-3-ref.html83
-rw-r--r--layout/reftests/text/726392-3.html94
-rw-r--r--layout/reftests/text/745555-1-ref.html28
-rw-r--r--layout/reftests/text/745555-1.html29
-rw-r--r--layout/reftests/text/745555-2-ref.html14
-rw-r--r--layout/reftests/text/745555-2.html19
-rw-r--r--layout/reftests/text/820255-ref.html11
-rw-r--r--layout/reftests/text/820255.html14
-rw-r--r--layout/reftests/text/arabic-fallback-1-ref.html17
-rw-r--r--layout/reftests/text/arabic-fallback-1.html17
-rw-r--r--layout/reftests/text/arabic-fallback-2-ref.html20
-rw-r--r--layout/reftests/text/arabic-fallback-2.html20
-rw-r--r--layout/reftests/text/arabic-fallback-3-ref.html17
-rw-r--r--layout/reftests/text/arabic-fallback-3.html17
-rw-r--r--layout/reftests/text/arabic-fallback-4-ref.html17
-rw-r--r--layout/reftests/text/arabic-fallback-4.html17
-rw-r--r--layout/reftests/text/arabic-final-ligature-spacing-ref.html6
-rw-r--r--layout/reftests/text/arabic-final-ligature-spacing.html9
-rw-r--r--layout/reftests/text/arabic-marks-1-ref.html42
-rw-r--r--layout/reftests/text/arabic-marks-1.html42
-rw-r--r--layout/reftests/text/arabic-shaping-1-ref.html17
-rw-r--r--layout/reftests/text/arabic-shaping-1.html17
-rw-r--r--layout/reftests/text/arial-bold-lam-alef-1-ref.html5
-rw-r--r--layout/reftests/text/arial-bold-lam-alef-1.html5
-rw-r--r--layout/reftests/text/auto-hyphenation-1-notref.html9
-rw-r--r--layout/reftests/text/auto-hyphenation-1-ref.html9
-rw-r--r--layout/reftests/text/auto-hyphenation-1.html10
-rw-r--r--layout/reftests/text/auto-hyphenation-10-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-10.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-1a.html10
-rw-r--r--layout/reftests/text/auto-hyphenation-2-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-2.html12
-rw-r--r--layout/reftests/text/auto-hyphenation-3-ref.html9
-rw-r--r--layout/reftests/text/auto-hyphenation-3.html10
-rw-r--r--layout/reftests/text/auto-hyphenation-4-ref.html9
-rw-r--r--layout/reftests/text/auto-hyphenation-4.html10
-rw-r--r--layout/reftests/text/auto-hyphenation-5-ref.html28
-rw-r--r--layout/reftests/text/auto-hyphenation-5.html28
-rw-r--r--layout/reftests/text/auto-hyphenation-6-ref.html9
-rw-r--r--layout/reftests/text/auto-hyphenation-6.html10
-rw-r--r--layout/reftests/text/auto-hyphenation-7-ref.html9
-rw-r--r--layout/reftests/text/auto-hyphenation-7.html10
-rw-r--r--layout/reftests/text/auto-hyphenation-8-ref.html10
-rw-r--r--layout/reftests/text/auto-hyphenation-8.html10
-rw-r--r--layout/reftests/text/auto-hyphenation-9-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-9.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-af-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-af-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-bg-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-bg-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-bn-1-ref.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-bn-1.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-ca-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-ca-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-cy-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-cy-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-da-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-da-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-de-1901-1-ref.html13
-rw-r--r--layout/reftests/text/auto-hyphenation-de-1901-1.html13
-rw-r--r--layout/reftests/text/auto-hyphenation-de-1996-1-ref.html13
-rw-r--r--layout/reftests/text/auto-hyphenation-de-1996-1.html13
-rw-r--r--layout/reftests/text/auto-hyphenation-de-ch-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-de-ch-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-eo-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-eo-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-es-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-es-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-et-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-et-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-fi-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-fi-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-fr-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-fr-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-gl-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-gl-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-gu-1-ref.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-gu-1.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-hi-1-ref.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-hi-1.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-hr-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-hr-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-hsb-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-hsb-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-hu-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-hu-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-ia-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-ia-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-is-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-is-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-it-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-it-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-kmr-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-kmr-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-kn-1-ref.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-kn-1.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-la-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-la-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-lt-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-lt-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-ml-1-ref.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-ml-1.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-mn-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-mn-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-nb-1-ref.html15
-rw-r--r--layout/reftests/text/auto-hyphenation-nb-1.html15
-rw-r--r--layout/reftests/text/auto-hyphenation-nl-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-nl-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-nn-1-ref.html15
-rw-r--r--layout/reftests/text/auto-hyphenation-nn-1.html15
-rw-r--r--layout/reftests/text/auto-hyphenation-pa-1-ref.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-pa-1.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-pl-1-ref.html50
-rw-r--r--layout/reftests/text/auto-hyphenation-pl-1.html20
-rw-r--r--layout/reftests/text/auto-hyphenation-pt-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-pt-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-ru-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-ru-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-sh-1-ref.html13
-rw-r--r--layout/reftests/text/auto-hyphenation-sh-1.html13
-rw-r--r--layout/reftests/text/auto-hyphenation-sl-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-sl-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-sr-1-ref.html13
-rw-r--r--layout/reftests/text/auto-hyphenation-sr-1.html13
-rw-r--r--layout/reftests/text/auto-hyphenation-sv-1-notref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-sv-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-sv-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-ta-1-ref.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-ta-1.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-te-1-ref.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-te-1.html4
-rw-r--r--layout/reftests/text/auto-hyphenation-tr-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-tr-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-transformed-1-ref.html18
-rw-r--r--layout/reftests/text/auto-hyphenation-transformed-1.html18
-rw-r--r--layout/reftests/text/auto-hyphenation-uk-1-ref.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-uk-1.html11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-1.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-10.xhtml12
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-11a.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-11b.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-12a.xhtml12
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-12b.xhtml12
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-13a.xhtml13
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-13b.xhtml13
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-14a.xhtml14
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-14b.xhtml14
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-1a.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-2.xhtml13
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-3.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-4.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-5.xhtml28
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-6.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-7.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-8.xhtml11
-rw-r--r--layout/reftests/text/auto-hyphenation-xmllang-9.xhtml12
-rw-r--r--layout/reftests/text/cgj-01-ref.html21
-rw-r--r--layout/reftests/text/cgj-01.html21
-rw-r--r--layout/reftests/text/color-opacity-rtl-1-ref.html18
-rw-r--r--layout/reftests/text/color-opacity-rtl-1.html17
-rw-r--r--layout/reftests/text/color-opacity-rtl-2-ref.html19
-rw-r--r--layout/reftests/text/color-opacity-rtl-2.html17
-rw-r--r--layout/reftests/text/control-chars-01-notref.html11
-rw-r--r--layout/reftests/text/control-chars-01a.html11
-rw-r--r--layout/reftests/text/control-chars-01b.html11
-rw-r--r--layout/reftests/text/control-chars-01c.html11
-rw-r--r--layout/reftests/text/control-chars-01d.html11
-rw-r--r--layout/reftests/text/control-chars-02-notref.html6
-rw-r--r--layout/reftests/text/control-chars-02.html6
-rw-r--r--layout/reftests/text/control-chars-03-ref.html6
-rw-r--r--layout/reftests/text/control-chars-03a.html6
-rw-r--r--layout/reftests/text/control-chars-03b.html10
-rw-r--r--layout/reftests/text/control-chars-04-notref.html11
-rw-r--r--layout/reftests/text/control-chars-04a.html11
-rw-r--r--layout/reftests/text/control-chars-04b.html11
-rw-r--r--layout/reftests/text/control-chars-04c.html11
-rw-r--r--layout/reftests/text/control-chars-04d.html11
-rw-r--r--layout/reftests/text/emoji-01-notref.html19
-rw-r--r--layout/reftests/text/emoji-01.html19
-rw-r--r--layout/reftests/text/emoji-02-notref.html19
-rw-r--r--layout/reftests/text/emoji-02.html20
-rw-r--r--layout/reftests/text/emoji-03-notref.html19
-rw-r--r--layout/reftests/text/emoji-03-ref.html19
-rw-r--r--layout/reftests/text/emoji-03.html19
-rw-r--r--layout/reftests/text/emoji-04-ref.html20
-rw-r--r--layout/reftests/text/emoji-04.html20
-rw-r--r--layout/reftests/text/emoji-05-notref.html20
-rw-r--r--layout/reftests/text/emoji-05.html20
-rw-r--r--layout/reftests/text/ethiopic-wordspace-ref.html17
-rw-r--r--layout/reftests/text/ethiopic-wordspace.html17
-rw-r--r--layout/reftests/text/fallback-01-ref.xhtml19
-rw-r--r--layout/reftests/text/fallback-01.xhtml19
-rw-r--r--layout/reftests/text/fallback-mark-stacking-1-notref.html23
-rw-r--r--layout/reftests/text/fallback-mark-stacking-1.html23
-rw-r--r--layout/reftests/text/font-selection-by-lang-01-ref.html23
-rw-r--r--layout/reftests/text/font-selection-by-lang-01.html20
-rw-r--r--layout/reftests/text/font-selection-fallback-1-ref.html42
-rw-r--r--layout/reftests/text/font-selection-fallback-1.html41
-rw-r--r--layout/reftests/text/font-selection-generic-1-ref.html55
-rw-r--r--layout/reftests/text/font-selection-generic-1.html55
-rw-r--r--layout/reftests/text/font-size-adjust-01-ref.html14
-rw-r--r--layout/reftests/text/font-size-adjust-01.html16
-rw-r--r--layout/reftests/text/font-size-adjust-02-ref.html15
-rw-r--r--layout/reftests/text/font-size-adjust-02.html15
-rw-r--r--layout/reftests/text/font-size-adjust-03-ref.html14
-rw-r--r--layout/reftests/text/font-size-adjust-03.html14
-rw-r--r--layout/reftests/text/glyph-decomposition-graphite-ref.html27
-rw-r--r--layout/reftests/text/glyph-decomposition-graphite.html27
-rw-r--r--layout/reftests/text/glyph-decomposition-opentype-ref.html27
-rw-r--r--layout/reftests/text/glyph-decomposition-opentype.html27
-rw-r--r--layout/reftests/text/graphite-01-ref.html23
-rw-r--r--layout/reftests/text/graphite-01.html23
-rw-r--r--layout/reftests/text/graphite-02-ref.html23
-rw-r--r--layout/reftests/text/graphite-02.html23
-rw-r--r--layout/reftests/text/graphite-03-notref.html21
-rw-r--r--layout/reftests/text/graphite-03a.html22
-rw-r--r--layout/reftests/text/graphite-03b.html25
-rw-r--r--layout/reftests/text/graphite-04-fa.html19
-rw-r--r--layout/reftests/text/graphite-04-ref.html20
-rw-r--r--layout/reftests/text/graphite-04-sd.html19
-rw-r--r--layout/reftests/text/graphite-04-snd.html20
-rw-r--r--layout/reftests/text/graphite-04-ur.html20
-rw-r--r--layout/reftests/text/graphite-04-urd.html19
-rw-r--r--layout/reftests/text/graphite-05-badlang.html20
-rw-r--r--layout/reftests/text/graphite-05-fail.html20
-rw-r--r--layout/reftests/text/graphite-05-feat.html21
-rw-r--r--layout/reftests/text/graphite-05-lang.html21
-rw-r--r--layout/reftests/text/graphite-05-multipass.html21
-rw-r--r--layout/reftests/text/graphite-05-ot-only.html21
-rw-r--r--layout/reftests/text/graphite-05-ref.html20
-rw-r--r--layout/reftests/text/graphite-05-simple.html21
-rw-r--r--layout/reftests/text/graphite-bidi-1-ref.html24
-rw-r--r--layout/reftests/text/graphite-bidi-1.html27
-rw-r--r--layout/reftests/text/graphite-surrogate-selection-ref.html23
-rw-r--r--layout/reftests/text/graphite-surrogate-selection.html23
-rw-r--r--layout/reftests/text/hyphenation-caps-1-ref.html16
-rw-r--r--layout/reftests/text/hyphenation-caps-1.html12
-rw-r--r--layout/reftests/text/hyphenation-control-1-ref.html50
-rw-r--r--layout/reftests/text/hyphenation-control-1.html50
-rw-r--r--layout/reftests/text/hyphenation-control-2-ref.html22
-rw-r--r--layout/reftests/text/hyphenation-control-2.html27
-rw-r--r--layout/reftests/text/hyphenation-control-3-ref.html20
-rw-r--r--layout/reftests/text/hyphenation-control-3.html24
-rw-r--r--layout/reftests/text/hyphenation-control-4-ref.html25
-rw-r--r--layout/reftests/text/hyphenation-control-4.html25
-rw-r--r--layout/reftests/text/hyphenation-control-5-ref.html22
-rw-r--r--layout/reftests/text/hyphenation-control-5.html22
-rw-r--r--layout/reftests/text/hyphenation-control-6-ref.html73
-rw-r--r--layout/reftests/text/hyphenation-control-6.html21
-rw-r--r--layout/reftests/text/hyphenation-control-7-ref.html25
-rw-r--r--layout/reftests/text/hyphenation-control-7.html26
-rw-r--r--layout/reftests/text/initial-zwj-1-ref.html16
-rw-r--r--layout/reftests/text/initial-zwj-1.html16
-rw-r--r--layout/reftests/text/justification-1-ref.html11
-rw-r--r--layout/reftests/text/justification-1.html17
-rw-r--r--layout/reftests/text/justification-2-ref.html12
-rw-r--r--layout/reftests/text/justification-2a.html14
-rw-r--r--layout/reftests/text/justification-2b.html13
-rw-r--r--layout/reftests/text/justification-2c.html13
-rw-r--r--layout/reftests/text/justification-2d.html13
-rw-r--r--layout/reftests/text/justification-cjk-extension-ref.html19
-rw-r--r--layout/reftests/text/justification-cjk-extension.html19
-rw-r--r--layout/reftests/text/justification-space-diacritic-ref.html21
-rw-r--r--layout/reftests/text/justification-space-diacritic.html21
-rw-r--r--layout/reftests/text/kerning-01-notref.html25
-rw-r--r--layout/reftests/text/kerning-01.html20
-rw-r--r--layout/reftests/text/letter-spacing-nolig-1-ref.html13
-rw-r--r--layout/reftests/text/letter-spacing-nolig-1.html13
-rw-r--r--layout/reftests/text/letter-spacing-nolig-2-ref.html17
-rw-r--r--layout/reftests/text/letter-spacing-nolig-2.html17
-rw-r--r--layout/reftests/text/ligature-with-space-1.html20
-rw-r--r--layout/reftests/text/line-editing-1-ref.html17
-rw-r--r--layout/reftests/text/line-editing-1a.html27
-rw-r--r--layout/reftests/text/line-editing-1b.html25
-rw-r--r--layout/reftests/text/line-editing-1c.html25
-rw-r--r--layout/reftests/text/line-editing-1d.html26
-rw-r--r--layout/reftests/text/line-editing-1e.html24
-rw-r--r--layout/reftests/text/lineheight-metrics-1-ref.html17
-rw-r--r--layout/reftests/text/lineheight-metrics-1.html31
-rw-r--r--layout/reftests/text/lineheight-metrics-2-ref.html17
-rw-r--r--layout/reftests/text/lineheight-metrics-2a.html29
-rw-r--r--layout/reftests/text/lineheight-metrics-2b.html29
-rw-r--r--layout/reftests/text/lineheight-percentage-1-ref.html3
-rw-r--r--layout/reftests/text/lineheight-percentage-1.html6
-rw-r--r--layout/reftests/text/long-1.html9
-rw-r--r--layout/reftests/text/long-ref.html8
-rw-r--r--layout/reftests/text/negative-letter-spacing-1-ref.html13
-rw-r--r--layout/reftests/text/negative-letter-spacing-1.html18
-rw-r--r--layout/reftests/text/osx-font-smoothing-2-notref.html23
-rw-r--r--layout/reftests/text/osx-font-smoothing-2-ref.html26
-rw-r--r--layout/reftests/text/osx-font-smoothing-2.html23
-rw-r--r--layout/reftests/text/osx-font-smoothing-ref.html31
-rw-r--r--layout/reftests/text/osx-font-smoothing.html32
-rw-r--r--layout/reftests/text/overflowwrap-04.html18
-rw-r--r--layout/reftests/text/overflowwrap-05.html18
-rw-r--r--layout/reftests/text/overflowwrap-06.html38
-rw-r--r--layout/reftests/text/overflowwrap-07.html13
-rw-r--r--layout/reftests/text/overflowwrap-09.html13
-rw-r--r--layout/reftests/text/overflowwrap-10.html14
-rw-r--r--layout/reftests/text/pre-line-1-ref.html22
-rw-r--r--layout/reftests/text/pre-line-1.html48
-rw-r--r--layout/reftests/text/pre-line-2-ref.html10
-rw-r--r--layout/reftests/text/pre-line-2.html12
-rw-r--r--layout/reftests/text/pre-line-3-ref.html6
-rw-r--r--layout/reftests/text/pre-line-3.html12
-rw-r--r--layout/reftests/text/pre-line-4-ref.html7
-rw-r--r--layout/reftests/text/pre-line-4.html7
-rw-r--r--layout/reftests/text/pre-space-1-ref.html20
-rw-r--r--layout/reftests/text/pre-space-1.html20
-rw-r--r--layout/reftests/text/pre-wrap-1-ref.html27
-rw-r--r--layout/reftests/text/pre-wrap-1.html21
-rw-r--r--layout/reftests/text/reftest.list364
-rw-r--r--layout/reftests/text/rgba-text-ref.html7
-rw-r--r--layout/reftests/text/rgba-text.html12
-rw-r--r--layout/reftests/text/segment-break-transformation-1-ref.html39
-rw-r--r--layout/reftests/text/segment-break-transformation-1.html59
-rw-r--r--layout/reftests/text/soft-hyphen-in-table-1-notref.html18
-rw-r--r--layout/reftests/text/soft-hyphen-in-table-1-ref.html18
-rw-r--r--layout/reftests/text/soft-hyphen-in-table-1.html18
-rw-r--r--layout/reftests/text/soft-hyphen-in-table-2-ref.html18
-rw-r--r--layout/reftests/text/soft-hyphen-in-table-2.html18
-rw-r--r--layout/reftests/text/soft-hyphens-1-ref.html13
-rw-r--r--layout/reftests/text/soft-hyphens-1a.html13
-rw-r--r--layout/reftests/text/soft-hyphens-1b.html13
-rw-r--r--layout/reftests/text/soft-hyphens-1c.html13
-rw-r--r--layout/reftests/text/soft-hyphens-break-word-1-ref.html13
-rw-r--r--layout/reftests/text/soft-hyphens-break-word-1a.html13
-rw-r--r--layout/reftests/text/soft-hyphens-break-word-1b.html13
-rw-r--r--layout/reftests/text/soft-hyphens-break-word-1c.html13
-rw-r--r--layout/reftests/text/space-font-1-ref.html26
-rw-r--r--layout/reftests/text/space-font-1.html28
-rw-r--r--layout/reftests/text/sub-sup-and-line-height-ref.html15
-rw-r--r--layout/reftests/text/sub-sup-and-line-height.html14
-rw-r--r--layout/reftests/text/subpixel-glyphs-x-1a.html29
-rw-r--r--layout/reftests/text/subpixel-glyphs-x-1b.html29
-rw-r--r--layout/reftests/text/subpixel-glyphs-x-2a.html21
-rw-r--r--layout/reftests/text/subpixel-glyphs-x-2b.html21
-rw-r--r--layout/reftests/text/subpixel-glyphs-x-3a.html33
-rw-r--r--layout/reftests/text/subpixel-glyphs-x-3b.html36
-rw-r--r--layout/reftests/text/subpixel-glyphs-y-1a.html30
-rw-r--r--layout/reftests/text/subpixel-glyphs-y-1b.html30
-rw-r--r--layout/reftests/text/subpixel-lineheight-1a.html52
-rw-r--r--layout/reftests/text/subpixel-lineheight-1b.html52
-rw-r--r--layout/reftests/text/swash-1-ref.html7
-rw-r--r--layout/reftests/text/swash-1.html7
-rw-r--r--layout/reftests/text/synthetic-bold-metrics-01-notref.html23
-rw-r--r--layout/reftests/text/synthetic-bold-metrics-01.html26
-rw-r--r--layout/reftests/text/synthetic-bold-papyrus-01-ref.html23
-rw-r--r--layout/reftests/text/synthetic-bold-papyrus-01.html28
-rw-r--r--layout/reftests/text/synthetic-bold-zero-width-01-ref.html35
-rw-r--r--layout/reftests/text/synthetic-bold-zero-width-01.html45
-rw-r--r--layout/reftests/text/text-align-left-in-rtl-block-iframe.html17
-rw-r--r--layout/reftests/text/text-align-left-in-rtl-block-ref.html23
-rw-r--r--layout/reftests/text/text-align-left-in-rtl-block.html25
-rw-r--r--layout/reftests/text/variation-selector-unsupported-1-ref.html20
-rw-r--r--layout/reftests/text/variation-selector-unsupported-1.html20
-rw-r--r--layout/reftests/text/webkit-text-security-1.html138
-rw-r--r--layout/reftests/text/webkit-text-security-2.html20
-rw-r--r--layout/reftests/text/webkit-text-security-3.html20
-rw-r--r--layout/reftests/text/webkit-text-security-4.html20
-rw-r--r--layout/reftests/text/webkit-text-security-5.html20
-rw-r--r--layout/reftests/text/white-space-1-ref.html64
-rw-r--r--layout/reftests/text/white-space-1a.html53
-rw-r--r--layout/reftests/text/white-space-1b.html53
-rw-r--r--layout/reftests/text/white-space-2-ref.html68
-rw-r--r--layout/reftests/text/white-space-2.html54
-rw-r--r--layout/reftests/text/white-space-3-ref.html17
-rw-r--r--layout/reftests/text/white-space-3.html19
-rw-r--r--layout/reftests/text/word-spacing-01-ref.html53
-rw-r--r--layout/reftests/text/word-spacing-01.html46
-rw-r--r--layout/reftests/text/wordbreak-1-ref.html11
-rw-r--r--layout/reftests/text/wordbreak-1.html15
-rw-r--r--layout/reftests/text/wordbreak-3-ref.html13
-rw-r--r--layout/reftests/text/wordbreak-3.html15
-rw-r--r--layout/reftests/text/wordbreak-4b-ref.html13
-rw-r--r--layout/reftests/text/wordbreak-4b.html15
-rw-r--r--layout/reftests/text/wordbreak-5-ref.html13
-rw-r--r--layout/reftests/text/wordbreak-5.html15
-rw-r--r--layout/reftests/text/wordbreak-6-ref.html13
-rw-r--r--layout/reftests/text/wordbreak-6.html15
-rw-r--r--layout/reftests/text/wordbreak-7-ref.html0
-rw-r--r--layout/reftests/text/wordbreak-7.html0
-rw-r--r--layout/reftests/text/wordbreak-7a-ref.html28
-rw-r--r--layout/reftests/text/wordbreak-7a.html30
-rw-r--r--layout/reftests/text/wordbreak-7b-ref.html30
-rw-r--r--layout/reftests/text/wordbreak-7b.html32
-rw-r--r--layout/reftests/text/wordbreak-8-ref.html17
-rw-r--r--layout/reftests/text/wordbreak-8.html19
-rw-r--r--layout/reftests/text/wordbreak-9-ref.html29
-rw-r--r--layout/reftests/text/wordbreak-9.html33
-rw-r--r--layout/reftests/text/wordbreak-dynamic-1-ref.html18
-rw-r--r--layout/reftests/text/wordbreak-dynamic-1.html25
-rw-r--r--layout/reftests/text/wordwrap-01-ref.html19
-rw-r--r--layout/reftests/text/wordwrap-01.html13
-rw-r--r--layout/reftests/text/wordwrap-02-ref.html30
-rw-r--r--layout/reftests/text/wordwrap-02.html23
-rw-r--r--layout/reftests/text/wordwrap-03-ref.html20
-rw-r--r--layout/reftests/text/wordwrap-03.html15
-rw-r--r--layout/reftests/text/wordwrap-04-ref.html10
-rw-r--r--layout/reftests/text/wordwrap-04.html18
-rw-r--r--layout/reftests/text/wordwrap-05-ref.html10
-rw-r--r--layout/reftests/text/wordwrap-05.html18
-rw-r--r--layout/reftests/text/wordwrap-06-ref.html35
-rw-r--r--layout/reftests/text/wordwrap-06.html38
-rw-r--r--layout/reftests/text/wordwrap-07-ref.html10
-rw-r--r--layout/reftests/text/wordwrap-07.html13
-rw-r--r--layout/reftests/text/wordwrap-08-ref.html13
-rw-r--r--layout/reftests/text/wordwrap-08.html13
-rw-r--r--layout/reftests/text/wordwrap-09-ref.html15
-rw-r--r--layout/reftests/text/wordwrap-09.html13
-rw-r--r--layout/reftests/text/wordwrap-10-ref.html14
-rw-r--r--layout/reftests/text/wordwrap-10.html14
-rw-r--r--layout/reftests/text/zwnj-01-notref.html21
-rw-r--r--layout/reftests/text/zwnj-01-ref.html24
-rw-r--r--layout/reftests/text/zwnj-01-ref.xhtml36
-rw-r--r--layout/reftests/text/zwnj-01.html21
-rw-r--r--layout/reftests/text/zwnj-01.xhtml33
-rw-r--r--layout/reftests/text/zwnj-02-ref.xhtml32
-rw-r--r--layout/reftests/text/zwnj-02.xhtml33
460 files changed, 8981 insertions, 0 deletions
diff --git a/layout/reftests/text/1170688-ref.html b/layout/reftests/text/1170688-ref.html
new file mode 100644
index 0000000000..0fe16cc252
--- /dev/null
+++ b/layout/reftests/text/1170688-ref.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+<head>
+<meta charset=utf-8>
+<style type="text/css">
+@font-face {
+ font-family: local-gentium;
+ src: url(../fonts/sil/GenR102.ttf);
+}
+p {
+ font: 300% local-gentium, serif;
+ font-weight: bold;
+ color: rgb(100,255,100);
+ margin: 0;
+}
+</style>
+</head>
+<body>
+<p>Test</p>
+</body>
+</html>
diff --git a/layout/reftests/text/1170688.html b/layout/reftests/text/1170688.html
new file mode 100644
index 0000000000..d83d81b3c7
--- /dev/null
+++ b/layout/reftests/text/1170688.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<html>
+<head>
+<meta charset=utf-8>
+<style type="text/css">
+@font-face {
+ font-family: local-gentium;
+ src: url(../fonts/sil/GenR102.ttf);
+}
+p {
+ font: 300% local-gentium, serif;
+ font-weight: bold;
+ color: rgba(100,255,100, 0.2);
+ margin: 0;
+}
+</style>
+</head>
+<body>
+<p>Test</p>
+</body>
+</html>
diff --git a/layout/reftests/text/1320665-cmap-format-13-ref.html b/layout/reftests/text/1320665-cmap-format-13-ref.html
new file mode 100644
index 0000000000..7f8314e4b9
--- /dev/null
+++ b/layout/reftests/text/1320665-cmap-format-13-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<head>
+<meta charset=utf-8>
+<style>
+body {
+ font-family: monospace;
+ font-size: 48px;
+}
+</style>
+</head>
+<body>
+PASS
diff --git a/layout/reftests/text/1320665-cmap-format-13.html b/layout/reftests/text/1320665-cmap-format-13.html
new file mode 100644
index 0000000000..d8992a236c
--- /dev/null
+++ b/layout/reftests/text/1320665-cmap-format-13.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<head>
+<meta charset=utf-8>
+<style>
+/* Adobe Blank 2 font from https://github.com/adobe-fonts/adobe-blank-2/blob/master/adobe-blank-2.css,
+ licensed under the SIL Open Font License, Version 1.1. http://scripts.sil.org/OFL */
+@font-face {
+ font-family: AdobeBlank2;
+ src: url("data:font/opentype;base64,T1RUTwAKAIAAAwAgQ0ZGIN6nWacAAAfMAAABMURTSUcAAAABAAAJCAAAAAhPUy8yAF+xmwAAARAAAABgY21hcAE0tLwAAAasAAABAGhlYWQIOsNZAAAArAAAADZoaGVhB1oD7wAAAOQAAAAkaG10eAPoAHwAAAkAAAAACG1heHAAAlAAAAABCAAAAAZuYW1lc0mXUAAAAXAAAAU6cG9zdP+4ADIAAAesAAAAIAABAAAAAgBB1Q6SE18PPPUAAwPoAAAAANKdP6AAAAAA0p0/oAB8/4gDbANwAAAAAwACAAAAAAAAAAEAAANw/4gAAAPoAHwAfANsAAEAAAAAAAAAAAAAAAAAAAACAABQAAACAAAAAwPoAZAABQAAAooCWAAAAEsCigJYAAABXgAyANwAAAAAAAAAAAAAAAD3/67/+9///w/gAD8AAAAAQURCTwBAAAD//wNw/4gAAANwAHhgLwH/AAAAAAAAAAAAAAAgAAAAAAALAIoAAwABBAkAAACUAAAAAwABBAkAAQAaAJQAAwABBAkAAgAOAK4AAwABBAkAAwA4ALwAAwABBAkABAAaAJQAAwABBAkABQB0APQAAwABBAkABgAWAWgAAwABBAkACAA0AX4AAwABBAkACwA0AbIAAwABBAkADQKWAeYAAwABBAkADgA0BHwAQwBvAHAAeQByAGkAZwBoAHQAIACpACAAMgAwADEAMwAsACAAMgAwADEANQAgAEEAZABvAGIAZQAgAFMAeQBzAHQAZQBtAHMAIABJAG4AYwBvAHIAcABvAHIAYQB0AGUAZAAgACgAaAB0AHQAcAA6AC8ALwB3AHcAdwAuAGEAZABvAGIAZQAuAGMAbwBtAC8AKQAuAEEAZABvAGIAZQAgAEIAbABhAG4AawAgADIAUgBlAGcAdQBsAGEAcgAyAC4AMAAwADEAOwBBAEQAQgBPADsAQQBkAG8AYgBlAEIAbABhAG4AawAyADsAQQBEAE8AQgBFAFYAZQByAHMAaQBvAG4AIAAyAC4AMAAwADEAOwBQAFMAIAAyAC4AMAAwADEAOwBoAG8AdABjAG8AbgB2ACAAMQAuADAALgA4ADgAOwBtAGEAawBlAG8AdABmAC4AbABpAGIAMgAuADUALgA2ADUAMAAxADIAQQBkAG8AYgBlAEIAbABhAG4AawAyAEEAZABvAGIAZQAgAFMAeQBzAHQAZQBtAHMAIABJAG4AYwBvAHIAcABvAHIAYQB0AGUAZABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBkAG8AYgBlAC4AYwBvAG0ALwB0AHkAcABlAC8AVABoAGkAcwAgAEYAbwBuAHQAIABTAG8AZgB0AHcAYQByAGUAIABpAHMAIABsAGkAYwBlAG4AcwBlAGQAIAB1AG4AZABlAHIAIAB0AGgAZQAgAFMASQBMACAATwBwAGUAbgAgAEYAbwBuAHQAIABMAGkAYwBlAG4AcwBlACwAIABWAGUAcgBzAGkAbwBuACAAMQAuADEALgAgAFQAaABpAHMAIABGAG8AbgB0ACAAUwBvAGYAdAB3AGEAcgBlACAAaQBzACAAZABpAHMAdAByAGkAYgB1AHQAZQBkACAAbwBuACAAYQBuACAAIgBBAFMAIABJAFMAIgAgAEIAQQBTAEkAUwAsACAAVwBJAFQASABPAFUAVAAgAFcAQQBSAFIAQQBOAFQASQBFAFMAIABPAFIAIABDAE8ATgBEAEkAVABJAE8ATgBTACAATwBGACAAQQBOAFkAIABLAEkATgBEACwAIABlAGkAdABoAGUAcgAgAGUAeABwAHIAZQBzAHMAIABvAHIAIABpAG0AcABsAGkAZQBkAC4AIABTAGUAZQAgAHQAaABlACAAUwBJAEwAIABPAHAAZQBuACAARgBvAG4AdAAgAEwAaQBjAGUAbgBzAGUAIABmAG8AcgAgAHQAaABlACAAcwBwAGUAYwBpAGYAaQBjACAAbABhAG4AZwB1AGEAZwBlACwAIABwAGUAcgBtAGkAcwBzAGkAbwBuAHMAIABhAG4AZAAgAGwAaQBtAGkAdABhAHQAaQBvAG4AcwAgAGcAbwB2AGUAcgBuAGkAbgBnACAAeQBvAHUAcgAgAHUAcwBlACAAbwBmACAAdABoAGkAcwAgAEYAbwBuAHQAIABTAG8AZgB0AHcAYQByAGUALgBoAHQAdABwADoALwAvAHMAYwByAGkAcAB0AHMALgBzAGkAbAAuAG8AcgBnAC8ATwBGAEwAAAAAAAEAAwAKAAAADAANAAAAAAD0AAAAAAAAABMAAAAAAADX/wAAAAEAAOAAAAD9zwAAAAEAAP3wAAD//QAAAAEAAQAAAAH//QAAAAEAAgAAAAL//QAAAAEAAwAAAAP//QAAAAEABAAAAAT//QAAAAEABQAAAAX//QAAAAEABgAAAAb//QAAAAEABwAAAAf//QAAAAEACAAAAAj//QAAAAEACQAAAAn//QAAAAEACgAAAAr//QAAAAEACwAAAAv//QAAAAEADAAAAAz//QAAAAEADQAAAA3//QAAAAEADgAAAA7//QAAAAEADwAAAA///QAAAAEAEAAAABD//QAAAAEAAwAAAAAAAP+1ADIAAAAAAAAAAAAAAAAAAAAAAAAAAAEABAIAAQEBDEFkb2JlQmxhbmsyAAEBAS34G/gciwwe+B0B+B4Ci/sM+gD6BAUeKgAfDB+NDCL3Uw/3WRH3Vgwl96wMJAAFAQEGDlZjcEFkb2JlSWRlbnRpdHlDb3B5cmlnaHQgMjAxMywgMjAxNSBBZG9iZSBTeXN0ZW1zIEluY29ycG9yYXRlZCAoaHR0cDovL3d3dy5hZG9iZS5jb20vKS5BZG9iZSBCbGFuayAyQWRvYmVCbGFuazItMgAAAAABAAAAAAIBAUxO+nz7DLf6JLcB9xC3+Sy3A/cQ+gQV/nz5hPp8B/1Y/icV+dIH98X8MwWmsBX7xfg3Bfj2BqZiFf3SB/vF+DMFcGYV98X8NwX89gYOiw4AAQEBCfgfDCaX97kS+46LHAVGiwa9Cr0LAAAAA+gAfAAAAAAAAAABAAAAAA==");
+}
+body {
+ font-family: monospace;
+ font-size: 48px;
+}
+span {
+ font-family: AdobeBlank2;
+ font-size: 24px; /* smaller size to avoid risk of disrupting line height */
+}
+</style>
+</head>
+<body>
+P<span> (fail) </span>A<span>&#x1234;&#x9876;&#xabcd;</span>S<span>&#x10400;&#x1f333;&#xfe0e;</span>S
diff --git a/layout/reftests/text/1331339-script-extensions-shaping-1-ref.html b/layout/reftests/text/1331339-script-extensions-shaping-1-ref.html
new file mode 100644
index 0000000000..aa86bc2977
--- /dev/null
+++ b/layout/reftests/text/1331339-script-extensions-shaping-1-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/TAMLThiruValluvar-Regular.ttf);
+}
+.test {
+ font-family: test;
+ width: -moz-fit-content;
+}
+.mask {
+ background: green;
+ position: relative;
+ top: -.7em;
+ height: .7em;
+}
+</style>
+</head>
+<body>
+<div class="test">
+&#x0BA4;&#x0BC6;&#x0BAA;&#x0BC6;
+<div class="mask"></div>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/1331339-script-extensions-shaping-1.html b/layout/reftests/text/1331339-script-extensions-shaping-1.html
new file mode 100644
index 0000000000..1571e806d8
--- /dev/null
+++ b/layout/reftests/text/1331339-script-extensions-shaping-1.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/TAMLThiruValluvar-Regular.ttf);
+}
+.test {
+ font-family: test;
+ width: -moz-fit-content;
+}
+.mask {
+ background: green;
+ position: relative;
+ top: -.7em;
+ height: .7em;
+}
+</style>
+</head>
+<body>
+<div class="test">
+<!--
+The Grantha nukta characters U+1133C should NOT disrupt shaping of the base text.
+-->
+&#x0BA4;&#x0BC6;&#x1133c;&#x0BAA;&#x1133c;&#x0BC6;&#x1133c;
+<!--
+We place a box over the bottom of the text to mask the nuktas from reftest comparison.
+-->
+<div class="mask"></div>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/1349308-1.html b/layout/reftests/text/1349308-1.html
new file mode 100644
index 0000000000..8be4fa849d
--- /dev/null
+++ b/layout/reftests/text/1349308-1.html
@@ -0,0 +1,2 @@
+<!-- bold font should *not* have the same glyph widths as regular face -->
+<span style="font:36px -apple-system;font-weight:bold;padding:2px;background:black">abcdefghijklmnopqrstuvwxyz
diff --git a/layout/reftests/text/1349308-notref.html b/layout/reftests/text/1349308-notref.html
new file mode 100644
index 0000000000..14d4090f91
--- /dev/null
+++ b/layout/reftests/text/1349308-notref.html
@@ -0,0 +1 @@
+<span style="font:36px -apple-system;font-weight:normal;padding:2px;background:black">abcdefghijklmnopqrstuvwxyz
diff --git a/layout/reftests/text/1463020-letter-spacing-text-transform-1-ref.html b/layout/reftests/text/1463020-letter-spacing-text-transform-1-ref.html
new file mode 100644
index 0000000000..956bb8e45e
--- /dev/null
+++ b/layout/reftests/text/1463020-letter-spacing-text-transform-1-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<style>
+span {
+ font-size: 36px;
+ font-kerning: none;
+}
+#ref {
+ text-transform: uppercase;
+}
+</style>
+<body>
+ <p>The two lines should match:
+ <p><span id="ref">S&nbsp;&nbsp;🇸🇪&nbsp;&nbsp;v&nbsp;&nbsp;e</span>
+ <p><span id="ref">S&nbsp;&nbsp;🇸🇪&nbsp;&nbsp;v&nbsp;&nbsp;e</span>
+</body>
diff --git a/layout/reftests/text/1463020-letter-spacing-text-transform-1.html b/layout/reftests/text/1463020-letter-spacing-text-transform-1.html
new file mode 100644
index 0000000000..e957a9bc98
--- /dev/null
+++ b/layout/reftests/text/1463020-letter-spacing-text-transform-1.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset=utf-8>
+<style>
+span {
+ font-size: 36px;
+ font-kerning: none;
+}
+#test, #ref {
+ text-transform: uppercase;
+}
+</style>
+<body>
+ <p>The two lines should match:
+ <p><span id="test">S🇸🇪ve</span><span id="nbsp">&nbsp;</span>
+ <p><span id="ref">S&nbsp;&nbsp;🇸🇪&nbsp;&nbsp;v&nbsp;&nbsp;e</span>
+</body>
+<script>
+var nbspWidth = document.getElementById("nbsp").offsetWidth;
+var test = document.getElementById("test");
+test.style.letterSpacing = (2 * nbspWidth) + "px";
+document.documentElement.classList.remove("reftest-wait");
+</script>
diff --git a/layout/reftests/text/1463020-letter-spacing-text-transform-2-ref.html b/layout/reftests/text/1463020-letter-spacing-text-transform-2-ref.html
new file mode 100644
index 0000000000..5a87a4b570
--- /dev/null
+++ b/layout/reftests/text/1463020-letter-spacing-text-transform-2-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<style>
+span {
+ font-size: 36px;
+ font-kerning: none;
+}
+#ref {
+ text-transform: lowercase;
+}
+</style>
+<body>
+ <p>The two lines should match:
+ <p><span id="ref">𐐔&nbsp;𐐯&nbsp;𐑅&nbsp;𐐨&nbsp;𐑉&nbsp;𐐯&nbsp;𐐻</span>
+ <p><span id="ref">𐐔&nbsp;𐐯&nbsp;𐑅&nbsp;𐐨&nbsp;𐑉&nbsp;𐐯&nbsp;𐐻</span>
+</body>
diff --git a/layout/reftests/text/1463020-letter-spacing-text-transform-2.html b/layout/reftests/text/1463020-letter-spacing-text-transform-2.html
new file mode 100644
index 0000000000..fe6e1b69ea
--- /dev/null
+++ b/layout/reftests/text/1463020-letter-spacing-text-transform-2.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset=utf-8>
+<style>
+span {
+ font-size: 36px;
+ font-kerning: none;
+}
+#test, #ref {
+ text-transform: lowercase;
+}
+</style>
+<body>
+ <p>The two lines should match:
+ <p><span id="test">𐐔𐐯𐑅𐐨𐑉𐐯𐐻</span><span id="nbsp">&nbsp;</span>
+ <p><span id="ref">𐐔&nbsp;𐐯&nbsp;𐑅&nbsp;𐐨&nbsp;𐑉&nbsp;𐐯&nbsp;𐐻</span>
+</body>
+<script>
+var nbspWidth = document.getElementById("nbsp").offsetWidth;
+var test = document.getElementById("test");
+test.style.letterSpacing = nbspWidth + "px";
+document.documentElement.classList.remove("reftest-wait");
+</script>
diff --git a/layout/reftests/text/1507661-spurious-hyphenation-after-explicit-ref.html b/layout/reftests/text/1507661-spurious-hyphenation-after-explicit-ref.html
new file mode 100644
index 0000000000..4dd3a0f138
--- /dev/null
+++ b/layout/reftests/text/1507661-spurious-hyphenation-after-explicit-ref.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div lang="en">e-<br>mail-<br>ing</div>
diff --git a/layout/reftests/text/1507661-spurious-hyphenation-after-explicit.html b/layout/reftests/text/1507661-spurious-hyphenation-after-explicit.html
new file mode 100644
index 0000000000..9872e7a29b
--- /dev/null
+++ b/layout/reftests/text/1507661-spurious-hyphenation-after-explicit.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div lang="en" style="width:0;hyphens:auto">e-mailing</div>
diff --git a/layout/reftests/text/1522857-1-ref.html b/layout/reftests/text/1522857-1-ref.html
new file mode 100644
index 0000000000..4547d25d0e
--- /dev/null
+++ b/layout/reftests/text/1522857-1-ref.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="font:300px monospace;width:3ch;text-align:right">ab<br>cd</div>
diff --git a/layout/reftests/text/1522857-1.html b/layout/reftests/text/1522857-1.html
new file mode 100644
index 0000000000..5c1c3c9722
--- /dev/null
+++ b/layout/reftests/text/1522857-1.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="font:300px monospace;width:3ch;text-align:right">ab cd</div>
diff --git a/layout/reftests/text/1637405-pua-shaping-1-notref.html b/layout/reftests/text/1637405-pua-shaping-1-notref.html
new file mode 100644
index 0000000000..a429031d6f
--- /dev/null
+++ b/layout/reftests/text/1637405-pua-shaping-1-notref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/JuniusX-Regular.woff2);
+}
+.test {
+ font: 50px test;
+}
+</style>
+<p>Test passes if the first line has the diacritic right-aligned over the m,
+while the second line has it centered:</p>
+<div class=test><span style="display:inline-block">m</span>&#xF03E;</div>
+<div class=test><span style="display:inline-block">m</span>&#xF03E;</div>
diff --git a/layout/reftests/text/1637405-pua-shaping-1.html b/layout/reftests/text/1637405-pua-shaping-1.html
new file mode 100644
index 0000000000..dfbb365768
--- /dev/null
+++ b/layout/reftests/text/1637405-pua-shaping-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/JuniusX-Regular.woff2);
+}
+.test {
+ font: 50px test;
+}
+</style>
+<p>Test passes if the first line has the diacritic right-aligned over the m,
+while the second line has it centered:</p>
+<div class=test><span style="display:inline-block">m</span>&#xF03E;</div>
+<div class=test>m&#xF03E;</div>
diff --git a/layout/reftests/text/1655364-1-ref.html b/layout/reftests/text/1655364-1-ref.html
new file mode 100644
index 0000000000..97046449ad
--- /dev/null
+++ b/layout/reftests/text/1655364-1-ref.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="font:300px Consolas, monospace;width:3ch;text-align:right">ab<br>cd</div>
diff --git a/layout/reftests/text/1655364-1.html b/layout/reftests/text/1655364-1.html
new file mode 100644
index 0000000000..627d9ac49b
--- /dev/null
+++ b/layout/reftests/text/1655364-1.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="font:300px Consolas, monospace;width:3ch;text-align:right">ab cd</div>
diff --git a/layout/reftests/text/1670581-1-ref.html b/layout/reftests/text/1670581-1-ref.html
new file mode 100644
index 0000000000..dd7e052207
--- /dev/null
+++ b/layout/reftests/text/1670581-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: "SourceSerifPro";
+ src: url("../fonts/SourceSerifPro-Regular.ttf.woff2");
+}
+:root {
+ font-family: "SourceSerifPro", monospace;
+ font-size: 2rem;
+}
+</style>
+Foo-bar-baz.
diff --git a/layout/reftests/text/1670581-1.html b/layout/reftests/text/1670581-1.html
new file mode 100644
index 0000000000..0f5958ba6f
--- /dev/null
+++ b/layout/reftests/text/1670581-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: "SourceSerifPro";
+ src: url("../fonts/SourceSerifPro-Regular.ttf.woff2");
+}
+:root {
+ font-family: "SourceSerifPro", monospace;
+ font-size: 2rem;
+}
+</style>
+Foo&#x2010;bar&#x2011;baz.
diff --git a/layout/reftests/text/1673098-1-ref.html b/layout/reftests/text/1673098-1-ref.html
new file mode 100644
index 0000000000..85732c7da9
--- /dev/null
+++ b/layout/reftests/text/1673098-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: "Chunkfive";
+ src: url("../fonts/Chunkfive.otf");
+}
+:root {
+ font-family: "Chunkfive", monospace;
+ font-size: 2rem;
+}
+</style>
+Foo-bar-baz.
diff --git a/layout/reftests/text/1673098-1.html b/layout/reftests/text/1673098-1.html
new file mode 100644
index 0000000000..d4272e15e4
--- /dev/null
+++ b/layout/reftests/text/1673098-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: "Chunkfive";
+ src: url("../fonts/Chunkfive.otf");
+}
+:root {
+ font-family: "Chunkfive", monospace;
+ font-size: 2rem;
+}
+</style>
+Foo&#x2010;bar&#x2011;baz.
diff --git a/layout/reftests/text/444656-ref.html b/layout/reftests/text/444656-ref.html
new file mode 100644
index 0000000000..9b6e4534b4
--- /dev/null
+++ b/layout/reftests/text/444656-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test soft hyphen in rtl text</title>
+ </head>
+ <body dir="rtl">
+ <p>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכל</p>
+ <p>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשת</p>
+ </p>
+ </body>
+</html>
diff --git a/layout/reftests/text/444656.html b/layout/reftests/text/444656.html
new file mode 100644
index 0000000000..85232c500a
--- /dev/null
+++ b/layout/reftests/text/444656.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test soft hyphen in rtl text</title>
+ <style>
+ div { width: min-content; position: relative; }
+
+ /*prevent the soft hyphens from contributing to the minimum content width*/
+ div > p:nth-child(2) {
+ position: absolute;
+ top: auto;
+ right: 0;
+ margin-top: 0;
+ width: 100%;
+ }
+ </style>
+ </head>
+ <body dir="rtl">
+ <div>
+ <!-- add a first paragraph with no soft hyphens to set minimum content width -->
+ <p>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכל</p>
+ <p>אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת&shy;אבגדהוזחטיכלמנסעפצקרשת</p>
+ </p>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/449555-1-ref.html b/layout/reftests/text/449555-1-ref.html
new file mode 100644
index 0000000000..4ca2caa546
--- /dev/null
+++ b/layout/reftests/text/449555-1-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh" xml:lang="zh">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+<style type="text/css">
+ * { word-wrap: normal;}
+</style>
+<title>Test Wordwrap</title>
+</head>
+<body>
+ <p>Test Text Input:<input type="text" id="username" name="username" size="25" value="this is a very loooooooooooooooooooooooooooooooooog text."/></p>
+ <p>Test Password Input:<input type="password" id="password" name="password" size="25" /></p>
+
+<p>
+<select name="num" style="width: 8em">
+<option value="1">1111111111111111111111111111111111111111</option>
+<option value="2">2222222222222222222222222222222222222222</option>
+<option value="3">3333333333333333333333333333333333333333</option>
+<option value="4">4444444444444444444444444444444444444444</option>
+</select>
+</p>
+
+<p>
+<select name="num2" size="6" style="width: 8em">
+<option value="1">1111111111111111111111111111111111111111</option>
+<option value="2">2222222222222222222222222222222222222222</option>
+<option value="3">3333333333333333333333333333333333333333</option>
+<option value="4">4444444444444444444444444444444444444444</option>
+</select>
+</p>
+
+</body>
+</html>
diff --git a/layout/reftests/text/449555-1.html b/layout/reftests/text/449555-1.html
new file mode 100644
index 0000000000..7df5d33ba5
--- /dev/null
+++ b/layout/reftests/text/449555-1.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="zh" xml:lang="zh">
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+<style type="text/css">
+ * { word-wrap: break-word;}
+</style>
+<title>Test Wordwrap</title>
+</head>
+<body>
+ <p>Test Text Input:<input type="text" id="username" name="username" size="25" value="this is a very loooooooooooooooooooooooooooooooooog text."/></p>
+ <p>Test Password Input:<input type="password" id="password" name="password" size="25" /></p>
+
+<p>
+<select name="num" style="width: 8em">
+<option value="1">1111111111111111111111111111111111111111</option>
+<option value="2">2222222222222222222222222222222222222222</option>
+<option value="3">3333333333333333333333333333333333333333</option>
+<option value="4">4444444444444444444444444444444444444444</option>
+</select>
+</p>
+
+<p>
+<select name="num2" size="6" style="width: 8em">
+<option value="1">1111111111111111111111111111111111111111</option>
+<option value="2">2222222222222222222222222222222222222222</option>
+<option value="3">3333333333333333333333333333333333333333</option>
+<option value="4">4444444444444444444444444444444444444444</option>
+</select>
+</p>
+
+</body>
+</html>
diff --git a/layout/reftests/text/467722-ref.html b/layout/reftests/text/467722-ref.html
new file mode 100644
index 0000000000..28777a1cb3
--- /dev/null
+++ b/layout/reftests/text/467722-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body style="font-size: 150px;">
+
+&zwj;&#x9BB8;&#x9143;
+
+</body>
+</html>
diff --git a/layout/reftests/text/467722.html b/layout/reftests/text/467722.html
new file mode 100644
index 0000000000..5c7ae38352
--- /dev/null
+++ b/layout/reftests/text/467722.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body style="font-size: 150px;" onload="document.documentElement.appendChild(document.body);">
+
+&zwj;&#x9BB8;&#x9143;
+
+</body>
+</html>
diff --git a/layout/reftests/text/475092-pos.html b/layout/reftests/text/475092-pos.html
new file mode 100644
index 0000000000..9c907d08f1
--- /dev/null
+++ b/layout/reftests/text/475092-pos.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+ <style type="text/css">
+ @font-face {
+ font-family: Pos;
+ src: url(../fonts/PositioningTest1.ttf);
+ }
+ p {
+ font-family: Pos;
+ font-size: 50px;
+ opacity: 0.5;
+ }
+ </style>
+</head>
+<body>
+ <!-- The PositioningTest2 font uses a GPOS positioning lookup
+ to replace the 'o' with a raised version of the glyph -->
+ <p>Hello World!</p>
+</body>
diff --git a/layout/reftests/text/475092-ref.html b/layout/reftests/text/475092-ref.html
new file mode 100644
index 0000000000..5e9509783f
--- /dev/null
+++ b/layout/reftests/text/475092-ref.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+ <style type="text/css">
+ @font-face {
+ font-family: Pos;
+ src: url(../fonts/PositioningTest1.ttf);
+ }
+ p {
+ font-family: Pos;
+ font-size: 50px;
+ opacity: 0.5;
+ }
+ </style>
+</head>
+<body>
+ <!-- The capital O character in the PositioningTest font
+ is actually a raised lowercase o glyph -->
+ <p>HellO WOrld!</p>
+</body>
diff --git a/layout/reftests/text/475092-sub.html b/layout/reftests/text/475092-sub.html
new file mode 100644
index 0000000000..84b675726f
--- /dev/null
+++ b/layout/reftests/text/475092-sub.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+ <style type="text/css">
+ @font-face {
+ font-family: Pos;
+ src: url(../fonts/PositioningTest2.ttf);
+ }
+ p {
+ font-family: Pos;
+ font-size: 50px;
+ opacity: 0.5;
+ }
+ </style>
+</head>
+<body>
+ <!-- The PositioningTest2 font uses a GSUB substitution lookup
+ to replace the 'o' with a raised version of the glyph -->
+ <p>Hello World!</p>
+</body>
diff --git a/layout/reftests/text/476378-soft-hyphen-fallback-ref.html b/layout/reftests/text/476378-soft-hyphen-fallback-ref.html
new file mode 100644
index 0000000000..30bf4040d9
--- /dev/null
+++ b/layout/reftests/text/476378-soft-hyphen-fallback-ref.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<title>Soft hyphen font fallback (for bug 476378)</title>
+</head>
+<body>
+
+<!-- On OS X, Hoefler Text has a distinctive hyphen; on Windows, Segoe UI does.
+ In each case U+2010 will fall back to a font with a very different glyph. -->
+<div style="width: 50pt;
+ font-family: Hoefler Text, Segoe UI, Trebuchet MS, Lucida Grande;
+ font-size: 24pt;">
+
+<!-- reference text uses an explicit ASCII hyphen at the expected break point -->
+<p>aaa-<br>aa</p>
+
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/476378-soft-hyphen-fallback.html b/layout/reftests/text/476378-soft-hyphen-fallback.html
new file mode 100644
index 0000000000..f5aaec8ba9
--- /dev/null
+++ b/layout/reftests/text/476378-soft-hyphen-fallback.html
@@ -0,0 +1,19 @@
+<html>
+<head>
+<title>Soft hyphen font fallback (for bug 476378)</title>
+</head>
+<body>
+
+<!-- On OS X, Hoefler Text has a distinctive hyphen; on Windows, Segoe UI does.
+ In each case U+2010 will fall back to a font with a very different glyph. -->
+<div style="width: 50pt;
+ font-family: Hoefler Text, Segoe UI, Trebuchet MS, Lucida Grande;
+ font-size: 24pt;">
+
+<!-- test whether soft-hyphen gets rendered from the primary font -->
+<p>aaa&shy;aa</p>
+
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/577380-ref.html b/layout/reftests/text/577380-ref.html
new file mode 100644
index 0000000000..ebc48f1461
--- /dev/null
+++ b/layout/reftests/text/577380-ref.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<style type="text/css">
+body {
+ font-family: Times; /* this test is only for OS X, we know Times will be there */
+ font-size: 40px;
+}
+</style>
+</head>
+<body>
+&#xfb01;
+</body>
+</html>
diff --git a/layout/reftests/text/577380.html b/layout/reftests/text/577380.html
new file mode 100644
index 0000000000..b4368c8651
--- /dev/null
+++ b/layout/reftests/text/577380.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<style type="text/css">
+body {
+ font-family: Times; /* this test is only for OS X, we know Times will be there */
+ font-size: 40px;
+}
+</style>
+</head>
+<body>
+fi
+</body>
+</html>
diff --git a/layout/reftests/text/726392-1-ref.html b/layout/reftests/text/726392-1-ref.html
new file mode 100644
index 0000000000..bf19e00f52
--- /dev/null
+++ b/layout/reftests/text/726392-1-ref.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Bug 726392</title>
+ <style type="text/css">
+ p { margin: 0; letter-spacing: 10px}
+ .alignLeft { text-align: left; }
+ .alignRight { text-align: right; }
+ .alignCenter { text-align: center; }
+ .alignJustify { text-align: justify; }
+ .alignStart { text-align: start; }
+ .alignEnd { text-align: end; }
+ .alignLastAuto { text-align-last: auto; }
+ .alignLastLeft { text-align-last: left; }
+ .alignLastRight { text-align-last: right; }
+ .alignLastCenter { text-align-last: center; }
+ .alignLastJustify { text-align-last: justify; }
+ .alignLastStart { text-align-last: start; }
+ .alignLastEnd { text-align-last: end; }
+ </style>
+</head>
+ <body>
+ <p class="alignLeft alignLastAuto">test</p>
+ <p class="alignLeft alignLastLeft">test</p>
+ <p class="alignLeft alignLastRight">test</p>
+ <p class="alignLeft alignLastCenter">test</p>
+ <p class="alignLeft alignLastJustify">test</p>
+ <p class="alignLeft alignLastStart">test</p>
+ <p class="alignLeft alignLastEnd">test</p>
+ <p class="alignJustify alignLastAuto">test</p>
+ <p class="alignJustify alignLastLeft">test</p>
+ <p class="alignJustify alignLastRight">test</p>
+ <p class="alignJustify alignLastCenter">test</p>
+ <p class="alignJustify alignLastJustify">test</p>
+ <p class="alignJustify alignLastStart">test</p>
+ <p class="alignJustify alignLastEnd">test</p>
+ <p class="alignStart alignLastAuto">test</p>
+ <p class="alignStart alignLastLeft">test</p>
+ <p class="alignStart alignLastRight">test</p>
+ <p class="alignStart alignLastCenter">test</p>
+ <p class="alignStart alignLastJustify">test</p>
+ <p class="alignStart alignLastStart">test</p>
+ <p class="alignStart alignLastEnd">test</p>
+ <p class="alignEnd alignLastAuto">test</p>
+ <p class="alignEnd alignLastLeft">test</p>
+ <p class="alignEnd alignLastRight">test</p>
+ <p class="alignEnd alignLastCenter">test</p>
+ <p class="alignEnd alignLastJustify">test</p>
+ <p class="alignEnd alignLastStart">test</p>
+ <p class="alignEnd alignLastEnd">test</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/726392-1.html b/layout/reftests/text/726392-1.html
new file mode 100644
index 0000000000..e45288ad9a
--- /dev/null
+++ b/layout/reftests/text/726392-1.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <meta charset="utf-8">
+ <title>Bug 726392</title>
+ <style type="text/css">
+ p { margin: 0; letter-spacing: 10px}
+ .alignLeft { text-align: left; }
+ .alignRight { text-align: right; }
+ .alignCenter { text-align: center; }
+ .alignJustify { text-align: justify; }
+ .alignStart { text-align: start; }
+ .alignEnd { text-align: end; }
+ .alignLastAuto { text-align-last: auto; }
+ .alignLastLeft { text-align-last: left; }
+ .alignLastRight { text-align-last: right; }
+ .alignLastCenter { text-align-last: center; }
+ .alignLastJustify { text-align-last: justify; }
+ .alignLastStart { text-align-last: start; }
+ .alignLastEnd { text-align-last: end; }
+ </style>
+</head>
+ <body>
+ <div id="e" style="width:50%">
+ <p class="alignLeft alignLastAuto">test</p>
+ <p class="alignLeft alignLastLeft">test</p>
+ <p class="alignLeft alignLastRight">test</p>
+ <p class="alignLeft alignLastCenter">test</p>
+ <p class="alignLeft alignLastJustify">test</p>
+ <p class="alignLeft alignLastStart">test</p>
+ <p class="alignLeft alignLastEnd">test</p>
+ <p class="alignJustify alignLastAuto">test</p>
+ <p class="alignJustify alignLastLeft">test</p>
+ <p class="alignJustify alignLastRight">test</p>
+ <p class="alignJustify alignLastCenter">test</p>
+ <p class="alignJustify alignLastJustify">test</p>
+ <p class="alignJustify alignLastStart">test</p>
+ <p class="alignJustify alignLastEnd">test</p>
+ <p class="alignStart alignLastAuto">test</p>
+ <p class="alignStart alignLastLeft">test</p>
+ <p class="alignStart alignLastRight">test</p>
+ <p class="alignStart alignLastCenter">test</p>
+ <p class="alignStart alignLastJustify">test</p>
+ <p class="alignStart alignLastStart">test</p>
+ <p class="alignStart alignLastEnd">test</p>
+ <p class="alignEnd alignLastAuto">test</p>
+ <p class="alignEnd alignLastLeft">test</p>
+ <p class="alignEnd alignLastRight">test</p>
+ <p class="alignEnd alignLastCenter">test</p>
+ <p class="alignEnd alignLastJustify">test</p>
+ <p class="alignEnd alignLastStart">test</p>
+ <p class="alignEnd alignLastEnd">test</p>
+
+<script type="text/javascript">
+function resizeElements()
+{
+ var enclosingDiv = document.getElementById("e");
+ enclosingDiv.style.width = "100%";
+ document.documentElement.removeAttribute("class");
+}
+
+document.addEventListener("MozReftestInvalidate", resizeElements);
+</script>
+
+</body>
+</html>
diff --git a/layout/reftests/text/726392-2-ref.html b/layout/reftests/text/726392-2-ref.html
new file mode 100644
index 0000000000..645c49b033
--- /dev/null
+++ b/layout/reftests/text/726392-2-ref.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Bug 726392</title>
+ <style type="text/css">
+ p { margin: 0; }
+ .alignLeft { text-align: left; }
+ .alignRight { text-align: right; }
+ .alignCenter { text-align: center; }
+ .alignJustify { text-align: justify; }
+ .alignStart { text-align: start; }
+ .alignEnd { text-align: end; }
+ .alignLastAuto { text-align-last: auto; }
+ .alignLastLeft { text-align-last: left; }
+ .alignLastRight { text-align-last: right; }
+ .alignLastCenter { text-align-last: center; }
+ .alignLastJustify { text-align-last: justify; }
+ .alignLastStart { text-align-last: start; }
+ .alignLastEnd { text-align-last: end; }
+ </style>
+</head>
+ <body dir="rtl">
+ <p dir="rtl" class="alignLeft alignLastAuto">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastLeft">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastRight">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastCenter">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastJustify">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastStart">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastEnd">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastAuto">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastLeft">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastRight">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastCenter">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastJustify">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastStart">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastEnd">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastAuto">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastLeft">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastRight">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastCenter">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastJustify">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastStart">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastEnd">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastAuto">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastLeft">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastRight">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastCenter">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastJustify">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastStart">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastEnd">בדיקה</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/726392-2.html b/layout/reftests/text/726392-2.html
new file mode 100644
index 0000000000..57b58e32fc
--- /dev/null
+++ b/layout/reftests/text/726392-2.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <meta charset="utf-8">
+ <title>Bug 726392</title>
+ <style type="text/css">
+ p { margin: 0; }
+ .alignLeft { text-align: left; }
+ .alignRight { text-align: right; }
+ .alignCenter { text-align: center; }
+ .alignJustify { text-align: justify; }
+ .alignStart { text-align: start; }
+ .alignEnd { text-align: end; }
+ .alignLastAuto { text-align-last: auto; }
+ .alignLastLeft { text-align-last: left; }
+ .alignLastRight { text-align-last: right; }
+ .alignLastCenter { text-align-last: center; }
+ .alignLastJustify { text-align-last: justify; }
+ .alignLastStart { text-align-last: start; }
+ .alignLastEnd { text-align-last: end; }
+ </style>
+</head>
+ <body>
+ <div id="e" style="width:50%">
+ <p dir="rtl" class="alignLeft alignLastAuto">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastLeft">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastRight">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastCenter">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastJustify">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastStart">בדיקה</p>
+ <p dir="rtl" class="alignLeft alignLastEnd">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastAuto">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastLeft">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastRight">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastCenter">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastJustify">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastStart">בדיקה</p>
+ <p dir="rtl" class="alignJustify alignLastEnd">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastAuto">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastLeft">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastRight">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastCenter">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastJustify">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastStart">בדיקה</p>
+ <p dir="rtl" class="alignStart alignLastEnd">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastAuto">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastLeft">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastRight">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastCenter">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastJustify">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastStart">בדיקה</p>
+ <p dir="rtl" class="alignEnd alignLastEnd">בדיקה</p>
+ </div>
+<script type="text/javascript">
+function resizeElements()
+{
+ var enclosingDiv = document.getElementById("e");
+ enclosingDiv.style.width = "100%";
+ document.documentElement.removeAttribute("class");
+}
+
+document.addEventListener("MozReftestInvalidate", resizeElements);
+</script>
+
+</body>
+</html>
diff --git a/layout/reftests/text/726392-3-ref.html b/layout/reftests/text/726392-3-ref.html
new file mode 100644
index 0000000000..338e7ba85c
--- /dev/null
+++ b/layout/reftests/text/726392-3-ref.html
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8">
+ <title>Bug 726392</title>
+ <style type="text/css">
+ p { margin: 0; white-space: pre-line; letter-spacing: 10px; font-size:6px;}
+ .alignLeft { text-align: left; }
+ .alignRight { text-align: right; }
+ .alignCenter { text-align: center; }
+ .alignJustify { text-align: justify; }
+ .alignStart { text-align: start; }
+ .alignEnd { text-align: end; }
+ .alignLastAuto { text-align-last: auto; }
+ .alignLastLeft { text-align-last: left; }
+ .alignLastRight { text-align-last: right; }
+ .alignLastCenter { text-align-last: center; }
+ .alignLastJustify { text-align-last: justify; }
+ .alignLastStart { text-align-last: start; }
+ .alignLastEnd { text-align-last: end; }
+ </style>
+</head>
+ <body style="width:590px; height:590px;">
+ <div>
+ <p class="alignLeft alignLastAuto">test
+test</p>
+ <p class="alignLeft alignLastLeft">test
+test</p>
+ <p class="alignLeft alignLastRight">test
+test</p>
+ <p class="alignLeft alignLastCenter">test
+test</p>
+ <p class="alignLeft alignLastJustify">test
+test</p>
+ <p class="alignLeft alignLastStart">test
+test</p>
+ <p class="alignLeft alignLastEnd">test
+test</p>
+ <p class="alignJustify alignLastAuto">test
+test</p>
+ <p class="alignJustify alignLastLeft">test
+test</p>
+ <p class="alignJustify alignLastRight">test
+test</p>
+ <p class="alignJustify alignLastCenter">test
+test</p>
+ <p class="alignJustify alignLastJustify">test
+test</p>
+ <p class="alignJustify alignLastStart">test
+test</p>
+ <p class="alignJustify alignLastEnd">test
+test</p>
+ <p class="alignStart alignLastAuto">test
+test</p>
+ <p class="alignStart alignLastLeft">test
+test</p>
+ <p class="alignStart alignLastRight">test
+test</p>
+ <p class="alignStart alignLastCenter">test
+test</p>
+ <p class="alignStart alignLastJustify">test
+test</p>
+ <p class="alignStart alignLastStart">test
+test</p>
+ <p class="alignStart alignLastEnd">test
+test</p>
+ <p class="alignEnd alignLastAuto">test
+test</p>
+ <p class="alignEnd alignLastLeft">test
+test</p>
+ <p class="alignEnd alignLastRight">test
+test</p>
+ <p class="alignEnd alignLastCenter">test
+test</p>
+ <p class="alignEnd alignLastJustify">test
+test</p>
+ <p class="alignEnd alignLastStart">test
+test</p>
+ <p class="alignEnd alignLastEnd">test
+test</p>
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/726392-3.html b/layout/reftests/text/726392-3.html
new file mode 100644
index 0000000000..76a7b284b9
--- /dev/null
+++ b/layout/reftests/text/726392-3.html
@@ -0,0 +1,94 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <head>
+ <meta charset="utf-8">
+ <title>Bug 726392</title>
+ <style type="text/css">
+ p { margin: 0; white-space: pre-line; letter-spacing: 10px; font-size:6px;}
+ .alignLeft { text-align: left; }
+ .alignRight { text-align: right; }
+ .alignCenter { text-align: center; }
+ .alignJustify { text-align: justify; }
+ .alignStart { text-align: start; }
+ .alignEnd { text-align: end; }
+ .alignLastAuto { text-align-last: auto; }
+ .alignLastLeft { text-align-last: left; }
+ .alignLastRight { text-align-last: right; }
+ .alignLastCenter { text-align-last: center; }
+ .alignLastJustify { text-align-last: justify; }
+ .alignLastStart { text-align-last: start; }
+ .alignLastEnd { text-align-last: end; }
+ </style>
+</head>
+ <body style="width:590px; height:590px;">
+ <div id="e" style="width:50%">
+ <p class="alignLeft alignLastAuto">test
+test</p>
+ <p class="alignLeft alignLastLeft">test
+test</p>
+ <p class="alignLeft alignLastRight">test
+test</p>
+ <p class="alignLeft alignLastCenter">test
+test</p>
+ <p class="alignLeft alignLastJustify">test
+test</p>
+ <p class="alignLeft alignLastStart">test
+test</p>
+ <p class="alignLeft alignLastEnd">test
+test</p>
+ <p class="alignJustify alignLastAuto">test
+test</p>
+ <p class="alignJustify alignLastLeft">test
+test</p>
+ <p class="alignJustify alignLastRight">test
+test</p>
+ <p class="alignJustify alignLastCenter">test
+test</p>
+ <p class="alignJustify alignLastJustify">test
+test</p>
+ <p class="alignJustify alignLastStart">test
+test</p>
+ <p class="alignJustify alignLastEnd">test
+test</p>
+ <p class="alignStart alignLastAuto">test
+test</p>
+ <p class="alignStart alignLastLeft">test
+test</p>
+ <p class="alignStart alignLastRight">test
+test</p>
+ <p class="alignStart alignLastCenter">test
+test</p>
+ <p class="alignStart alignLastJustify">test
+test</p>
+ <p class="alignStart alignLastStart">test
+test</p>
+ <p class="alignStart alignLastEnd">test
+test</p>
+ <p class="alignEnd alignLastAuto">test
+test</p>
+ <p class="alignEnd alignLastLeft">test
+test</p>
+ <p class="alignEnd alignLastRight">test
+test</p>
+ <p class="alignEnd alignLastCenter">test
+test</p>
+ <p class="alignEnd alignLastJustify">test
+test</p>
+ <p class="alignEnd alignLastStart">test
+test</p>
+ <p class="alignEnd alignLastEnd">test
+test</p>
+ </div>
+<script type="text/javascript">
+function resizeElements()
+{
+ var enclosingDiv = document.getElementById("e");
+ enclosingDiv.style.width = "100%";
+ document.documentElement.removeAttribute("class");
+}
+
+document.addEventListener("MozReftestInvalidate", resizeElements);
+</script>
+
+</body>
+</html>
diff --git a/layout/reftests/text/745555-1-ref.html b/layout/reftests/text/745555-1-ref.html
new file mode 100644
index 0000000000..5a411b9bc8
--- /dev/null
+++ b/layout/reftests/text/745555-1-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html;charset=utf-8">
+<title>Bug 745555 - line-wrapping with uppercased es-zet</title>
+<style type="text/css">
+div {
+ font-family: monospace;
+ display: inline-block;
+ border: 1px solid red;
+ vertical-align: top;
+}
+</style>
+</head>
+<body>
+<div style="width:3.0em">SS SS SS SS SS</div>
+<div style="width:3.2em">SS SS SS SS SS</div>
+<div style="width:3.4em">SS SS SS SS SS</div>
+<div style="width:3.6em">SS SS SS SS SS</div>
+<div style="width:3.8em">SS SS SS SS SS</div>
+<div style="width:4.0em">SS SS SS SS SS</div>
+<div style="width:4.2em">SS SS SS SS SS</div>
+<div style="width:4.4em">SS SS SS SS SS</div>
+<div style="width:4.6em">SS SS SS SS SS</div>
+<div style="width:4.8em">SS SS SS SS SS</div>
+<div style="width:5.0em">SS SS SS SS SS</div>
+</body>
+</html>
diff --git a/layout/reftests/text/745555-1.html b/layout/reftests/text/745555-1.html
new file mode 100644
index 0000000000..09b2448f53
--- /dev/null
+++ b/layout/reftests/text/745555-1.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html;charset=utf-8">
+<title>Bug 745555 - line-wrapping with uppercased es-zet</title>
+<style type="text/css">
+div {
+ font-family: monospace;
+ text-transform: uppercase;
+ display: inline-block;
+ border: 1px solid red;
+ vertical-align: top;
+}
+</style>
+</head>
+<body>
+<div style="width:3.0em">ß ß ß ß ß</div>
+<div style="width:3.2em">ß ß ß ß ß</div>
+<div style="width:3.4em">ß ß ß ß ß</div>
+<div style="width:3.6em">ß ß ß ß ß</div>
+<div style="width:3.8em">ß ß ß ß ß</div>
+<div style="width:4.0em">ß ß ß ß ß</div>
+<div style="width:4.2em">ß ß ß ß ß</div>
+<div style="width:4.4em">ß ß ß ß ß</div>
+<div style="width:4.6em">ß ß ß ß ß</div>
+<div style="width:4.8em">ß ß ß ß ß</div>
+<div style="width:5.0em">ß ß ß ß ß</div>
+</body>
+</html>
diff --git a/layout/reftests/text/745555-2-ref.html b/layout/reftests/text/745555-2-ref.html
new file mode 100644
index 0000000000..5bafb6b057
--- /dev/null
+++ b/layout/reftests/text/745555-2-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html;charset=utf-8">
+<title>Bug 745555 - preformatted tabs/newlines with uppercased es-zet</title>
+</head>
+<body>
+<pre>
+FOO SSAR BASS
+ FOOBAR
+THE QUICK BROWN FOX JUMPSS
+</pre>
+</body>
+</html>
diff --git a/layout/reftests/text/745555-2.html b/layout/reftests/text/745555-2.html
new file mode 100644
index 0000000000..243f0f860a
--- /dev/null
+++ b/layout/reftests/text/745555-2.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html;charset=utf-8">
+<title>Bug 745555 - preformatted tabs/newlines with uppercased es-zet</title>
+<style type="text/css">
+pre {
+ text-transform: uppercase;
+}
+</style>
+</head>
+<body>
+<pre>
+foo ßar baß
+ foobar
+the quick brown fox jumpß
+</pre>
+</body>
+</html>
diff --git a/layout/reftests/text/820255-ref.html b/layout/reftests/text/820255-ref.html
new file mode 100644
index 0000000000..5a872b4919
--- /dev/null
+++ b/layout/reftests/text/820255-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Test - Bug 820255</title>
+ </head>
+ <body>
+ <div>A&#x1680;<br>B</div>
+ <div>A&#x205F;<br>B</div>
+ </body>
+</html>
diff --git a/layout/reftests/text/820255.html b/layout/reftests/text/820255.html
new file mode 100644
index 0000000000..5f7afe7a90
--- /dev/null
+++ b/layout/reftests/text/820255.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ div { width: 0px; }
+ </style>
+ <title>Test - Bug 820255</title>
+ </head>
+ <body>
+ <div>A&#x1680;B</div>
+ <div>A&#x205F;B</div>
+ </body>
+</html>
diff --git a/layout/reftests/text/arabic-fallback-1-ref.html b/layout/reftests/text/arabic-fallback-1-ref.html
new file mode 100644
index 0000000000..15ab67df00
--- /dev/null
+++ b/layout/reftests/text/arabic-fallback-1-ref.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DroidSansArabic-noGSUB.ttf);
+}
+body {
+ font-family: test;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+<p>Arabic: &#xFE8D;&#xFEDF;&#xFECC;&#xFEAE;&#xFE91;&#xFEF2;</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-fallback-1.html b/layout/reftests/text/arabic-fallback-1.html
new file mode 100644
index 0000000000..091f3e48e0
--- /dev/null
+++ b/layout/reftests/text/arabic-fallback-1.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DroidSansArabic-noGSUB.ttf);
+}
+body {
+ font-family: test;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+<p>Arabic: &#x627;&#x644;&#x639;&#x631;&#x628;&#x64A;</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-fallback-2-ref.html b/layout/reftests/text/arabic-fallback-2-ref.html
new file mode 100644
index 0000000000..5f2ade3366
--- /dev/null
+++ b/layout/reftests/text/arabic-fallback-2-ref.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DroidSansArabic-noGSUB.ttf);
+}
+body {
+ font-family: test;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+<p>With vowels:
+&#xFE83;&#x064E;&#xFE91;&#x0652;&#xFEA0;&#x064E;&#xFEAA;&#x0650;&#xFEF3;&#x064E;&#x0651;&#xFE94;
+&#xFECB;&#x064E;&#xFEAE;&#x064E;&#xFE91;&#x0650;&#xFEF4;&#x064E;&#x0651;&#xFE94;
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-fallback-2.html b/layout/reftests/text/arabic-fallback-2.html
new file mode 100644
index 0000000000..5ad2e46cca
--- /dev/null
+++ b/layout/reftests/text/arabic-fallback-2.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DroidSansArabic-noGSUB.ttf);
+}
+body {
+ font-family: test;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+<p>With vowels:
+&#x0623;&#x064E;&#x0628;&#x0652;&#x062C;&#x064E;&#x062F;&#x0650;&#x064A;&#x064E;&#x0651;&#x0629;
+&#x0639;&#x064E;&#x0631;&#x064E;&#x0628;&#x0650;&#x064A;&#x064E;&#x0651;&#x0629;
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-fallback-3-ref.html b/layout/reftests/text/arabic-fallback-3-ref.html
new file mode 100644
index 0000000000..b7fb15922e
--- /dev/null
+++ b/layout/reftests/text/arabic-fallback-3-ref.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DroidSansArabic-noGSUB.ttf);
+}
+body {
+ font-family: test;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+<p>Ligatures: &#xFEFB; &#xFEDF;&#xFEFC;</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-fallback-3.html b/layout/reftests/text/arabic-fallback-3.html
new file mode 100644
index 0000000000..ed05df74b0
--- /dev/null
+++ b/layout/reftests/text/arabic-fallback-3.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DroidSansArabic-noGSUB.ttf);
+}
+body {
+ font-family: test;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+<p>Ligatures: &#x0644;&#x0627; &#x0644;&#x0644;&#x0627;</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-fallback-4-ref.html b/layout/reftests/text/arabic-fallback-4-ref.html
new file mode 100644
index 0000000000..3a1f3b7436
--- /dev/null
+++ b/layout/reftests/text/arabic-fallback-4-ref.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DroidSansArabic-noGSUB.ttf);
+}
+body {
+ font-family: test;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+<p>Ligature with vowel: &#xFEDF;&#x064E;&#xFE8E;</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-fallback-4.html b/layout/reftests/text/arabic-fallback-4.html
new file mode 100644
index 0000000000..6a18456f63
--- /dev/null
+++ b/layout/reftests/text/arabic-fallback-4.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DroidSansArabic-noGSUB.ttf);
+}
+body {
+ font-family: test;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+<p>Ligature with vowel: &#x0644;&#x064E;&#x0627;</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-final-ligature-spacing-ref.html b/layout/reftests/text/arabic-final-ligature-spacing-ref.html
new file mode 100644
index 0000000000..63dbff9911
--- /dev/null
+++ b/layout/reftests/text/arabic-final-ligature-spacing-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<style>
+p { font: 36px Geeza Pro, sans-serif; }
+</style>
+
+<p>&#x633;&#x644;&#x627;&#x645;</p>
diff --git a/layout/reftests/text/arabic-final-ligature-spacing.html b/layout/reftests/text/arabic-final-ligature-spacing.html
new file mode 100644
index 0000000000..7ecae5f489
--- /dev/null
+++ b/layout/reftests/text/arabic-final-ligature-spacing.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<style>
+p { font: 36px Geeza Pro, sans-serif; }
+span { font-variant: small-caps; }
+</style>
+
+<!-- bug 739117: breaking the run after the lam-alef ligature
+ should NOT cause extra space to appear -->
+<p>&#x633;&#x644;&#x627;<span>&#x645;</span></p>
diff --git a/layout/reftests/text/arabic-marks-1-ref.html b/layout/reftests/text/arabic-marks-1-ref.html
new file mode 100644
index 0000000000..78c86992aa
--- /dev/null
+++ b/layout/reftests/text/arabic-marks-1-ref.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>bug 873902 - marks should not affect width of Arabic text</title>
+<style>
+body {
+ background-color: white;
+ font-size: 50px;
+ margin: 20px;
+}
+
+/* Try several fonts that should be available on Windows; at least Courier New is also on OS X.
+ Elsewhere, we may fall back to default, which may or may not be "interesting" to test,
+ but should pass harmlessly unless there's actually a broken font that shapes badly. */
+#a {
+ font-family: Andalus;
+}
+#b {
+ font-family: Courier New;
+}
+#c {
+ font-family: Simplified Arabic;
+}
+
+.test {
+ color: white;
+}
+</style>
+</head>
+<body>
+<div id="a">
+foo<span class="test">الرحمن الرحيم</span>bar
+</div>
+<div id="b">
+foo<span class="test">الرحمن الرحيم</span>bar
+</div>
+<div id="c">
+foo<span class="test">الرحمن الرحيم</span>bar
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-marks-1.html b/layout/reftests/text/arabic-marks-1.html
new file mode 100644
index 0000000000..442de13ab7
--- /dev/null
+++ b/layout/reftests/text/arabic-marks-1.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>bug 873902 - marks should not affect width of Arabic text</title>
+<style>
+body {
+ background-color: white;
+ font-size: 50px;
+ margin: 20px;
+}
+
+/* Try several fonts that should be available on Windows; at least Courier New is also on OS X.
+ Elsewhere, we may fall back to default, which may or may not be "interesting" to test,
+ but should pass harmlessly unless there's actually a broken font that shapes badly. */
+#a {
+ font-family: Andalus;
+}
+#b {
+ font-family: Courier New;
+}
+#c {
+ font-family: Simplified Arabic;
+}
+
+.test {
+ color: white;
+}
+</style>
+</head>
+<body>
+<div id="a">
+foo<span class="test">الرَّحْمَنِ الرَّحِيمِ</span>bar
+</div>
+<div id="b">
+foo<span class="test">الرَّحْمَنِ الرَّحِيمِ</span>bar
+</div>
+<div id="c">
+foo<span class="test">الرَّحْمَنِ الرَّحِيمِ</span>bar
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-shaping-1-ref.html b/layout/reftests/text/arabic-shaping-1-ref.html
new file mode 100644
index 0000000000..eed7babab2
--- /dev/null
+++ b/layout/reftests/text/arabic-shaping-1-ref.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+body {
+ font-family: test;
+ font-size: 60pt;
+}
+</style>
+</head>
+<body>
+<p>Arabic: &#xFE8D;&#xFEDF;&#xFECC;&#xFEAE;&#xFE91;&#xFEF2;</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arabic-shaping-1.html b/layout/reftests/text/arabic-shaping-1.html
new file mode 100644
index 0000000000..e75e674ca8
--- /dev/null
+++ b/layout/reftests/text/arabic-shaping-1.html
@@ -0,0 +1,17 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+body {
+ font-family: test;
+ font-size: 60pt;
+}
+</style>
+</head>
+<body>
+<p>Arabic: &#x627;&#x644;&#x639;&#x631;&#x628;&#x64A;</p>
+</body>
+</html>
diff --git a/layout/reftests/text/arial-bold-lam-alef-1-ref.html b/layout/reftests/text/arial-bold-lam-alef-1-ref.html
new file mode 100644
index 0000000000..91a9445246
--- /dev/null
+++ b/layout/reftests/text/arial-bold-lam-alef-1-ref.html
@@ -0,0 +1,5 @@
+<html>
+<body style="font-family: arial; font-size: 36px; font-weight: bold;">
+&#xFEFB; &#xFEDF;&#xFEFC;
+</body>
+</html>
diff --git a/layout/reftests/text/arial-bold-lam-alef-1.html b/layout/reftests/text/arial-bold-lam-alef-1.html
new file mode 100644
index 0000000000..2772932d70
--- /dev/null
+++ b/layout/reftests/text/arial-bold-lam-alef-1.html
@@ -0,0 +1,5 @@
+<html>
+<body style="font-family: arial; font-size: 36px; font-weight: bold;">
+&#x644;&#x627; &#x644;&#x644;&#x627;
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-1-notref.html b/layout/reftests/text/auto-hyphenation-1-notref.html
new file mode 100644
index 0000000000..8900244311
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-1-notref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body lang="en-us">
+<div style="width: 5em; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-1-ref.html b/layout/reftests/text/auto-hyphenation-1-ref.html
new file mode 100644
index 0000000000..98a59945d6
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-1-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body lang="en-us">
+<div style="width: 5em; hyphens: manual; font-family:sans-serif;">
+su&shy;per&shy;cal&shy;ifrag&shy;ilis&shy;tic&shy;ex&shy;pi&shy;ali&shy;do&shy;cious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-1.html b/layout/reftests/text/auto-hyphenation-1.html
new file mode 100644
index 0000000000..5822adbef1
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-1.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<!-- simple test for automatic hyphenation -->
+<body lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-10-ref.html b/layout/reftests/text/auto-hyphenation-10-ref.html
new file mode 100644
index 0000000000..8914ccbfe1
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-10-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<meta charset="UTF-8">
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: none;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-10.html b/layout/reftests/text/auto-hyphenation-10.html
new file mode 100644
index 0000000000..3411208b5a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-10.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<meta charset="UTF-8">
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-1a.html b/layout/reftests/text/auto-hyphenation-1a.html
new file mode 100644
index 0000000000..2e82f92185
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-1a.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<!-- adding random <span>s should not affect hyphenation -->
+<body lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+super<span>cali</span>frag<span>ili</span>sti<span>cex</span>pialidoc<span>i</span>ous
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-2-ref.html b/layout/reftests/text/auto-hyphenation-2-ref.html
new file mode 100644
index 0000000000..bfb1a4c3bd
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-2-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<body lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+<span style="hyphens:none">super<span lang="foo">cali</span>fragilisticexpialidocious</span>
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-2.html b/layout/reftests/text/auto-hyphenation-2.html
new file mode 100644
index 0000000000..45f5aaa991
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-2.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<!-- mixed languages in a word should inhibit automatic hyphenation -->
+<body lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+super<span lang="foo">cali</span>fragilisticexpialidocious
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-3-ref.html b/layout/reftests/text/auto-hyphenation-3-ref.html
new file mode 100644
index 0000000000..99c4fb38b1
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-3-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body lang="en-us">
+<div style="width: 5em;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-3.html b/layout/reftests/text/auto-hyphenation-3.html
new file mode 100644
index 0000000000..5ebb1a12ba
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-3.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<!-- check that hyphens:none prevents break at &shy; -->
+<body lang="en-us">
+<div style="width: 5em; hyphens: none;">
+su&shy;per&shy;cal&shy;ifrag&shy;ilis&shy;tic&shy;ex&shy;pi&shy;ali&shy;do&shy;cious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-4-ref.html b/layout/reftests/text/auto-hyphenation-4-ref.html
new file mode 100644
index 0000000000..68cfcf6008
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-4-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body lang="x-unknown-language">
+<div style="width: 5em; hyphens: none;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-4.html b/layout/reftests/text/auto-hyphenation-4.html
new file mode 100644
index 0000000000..82d187e252
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-4.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<!-- check that hyphenation is not applied to unknown language -->
+<body lang="x-unknown-language">
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-5-ref.html b/layout/reftests/text/auto-hyphenation-5-ref.html
new file mode 100644
index 0000000000..a390ad72a8
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-5-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+div {
+ margin: 10px;
+ width: 10px;
+ font-family: monospace;
+ hyphens: manual;
+}
+</style>
+</head>
+<!-- test some hyphenations that involve overlapping patterns -->
+<body lang="en-us">
+<div>
+photo
+</div>
+<div>
+pho&shy;to&shy;graph
+</div>
+<div>
+pho&shy;tog&shy;ra&shy;pher
+</div>
+<div>
+pho&shy;to&shy;graph&shy;i&shy;cal
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-5.html b/layout/reftests/text/auto-hyphenation-5.html
new file mode 100644
index 0000000000..5075612398
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-5.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+div {
+ margin: 10px;
+ width: 10px;
+ font-family: monospace;
+ hyphens: auto;
+}
+</style>
+</head>
+<!-- test some hyphenations that involve overlapping patterns -->
+<body lang="en-us">
+<div>
+photo
+</div>
+<div>
+photograph
+</div>
+<div>
+photographer
+</div>
+<div>
+photographical
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-6-ref.html b/layout/reftests/text/auto-hyphenation-6-ref.html
new file mode 100644
index 0000000000..3ec974024e
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-6-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body lang="en-us">
+<div style="width: 0; hyphens: manual;">
+hy&shy;<span style="color:red">phen&shy;</span>ation
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-6.html b/layout/reftests/text/auto-hyphenation-6.html
new file mode 100644
index 0000000000..5f66d64e2a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-6.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<!-- style changes don't break hyphenation -->
+<body lang="en-us">
+<div style="width: 0; hyphens: auto;">
+hy<span style="color:red">phen</span>ation
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-7-ref.html b/layout/reftests/text/auto-hyphenation-7-ref.html
new file mode 100644
index 0000000000..5ac5916ce3
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-7-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body lang="en-us">
+<div style="width: 0; hyphens: manual;">
+h<span style="color:red">y&shy;phen&shy;a</span>tion
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-7.html b/layout/reftests/text/auto-hyphenation-7.html
new file mode 100644
index 0000000000..9b95cc1945
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-7.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<!-- style changes don't break hyphenation -->
+<body lang="en-us">
+<div style="width: 0; hyphens: auto;">
+h<span style="color:red">yphena</span>tion
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-8-ref.html b/layout/reftests/text/auto-hyphenation-8-ref.html
new file mode 100644
index 0000000000..7854c5d2ff
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-8-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: none;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-8.html b/layout/reftests/text/auto-hyphenation-8.html
new file mode 100644
index 0000000000..7dd93503d6
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-8.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-9-ref.html b/layout/reftests/text/auto-hyphenation-9-ref.html
new file mode 100644
index 0000000000..54c2006697
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-9-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<meta charset="iso-8859-1">
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: none;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-9.html b/layout/reftests/text/auto-hyphenation-9.html
new file mode 100644
index 0000000000..6eae8d4e97
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-9.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<meta charset="iso-8859-1">
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-af-1-ref.html b/layout/reftests/text/auto-hyphenation-af-1-ref.html
new file mode 100644
index 0000000000..40e2951da8
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-af-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="af">
+Alle mens&shy;li&shy;ke we&shy;sens word vry, met ge&shy;ly&shy;ke waar&shy;dig&shy;heid en reg&shy;te, ge&shy;bo&shy;re.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-af-1.html b/layout/reftests/text/auto-hyphenation-af-1.html
new file mode 100644
index 0000000000..5803ed2e1a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-af-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="af">
+Alle menslike wesens word vry, met gelyke waardigheid en regte, gebore.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-bg-1-ref.html b/layout/reftests/text/auto-hyphenation-bg-1-ref.html
new file mode 100644
index 0000000000..a214a7a76d
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-bg-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="bg">
+Всички хо&shy;ра се раж&shy;дат сво&shy;бод&shy;ни и рав&shy;ни по дос&shy;тойн&shy;с&shy;т&shy;во и пра&shy;ва.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-bg-1.html b/layout/reftests/text/auto-hyphenation-bg-1.html
new file mode 100644
index 0000000000..c1fb848f60
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-bg-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="bg">
+Всички хора се раждат свободни и равни по достойнство и права.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-bn-1-ref.html b/layout/reftests/text/auto-hyphenation-bn-1-ref.html
new file mode 100644
index 0000000000..1c6254b956
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-bn-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="bn" style="width:0; hyphens:manual;">
+সম&shy;স্ত মা&shy;নুষ স্বা&shy;ধী&shy;ন&shy;ভা&shy;বে সমান মর্যা&shy;দা এবং অধি&shy;কার নি&shy;য়ে জন্ম&shy;গ্র&shy;হণ করে।
diff --git a/layout/reftests/text/auto-hyphenation-bn-1.html b/layout/reftests/text/auto-hyphenation-bn-1.html
new file mode 100644
index 0000000000..a0488ceff9
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-bn-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="bn" style="width:0; hyphens:auto;">
+সমস্ত মানুষ স্বাধীনভাবে সমান মর্যাদা এবং অধিকার নিয়ে জন্মগ্রহণ করে।
diff --git a/layout/reftests/text/auto-hyphenation-ca-1-ref.html b/layout/reftests/text/auto-hyphenation-ca-1-ref.html
new file mode 100644
index 0000000000..bf029b5958
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ca-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="ca">
+Tots els és&shy;sers hu&shy;mans nei&shy;xen lliu&shy;res i iguals en dig&shy;ni&shy;tat i en drets.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-ca-1.html b/layout/reftests/text/auto-hyphenation-ca-1.html
new file mode 100644
index 0000000000..1e8c9f23bc
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ca-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="ca">
+Tots els éssers humans neixen lliures i iguals en dignitat i en drets.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-cy-1-ref.html b/layout/reftests/text/auto-hyphenation-cy-1-ref.html
new file mode 100644
index 0000000000..b182e9b381
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-cy-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="cy">
+Genir pawb yn rhydd ac yn gyd&shy;radd â'i gil&shy;ydd mewn urdd&shy;as a hawl&shy;iau.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-cy-1.html b/layout/reftests/text/auto-hyphenation-cy-1.html
new file mode 100644
index 0000000000..43876c2ffa
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-cy-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="cy">
+Genir pawb yn rhydd ac yn gydradd â'i gilydd mewn urddas a hawliau.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-da-1-ref.html b/layout/reftests/text/auto-hyphenation-da-1-ref.html
new file mode 100644
index 0000000000..0efd813097
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-da-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="da">
+Alle men&shy;ne&shy;sker er født frie og li&shy;ge i vær&shy;dig&shy;hed og ret&shy;tig&shy;he&shy;der.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-da-1.html b/layout/reftests/text/auto-hyphenation-da-1.html
new file mode 100644
index 0000000000..3a2349403b
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-da-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="da">
+Alle mennesker er født frie og lige i værdighed og rettigheder.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-de-1901-1-ref.html b/layout/reftests/text/auto-hyphenation-de-1901-1-ref.html
new file mode 100644
index 0000000000..9c1faeb497
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-de-1901-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="de-1901">
+Al&shy;le Men&shy;schen sind frei und gleich an Wür&shy;de und Rech&shy;ten ge&shy;bo&shy;ren.
+<p>
+bu&shy;sser <!-- example word that is hyphenated differently by de-1901 and de-1996 -->
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-de-1901-1.html b/layout/reftests/text/auto-hyphenation-de-1901-1.html
new file mode 100644
index 0000000000..e795181f7b
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-de-1901-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="de-1901">
+Alle Menschen sind frei und gleich an Würde und Rechten geboren.
+<p>
+busser <!-- example word that is hyphenated differently by de-1901 and de-1996 -->
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-de-1996-1-ref.html b/layout/reftests/text/auto-hyphenation-de-1996-1-ref.html
new file mode 100644
index 0000000000..4294625533
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-de-1996-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="de-1996">
+Al&shy;le Men&shy;schen sind frei und gleich an Wür&shy;de und Rech&shy;ten ge&shy;bo&shy;ren.
+<p>
+bus&shy;ser <!-- example word that is hyphenated differently by de-1901 and de-1996 -->
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-de-1996-1.html b/layout/reftests/text/auto-hyphenation-de-1996-1.html
new file mode 100644
index 0000000000..fb542c4757
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-de-1996-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="de-1996">
+Alle Menschen sind frei und gleich an Würde und Rechten geboren.
+<p>
+busser <!-- example word that is hyphenated differently by de-1901 and de-1996 -->
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-de-ch-1-ref.html b/layout/reftests/text/auto-hyphenation-de-ch-1-ref.html
new file mode 100644
index 0000000000..f5b9e90a7a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-de-ch-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="de-CH">
+Al&shy;le Men&shy;schen sind frei und gleich an Wür&shy;de und Rech&shy;ten ge&shy;bo&shy;ren.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-de-ch-1.html b/layout/reftests/text/auto-hyphenation-de-ch-1.html
new file mode 100644
index 0000000000..7b41175419
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-de-ch-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="de-CH">
+Alle Menschen sind frei und gleich an Würde und Rechten geboren.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-eo-1-ref.html b/layout/reftests/text/auto-hyphenation-eo-1-ref.html
new file mode 100644
index 0000000000..f456c15945
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-eo-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="eo">
+Ĉiuj ho&shy;moj es&shy;tas de&shy;na&shy;s&shy;ke li&shy;be&shy;raj kaj ega&shy;laj laŭ di&shy;g&shy;no kaj raj&shy;toj.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-eo-1.html b/layout/reftests/text/auto-hyphenation-eo-1.html
new file mode 100644
index 0000000000..423ca95ae2
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-eo-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="eo">
+Ĉiuj homoj estas denaske liberaj kaj egalaj laŭ digno kaj rajtoj.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-es-1-ref.html b/layout/reftests/text/auto-hyphenation-es-1-ref.html
new file mode 100644
index 0000000000..24300ab510
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-es-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="es">
+Todos los se&shy;res hu&shy;ma&shy;nos na&shy;cen li&shy;bres e igua&shy;les en dig&shy;ni&shy;dad y de&shy;re&shy;chos
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-es-1.html b/layout/reftests/text/auto-hyphenation-es-1.html
new file mode 100644
index 0000000000..fa2c688510
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-es-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="es">
+Todos los seres humanos nacen libres e iguales en dignidad y derechos
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-et-1-ref.html b/layout/reftests/text/auto-hyphenation-et-1-ref.html
new file mode 100644
index 0000000000..0758d6c587
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-et-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="et">
+Kõik ini&shy;me&shy;sed sün&shy;nivad va&shy;ba&shy;de&shy;na ja võrds&shy;ete&shy;na oma vää&shy;ri&shy;ku&shy;selt ja õi&shy;gus&shy;telt
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-et-1.html b/layout/reftests/text/auto-hyphenation-et-1.html
new file mode 100644
index 0000000000..7009aa7ab3
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-et-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="et">
+Kõik inimesed sünnivad vabadena ja võrdsetena oma väärikuselt ja õigustelt
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-fi-1-ref.html b/layout/reftests/text/auto-hyphenation-fi-1-ref.html
new file mode 100644
index 0000000000..1bb845a405
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-fi-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="fi">
+Kaik&shy;ki ih&shy;mi&shy;set syn&shy;ty&shy;vät va&shy;pai&shy;na ja ta&shy;sa&shy;ver&shy;tai&shy;si&shy;na ar&shy;vol&shy;taan ja oi&shy;keuk&shy;sil&shy;taan.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-fi-1.html b/layout/reftests/text/auto-hyphenation-fi-1.html
new file mode 100644
index 0000000000..fcf377fbbd
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-fi-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="fi">
+Kaikki ihmiset syntyvät vapaina ja tasavertaisina arvoltaan ja oikeuksiltaan.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-fr-1-ref.html b/layout/reftests/text/auto-hyphenation-fr-1-ref.html
new file mode 100644
index 0000000000..696ebc45b5
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-fr-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="fr">
+Tout in&shy;di&shy;vi&shy;du a droit à la vie, à la li&shy;ber&shy;té et à la sû&shy;re&shy;té de sa per&shy;sonne.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-fr-1.html b/layout/reftests/text/auto-hyphenation-fr-1.html
new file mode 100644
index 0000000000..edc5b47b59
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-fr-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="fr">
+Tout individu a droit à la vie, à la liberté et à la sûreté de sa personne.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-gl-1-ref.html b/layout/reftests/text/auto-hyphenation-gl-1-ref.html
new file mode 100644
index 0000000000..f07e7c2173
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-gl-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="gl">
+Tódolos se&shy;res hu&shy;ma&shy;nos na&shy;cen li&shy;bres e iguais en dig&shy;ni&shy;da&shy;de e de&shy;rei&shy;tos
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-gl-1.html b/layout/reftests/text/auto-hyphenation-gl-1.html
new file mode 100644
index 0000000000..55627cc1cb
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-gl-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="gl">
+Tódolos seres humanos nacen libres e iguais en dignidade e dereitos
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-gu-1-ref.html b/layout/reftests/text/auto-hyphenation-gu-1-ref.html
new file mode 100644
index 0000000000..04d756a05a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-gu-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="gu" style="width:0; hyphens:manual;">
+પ્ર&shy;તિ&shy;ષ્ઠા અને અધિ&shy;કા&shy;રો&shy;ની દૃ&shy;ષ્ટિએ સર્વ મા&shy;ન&shy;વો જન્મ&shy;થી સ્વ&shy;તંત્ર અને સમાન હોય છે.
diff --git a/layout/reftests/text/auto-hyphenation-gu-1.html b/layout/reftests/text/auto-hyphenation-gu-1.html
new file mode 100644
index 0000000000..45531a9786
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-gu-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="gu" style="width:0; hyphens:auto;">
+પ્રતિષ્ઠા અને અધિકારોની દૃષ્ટિએ સર્વ માનવો જન્મથી સ્વતંત્ર અને સમાન હોય છે.
diff --git a/layout/reftests/text/auto-hyphenation-hi-1-ref.html b/layout/reftests/text/auto-hyphenation-hi-1-ref.html
new file mode 100644
index 0000000000..dd8a8f15b0
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-hi-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="hi" style="width:0; hyphens:manual;">
+सभी मनु&shy;ष्यों को गौ&shy;रव और अधि&shy;का&shy;रों के मा&shy;म&shy;ले में जन्म&shy;जात स्व&shy;त&shy;न्त्र&shy;ता और समा&shy;न&shy;ता प्रा&shy;प्त है ।
diff --git a/layout/reftests/text/auto-hyphenation-hi-1.html b/layout/reftests/text/auto-hyphenation-hi-1.html
new file mode 100644
index 0000000000..181804bfed
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-hi-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="hi" style="width:0; hyphens:auto;">
+सभी मनुष्यों को गौरव और अधिकारों के मामले में जन्मजात स्वतन्त्रता और समानता प्राप्त है ।
diff --git a/layout/reftests/text/auto-hyphenation-hr-1-ref.html b/layout/reftests/text/auto-hyphenation-hr-1-ref.html
new file mode 100644
index 0000000000..4911fffaa2
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-hr-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="hr">
+Sva ljud&shy;ska bi&shy;ća ra&shy;ća&shy;ju se slo&shy;bod&shy;na i jed&shy;na&shy;ka u dos&shy;to&shy;jans&shy;tvu i pra&shy;vi&shy;ma
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-hr-1.html b/layout/reftests/text/auto-hyphenation-hr-1.html
new file mode 100644
index 0000000000..02d902d71c
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-hr-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="hr">
+Sva ljudska bića raćaju se slobodna i jednaka u dostojanstvu i pravima
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-hsb-1-ref.html b/layout/reftests/text/auto-hyphenation-hsb-1-ref.html
new file mode 100644
index 0000000000..e999792056
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-hsb-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="hsb">
+Wšitcy čło&shy;wje&shy;ko&shy;jo su wot na&shy;ro&shy;da swo&shy;bod&shy;ni a su je&shy;na&shy;cy po do&shy;stoj&shy;nos&shy;ći a pra&shy;wach
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-hsb-1.html b/layout/reftests/text/auto-hyphenation-hsb-1.html
new file mode 100644
index 0000000000..45d921f8bd
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-hsb-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="hsb">
+Wšitcy čłowjekojo su wot naroda swobodni a su jenacy po dostojnosći a prawach
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-hu-1-ref.html b/layout/reftests/text/auto-hyphenation-hu-1-ref.html
new file mode 100644
index 0000000000..96945aa1dc
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-hu-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="hu">
+Minden em&shy;be&shy;ri lény sza&shy;ba&shy;don szü&shy;le&shy;tik és egyen&shy;lő mél&shy;tó&shy;sá&shy;ga és jo&shy;ga van.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-hu-1.html b/layout/reftests/text/auto-hyphenation-hu-1.html
new file mode 100644
index 0000000000..c74f6d725f
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-hu-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="hu">
+Minden emberi lény szabadon születik és egyenlő méltósága és joga van.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-ia-1-ref.html b/layout/reftests/text/auto-hyphenation-ia-1-ref.html
new file mode 100644
index 0000000000..bd4bbdeb31
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ia-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="ia">
+Tote le es&shy;se&shy;res hu&shy;man na&shy;sce li&shy;be&shy;re e equal in dig&shy;ni&shy;ta&shy;te e in de&shy;rec&shy;tos
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-ia-1.html b/layout/reftests/text/auto-hyphenation-ia-1.html
new file mode 100644
index 0000000000..dc5972cc00
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ia-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="ia">
+Tote le esseres human nasce libere e equal in dignitate e in derectos
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-is-1-ref.html b/layout/reftests/text/auto-hyphenation-is-1-ref.html
new file mode 100644
index 0000000000..76b6d43dc1
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-is-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="is">
+Hver mað&shy;ur er bor&shy;inn frjáls og jafn öðr&shy;um að virð&shy;ingu og rétt&shy;ind&shy;um
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-is-1.html b/layout/reftests/text/auto-hyphenation-is-1.html
new file mode 100644
index 0000000000..3efac1056f
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-is-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="is">
+Hver maður er borinn frjáls og jafn öðrum að virðingu og réttindum
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-it-1-ref.html b/layout/reftests/text/auto-hyphenation-it-1-ref.html
new file mode 100644
index 0000000000..25ac37d257
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-it-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="it">
+Tutti gli es&shy;se&shy;ri uma&shy;ni na&shy;sco&shy;no li&shy;be&shy;ri ed egua&shy;li in di&shy;gni&shy;tà e di&shy;rit&shy;ti.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-it-1.html b/layout/reftests/text/auto-hyphenation-it-1.html
new file mode 100644
index 0000000000..963c108982
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-it-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="it">
+Tutti gli esseri umani nascono liberi ed eguali in dignità e diritti.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-kmr-1-ref.html b/layout/reftests/text/auto-hyphenation-kmr-1-ref.html
new file mode 100644
index 0000000000..6af785c4b6
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-kmr-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="kmr">
+Hemû mi&shy;rov azad û di we&shy;qar û ma&shy;fan de we&shy;k&shy;hev tên din&shy;ya&shy;yê
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-kmr-1.html b/layout/reftests/text/auto-hyphenation-kmr-1.html
new file mode 100644
index 0000000000..43887b80f4
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-kmr-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="kmr">
+Hemû mirov azad û di weqar û mafan de wekhev tên dinyayê
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-kn-1-ref.html b/layout/reftests/text/auto-hyphenation-kn-1-ref.html
new file mode 100644
index 0000000000..f791517e8f
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-kn-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="kn" style="width:0; hyphens:manual;">
+ಎಲ್ಲಾ ಮಾ&shy;ನ&shy;ವ&shy;ರೂ ಸ್ವ&shy;ತಂ&shy;ತ್ರ&shy;ರಾ&shy;ಗಿ&shy;ಯೇ ಜನಿ&shy;ಸಿ&shy;ದ್ದಾ&shy;ರೆ. ಹಾ&shy;ಗೂ ಘನ&shy;ತೆ ಮತ್ತು ಹಕ್ಕು&shy;ಗ&shy;ಳ&shy;ಲ್ಲಿ ಸಮಾ&shy;ನ&shy;ರಾ&shy;ಗಿ&shy;ದ್ದಾ&shy;ರೆ.
diff --git a/layout/reftests/text/auto-hyphenation-kn-1.html b/layout/reftests/text/auto-hyphenation-kn-1.html
new file mode 100644
index 0000000000..9f520e17d4
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-kn-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="kn" style="width:0; hyphens:auto;">
+ಎಲ್ಲಾ ಮಾನವರೂ ಸ್ವತಂತ್ರರಾಗಿಯೇ ಜನಿಸಿದ್ದಾರೆ. ಹಾಗೂ ಘನತೆ ಮತ್ತು ಹಕ್ಕುಗಳಲ್ಲಿ ಸಮಾನರಾಗಿದ್ದಾರೆ.
diff --git a/layout/reftests/text/auto-hyphenation-la-1-ref.html b/layout/reftests/text/auto-hyphenation-la-1-ref.html
new file mode 100644
index 0000000000..03afab6f3e
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-la-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="la">
+Omnes ho&shy;mi&shy;nes di&shy;gni&shy;ta&shy;te et iu&shy;re li&shy;be&shy;ri et pa&shy;res na&shy;scun&shy;tur
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-la-1.html b/layout/reftests/text/auto-hyphenation-la-1.html
new file mode 100644
index 0000000000..bb76d0d428
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-la-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="la">
+Omnes homines dignitate et iure liberi et pares nascuntur
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-lt-1-ref.html b/layout/reftests/text/auto-hyphenation-lt-1-ref.html
new file mode 100644
index 0000000000..422d57b247
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-lt-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="lt">
+Visi žmo&shy;nės gims&shy;ta lais&shy;vi ir ly&shy;gūs sa&shy;vo oru&shy;mu ir tei&shy;sė&shy;mis.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-lt-1.html b/layout/reftests/text/auto-hyphenation-lt-1.html
new file mode 100644
index 0000000000..3c896a5655
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-lt-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="lt">
+Visi žmonės gimsta laisvi ir lygūs savo orumu ir teisėmis.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-ml-1-ref.html b/layout/reftests/text/auto-hyphenation-ml-1-ref.html
new file mode 100644
index 0000000000..4d8dc4619a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ml-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="ml" style="width:0; hyphens:manual;">
+മനു&shy;ഷ്യ&shy;രെ&shy;ല്ലാ&shy;വ&shy;രും തു&shy;ല്യാ&shy;വ&shy;കാ&shy;ശ&shy;ങ്ങ&shy;ളോ&shy;ടും അന്ത&shy;സ്സോ&shy;ടും സ്വാ&shy;ത&shy;ന്ത്ര്യ&shy;ത്തോ&shy;ടും&shy;കൂ&shy;ടി ജനി&shy;ച്ചി&shy;ട്ടു&shy;ള്ള&shy;വ&shy;രാ&shy;ണ്‌.
diff --git a/layout/reftests/text/auto-hyphenation-ml-1.html b/layout/reftests/text/auto-hyphenation-ml-1.html
new file mode 100644
index 0000000000..c5d421824c
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ml-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="ml" style="width:0; hyphens:auto;">
+മനുഷ്യരെല്ലാവരും തുല്യാവകാശങ്ങളോടും അന്തസ്സോടും സ്വാതന്ത്ര്യത്തോടുംകൂടി ജനിച്ചിട്ടുള്ളവരാണ്‌.
diff --git a/layout/reftests/text/auto-hyphenation-mn-1-ref.html b/layout/reftests/text/auto-hyphenation-mn-1-ref.html
new file mode 100644
index 0000000000..d2a3db12ba
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-mn-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="mn">
+Хүн бүр төрж мэнд&shy;лэ&shy;хэд эрх чө&shy;лөө&shy;тэй, адил&shy;хан нэр төр&shy;тэй, ижил эрх&shy;тэй бай&shy;даг
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-mn-1.html b/layout/reftests/text/auto-hyphenation-mn-1.html
new file mode 100644
index 0000000000..e00d43c253
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-mn-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="mn">
+Хүн бүр төрж мэндлэхэд эрх чөлөөтэй, адилхан нэр төртэй, ижил эрхтэй байдаг
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-nb-1-ref.html b/layout/reftests/text/auto-hyphenation-nb-1-ref.html
new file mode 100644
index 0000000000..6604655498
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-nb-1-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="nb">
+Alle men&shy;nes&shy;ker er født frie og med sam&shy;me men&shy;neske&shy;verd og men&shy;neske&shy;ret&shy;tig&shy;he&shy;ter.
+<p>
+<!-- words that differ in nb/nn locales -->
+at&shy;ten&shy;de
+be&shy;tre
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-nb-1.html b/layout/reftests/text/auto-hyphenation-nb-1.html
new file mode 100644
index 0000000000..e64396a67b
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-nb-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="nb">
+Alle mennesker er født frie og med samme menneskeverd og menneskerettigheter.
+<p>
+<!-- words that differ in nb/nn locales -->
+attende
+betre
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-nl-1-ref.html b/layout/reftests/text/auto-hyphenation-nl-1-ref.html
new file mode 100644
index 0000000000..ca6d1f516c
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-nl-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="nl">
+Alle men&shy;sen wor&shy;den vrij en ge&shy;lijk in waar&shy;dig&shy;heid en rech&shy;ten ge&shy;bo&shy;ren
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-nl-1.html b/layout/reftests/text/auto-hyphenation-nl-1.html
new file mode 100644
index 0000000000..e7cb9ab9e1
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-nl-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="nl">
+Alle mensen worden vrij en gelijk in waardigheid en rechten geboren
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-nn-1-ref.html b/layout/reftests/text/auto-hyphenation-nn-1-ref.html
new file mode 100644
index 0000000000..d20acf9e23
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-nn-1-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="nn">
+Alle men&shy;nes&shy;ke er fød&shy;de til fri&shy;dom og med same men&shy;neske&shy;verd og men&shy;neske&shy;ret&shy;tar.
+<p>
+<!-- words that differ in nb/nn locales -->
+att&shy;en&shy;de
+bet&shy;re
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-nn-1.html b/layout/reftests/text/auto-hyphenation-nn-1.html
new file mode 100644
index 0000000000..405966c9c2
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-nn-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="nn">
+Alle menneske er fødde til fridom og med same menneskeverd og menneskerettar.
+<p>
+<!-- words that differ in nb/nn locales -->
+attende
+betre
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-pa-1-ref.html b/layout/reftests/text/auto-hyphenation-pa-1-ref.html
new file mode 100644
index 0000000000..e89d0bb371
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-pa-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="pa" style="width:0; hyphens:manual;">
+ਸਾ&shy;ਰਾ ਮਨੁੱਖੀ ਪਰਿ&shy;ਵਾਰ ਆਪ&shy;ਣੀ ਮਹਿ&shy;ਮਾ, ਸ਼ਾਨ ਅਤੇ ਹੱਕਾਂ ਦੇ ਪੱਖੋਂ ਜਨਮ ਤੋਂ ਹੀ ਆਜ਼ਾਦ ਹੈ ਅਤੇ ਸੁ&shy;ਤੇ ਸਿੱਧ ਸਾ&shy;ਰੇ ਲੋਕ ਬਰਾ&shy;ਬਰ ਹਨ ।
diff --git a/layout/reftests/text/auto-hyphenation-pa-1.html b/layout/reftests/text/auto-hyphenation-pa-1.html
new file mode 100644
index 0000000000..ab932b8510
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-pa-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="pa" style="width:0; hyphens:auto;">
+ਸਾਰਾ ਮਨੁੱਖੀ ਪਰਿਵਾਰ ਆਪਣੀ ਮਹਿਮਾ, ਸ਼ਾਨ ਅਤੇ ਹੱਕਾਂ ਦੇ ਪੱਖੋਂ ਜਨਮ ਤੋਂ ਹੀ ਆਜ਼ਾਦ ਹੈ ਅਤੇ ਸੁਤੇ ਸਿੱਧ ਸਾਰੇ ਲੋਕ ਬਰਾਬਰ ਹਨ ।
diff --git a/layout/reftests/text/auto-hyphenation-pl-1-ref.html b/layout/reftests/text/auto-hyphenation-pl-1-ref.html
new file mode 100644
index 0000000000..6ed72f2717
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-pl-1-ref.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html lang="pl">
+<head>
+<meta charset="utf-8">
+<title>Polish hyphenation test</title>
+<style>
+body {
+ font-family: "Times New Roman", serif; /* prefer TNR to Times (default) on OS X... */
+ font-feature-settings: 'kern' off;
+}
+</style>
+</head>
+<body>
+<div style="white-space:pre-wrap;">Unikod
+przy-
+pi-
+su-
+je
+uni-
+kal-
+ny
+nu-
+mer
+każ-
+de-
+mu
+zna-
+ko-
+wi,
+nie-
+za-
+leż-
+ny
+od
+uży-
+wa-
+nej
+plat-
+for-
+my,
+pro-
+gra-
+mu
+czy
+ję-
+zy-
+ka.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-pl-1.html b/layout/reftests/text/auto-hyphenation-pl-1.html
new file mode 100644
index 0000000000..55fddc07b0
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-pl-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="pl">
+<head>
+<meta charset="utf-8">
+<title>Polish hyphenation test</title>
+<style>
+body {
+ font-family: "Times New Roman", serif; /* prefer TNR to Times (default) on OS X... */
+ font-feature-settings: 'kern' off;
+}
+</style>
+</head>
+<body>
+<div style="width:0pt; hyphens:auto">
+Unikod przypisuje unikalny numer każdemu znakowi,
+niezależny od używanej platformy,
+programu czy języka.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-pt-1-ref.html b/layout/reftests/text/auto-hyphenation-pt-1-ref.html
new file mode 100644
index 0000000000..b40616ef3c
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-pt-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="pt">
+Todos os se&shy;res hu&shy;ma&shy;nos nas&shy;cem li&shy;vres e iguais em dig&shy;ni&shy;da&shy;de e em di&shy;rei&shy;tos
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-pt-1.html b/layout/reftests/text/auto-hyphenation-pt-1.html
new file mode 100644
index 0000000000..d2b3a1c647
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-pt-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="pt">
+Todos os seres humanos nascem livres e iguais em dignidade e em direitos
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-ru-1-ref.html b/layout/reftests/text/auto-hyphenation-ru-1-ref.html
new file mode 100644
index 0000000000..6686b2c1a6
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ru-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="ru">
+Все лю&shy;ди рож&shy;да&shy;ют&shy;ся сво&shy;бод&shy;ны&shy;ми и рав&shy;ны&shy;ми в сво&shy;ем до&shy;сто&shy;ин&shy;стве и пра&shy;вах.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-ru-1.html b/layout/reftests/text/auto-hyphenation-ru-1.html
new file mode 100644
index 0000000000..859acd5237
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ru-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="ru">
+Все люди рождаются свободными и равными в своем достоинстве и правах.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sh-1-ref.html b/layout/reftests/text/auto-hyphenation-sh-1-ref.html
new file mode 100644
index 0000000000..dd183b26b5
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sh-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual; font-size:5px" lang="sh">
+Сва људ&shy;ска би&shy;ћа ра&shy;ђа&shy;ју се сло&shy;бод&shy;на и јед&shy;на&shy;ка у до&shy;сто&shy;јан&shy;ству и пра&shy;ви&shy;ма.
+<p>
+Sva ljud&shy;ska bi&shy;ća ra&shy;đa&shy;ju se slo&shy;bod&shy;na i jed&shy;na&shy;ka u do&shy;sto&shy;jan&shy;stvu i pra&shy;vi&shy;ma.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sh-1.html b/layout/reftests/text/auto-hyphenation-sh-1.html
new file mode 100644
index 0000000000..4b1c835415
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sh-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto; font-size:5px" lang="sh">
+Сва људска бића рађају се слободна и једнака у достојанству и правима.
+<p>
+Sva ljudska bića rađaju se slobodna i jednaka u dostojanstvu i pravima.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sl-1-ref.html b/layout/reftests/text/auto-hyphenation-sl-1-ref.html
new file mode 100644
index 0000000000..760b51ec7a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sl-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="sl">
+Vsi lju&shy;dje se ro&shy;di&shy;jo svo&shy;bo&shy;dni in ima&shy;jo ena&shy;ko do&shy;sto&shy;jan&shy;stvo in ena&shy;ke pra&shy;vi&shy;ce
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sl-1.html b/layout/reftests/text/auto-hyphenation-sl-1.html
new file mode 100644
index 0000000000..e59192aaa4
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sl-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="sl">
+Vsi ljudje se rodijo svobodni in imajo enako dostojanstvo in enake pravice
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sr-1-ref.html b/layout/reftests/text/auto-hyphenation-sr-1-ref.html
new file mode 100644
index 0000000000..a23fb56f0e
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sr-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual; font-size:5px" lang="sr">
+Сва људ&shy;ска би&shy;ћа ра&shy;ђа&shy;ју се сло&shy;бод&shy;на и јед&shy;на&shy;ка у до&shy;сто&shy;јан&shy;ству и пра&shy;ви&shy;ма.
+<p>
+Sva ljud&shy;ska bi&shy;ća ra&shy;đa&shy;ju se slo&shy;bod&shy;na i jed&shy;na&shy;ka u do&shy;sto&shy;jan&shy;stvu i pra&shy;vi&shy;ma.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sr-1.html b/layout/reftests/text/auto-hyphenation-sr-1.html
new file mode 100644
index 0000000000..1560fe9d3c
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sr-1.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto; font-size:5px" lang="sr">
+Сва људска бића рађају се слободна и једнака у достојанству и правима.
+<p>
+Sva ljudska bića rađaju se slobodna i jednaka u dostojanstvu i pravima.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sv-1-notref.html b/layout/reftests/text/auto-hyphenation-sv-1-notref.html
new file mode 100644
index 0000000000..02986a88de
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sv-1-notref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="en-US">
+Alla människor äro födda fria och lika i värde och rättigheter
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sv-1-ref.html b/layout/reftests/text/auto-hyphenation-sv-1-ref.html
new file mode 100644
index 0000000000..78ad51d406
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sv-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="sv">
+Alla män&shy;ni&shy;skor äro föd&shy;da fria och li&shy;ka i vär&shy;de och rät&shy;tig&shy;he&shy;ter
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-sv-1.html b/layout/reftests/text/auto-hyphenation-sv-1.html
new file mode 100644
index 0000000000..a2096ee6f4
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-sv-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="sv">
+Alla människor äro födda fria och lika i värde och rättigheter
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-ta-1-ref.html b/layout/reftests/text/auto-hyphenation-ta-1-ref.html
new file mode 100644
index 0000000000..9b6c1cba76
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ta-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="ta" style="width:0; hyphens:manual;">
+மனி&shy;தப் பி&shy;றி&shy;வி&shy;யி&shy;னர் சக&shy;ல&shy;ரும் சு&shy;தந்&shy;தி&shy;ர&shy;மா&shy;க&shy;வே பி&shy;றக்&shy;கின்&shy;றனர்; அவர்&shy;கள் மதிப்&shy;பி&shy;லும், உரி&shy;மை&shy;க&shy;ளி&shy;லும் சம&shy;மா&shy;ன&shy;வர்&shy;கள், அவர்&shy;கள் நி&shy;யா&shy;யத்&shy;தை&shy;யும் மனச்&shy;சாட்&shy;சி&shy;யை&shy;யும் இயற்&shy;பண்&shy;பா&shy;கப் பெற்&shy;ற&shy;வர்&shy;கள்.
diff --git a/layout/reftests/text/auto-hyphenation-ta-1.html b/layout/reftests/text/auto-hyphenation-ta-1.html
new file mode 100644
index 0000000000..230192528c
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-ta-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="ta" style="width:0; hyphens:auto;">
+மனிதப் பிறிவியினர் சகலரும் சுதந்திரமாகவே பிறக்கின்றனர்; அவர்கள் மதிப்பிலும், உரிமைகளிலும் சமமானவர்கள், அவர்கள் நியாயத்தையும் மனச்சாட்சியையும் இயற்பண்பாகப் பெற்றவர்கள்.
diff --git a/layout/reftests/text/auto-hyphenation-te-1-ref.html b/layout/reftests/text/auto-hyphenation-te-1-ref.html
new file mode 100644
index 0000000000..9069d85def
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-te-1-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="te" style="width:0; hyphens:manual;">
+ప్ర&shy;తి&shy;ప&shy;త్తి&shy;స్వ&shy;త్వ&shy;ముల వి&shy;ష&shy;య&shy;మున మా&shy;న&shy;వు&shy;లె&shy;ల్ల&shy;రు&shy;ను జన్మ&shy;తః స్వ&shy;తం&shy;త్రు&shy;లు&shy;ను సమా&shy;ను&shy;లు&shy;ను నగు&shy;దు&shy;రు.
diff --git a/layout/reftests/text/auto-hyphenation-te-1.html b/layout/reftests/text/auto-hyphenation-te-1.html
new file mode 100644
index 0000000000..c1c75312d6
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-te-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<div lang="te" style="width:0; hyphens:auto;">
+ప్రతిపత్తిస్వత్వముల విషయమున మానవులెల్లరును జన్మతః స్వతంత్రులును సమానులును నగుదురు.
diff --git a/layout/reftests/text/auto-hyphenation-tr-1-ref.html b/layout/reftests/text/auto-hyphenation-tr-1-ref.html
new file mode 100644
index 0000000000..f5827c0e9a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-tr-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="tr">
+Bütün in&shy;san&shy;lar hür, hay&shy;si&shy;yet ve hak&shy;lar ba&shy;kı&shy;mın&shy;dan eşit do&shy;ğar&shy;lar.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-tr-1.html b/layout/reftests/text/auto-hyphenation-tr-1.html
new file mode 100644
index 0000000000..fc6437182d
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-tr-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="tr">
+Bütün insanlar hür, haysiyet ve haklar bakımından eşit doğarlar.
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-transformed-1-ref.html b/layout/reftests/text/auto-hyphenation-transformed-1-ref.html
new file mode 100644
index 0000000000..dc13355076
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-transformed-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="de">
+<head>
+<meta charset="utf-8">
+<title>Test for auto hyphenation with text-transform</title>
+</head>
+<body>
+<div style="width:0px;">
+mas&shy;se<br>ma&shy;ße
+</div>
+<div style="width:0px;">
+MAS&shy;SE<br>MA&shy;SSE
+</div>
+<div style="width:0px;">
+Mas&shy;se<br>Ma&shy;ße
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-transformed-1.html b/layout/reftests/text/auto-hyphenation-transformed-1.html
new file mode 100644
index 0000000000..181c33b1d2
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-transformed-1.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="de">
+<head>
+<meta charset="utf-8">
+<title>Test for auto hyphenation with text-transform</title>
+</head>
+<body>
+<div style="width:0px; hyphens:auto">
+masse<br>maße
+</div>
+<div style="width:0px; hyphens:auto; text-transform:uppercase">
+masse<br>maße
+</div>
+<div style="width:0px; hyphens:auto; text-transform:capitalize">
+masse<br>maße
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-uk-1-ref.html b/layout/reftests/text/auto-hyphenation-uk-1-ref.html
new file mode 100644
index 0000000000..7c99e28d01
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-uk-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:manual;" lang="uk">
+Всі лю&shy;ди на&shy;ро&shy;джу&shy;ю&shy;ться віль&shy;ни&shy;ми і рів&shy;ни&shy;ми у сво&shy;їй гі&shy;дно&shy;сті та пра&shy;вах
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-uk-1.html b/layout/reftests/text/auto-hyphenation-uk-1.html
new file mode 100644
index 0000000000..0f3c72ce16
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-uk-1.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=utf-8">
+</head>
+<body>
+<div style="width:1em; hyphens:auto;" lang="uk">
+Всі люди народжуються вільними і рівними у своїй гідності та правах
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-1.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-1.xhtml
new file mode 100644
index 0000000000..b102f63151
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-1.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- simple test for automatic hyphenation -->
+<body xml:lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-10.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-10.xhtml
new file mode 100644
index 0000000000..9ae2f056fe
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-10.xhtml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-11a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-11a.xhtml
new file mode 100644
index 0000000000..eab1a7011c
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-11a.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that xml:lang beats lang -->
+<body xml:lang="en-us" lang="x-unknown-language">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-11b.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-11b.xhtml
new file mode 100644
index 0000000000..e243bc2c4f
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-11b.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that xml:lang beats lang -->
+<body lang="x-unknown-language" xml:lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-12a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-12a.xhtml
new file mode 100644
index 0000000000..18c8846473
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-12a.xhtml
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that xml:lang beats lang -->
+<!-- check that hyphenation is not applied to unknown language -->
+<body xml:lang="x-unknown-language" lang="en-us">
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-12b.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-12b.xhtml
new file mode 100644
index 0000000000..602e59b27c
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-12b.xhtml
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that xml:lang beats lang -->
+<!-- check that hyphenation is not applied to unknown language -->
+<body lang="en-us" xml:lang="x-unknown-language">
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-13a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-13a.xhtml
new file mode 100644
index 0000000000..10488ad8fa
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-13a.xhtml
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that innermost beats xml:lang vs. lang difference -->
+<body lang="x-unknown-language">
+<div xml:lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+</div>
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-13b.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-13b.xhtml
new file mode 100644
index 0000000000..ef231cf855
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-13b.xhtml
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that innermost beats xml:lang vs. lang difference -->
+<body xml:lang="x-unknown-language">
+<div lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+</div>
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-14a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-14a.xhtml
new file mode 100644
index 0000000000..124a6e127d
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-14a.xhtml
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that innermost beats xml:lang vs. lang difference -->
+<!-- check that hyphenation is not applied to unknown language -->
+<body lang="en-us">
+<div xml:lang="x-unknown-language">
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-14b.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-14b.xhtml
new file mode 100644
index 0000000000..a4fd52b704
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-14b.xhtml
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that innermost beats xml:lang vs. lang difference -->
+<!-- check that hyphenation is not applied to unknown language -->
+<body xml:lang="en-us">
+<div lang="x-unknown-language">
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-1a.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-1a.xhtml
new file mode 100644
index 0000000000..77a3c3b56f
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-1a.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- adding random <span>s should not affect hyphenation -->
+<body xml:lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+super<span>cali</span>frag<span>ili</span>sti<span>cex</span>pialidoc<span>i</span>ous
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-2.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-2.xhtml
new file mode 100644
index 0000000000..382deafe4a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-2.xhtml
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- mixed languages in a word should inhibit automatic hyphenation -->
+<body xml:lang="en-us">
+<div style="width: 5em; hyphens: auto; font-family:sans-serif;">
+supercalifragilisticexpialidocious
+super<span xml:lang="foo">cali</span>fragilisticexpialidocious
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-3.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-3.xhtml
new file mode 100644
index 0000000000..1560f9e6b9
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-3.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that hyphens:none prevents break at &shy; -->
+<body xml:lang="en-us">
+<div style="width: 5em; hyphens: none;">
+su&#173;per&#173;cal&#173;ifrag&#173;ilis&#173;tic&#173;ex&#173;pi&#173;ali&#173;do&#173;cious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-4.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-4.xhtml
new file mode 100644
index 0000000000..4a453f628b
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-4.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that hyphenation is not applied to unknown language -->
+<body xml:lang="x-unknown-language">
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-5.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-5.xhtml
new file mode 100644
index 0000000000..dce0ee03f8
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-5.xhtml
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<style type="text/css">
+div {
+ margin: 10px;
+ width: 10px;
+ font-family: monospace;
+ hyphens: auto;
+}
+</style>
+</head>
+<!-- test some hyphenations that involve overlapping patterns -->
+<body xml:lang="en-us">
+<div>
+photo
+</div>
+<div>
+photograph
+</div>
+<div>
+photographer
+</div>
+<div>
+photographical
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-6.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-6.xhtml
new file mode 100644
index 0000000000..6a9bf1bd92
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-6.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- style changes don't break hyphenation -->
+<body xml:lang="en-us">
+<div style="width: 0; hyphens: auto;">
+hy<span style="color:red">phen</span>ation
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-7.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-7.xhtml
new file mode 100644
index 0000000000..81333df42a
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-7.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- style changes don't break hyphenation -->
+<body xml:lang="en-us">
+<div style="width: 0; hyphens: auto;">
+h<span style="color:red">yphena</span>tion
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-8.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-8.xhtml
new file mode 100644
index 0000000000..97ce7fcd9d
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-8.xhtml
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/auto-hyphenation-xmllang-9.xhtml b/layout/reftests/text/auto-hyphenation-xmllang-9.xhtml
new file mode 100644
index 0000000000..18a8bc862f
--- /dev/null
+++ b/layout/reftests/text/auto-hyphenation-xmllang-9.xhtml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="iso-8859-1" ?>
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head><title>Hyphenation test</title></head>
+<!-- check that hyphenation is not applied when language is not specified -->
+<body>
+<div style="width: 5em; hyphens: auto;">
+supercalifragilisticexpialidocious
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/text/cgj-01-ref.html b/layout/reftests/text/cgj-01-ref.html
new file mode 100644
index 0000000000..20c211bdab
--- /dev/null
+++ b/layout/reftests/text/cgj-01-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<!-- U+034F Combining Grapheme Joiner test #1.
+ The CGJ should not be visible,
+ nor affect the width of the first cluster. -->
+<html>
+ <head>
+ <title>CGJ test</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <style type="text/css">
+ body {
+ font-size: 35px;
+ line-height: 100px;
+ /* prefer Calibri on Win7 to avoid visible CGJ glyph */
+ font-family: Calibri, sans-serif;
+ }
+ </style>
+ </head>
+ <body lang="fr">
+ <p>a&#x300;b</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/cgj-01.html b/layout/reftests/text/cgj-01.html
new file mode 100644
index 0000000000..bea39f5704
--- /dev/null
+++ b/layout/reftests/text/cgj-01.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<!-- U+034F Combining Grapheme Joiner test #1.
+ The CGJ should not be visible,
+ nor affect the width of the first cluster. -->
+<html>
+ <head>
+ <title>CGJ test</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <style type="text/css">
+ body {
+ font-size: 35px;
+ line-height: 100px;
+ /* prefer Calibri on Win7 to avoid visible CGJ glyph */
+ font-family: Calibri, sans-serif;
+ }
+ </style>
+ </head>
+ <body lang="fr">
+ <p>a&#x300;&#x34f;b</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/color-opacity-rtl-1-ref.html b/layout/reftests/text/color-opacity-rtl-1-ref.html
new file mode 100644
index 0000000000..afe96a51d1
--- /dev/null
+++ b/layout/reftests/text/color-opacity-rtl-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<title>Mozilla bug 1318539</title>
+<style>
+.ref {
+ font-family: Twemoji Mozilla, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, sans-serif;
+ font-size: 48px;
+ opacity: 0.5;
+ text-align: right;
+}
+</style>
+</head>
+<body class="ref">
+(&#x1f602;&#x1f601;&#x1f600;)
+</body>
+</html>
diff --git a/layout/reftests/text/color-opacity-rtl-1.html b/layout/reftests/text/color-opacity-rtl-1.html
new file mode 100644
index 0000000000..ee6e09090c
--- /dev/null
+++ b/layout/reftests/text/color-opacity-rtl-1.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<title>Mozilla bug 1318539</title>
+<style>
+.test {
+ font-family: Twemoji Mozilla, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, sans-serif;
+ font-size: 48px;
+ opacity: 0.5;
+}
+</style>
+</head>
+<body dir=rtl class="test">
+(&#x1f600;&#x1f601;&#x1f602;)
+</body>
+</html>
diff --git a/layout/reftests/text/color-opacity-rtl-2-ref.html b/layout/reftests/text/color-opacity-rtl-2-ref.html
new file mode 100644
index 0000000000..88ee708431
--- /dev/null
+++ b/layout/reftests/text/color-opacity-rtl-2-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<title>Mozilla bug 1318539</title>
+<style>
+.ref {
+ font-family: Twemoji Mozilla, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, sans-serif;
+ font-size: 48px;
+ opacity: 0.5;
+ unicode-bidi: bidi-override;
+ direction: ltr;
+}
+</style>
+</head>
+<body class="ref">
+&#x5d1;&#x1f600;&#x5d0;
+</body>
+</html>
diff --git a/layout/reftests/text/color-opacity-rtl-2.html b/layout/reftests/text/color-opacity-rtl-2.html
new file mode 100644
index 0000000000..1a9b0f4c10
--- /dev/null
+++ b/layout/reftests/text/color-opacity-rtl-2.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<title>Mozilla bug 1318539</title>
+<style>
+.test {
+ font-family: Twemoji Mozilla, Apple Color Emoji, Segoe UI Emoji, Noto Color Emoji, sans-serif;
+ font-size: 48px;
+ opacity: 0.5;
+}
+</style>
+</head>
+<body class="test">
+&#x5d0;&#x1f600;&#x5d1;
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-01-notref.html b/layout/reftests/text/control-chars-01-notref.html
new file mode 100644
index 0000000000..3b7735d33b
--- /dev/null
+++ b/layout/reftests/text/control-chars-01-notref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<textarea style="-moz-appearance:none; width:300px; height:300px;">
+foobar
+</textarea>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-01a.html b/layout/reftests/text/control-chars-01a.html
new file mode 100644
index 0000000000..1dbd34ba66
--- /dev/null
+++ b/layout/reftests/text/control-chars-01a.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<textarea style="-moz-appearance:none; width:300px; height:300px;">
+foo&#x01;bar
+</textarea>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-01b.html b/layout/reftests/text/control-chars-01b.html
new file mode 100644
index 0000000000..19e08552da
--- /dev/null
+++ b/layout/reftests/text/control-chars-01b.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<textarea style="-moz-appearance:none; width:300px; height:300px;">
+foo&#x1f;bar
+</textarea>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-01c.html b/layout/reftests/text/control-chars-01c.html
new file mode 100644
index 0000000000..28504d4f43
--- /dev/null
+++ b/layout/reftests/text/control-chars-01c.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<textarea style="-moz-appearance:none; width:300px; height:300px;">
+foo&#x7f;bar
+</textarea>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-01d.html b/layout/reftests/text/control-chars-01d.html
new file mode 100644
index 0000000000..561489b259
--- /dev/null
+++ b/layout/reftests/text/control-chars-01d.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<textarea style="-moz-appearance:none; width:300px; height:300px;">
+foo&#x8f;bar
+</textarea>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-02-notref.html b/layout/reftests/text/control-chars-02-notref.html
new file mode 100644
index 0000000000..fe88d751b6
--- /dev/null
+++ b/layout/reftests/text/control-chars-02-notref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body style="-moz-control-character-visibility:visible">
+foobar
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-02.html b/layout/reftests/text/control-chars-02.html
new file mode 100644
index 0000000000..63210d20e8
--- /dev/null
+++ b/layout/reftests/text/control-chars-02.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body style="-moz-control-character-visibility:visible">
+foo&#x01;bar
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-03-ref.html b/layout/reftests/text/control-chars-03-ref.html
new file mode 100644
index 0000000000..2fecd054f9
--- /dev/null
+++ b/layout/reftests/text/control-chars-03-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+foobar
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-03a.html b/layout/reftests/text/control-chars-03a.html
new file mode 100644
index 0000000000..27fa168f18
--- /dev/null
+++ b/layout/reftests/text/control-chars-03a.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body style="-moz-control-character-visibility:hidden">
+foo&#x01;bar
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-03b.html b/layout/reftests/text/control-chars-03b.html
new file mode 100644
index 0000000000..488e5e7513
--- /dev/null
+++ b/layout/reftests/text/control-chars-03b.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML>
+<html>
+<body style="-moz-control-character-visibility:visible">
+<span id="s">foo&#x01;bar</span>
+<script>
+var x = s.getBoundingClientRect().width;
+document.body.setAttribute("style", "-moz-control-character-visibility:hidden");
+</script>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-04-notref.html b/layout/reftests/text/control-chars-04-notref.html
new file mode 100644
index 0000000000..97509ce967
--- /dev/null
+++ b/layout/reftests/text/control-chars-04-notref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<div>
+foobar
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-04a.html b/layout/reftests/text/control-chars-04a.html
new file mode 100644
index 0000000000..9a8e3332db
--- /dev/null
+++ b/layout/reftests/text/control-chars-04a.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<div>
+foo&#x01;bar
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-04b.html b/layout/reftests/text/control-chars-04b.html
new file mode 100644
index 0000000000..48e24b0385
--- /dev/null
+++ b/layout/reftests/text/control-chars-04b.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<div>
+foo&#x1f;bar
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-04c.html b/layout/reftests/text/control-chars-04c.html
new file mode 100644
index 0000000000..fd5f892c94
--- /dev/null
+++ b/layout/reftests/text/control-chars-04c.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<div>
+foo&#x7f;bar
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/control-chars-04d.html b/layout/reftests/text/control-chars-04d.html
new file mode 100644
index 0000000000..94623baeb6
--- /dev/null
+++ b/layout/reftests/text/control-chars-04d.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+<div>
+foo&#x8f;bar
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-01-notref.html b/layout/reftests/text/emoji-01-notref.html
new file mode 100644
index 0000000000..8c5c479705
--- /dev/null
+++ b/layout/reftests/text/emoji-01-notref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Check that emoji char renders something visible (bug 715798, bug 779042)</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<div>
+U+1F603:
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-01.html b/layout/reftests/text/emoji-01.html
new file mode 100644
index 0000000000..53082b913d
--- /dev/null
+++ b/layout/reftests/text/emoji-01.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Check that emoji char renders something visible (bug 715798, bug 779042)</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<div>
+U+1F603: &#x1F603;
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-02-notref.html b/layout/reftests/text/emoji-02-notref.html
new file mode 100644
index 0000000000..e9fc9fe6b0
--- /dev/null
+++ b/layout/reftests/text/emoji-02-notref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Check that HUGE emoji char renders something visible (bug 715798, bug 779042)</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 600px;
+}
+</style>
+</head>
+<body>
+<div>
+U+1F633: <span style="font-size:400px">&nbsp;</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-02.html b/layout/reftests/text/emoji-02.html
new file mode 100644
index 0000000000..099b184712
--- /dev/null
+++ b/layout/reftests/text/emoji-02.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Check that HUGE emoji char renders something visible (bug 715798, bug 779042)</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 600px;
+}
+</style>
+</head>
+<body>
+<div>
+<!-- If the emoji size is too big, skia will fail to render it. 250 seems to be the max -->
+U+1F633: <span style="font-size:250px">&#x1F633;</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-03-notref.html b/layout/reftests/text/emoji-03-notref.html
new file mode 100644
index 0000000000..56a521afa1
--- /dev/null
+++ b/layout/reftests/text/emoji-03-notref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Emoji rendering should be affected by VS15/VS16</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<div>
+&#x2764;&#xfe0f;
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-03-ref.html b/layout/reftests/text/emoji-03-ref.html
new file mode 100644
index 0000000000..b82fbe9f80
--- /dev/null
+++ b/layout/reftests/text/emoji-03-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Emoji rendering should be affected by VS15/VS16</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<div>
+&#x2764;&#xfe0e;
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-03.html b/layout/reftests/text/emoji-03.html
new file mode 100644
index 0000000000..7c2d71de4f
--- /dev/null
+++ b/layout/reftests/text/emoji-03.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Emoji rendering should be affected by VS15/VS16</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<div>
+&#x2764;
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-04-ref.html b/layout/reftests/text/emoji-04-ref.html
new file mode 100644
index 0000000000..354df991e6
--- /dev/null
+++ b/layout/reftests/text/emoji-04-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Emoji-style glyph should ignore color</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+ color: blue;
+}
+</style>
+</head>
+<body>
+<div>
+&#x2764;&#xfe0f;
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-04.html b/layout/reftests/text/emoji-04.html
new file mode 100644
index 0000000000..87a02555a1
--- /dev/null
+++ b/layout/reftests/text/emoji-04.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Emoji-style glyph should ignore color</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+ color: green;
+}
+</style>
+</head>
+<body>
+<div>
+&#x2764;&#xfe0f;
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-05-notref.html b/layout/reftests/text/emoji-05-notref.html
new file mode 100644
index 0000000000..574d30a6b1
--- /dev/null
+++ b/layout/reftests/text/emoji-05-notref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Text-style glyph should respect color</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+ color: blue;
+}
+</style>
+</head>
+<body>
+<div>
+&#x2764;&#xfe0e;
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/emoji-05.html b/layout/reftests/text/emoji-05.html
new file mode 100644
index 0000000000..7401d1c1bc
--- /dev/null
+++ b/layout/reftests/text/emoji-05.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Text-style glyph should respect color</title>
+<style type="text/css">
+body {
+ margin: 10px;
+ font-size: 40px;
+ line-height: 2em;
+ color: green;
+}
+</style>
+</head>
+<body>
+<div>
+&#x2764;&#xfe0e;
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/ethiopic-wordspace-ref.html b/layout/reftests/text/ethiopic-wordspace-ref.html
new file mode 100644
index 0000000000..39c289b5e6
--- /dev/null
+++ b/layout/reftests/text/ethiopic-wordspace-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+ <meta charset="utf-8">
+ <title>Reference: Testcase for bug 815077</title>
+</head>
+<body>
+
+<p>
+የሰው፡<br>ልጅ፡<br>ሁሉ፡<br>ሲወለድ፡<br>ነጻና፡<br>በክብርና፡<br>በመብትም፡<br>እኩልነት፡<br>ያለው፡<br>ነው።፡<br>የተፈጥሮ፡<br>ማስተዋልና፡<br>ሕሊና፡<br>ስላለው፡<br>አንዱ፡<br>ሌላውን፡<br>በወንድማማችነት፡<br>መንፈስ፡<br>መመልከት፡<br>ይገባዋል።
+</p>
+
+</body>
+</html>
diff --git a/layout/reftests/text/ethiopic-wordspace.html b/layout/reftests/text/ethiopic-wordspace.html
new file mode 100644
index 0000000000..912374e34e
--- /dev/null
+++ b/layout/reftests/text/ethiopic-wordspace.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+ <meta charset="utf-8">
+ <title>Testcase for bug 815077</title>
+</head>
+<body>
+
+<p style="width:0">
+የሰው፡ልጅ፡ሁሉ፡ሲወለድ፡ነጻና፡በክብርና፡በመብትም፡እኩልነት፡ያለው፡ነው።፡የተፈጥሮ፡ማስተዋልና፡ሕሊና፡ስላለው፡አንዱ፡ሌላውን፡በወንድማማችነት፡መንፈስ፡መመልከት፡ይገባዋል።
+</p>
+
+</body>
+</html>
diff --git a/layout/reftests/text/fallback-01-ref.xhtml b/layout/reftests/text/fallback-01-ref.xhtml
new file mode 100644
index 0000000000..4894469eb6
--- /dev/null
+++ b/layout/reftests/text/fallback-01-ref.xhtml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+ [<!ENTITY first "!"><!ENTITY fallback "&#x00e6;">]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!-- U+00E6 is expected to be found in Arial and DejaVu Sans, but not
+ Devanagari MT, FrankRuehl, nor Standard Symbols L.
+ "!" is chosen as it is expected to be found in the first font found. -->
+ <head>
+ <style>
+ p { font-size: 16.6px;
+ font-family: Devanagari MT, FrankRuehl, Standard Symbols L, Arial, DejaVu Sans; serif }
+ .fallback { font-family: Arial, DejaVu Sans, serif; }
+ </style>
+ </head>
+ <body>
+ <p><span class="fallback">&fallback;&fallback;</span>&first;<span class="fallback">&fallback;</span>&first;<span class="fallback">&fallback;</span>&first;<span class="fallback">&fallback;</span></p>
+ </body>
+</html>
diff --git a/layout/reftests/text/fallback-01.xhtml b/layout/reftests/text/fallback-01.xhtml
new file mode 100644
index 0000000000..804fb04730
--- /dev/null
+++ b/layout/reftests/text/fallback-01.xhtml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+ [<!ENTITY first "!"><!ENTITY fallback "&#x00e6;">]>
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!-- U+00E6 is expected to be found in Arial and DejaVu Sans, but not
+ Devanagari MT, FrankRuehl, nor Standard Symbols L.
+ "!" is chosen as it is expected to be found in the first font found. -->
+ <head>
+ <style>
+ p { font-size: 16.6px;
+ font-family: Devanagari MT, FrankRuehl, Standard Symbols L, Arial, DejaVu Sans; serif }
+ .fallback { font-family: Arial, DejaVu Sans, serif; }
+ </style>
+ </head>
+ <body>
+ <p>&fallback;&fallback;&first;&fallback;&first;&fallback;&first;<span class="fallback">&fallback;</span></p>
+ </body>
+</html>
diff --git a/layout/reftests/text/fallback-mark-stacking-1-notref.html b/layout/reftests/text/fallback-mark-stacking-1-notref.html
new file mode 100644
index 0000000000..85df2ebd16
--- /dev/null
+++ b/layout/reftests/text/fallback-mark-stacking-1-notref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ /* Note that this font has no OpenType layout tables: */
+ src: url(../fonts/sil/GenR102.ttf);
+}
+body {
+ font-family: test;
+}
+.test {
+ font-size: 100px;
+ line-height: 2;
+}
+</style>
+</head>
+<body>
+These examples should NOT look the same:
+<div class=test>x&#x303;&#x302; x&#x302;&#x303;</div>
+</body>
diff --git a/layout/reftests/text/fallback-mark-stacking-1.html b/layout/reftests/text/fallback-mark-stacking-1.html
new file mode 100644
index 0000000000..2a6138f8f9
--- /dev/null
+++ b/layout/reftests/text/fallback-mark-stacking-1.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: test;
+ /* Note that this font has no OpenType layout tables: */
+ src: url(../fonts/sil/GenR102.ttf);
+}
+body {
+ font-family: test;
+}
+.test {
+ font-size: 100px;
+ line-height: 2;
+}
+</style>
+</head>
+<body>
+These examples should NOT look the same:
+<div class=test>x&#x302;&#x303; x&#x303;&#x302;</div>
+</body>
diff --git a/layout/reftests/text/font-selection-by-lang-01-ref.html b/layout/reftests/text/font-selection-by-lang-01-ref.html
new file mode 100644
index 0000000000..6e962fb5a7
--- /dev/null
+++ b/layout/reftests/text/font-selection-by-lang-01-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>test for font selection by language reference</title>
+ <!-- A unique name is included in font-family
+ to force a new cache entry for each element.
+ -->
+ <style type="text/css">
+ p.a {
+ font-family: sans-serif, font-selection-by-lang-1;
+ }
+ p.b {
+ font-family: sans-serif, font-selection-by-lang-2;
+ }
+ </style>
+</head>
+<body>
+ <p class="a" lang="ja">0123456789<p>
+ <p class="b" lang="en">0123456789<p>
+</body>
+</html>
diff --git a/layout/reftests/text/font-selection-by-lang-01.html b/layout/reftests/text/font-selection-by-lang-01.html
new file mode 100644
index 0000000000..a88310d3d0
--- /dev/null
+++ b/layout/reftests/text/font-selection-by-lang-01.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>test for font selection by language</title>
+ <!-- Checks that caches do not cause the lang="ja" font to be used for
+ the lang="en" element.
+ -->
+ <style type="text/css">
+ p {
+ font-family: sans-serif;
+ }
+ </style>
+</head>
+<body>
+ <p lang="ja">0123456789<p>
+ <p lang="en">0123456789<p>
+</body>
+</html>
diff --git a/layout/reftests/text/font-selection-fallback-1-ref.html b/layout/reftests/text/font-selection-fallback-1-ref.html
new file mode 100644
index 0000000000..5e0fb11633
--- /dev/null
+++ b/layout/reftests/text/font-selection-fallback-1-ref.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+ <title>Reference for test that language support doesn't override
+ specified family - Bug 678561</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ @font-face {
+ font-family: "MarkA";
+ src: url(../fonts/markA.ttf);
+ }
+ @font-face {
+ font-family: "MarkB";
+ src: url(../fonts/markB.ttf);
+ }
+ @font-face {
+ font-family: "DejaVu Sans Mono";
+ src: url(../fonts/DejaVuSansMono.otf);
+ }
+
+ .c1 { font-family: MarkA; }
+ .c2 { font-family: MarkB; }
+ .c3 { font-family: DejaVu Sans Mono; }
+
+ /* to ensure the same vertical positioning of the text */
+ .spacer { line-height: 3em }
+ </style>
+</head>
+<body>
+
+<p><span class="c1">A</span></p>
+<p><span class="c2">B</span><span class="spacer"></span></p>
+<p><span class="c3">C</span><span class="spacer"></span></p>
+
+<p class="c3">A</p>
+<p class="c3">B</p>
+<p class="c3">C</p>
+
+</body>
+</html>
diff --git a/layout/reftests/text/font-selection-fallback-1.html b/layout/reftests/text/font-selection-fallback-1.html
new file mode 100644
index 0000000000..0f6700ec12
--- /dev/null
+++ b/layout/reftests/text/font-selection-fallback-1.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+ <title>Test that language support doesn't override specified family - Bug 678561</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ @font-face {
+ font-family: "MarkA";
+ src: url(../fonts/markA.ttf);
+ }
+ @font-face {
+ font-family: "MarkB";
+ src: url(../fonts/markB.ttf);
+ }
+ @font-face {
+ font-family: "DejaVu Sans Mono";
+ src: url(../fonts/DejaVuSansMono.otf);
+ }
+
+ .c1 { font-family: MarkA, MarkB, DejaVu Sans Mono; }
+
+ .c2 { font-family: DejaVu Sans Mono, MarkA, MarkB; }
+
+ /* to ensure the same vertical positioning of the text */
+ .spacer { line-height: 3em }
+ </style>
+</head>
+<body>
+
+<p><span class="c1">A</span></p>
+<p><span class="c1">B</span><span class="spacer"></span></p>
+<p><span class="c1">C</span><span class="spacer"></span></p>
+
+<p class="c2">A</p>
+<p class="c2">B</p>
+<p class="c2">C</p>
+
+</body>
+</html>
diff --git a/layout/reftests/text/font-selection-generic-1-ref.html b/layout/reftests/text/font-selection-generic-1-ref.html
new file mode 100644
index 0000000000..dfb7645a9d
--- /dev/null
+++ b/layout/reftests/text/font-selection-generic-1-ref.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ @font-face {
+ font-family: "MarkA";
+ src: url(../fonts/markA.ttf);
+ }
+
+ .c1 { font-family: sans-serif; }
+ .c2 { font-family: serif; }
+ .c3 { font-family: monospace, fantasy; }
+ .c4 { font-family: fantasy; }
+ .c5 { font-family: cursive; }
+
+ .c11 { font-family: MarkA, serif; }
+ .c12 { font-family: MarkA, monospace; }
+ .c13 { font-family: MarkA, sans-serif; }
+ .c14 { font-family: MarkA, cursive; }
+ .c15 { font-family: MarkA, fantasy; }
+
+ /* to ensure the same vertical positioning of the text */
+ .spacer { line-height: 3em }
+ </style>
+</head>
+<body>
+
+<p class="c1">AB</p>
+<p class="c2">AB</p>
+<p class="c3">AB</p>
+<!-- Rev3 Fedora 12 test machines don't have fantasy or cursive,
+ and WINNT 5.2 machines don't have fantasy.
+<p class="c4">AB</p>
+<p class="c5">AB</p>
+-->
+
+<p class="c11">A</p>
+<p><span class="c1">B</span><span class="spacer"></span></p>
+<p class="c12">A</p>
+<p><span class="c2">B</span><span class="spacer"></span></p>
+<p class="c13">A</p>
+<p><span class="c3">B</span><span class="spacer"></span></p>
+<!--
+<p class="c14">A</p>
+<p class="c4">B</p>
+<p class="c15">A</p>
+<p class="c5">B</p>
+-->
+
+</body>
+</html>
diff --git a/layout/reftests/text/font-selection-generic-1.html b/layout/reftests/text/font-selection-generic-1.html
new file mode 100644
index 0000000000..fc08ebd98b
--- /dev/null
+++ b/layout/reftests/text/font-selection-generic-1.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ @font-face {
+ font-family: "MarkA";
+ src: url(../fonts/markA.ttf);
+ }
+
+ .c1 { font-family: sans-serif, MarkA; }
+ .c2 { font-family: serif, MarkA; }
+ .c3 { font-family: monospace, MarkA; }
+ .c4 { font-family: fantasy, MarkA; }
+ .c5 { font-family: cursive, MarkA; }
+
+ .c11 { font-family: MarkA, sans-serif; }
+ .c12 { font-family: MarkA, serif; }
+ .c13 { font-family: MarkA, monospace; }
+ .c14 { font-family: MarkA, fantasy; }
+ .c15 { font-family: MarkA, cursive; }
+
+ /* to ensure the same vertical positioning of the text */
+ .spacer { line-height: 3em }
+ </style>
+</head>
+<body>
+
+<p class="c1">AB</p>
+<p class="c2">AB</p>
+<p class="c3">AB</p>
+<!-- Rev3 Fedora 12 test machines don't have fantasy or cursive,
+ and WINNT 5.2 machines don't have fantasy.
+<p class="c4">AB</p>
+<p class="c5">AB</p>
+-->
+
+<p class="c11">A</p>
+<p><span class="c11">B</span><span class="spacer"></span></p>
+<p class="c12">A</p>
+<p><span class="c12">B</span><span class="spacer"></span></p>
+<p class="c13">A</p>
+<p><span class="c13">B</span><span class="spacer"></span></p>
+<!--
+<p class="c14">A</p>
+<p class="c14">B</p>
+<p class="c15">A</p>
+<p class="c15">B</p>
+-->
+
+</body>
+</html>
diff --git a/layout/reftests/text/font-size-adjust-01-ref.html b/layout/reftests/text/font-size-adjust-01-ref.html
new file mode 100644
index 0000000000..2e198fe6c3
--- /dev/null
+++ b/layout/reftests/text/font-size-adjust-01-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ </head>
+ <style>
+ p { font-family: sans-serif; font-size: 24pt; }
+ </style>
+ <body>
+ <p>hello</p>
+ <p>small</p>
+ <p>world</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/font-size-adjust-01.html b/layout/reftests/text/font-size-adjust-01.html
new file mode 100644
index 0000000000..4da5d882ae
--- /dev/null
+++ b/layout/reftests/text/font-size-adjust-01.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ </head>
+ <style>
+ p { font-family: sans-serif; font-size: 24pt; }
+ .small { font-size-adjust: 0.25; }
+ .large { font-size-adjust: 0.9; }
+ </style>
+ <body>
+ <p>hello</p>
+ <p class="small">small</p>
+ <p class="large">world</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/font-size-adjust-02-ref.html b/layout/reftests/text/font-size-adjust-02-ref.html
new file mode 100644
index 0000000000..340e3fd822
--- /dev/null
+++ b/layout/reftests/text/font-size-adjust-02-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ </head>
+ <style>
+ .big { font-family: sans-serif; font-size: 40pt; }
+ .a { font-family: sans-serif; font-size: 15pt; font-size-adjust: 0.8; }
+ .b { font-family: sans-serif; font-size: 30pt; font-size-adjust: 0.4; }
+ </style>
+ <body>
+ <p class="big">1. <span class="a">lines should be the same size</span></p>
+ <p class="big">2. <span class="b">lines should be the same size</span></p>
+ </body>
+</html>
diff --git a/layout/reftests/text/font-size-adjust-02.html b/layout/reftests/text/font-size-adjust-02.html
new file mode 100644
index 0000000000..23e9c5f12c
--- /dev/null
+++ b/layout/reftests/text/font-size-adjust-02.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ </head>
+ <style>
+ .big { font-family: sans-serif; font-size: 40pt; }
+ .a { font-family: sans-serif; font-size: 15pt; font-size-adjust: 0.8; }
+ .b { font-family: sans-serif; font-size: 30pt; font-size-adjust: 0.4; }
+ </style>
+ <body>
+ <p class="big">1. <span class="b">lines should be the same size</span></p>
+ <p class="big">2. <span class="a">lines should be the same size</span></p>
+ </body>
+</html>
diff --git a/layout/reftests/text/font-size-adjust-03-ref.html b/layout/reftests/text/font-size-adjust-03-ref.html
new file mode 100644
index 0000000000..1958f7d7d7
--- /dev/null
+++ b/layout/reftests/text/font-size-adjust-03-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ </head>
+ <style>
+ .a { font-family: sans-serif; font-size: 15pt; font-size-adjust: 0.8; }
+ .b { font-family: sans-serif; font-size: 30pt; font-size-adjust: 0.4; }
+ </style>
+ <body>
+ <p class="b">lines should be the same size</p>
+ <p class="a">lines should be the same size</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/font-size-adjust-03.html b/layout/reftests/text/font-size-adjust-03.html
new file mode 100644
index 0000000000..5188b48749
--- /dev/null
+++ b/layout/reftests/text/font-size-adjust-03.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ </head>
+ <style>
+ .a { font-family: sans-serif; font-size: 15pt; font-size-adjust: 0.8; }
+ .b { font-family: sans-serif; font-size: 30pt; font-size-adjust: 0.4; }
+ </style>
+ <body>
+ <p class="a">lines should be the same size</p>
+ <p class="b">lines should be the same size</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/glyph-decomposition-graphite-ref.html b/layout/reftests/text/glyph-decomposition-graphite-ref.html
new file mode 100644
index 0000000000..0ffe73917e
--- /dev/null
+++ b/layout/reftests/text/glyph-decomposition-graphite-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>test rendering with decomposition (bug 772640)</title>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: test;
+ font-size: 40px;
+ text-align: left;
+}
+</style>
+</head>
+<body>
+<div>
+<!-- with graphite enabled, this will display ThisIsGraphite to confirm it's working -->
+ThisIsNotGraphite:<br>
+<!-- U+0622 should render identically to U+0627,U+0653 -->
+RTL: <span dir="rtl">a&#x0627;&#x0653;z</span><br>
+LTR: <span dir="ltr" style="unicode-bidi: bidi-override">a&#x0627;&#x0653;z</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/glyph-decomposition-graphite.html b/layout/reftests/text/glyph-decomposition-graphite.html
new file mode 100644
index 0000000000..365923c4f6
--- /dev/null
+++ b/layout/reftests/text/glyph-decomposition-graphite.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>test rendering with decomposition (bug 772640)</title>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: test;
+ font-size: 40px;
+ text-align: left;
+}
+</style>
+</head>
+<body>
+<div>
+<!-- with graphite enabled, this will display ThisIsGraphite to confirm it's working -->
+ThisIsNotGraphite:<br>
+<!-- U+0622 should render identically to U+0627,U+0653 -->
+RTL: <span dir="rtl">a&#x0622;z</span><br>
+LTR: <span dir="ltr" style="unicode-bidi: bidi-override">a&#x0622;z</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/glyph-decomposition-opentype-ref.html b/layout/reftests/text/glyph-decomposition-opentype-ref.html
new file mode 100644
index 0000000000..0ffe73917e
--- /dev/null
+++ b/layout/reftests/text/glyph-decomposition-opentype-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>test rendering with decomposition (bug 772640)</title>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: test;
+ font-size: 40px;
+ text-align: left;
+}
+</style>
+</head>
+<body>
+<div>
+<!-- with graphite enabled, this will display ThisIsGraphite to confirm it's working -->
+ThisIsNotGraphite:<br>
+<!-- U+0622 should render identically to U+0627,U+0653 -->
+RTL: <span dir="rtl">a&#x0627;&#x0653;z</span><br>
+LTR: <span dir="ltr" style="unicode-bidi: bidi-override">a&#x0627;&#x0653;z</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/glyph-decomposition-opentype.html b/layout/reftests/text/glyph-decomposition-opentype.html
new file mode 100644
index 0000000000..365923c4f6
--- /dev/null
+++ b/layout/reftests/text/glyph-decomposition-opentype.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<title>test rendering with decomposition (bug 772640)</title>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: test;
+ font-size: 40px;
+ text-align: left;
+}
+</style>
+</head>
+<body>
+<div>
+<!-- with graphite enabled, this will display ThisIsGraphite to confirm it's working -->
+ThisIsNotGraphite:<br>
+<!-- U+0622 should render identically to U+0627,U+0653 -->
+RTL: <span dir="rtl">a&#x0622;z</span><br>
+LTR: <span dir="ltr" style="unicode-bidi: bidi-override">a&#x0622;z</span>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-01-ref.html b/layout/reftests/text/graphite-01-ref.html
new file mode 100644
index 0000000000..6e8b3ab508
--- /dev/null
+++ b/layout/reftests/text/graphite-01-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: PigLatin;
+ src: url(../fonts/sil/PigLatin-nographite.ttf);
+}
+
+body {
+ font: 34px PigLatin;
+ width: 5em;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<p>
+Igpay
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-01.html b/layout/reftests/text/graphite-01.html
new file mode 100644
index 0000000000..aa8b13fce6
--- /dev/null
+++ b/layout/reftests/text/graphite-01.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: PigLatin;
+ src: url(../fonts/sil/PigLatinBenchmark_v3.ttf);
+}
+
+body {
+ font: 34px PigLatin;
+ width: 5em;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<p>
+Pig
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-02-ref.html b/layout/reftests/text/graphite-02-ref.html
new file mode 100644
index 0000000000..2e00202bc9
--- /dev/null
+++ b/layout/reftests/text/graphite-02-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: PigLatin;
+ src: url(../fonts/sil/PigLatin-nographite.ttf);
+}
+
+body {
+ font: 34px PigLatin;
+ width: 5em;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<p>
+Igpay<br>Atinlay
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-02.html b/layout/reftests/text/graphite-02.html
new file mode 100644
index 0000000000..0842dff7bf
--- /dev/null
+++ b/layout/reftests/text/graphite-02.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: PigLatin;
+ src: url(../fonts/sil/PigLatinBenchmark_v3.ttf);
+}
+
+body {
+ font: 34px PigLatin;
+ width: 5em;
+ line-height: 2em;
+}
+</style>
+</head>
+<body>
+<p>
+Pig Latin
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-03-notref.html b/layout/reftests/text/graphite-03-notref.html
new file mode 100644
index 0000000000..32f8aaea3a
--- /dev/null
+++ b/layout/reftests/text/graphite-03-notref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+@font-face {
+ font-family: padauk;
+ src: url(../fonts/sil/Padauk.ttf);
+}
+
+body {
+ font: 34px padauk;
+}
+</style>
+</head>
+<body>
+<p lang="my"><!-- default (Burmese) behavior of Padauk -->
+ပှၤလၢအတလဲၤဘၣ်ဝဲလၢ ပှၤတတီတလိၤဘၣ်အ ကူၣ်ထီၣ်ဖးလီၤတၢ်အပူၤ, ဒီးတဆၢထၢၣ်ဘၣ်ဝဲလၢ ပှၤမၤတၢ်ဒဲးဘးအကျဲ, ဒီးတဆ့ၣ်နီၤဘၣ်ဝဲလၢ ပှၤ ဒုၣ်ဒွဲၣ်တၢ်အလီၢ်ဆ့ၣ်နီၤဘၣ်န့ၣ် ဘၣ်ဆိၣ်ဂ့ၤဝဲလီၤ.
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-03a.html b/layout/reftests/text/graphite-03a.html
new file mode 100644
index 0000000000..6577b443a5
--- /dev/null
+++ b/layout/reftests/text/graphite-03a.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+@font-face {
+ font-family: padauk;
+ src: url(../fonts/sil/Padauk.ttf);
+}
+
+body {
+ font: 34px padauk;
+}
+</style>
+</head>
+<body>
+<p lang="ksw"><!-- check that changing language affects the rendering:
+ this modifies the shape of a couple of lower diacritics -->
+ပှၤလၢအတလဲၤဘၣ်ဝဲလၢ ပှၤတတီတလိၤဘၣ်အ ကူၣ်ထီၣ်ဖးလီၤတၢ်အပူၤ, ဒီးတဆၢထၢၣ်ဘၣ်ဝဲလၢ ပှၤမၤတၢ်ဒဲးဘးအကျဲ, ဒီးတဆ့ၣ်နီၤဘၣ်ဝဲလၢ ပှၤ ဒုၣ်ဒွဲၣ်တၢ်အလီၢ်ဆ့ၣ်နီၤဘၣ်န့ၣ် ဘၣ်ဆိၣ်ဂ့ၤဝဲလီၤ.
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-03b.html b/layout/reftests/text/graphite-03b.html
new file mode 100644
index 0000000000..c584612e24
--- /dev/null
+++ b/layout/reftests/text/graphite-03b.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style type="text/css">
+@font-face {
+ font-family: padauk;
+ src: url(../fonts/sil/Padauk.ttf);
+}
+
+body {
+ font: 34px padauk;
+ font-feature-settings: "kdot" on;
+ /* check that setting an optional graphite feature affects rendering:
+ * this adds "dots" to the ends of a number of curved strokes
+ */
+}
+</style>
+</head>
+<body>
+<p lang="my">
+ပှၤလၢအတလဲၤဘၣ်ဝဲလၢ ပှၤတတီတလိၤဘၣ်အ ကူၣ်ထီၣ်ဖးလီၤတၢ်အပူၤ, ဒီးတဆၢထၢၣ်ဘၣ်ဝဲလၢ ပှၤမၤတၢ်ဒဲးဘးအကျဲ, ဒီးတဆ့ၣ်နီၤဘၣ်ဝဲလၢ ပှၤ ဒုၣ်ဒွဲၣ်တၢ်အလီၢ်ဆ့ၣ်နီၤဘၣ်န့ၣ် ဘၣ်ဆိၣ်ဂ့ၤဝဲလီၤ.
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-04-fa.html b/layout/reftests/text/graphite-04-fa.html
new file mode 100644
index 0000000000..2155c8661f
--- /dev/null
+++ b/layout/reftests/text/graphite-04-fa.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: schz-gr;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: schz-gr;
+ font-size: 40px;
+}
+</style>
+</head>
+<body lang="fa">
+<!-- Persian (Farsi) should be the same as English-tagged -->
+&#x6f0;&#x6f1;&#x6f2;&#x6f3;&#x6f4;&#x6f5;&#x6f6;&#x6f7;&#x6f8;&#x6f9;
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-04-ref.html b/layout/reftests/text/graphite-04-ref.html
new file mode 100644
index 0000000000..72e5cdb8af
--- /dev/null
+++ b/layout/reftests/text/graphite-04-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: schz-gr;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: schz-gr;
+ font-size: 40px;
+}
+</style>
+</head>
+<body lang="en">
+<!-- for testing Graphite language support we'll use the Eastern Arabic-Indic digits;
+ default rendering will have the Persian forms -->
+&#x6f0;&#x6f1;&#x6f2;&#x6f3;&#x6f4;&#x6f5;&#x6f6;&#x6f7;&#x6f8;&#x6f9;
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-04-sd.html b/layout/reftests/text/graphite-04-sd.html
new file mode 100644
index 0000000000..85ebe2c3e8
--- /dev/null
+++ b/layout/reftests/text/graphite-04-sd.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: schz-gr;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: schz-gr;
+ font-size: 40px;
+}
+</style>
+</head>
+<body lang="sd">
+<!-- Sindhi - digits 6 and 7 have different forms -->
+&#x6f0;&#x6f1;&#x6f2;&#x6f3;&#x6f4;&#x6f5;&#x6f6;&#x6f7;&#x6f8;&#x6f9;
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-04-snd.html b/layout/reftests/text/graphite-04-snd.html
new file mode 100644
index 0000000000..3bd776f230
--- /dev/null
+++ b/layout/reftests/text/graphite-04-snd.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: schz-gr;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: schz-gr;
+ font-size: 40px;
+}
+</style>
+</head>
+<body lang="snd">
+<!-- Sindhi incorrectly tagged with iso-639-3 code instead of bcp47/iso-639-1;
+ rendering should therefore match the default "en", NOT the correctly-tagged "sd" version -->
+&#x6f0;&#x6f1;&#x6f2;&#x6f3;&#x6f4;&#x6f5;&#x6f6;&#x6f7;&#x6f8;&#x6f9;
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-04-ur.html b/layout/reftests/text/graphite-04-ur.html
new file mode 100644
index 0000000000..579b2ab8aa
--- /dev/null
+++ b/layout/reftests/text/graphite-04-ur.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: schz-gr;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: schz-gr;
+ font-size: 40px;
+}
+</style>
+</head>
+<body lang="ur">
+<!-- in Urdu, the digit 4 should differ from Sindhi,
+ and 6 and 7 also differ from Persian -->
+&#x6f0;&#x6f1;&#x6f2;&#x6f3;&#x6f4;&#x6f5;&#x6f6;&#x6f7;&#x6f8;&#x6f9;
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-04-urd.html b/layout/reftests/text/graphite-04-urd.html
new file mode 100644
index 0000000000..33599b4cd9
--- /dev/null
+++ b/layout/reftests/text/graphite-04-urd.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: schz-gr;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+}
+body {
+ font-family: schz-gr;
+ font-size: 40px;
+}
+</style>
+</head>
+<body lang="urd">
+<!-- incorrectly-tagged Urdu should match the default rendering -->
+&#x6f0;&#x6f1;&#x6f2;&#x6f3;&#x6f4;&#x6f5;&#x6f6;&#x6f7;&#x6f8;&#x6f9;
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-05-badlang.html b/layout/reftests/text/graphite-05-badlang.html
new file mode 100644
index 0000000000..933e8332c3
--- /dev/null
+++ b/layout/reftests/text/graphite-05-badlang.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/graphite/grtest-langfeat.ttf);
+}
+
+body {
+ margin: 20px;
+ font: 100px test;
+}
+p { margin: 0; padding: 0; }
+</style>
+</head>
+<body>
+<p lang="fra">PaSs</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-05-fail.html b/layout/reftests/text/graphite-05-fail.html
new file mode 100644
index 0000000000..27995b9a0a
--- /dev/null
+++ b/layout/reftests/text/graphite-05-fail.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/graphite/grtest-ot-only.ttf);
+}
+
+body {
+ margin: 20px;
+ font: 100px test;
+}
+p { margin: 0; padding: 0; }
+</style>
+</head>
+<body>
+<p>FAIL</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-05-feat.html b/layout/reftests/text/graphite-05-feat.html
new file mode 100644
index 0000000000..f4082dde08
--- /dev/null
+++ b/layout/reftests/text/graphite-05-feat.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/graphite/grtest-langfeat.ttf);
+}
+
+body {
+ margin: 20px;
+ font: 100px test;
+ font-feature-settings: "TST1", "FTP2";
+}
+p { margin: 0; padding: 0; }
+</style>
+</head>
+<body>
+<p>FAIL</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-05-lang.html b/layout/reftests/text/graphite-05-lang.html
new file mode 100644
index 0000000000..c4a8cb0ddc
--- /dev/null
+++ b/layout/reftests/text/graphite-05-lang.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/graphite/grtest-langfeat.ttf);
+}
+
+body {
+ margin: 20px;
+ font: 100px test;
+ font-feature-settings: "TST1";
+}
+p { margin: 0; padding: 0; }
+</style>
+</head>
+<body>
+<p lang="fr">FAIL</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-05-multipass.html b/layout/reftests/text/graphite-05-multipass.html
new file mode 100644
index 0000000000..b3e2522cde
--- /dev/null
+++ b/layout/reftests/text/graphite-05-multipass.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/graphite/grtest-multipass.ttf);
+}
+
+body {
+ margin: 20px;
+ font: 100px test;
+ font-feature-settings: "TST1";
+}
+p { margin: 0; padding: 0; }
+</style>
+</head>
+<body>
+<p>FAIL</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-05-ot-only.html b/layout/reftests/text/graphite-05-ot-only.html
new file mode 100644
index 0000000000..ae4d046cab
--- /dev/null
+++ b/layout/reftests/text/graphite-05-ot-only.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/graphite/grtest-ot-only.ttf);
+}
+
+body {
+ margin: 20px;
+ font: 100px test;
+ font-feature-settings: "TST1";
+}
+p { margin: 0; padding: 0; }
+</style>
+</head>
+<body>
+<p>FAIL</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-05-ref.html b/layout/reftests/text/graphite-05-ref.html
new file mode 100644
index 0000000000..aafa87cc1a
--- /dev/null
+++ b/layout/reftests/text/graphite-05-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/graphite/grtest-ref.ttf);
+}
+
+body {
+ margin: 20px;
+ font: 100px test;
+}
+p { margin: 0; padding: 0; }
+</style>
+</head>
+<body>
+<p>PaSs</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-05-simple.html b/layout/reftests/text/graphite-05-simple.html
new file mode 100644
index 0000000000..aa126ede85
--- /dev/null
+++ b/layout/reftests/text/graphite-05-simple.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url(../fonts/graphite/grtest-simple.ttf);
+}
+
+body {
+ margin: 20px;
+ font: 100px test;
+ font-feature-settings: "TST1";
+}
+p { margin: 0; padding: 0; }
+</style>
+</head>
+<body>
+<p>FAIL</p>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-bidi-1-ref.html b/layout/reftests/text/graphite-bidi-1-ref.html
new file mode 100644
index 0000000000..0523cf33cb
--- /dev/null
+++ b/layout/reftests/text/graphite-bidi-1-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url("../fonts/sil/Scheherazade-BidiBug.woff");
+}
+div {
+ width: 5em;
+ border: 1px solid silver;
+ font-family: test;
+ font-size: 40px;
+ text-align: center;
+}
+.b {
+ background: yellow;
+}
+</style>
+</head>
+<body>
+<div><span class=b>abc</span></div>
+</html>
diff --git a/layout/reftests/text/graphite-bidi-1.html b/layout/reftests/text/graphite-bidi-1.html
new file mode 100644
index 0000000000..74c5d6c90c
--- /dev/null
+++ b/layout/reftests/text/graphite-bidi-1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<meta charset="utf-8">
+<style type="text/css">
+@font-face {
+ font-family: test;
+ src: url("../fonts/sil/Scheherazade-BidiBug.woff");
+}
+div {
+ width: 5em;
+ border: 1px solid silver;
+ font-family: test;
+ font-size: 40px;
+ text-align: center;
+}
+.a {
+ color: transparent;
+}
+.b {
+ background: yellow;
+}
+</style>
+</head>
+<body>
+<div><span class=a>"</span><span class=b>abc</span><span class=a>"</span></div>
+</html>
diff --git a/layout/reftests/text/graphite-surrogate-selection-ref.html b/layout/reftests/text/graphite-surrogate-selection-ref.html
new file mode 100644
index 0000000000..5d2c88cb72
--- /dev/null
+++ b/layout/reftests/text/graphite-surrogate-selection-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1260825 reference</title>
+<meta charset="utf-8">
+<style>
+@font-face { font-family: test; src: url(../fonts/MiaoUnicode-Regular.ttf); }
+#test { font-family: test, serif; font-size: 60px; }
+.sel { background: cyan; }
+.inv { color: transparent; }
+</style>
+</head>
+<body>
+All lines should show the same single glyph &amp; background area:
+<div id="test">
+<span class="sel">&#x16f50;</span><br>
+<span class="sel">&#x16f50;</span><br>
+<span class="sel">&#x16f50;</span><br>
+<span class="sel">&#x16f50;</span><br>
+<span class="sel">&#x16f50;</span><br>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/graphite-surrogate-selection.html b/layout/reftests/text/graphite-surrogate-selection.html
new file mode 100644
index 0000000000..f086b3fa4f
--- /dev/null
+++ b/layout/reftests/text/graphite-surrogate-selection.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Bug 1260825 testcase</title>
+<meta charset="utf-8">
+<style>
+@font-face { font-family: test; src: url(../fonts/MiaoUnicode-Regular.ttf); }
+#test { font-family: test, serif; font-size: 60px; }
+.sel { background: cyan; }
+.inv { color: transparent; }
+</style>
+</head>
+<body>
+All lines should show the same single glyph &amp; background area:
+<div id="test">
+<span class="sel">&#x16f50;</span><br>
+<span class="sel">&#x16f50;</span><span class="inv">&#x16f50;</span><br>
+<span class="sel">&#x16f50;</span><span class="inv">&#x16f50;&#x16f50;</span><br>
+<span class="sel">&#x16f50;</span><span class="inv">&#x16f0a;</span><br>
+<span class="sel">&#x16f50;</span><span class="inv">&#x16f0a;&#x16f6a;</span><br>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-caps-1-ref.html b/layout/reftests/text/hyphenation-caps-1-ref.html
new file mode 100644
index 0000000000..8fd0a78e9a
--- /dev/null
+++ b/layout/reftests/text/hyphenation-caps-1-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+div { font: 16px/24px serif; width: 8em; float: left; font-kerning: none; }
+p { margin: 1em 0; }
+</style>
+<script>
+for (const lang of ["en-US", "en"]) {
+ document.write("<div lang='" + lang + "'>" + lang +
+ ":<p>in-<br>ter-<br>caps</p><p>Intercaps</p><p>interCaps</p></div>");
+}
+for (const lang of ["de", "de-DE", "de-1901", "de-1996"]) {
+ document.write("<div lang='" + lang + "'>" + lang +
+ ":<p>in-<br>ter-<br>caps</p><p>In-<br>ter-<br>caps</p><p>interCaps</p></div>");
+}
+</script>
diff --git a/layout/reftests/text/hyphenation-caps-1.html b/layout/reftests/text/hyphenation-caps-1.html
new file mode 100644
index 0000000000..4c1b5e5cab
--- /dev/null
+++ b/layout/reftests/text/hyphenation-caps-1.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+div { font: 16px/24px serif; width: 8em; float: left; font-kerning: none; }
+p { hyphens: auto; width: 2em; margin: 1em 0; }
+</style>
+<script>
+for (const lang of ["en-US", "en", "de", "de-DE", "de-1901", "de-1996"]) {
+ document.write("<div lang='" + lang + "'>" + lang +
+ ":<p>intercaps</p><p>Intercaps</p><p>interCaps</p></div>");
+}
+</script>
diff --git a/layout/reftests/text/hyphenation-control-1-ref.html b/layout/reftests/text/hyphenation-control-1-ref.html
new file mode 100644
index 0000000000..5b26063a8b
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-1-ref.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+code {
+ display: block;
+ hyphens: manual;
+ border: 1px solid black;
+ /* Prefer Courier New if available, as otherwise Menlo may be used,
+ and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
+ font-family: Courier New, Courier, monospace;
+}
+</style>
+</head>
+<body lang="en-us">
+<!--
+ Hyphenation opportunities of the texts in this test are as follows,
+
+ frag[A]ilis[A]tic[C]ex[A]pi[A]ali
+
+ where [A] is an automatic hyphen, and [C] is a conditional hyphen.
+
+ In this test, we set width to somewhere between every pair of adjacent hyphenations,
+ then we see if lines break correctly.
+-->
+<code style="width:4ch;">
+frag-<br />ilis-<br />tic-<br />ex-<br />pi-<br />ali
+</code>
+<br />
+<code style="width:5ch;">
+frag-<br />ilis-<br />tic-<br />expi-<br />ali
+</code>
+<br />
+<code style="width:9ch;">
+fragilis-<br />tic-<br />expiali
+</code>
+<br />
+<code style="width:12ch;">
+fragilistic-<br />expiali
+</code>
+<br />
+<code style="width:14ch;">
+fragilistic-<br />expiali
+</code>
+<br />
+<code style="width:16ch;">
+fragilistic-<br />expiali
+</code>
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-control-1.html b/layout/reftests/text/hyphenation-control-1.html
new file mode 100644
index 0000000000..3ab7510dc1
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-1.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+code {
+ display: block;
+ hyphens: auto;
+ border: 1px solid black;
+ /* Prefer Courier New if available, as otherwise Menlo may be used,
+ and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
+ font-family: Courier New, Courier, monospace;
+}
+</style>
+</head>
+<body lang="en-us">
+<!--
+ Hyphenation opportunities of the texts in this test are as follows,
+
+ frag[A]ilis[A]tic[C]ex[A]pi[A]ali
+
+ where [A] is an automatic hyphen, and [C] is a conditional hyphen.
+
+ In this test, we set width to somewhere between every pair of adjacent hyphenations,
+ then we see if lines break correctly.
+-->
+<code style="width:4ch;">
+fragilistic&shy;expiali
+</code>
+<br />
+<code style="width:5ch;">
+fragilistic&shy;expiali
+</code>
+<br />
+<code style="width:9ch;">
+fragilistic&shy;expiali
+</code>
+<br />
+<code style="width:12ch;">
+fragilistic&shy;expiali
+</code>
+<br />
+<code style="width:14ch;">
+fragilistic&shy;expiali
+</code>
+<br />
+<code style="width:16ch;">
+fragilistic&shy;expiali
+</code>
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-control-2-ref.html b/layout/reftests/text/hyphenation-control-2-ref.html
new file mode 100644
index 0000000000..6f48c8bd8b
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-2-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+code {
+ display:block;
+ hyphens:manual;
+ border: 1px solid black;
+}
+</style>
+</head>
+<body lang="en-us">
+<code style="width:15ch;">
+Supercali-<br />fragilistic-<br />expialidocious
+</code>
+<br />
+<code style="width:15ch;">
+Supercali&#x2010;<br />fragilistic&#x2010;<br />expialidocious
+</code>
+<br />
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-control-2.html b/layout/reftests/text/hyphenation-control-2.html
new file mode 100644
index 0000000000..7cbb3ec457
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-2.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+code {
+ display:block;
+ hyphens:auto;
+ border: 1px solid black;
+}
+</style>
+</head>
+<body lang="en-us">
+<!--
+ Test checks that automatic hyphenation opportunities within a word
+ must be ignored if the word contains an explicit hyphen (U+2010) or hyphen-minus (U+002D),
+ in favor of the conditional hyphen(s)
+-->
+<code style="width:15ch;">
+Supercali-fragilistic-expialidocious
+</code>
+<br />
+<code style="width:15ch;">
+Supercali&#x2010;fragilistic&#x2010;expialidocious
+</code>
+<br />
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-control-3-ref.html b/layout/reftests/text/hyphenation-control-3-ref.html
new file mode 100644
index 0000000000..46a6b60d6e
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-3-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+code {
+ display: block;
+ hyphens: manual;
+ border: 1px solid black;
+ /* Prefer Courier New if available, as otherwise Menlo may be used,
+ and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
+ font-family: Courier New, Courier, monospace;
+}
+</style>
+</head>
+<body lang="en-us">
+<code style="width:100ch;">
+abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstu-<br />vwxyzsupercalifragilisticexpialidocious-<br />abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
+</code>
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-control-3.html b/layout/reftests/text/hyphenation-control-3.html
new file mode 100644
index 0000000000..c96a1e3e7b
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-3.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+code {
+ display: block;
+ hyphens: auto;
+ border: 1px solid black;
+ /* Prefer Courier New if available, as otherwise Menlo may be used,
+ and its HYPHEN and HYPHEN-MINUS glyphs don't match. */
+ font-family: Courier New, Courier, monospace;
+}
+</style>
+</head>
+<body lang="en-us">
+<!--
+ Test checks that automatic hyphenation opportunities should honor
+ manual hyphenation opportunities even if they are within an extreme long word.
+-->
+<code style="width:100ch;">
+abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzsuper&shy;cali&shy;fragi&shy;listic&shy;expiali&shy;docious&shy;abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz
+</code>
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-control-4-ref.html b/layout/reftests/text/hyphenation-control-4-ref.html
new file mode 100644
index 0000000000..440be641e9
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-4-ref.html
@@ -0,0 +1,25 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta charset="utf-8">
+</head>
+<body>
+<!--
+ Test checks that hyphenation breaks should not be affected if there are multiple inline
+ elements inside a paragraph.
+-->
+<p style="width:60ch;font-family:monospace;hyphens:auto" lang="de">
+Dem Vernehmen nach wandten sich auch Kabelnetzbetreiber und Telekommunikationsfirmen
+gegen den Plan: Die Regierung hatte – genauso wie die EU –
+das 5,9-GHz-Frequenzband für die "Car-to-Car-Communication" reserviert,
+das die Branche lieber für breitbandiges mobiles Internet nutzen will.
+Den Mobilfunkern stieß zudem übel auf, dass die Autoindustrie vorrangig
+das Spektrum hätte nutzen können. Die EU-Kommission hat voriges Jahr eine
+Strategie für "kooperative intelligente Transportsysteme" auf den Weg gebracht.
+Bis 2019 sollen demnach auf dem alten Kontinent die Grundlagen stehen,
+damit vernetzte Autos untereinander und mit der Verkehrsinfrastruktur
+kommunizieren können. Diese zweite Komponente der
+"Vehicle-to-Infrastructure"-Kommunikation war der US-Regierung
+von Anfang an zu teuer ersch
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-control-4.html b/layout/reftests/text/hyphenation-control-4.html
new file mode 100644
index 0000000000..a4502d70e5
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-4.html
@@ -0,0 +1,25 @@
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta charset="utf-8">
+</head>
+<body>
+<!--
+ Test checks that hyphenation breaks should not be affected if there are multiple inline
+ elements inside a paragraph.
+-->
+<p style="width:60ch;font-family:monospace;hyphens:auto" lang="de">
+Dem Vernehmen nach wandten sich auch Kabelnetzbetreiber und Telekommunikationsfirmen
+gegen den Plan: Die Regierung hatte – <span>genauso</span> wie die EU –
+das 5,9-GHz-Frequenzband für die "Car-to-Car-Communication" reserviert,
+das die Branche lieber für breitbandiges mobiles Internet nutzen will.
+Den Mobilfunkern stieß zudem übel auf, dass die Autoindustrie vorrangig
+das Spektrum hätte nutzen können. Die EU-Kommission hat voriges Jahr eine
+Strategie für "kooperative intelligente Transportsysteme" auf den Weg gebracht.
+Bis 2019 sollen demnach auf dem alten Kontinent die Grundlagen stehen,
+damit vernetzte Autos untereinander und mit der Verkehrsinfrastruktur
+kommunizieren können. Diese zweite Komponente der
+"Vehicle-to-Infrastructure"-Kommunikation war der US-Regierung
+von Anfang an zu teuer ersch
+</p>
+</body>
+</html>
diff --git a/layout/reftests/text/hyphenation-control-5-ref.html b/layout/reftests/text/hyphenation-control-5-ref.html
new file mode 100644
index 0000000000..66548a1dff
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-5-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<style>
+body { columns: 3; }
+p { margin: 0 0 1em 0; }
+</style>
+<body>
+<p>hard-<br>hit
+<p>hard-<br>hit-<br>ting
+<p>hard-<br>est-<br>hit
+<p>hard-<br>est-<br>hit-<br>ting
+
+<p><b>hard</b>-<br>hit
+<p><b>hard</b>-<br>hit-<br>ting
+<p><b>hard-<br>est</b>-<br>hit
+<p><b>hard-<br>est</b>-<br>hit-<br>ting
+
+<p>hard-<br><b>hit</b>
+<p>hard-<br><b>hit-<br>ting</b>
+<p>hard-<br>est-<br><b>hit</b>
+<p>hard-<br>est-<br><b>hit-<br>ting</b>
diff --git a/layout/reftests/text/hyphenation-control-5.html b/layout/reftests/text/hyphenation-control-5.html
new file mode 100644
index 0000000000..e21a53dfee
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-5.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<style>
+body { columns: 3; }
+p { margin: 0 0 1em 0; width:0; hyphens:auto; }
+</style>
+<body>
+<p>hard-hit
+<p>hard-hitting
+<p>hardest-hit
+<p>hardest-hitting
+
+<p><b>hard</b>-hit
+<p><b>hard</b>-hitting
+<p><b>hardest</b>-hit
+<p><b>hardest</b>-hitting
+
+<p>hard-<b>hit</b>
+<p>hard-<b>hitting</b>
+<p>hardest-<b>hit</b>
+<p>hardest-<b>hitting</b>
diff --git a/layout/reftests/text/hyphenation-control-6-ref.html b/layout/reftests/text/hyphenation-control-6-ref.html
new file mode 100644
index 0000000000..6eceb0f2c7
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-6-ref.html
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<style>
+.test { hyphens:auto; font:10px Ubuntu Mono, Courier New, Courier, monospace; border: 1px solid silver; }
+</style>
+<body>
+<p>All the columns should appear identical:</p>
+<div id="outer" style="columns:6">
+<script>
+let outer = document.getElementById("outer");
+for (i = 1; i <= 6; ++i) {
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "0ch";
+ div.innerHTML = "the<br>flow-<br>rel-<br>a-<br>tive";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "2ch";
+ div.innerHTML = "the<br>flow-<br>rel-<br>a-<br>tive";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "4ch";
+ div.innerHTML = "the<br>flow-<br>rel-<br>a-<br>tive";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "6ch";
+ div.innerHTML = "the<br>flow-<br>rela-<br>tive";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "8ch";
+ div.innerHTML = "the<br>flow-<br>relative";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "10ch";
+ div.innerHTML = "the flow-<br>relative";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "12ch";
+ div.innerHTML = "the flow-<br>relative";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "14ch";
+ div.innerHTML = "the flow-<br>relative";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "16ch";
+ div.innerHTML = "the flow-<br>relative";
+ outer.appendChild(div);
+
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = "18ch";
+ div.innerHTML = "the flow-relative";
+ outer.appendChild(div);
+}
+</script>
diff --git a/layout/reftests/text/hyphenation-control-6.html b/layout/reftests/text/hyphenation-control-6.html
new file mode 100644
index 0000000000..103ba91aea
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-6.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<style>
+.test { hyphens:auto; font:10px Ubuntu Mono, Courier New, Courier, monospace; border: 1px solid silver; }
+</style>
+<body>
+<p>All the columns should appear identical:</p>
+<div id="outer" style="columns:6">
+<script>
+let outer = document.getElementById("outer");
+for (i = 1; i <= 6; ++i) {
+ for (j = 0; j <= 18; j += 2) {
+ div = document.createElement("div");
+ div.className = "test";
+ div.style.width = j + "ch";
+ div.textContent = "the" + " ".repeat(i) + "flow-relative";
+ outer.appendChild(div);
+ }
+}
+</script>
diff --git a/layout/reftests/text/hyphenation-control-7-ref.html b/layout/reftests/text/hyphenation-control-7-ref.html
new file mode 100644
index 0000000000..b2a3feab55
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-7-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta "charset=utf-8">
+ <style>
+ p {
+ background: yellow;
+ margin: 0 0 1em 0;
+ font-family: monospace;
+ }
+ </style>
+<body>
+<h3>The columns should appear identical; "relative" should never be hyphenated</h3>
+<div style="columns:2">
+<p style="width: 16ch">the flow-<br>relative flow-<br>relative flow-<br>relative flow-<br>relative flow-<br>relative</p>
+<p style="width: 20ch">the flow-relative<br>flow-relative flow-<br>relative flow-<br>relative flow-<br>relative</p>
+<p style="width: 24ch">the flow-relative flow-<br>relative flow-relative<br>flow-relative flow-<br>relative</p>
+<p style="width: 41ch">the flow-relative flow-relative flow-<br>relative flow-relative flow-relative</p>
+<p style="width: 50ch">the flow-relative flow-relative flow-relative<br>flow-relative flow-relative</p>
+
+<p style="width: 16ch">the flow-<br>relative flow-<br>relative flow-<br>relative flow-<br>relative flow-<br>relative</p>
+<p style="width: 20ch">the flow-relative<br>flow-relative flow-<br>relative flow-<br>relative flow-<br>relative</p>
+<p style="width: 24ch">the flow-relative flow-<br>relative flow-relative<br>flow-relative flow-<br>relative</p>
+<p style="width: 41ch">the flow-relative flow-relative flow-<br>relative flow-relative flow-relative</p>
+<p style="width: 50ch">the flow-relative flow-relative flow-relative<br>flow-relative flow-relative</p>
diff --git a/layout/reftests/text/hyphenation-control-7.html b/layout/reftests/text/hyphenation-control-7.html
new file mode 100644
index 0000000000..7b48271fa6
--- /dev/null
+++ b/layout/reftests/text/hyphenation-control-7.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta "charset=utf-8">
+ <style>
+ p {
+ background: yellow;
+ margin: 0 0 1em 0;
+ font-family: monospace;
+ hyphens: auto;
+ }
+ </style>
+<body>
+<h3>The columns should appear identical; "relative" should never be hyphenated</h3>
+<div style="columns:2">
+<p style="width: 16ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+<p style="width: 20ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+<p style="width: 24ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+<p style="width: 41ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+<p style="width: 50ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+
+<p style="width: 16ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+<p style="width: 20ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+<p style="width: 24ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+<p style="width: 41ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
+<p style="width: 50ch">the flow-relative flow-relative flow-relative flow-relative flow-relative</p>
diff --git a/layout/reftests/text/initial-zwj-1-ref.html b/layout/reftests/text/initial-zwj-1-ref.html
new file mode 100644
index 0000000000..e4d867bbfb
--- /dev/null
+++ b/layout/reftests/text/initial-zwj-1-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="ar">
+<head>
+<title>Bug 978313</title>
+<meta charset="utf-8">
+<style>
+body {
+ font-family: Arial, DejaVu Sans, Droid Sans Arabic, Droid Arabic Naskh;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+&zwj;ی&zwj;ت
+</body>
+</html>
diff --git a/layout/reftests/text/initial-zwj-1.html b/layout/reftests/text/initial-zwj-1.html
new file mode 100644
index 0000000000..fd039c5831
--- /dev/null
+++ b/layout/reftests/text/initial-zwj-1.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="ar">
+<head>
+<title>Bug 978313</title>
+<meta charset="utf-8">
+<style>
+body {
+ font-family: Arial, DejaVu Sans, Droid Sans Arabic, Droid Arabic Naskh;
+ font-size: 36px;
+}
+</style>
+</head>
+<body>
+&zwj;یت
+</body>
+</html>
diff --git a/layout/reftests/text/justification-1-ref.html b/layout/reftests/text/justification-1-ref.html
new file mode 100644
index 0000000000..a89222d414
--- /dev/null
+++ b/layout/reftests/text/justification-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<html>
+<body style="font-family:monospace; line-height:1.5em; width:14ch; text-align:justify; border:1px solid black; overflow:hidden;">
+
+<p>I am the very model of a modern major-general.</p>
+<p style="width:100ch;">I am the very model of a modern major-general.</p>
+<p style="width:100ch;">I &nbsp;am the<br>very model of a modern major-general.</p>
+<p>I&nbsp;&nbsp;am the<br>very model of a modern major-general.</p>
+<p>I am the<br>very model of a modern major-general.</p>
+</body>
+</html>
diff --git a/layout/reftests/text/justification-1.html b/layout/reftests/text/justification-1.html
new file mode 100644
index 0000000000..a12544fc19
--- /dev/null
+++ b/layout/reftests/text/justification-1.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+<body style="font-family:monospace; line-height:1.5em; width:14ch; text-align:justify; border:1px solid black; overflow:hidden;">
+
+<!-- Test which white-space values are allowed to take justification -->
+
+<p style="white-space:normal;">I am the
+very model of a modern major-general.</p>
+<p style="white-space:nowrap;">I am the
+very model of a modern major-general.</p>
+<p style="white-space:pre;">I am the
+very model of a modern major-general.</p>
+<p style="white-space:pre-wrap;">I am the
+very model of a modern major-general.</p>
+<p style="white-space:pre-line;">I am the
+very model of a modern major-general.</p>
+</body></html>
diff --git a/layout/reftests/text/justification-2-ref.html b/layout/reftests/text/justification-2-ref.html
new file mode 100644
index 0000000000..70443e6820
--- /dev/null
+++ b/layout/reftests/text/justification-2-ref.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+span { display:inline-block; width:100px; height:10px; background:yellow; }
+</style>
+</head>
+<body>
+<span></span><span style="background:none;"></span><span></span><br>
+<span></span>
+</body>
+</html>
diff --git a/layout/reftests/text/justification-2a.html b/layout/reftests/text/justification-2a.html
new file mode 100644
index 0000000000..2711eef658
--- /dev/null
+++ b/layout/reftests/text/justification-2a.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+span { display:inline-block; width:100px; height:10px; background:yellow; }
+</style>
+</head>
+<!-- Test that justify actually works. 3 spans won't fit on a line so there will be
+ two spans plus 100px of justification space on the first line. -->
+<body style="text-align:justify; width:300px;">
+<span></span> <span></span>
+<span></span>
+</body>
+</html>
diff --git a/layout/reftests/text/justification-2b.html b/layout/reftests/text/justification-2b.html
new file mode 100644
index 0000000000..5ff414ff52
--- /dev/null
+++ b/layout/reftests/text/justification-2b.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+span { display:inline-block; width:100px; height:10px; background:yellow; }
+</style>
+</head>
+<!-- Test that text-align is taken from the containing block only -->
+<body style="text-align:justify; width:300px;">
+<span></span><span style="display:inline; text-align:left; background:none"> <span></span>
+<span></span>
+</body>
+</html>
diff --git a/layout/reftests/text/justification-2c.html b/layout/reftests/text/justification-2c.html
new file mode 100644
index 0000000000..1179aff6d7
--- /dev/null
+++ b/layout/reftests/text/justification-2c.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+span { display:inline-block; width:100px; height:10px; background:yellow; }
+</style>
+</head>
+<!-- Test that &nbsp; has justification space added. -->
+<body style="text-align:justify; width:300px;">
+<span></span>&nbsp;<span></span>
+<span></span>
+</body>
+</html>
diff --git a/layout/reftests/text/justification-2d.html b/layout/reftests/text/justification-2d.html
new file mode 100644
index 0000000000..d4f54f4884
--- /dev/null
+++ b/layout/reftests/text/justification-2d.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+span { display:inline-block; width:100px; height:10px; background:yellow; }
+</style>
+</head>
+<!-- Test that U+2007 FIGURE SPACE does not have justification space added. -->
+<body style="text-align:justify; width:300px;">
+<span></span>&#x2007;<span></span>
+<span></span>
+</body>
+</html>
diff --git a/layout/reftests/text/justification-cjk-extension-ref.html b/layout/reftests/text/justification-cjk-extension-ref.html
new file mode 100644
index 0000000000..565c7556f3
--- /dev/null
+++ b/layout/reftests/text/justification-cjk-extension-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/gw432047.ttf);
+}
+div {
+ font:16px test;
+ width:200px;
+ border:1px solid red;
+ text-align-last:justify;
+}
+span {
+ color: transparent;
+}
+</style>
+<div lang="zh">&#x4e00;&#x845b;<span>&#x4e00;&#x845b;</span>&#x4e00;&#x845b;
diff --git a/layout/reftests/text/justification-cjk-extension.html b/layout/reftests/text/justification-cjk-extension.html
new file mode 100644
index 0000000000..d15bd99404
--- /dev/null
+++ b/layout/reftests/text/justification-cjk-extension.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<meta charset="utf-8">
+<style>
+@font-face {
+ font-family: test;
+ src: url(../fonts/gw432047.ttf);
+}
+div {
+ font:16px test;
+ width:200px;
+ border:1px solid red;
+ text-align-last:justify;
+}
+span {
+ color: transparent;
+}
+</style>
+<div lang="zh">&#x4e00;&#x845b;<span>&#x20b9f;&#x20b9f;</span>&#x4e00;&#x845b;
diff --git a/layout/reftests/text/justification-space-diacritic-ref.html b/layout/reftests/text/justification-space-diacritic-ref.html
new file mode 100644
index 0000000000..39ac355941
--- /dev/null
+++ b/layout/reftests/text/justification-space-diacritic-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<meta charset="utf-8">
+<style>
+div {
+ font-family:monospace;
+ width:200px;
+ border:1px solid red;
+ text-align-last:justify;
+}
+span {
+ display:inline-block;
+}
+</style>
+<!-- The <space> or <nbsp> characters that carry combining marks
+ should NOT be stretched by justification. -->
+<div>
+<p><span>Hello &#x308; &#x308; &#x308;</span> world
+<p><span>Hello&nbsp;&#x308;&nbsp;&#x308;&nbsp;&#x308;</span> world
+<p><span>Hello&nbsp;&#x308;</span> <span>&nbsp;&#x301;&nbsp;&#x300;world</span>
+<p><span>Hello&nbsp;&#x202d;&#x308;&#x202c;</span>‬ <span>&nbsp;&#x202d;&#x302;&#x202c;world</span>
diff --git a/layout/reftests/text/justification-space-diacritic.html b/layout/reftests/text/justification-space-diacritic.html
new file mode 100644
index 0000000000..e55168fdf5
--- /dev/null
+++ b/layout/reftests/text/justification-space-diacritic.html
@@ -0,0 +1,21 @@
+<!DOCTYPE HTML>
+<html>
+<meta charset="utf-8">
+<style>
+div {
+ font-family:monospace;
+ width:200px;
+ border:1px solid red;
+ text-align-last:justify;
+}
+span {
+ display:inline-block;
+}
+</style>
+<!-- The <space> or <nbsp> characters that carry combining marks
+ should NOT be stretched by justification. -->
+<div>
+<p>Hello &#x308; &#x308; &#x308; world
+<p>Hello&nbsp;&#x308;&nbsp;&#x308;&nbsp;&#x308; world
+<p>Hello&nbsp;&#x308; &nbsp;&#x301;&nbsp;&#x300;world
+<p>Hello&nbsp;&#x202d;&#x308;&#x202c;‬ &nbsp;&#x202d;&#x302;&#x202c;world
diff --git a/layout/reftests/text/kerning-01-notref.html b/layout/reftests/text/kerning-01-notref.html
new file mode 100644
index 0000000000..43df5e4d69
--- /dev/null
+++ b/layout/reftests/text/kerning-01-notref.html
@@ -0,0 +1,25 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: mplus;
+ src: url(../fonts/mplus/mplus-1p-regular-no-OT.ttf);
+ /* a copy of M+ with OpenType tables removed, so only legacy 'kern' is present */
+}
+
+body {
+ text-rendering: optimizeLegibility;
+ font-size: 40px;
+ font-family: mplus;
+}
+span {
+ font-family: serif;
+}
+</style>
+</head>
+<body>
+<!-- the ZWNJ characters with font change should prevent kerning at those positions;
+ if the testcase looks the same, then kerning failed altogether -->
+AVA<span>&zwnj;</span>V<span>&zwnj;</span>A
+</body>
+</html>
diff --git a/layout/reftests/text/kerning-01.html b/layout/reftests/text/kerning-01.html
new file mode 100644
index 0000000000..55cf986700
--- /dev/null
+++ b/layout/reftests/text/kerning-01.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: mplus;
+ src: url(../fonts/mplus/mplus-1p-regular-no-OT.ttf);
+ /* a copy of M+ with OpenType tables removed, so only legacy 'kern' is present */
+}
+
+body {
+ text-rendering: optimizeLegibility;
+ font-size: 40px;
+ font-family: mplus;
+}
+</style>
+</head>
+<body>
+AVAVA
+</body>
+</html>
diff --git a/layout/reftests/text/letter-spacing-nolig-1-ref.html b/layout/reftests/text/letter-spacing-nolig-1-ref.html
new file mode 100644
index 0000000000..615df75960
--- /dev/null
+++ b/layout/reftests/text/letter-spacing-nolig-1-ref.html
@@ -0,0 +1,13 @@
+<style>
+.a {
+ font: 32px/2 Times;
+}
+.b {
+ font: 32px/2 Times;
+ letter-spacing: 1em;
+}
+</style>
+
+<div class="a">office
+
+<div class="b">off&zwnj;ice
diff --git a/layout/reftests/text/letter-spacing-nolig-1.html b/layout/reftests/text/letter-spacing-nolig-1.html
new file mode 100644
index 0000000000..9dfc5d72a4
--- /dev/null
+++ b/layout/reftests/text/letter-spacing-nolig-1.html
@@ -0,0 +1,13 @@
+<style>
+.a {
+ font: 32px/2 Times;
+}
+.b {
+ font: 32px/2 Times;
+ letter-spacing: 1em;
+}
+</style>
+
+<div class="a">office
+
+<div class="b">office
diff --git a/layout/reftests/text/letter-spacing-nolig-2-ref.html b/layout/reftests/text/letter-spacing-nolig-2-ref.html
new file mode 100644
index 0000000000..2ad7d4ea36
--- /dev/null
+++ b/layout/reftests/text/letter-spacing-nolig-2-ref.html
@@ -0,0 +1,17 @@
+<style>
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff);
+}
+.a {
+ font: 32px/2 libertine;
+}
+.b {
+ font: 32px/2 libertine;
+ letter-spacing: 1em;
+}
+</style>
+
+<div class="a">office
+
+<div class="b">of&zwnj;f&zwnj;ice
diff --git a/layout/reftests/text/letter-spacing-nolig-2.html b/layout/reftests/text/letter-spacing-nolig-2.html
new file mode 100644
index 0000000000..e97f114f70
--- /dev/null
+++ b/layout/reftests/text/letter-spacing-nolig-2.html
@@ -0,0 +1,17 @@
+<style>
+@font-face {
+ font-family: libertine;
+ src: url(../fonts/LinLibertine_Re-4.7.5.woff);
+}
+.a {
+ font: 32px/2 libertine;
+}
+.b {
+ font: 32px/2 libertine;
+ letter-spacing: 1em;
+}
+</style>
+
+<div class="a">office
+
+<div class="b">office
diff --git a/layout/reftests/text/ligature-with-space-1.html b/layout/reftests/text/ligature-with-space-1.html
new file mode 100644
index 0000000000..9526db6237
--- /dev/null
+++ b/layout/reftests/text/ligature-with-space-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ @font-face {
+ font-family: "MarkAB-spaceliga";
+ src: url(../fonts/markAB-spaceliga.otf);
+ }
+
+ body { font-family: MarkAB-spaceliga; }
+ </style>
+</head>
+<body>
+B A;
+</body>
+</html>
diff --git a/layout/reftests/text/line-editing-1-ref.html b/layout/reftests/text/line-editing-1-ref.html
new file mode 100644
index 0000000000..8941e0b4ff
--- /dev/null
+++ b/layout/reftests/text/line-editing-1-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+<!-- using padding to avoid possible reftest failures
+ due to antialiasing pixels not being refreshed,
+ see bugs 475968, 476927 -->
+<body style="white-space:pre; padding: 2px; font-family: sans-serif;">
+Line 1
+Line 2
+Line 3
+Line 4
+Line 5
+Line 6
+Line 7
+Line 8
+Line 9
+</body>
+</html>
diff --git a/layout/reftests/text/line-editing-1a.html b/layout/reftests/text/line-editing-1a.html
new file mode 100644
index 0000000000..31c42103b0
--- /dev/null
+++ b/layout/reftests/text/line-editing-1a.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<script>
+function doTest() {
+ var text = document.body.firstChild;
+ // Delete a line, then make a change after it
+ text.deleteData(8, 7);
+ text.replaceData(55, 1, "8");
+ document.documentElement.removeAttribute('class');
+}
+document.addEventListener("MozReftestInvalidate", doTest);
+</script>
+</head>
+<body style="white-space:pre; padding: 2px; font-family: sans-serif;">
+Line 1
+Line 2
+Line 2
+Line 3
+Line 4
+Line 5
+Line 6
+Line 7
+Line X
+Line 9
+</body>
+</html>
diff --git a/layout/reftests/text/line-editing-1b.html b/layout/reftests/text/line-editing-1b.html
new file mode 100644
index 0000000000..35c5fe4e71
--- /dev/null
+++ b/layout/reftests/text/line-editing-1b.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<script>
+function doTest() {
+ var text = document.body.firstChild;
+ // Insert a line, then make a change after it
+ text.insertData(8, "Line 2\n");
+ text.replaceData(55, 1, "8");
+ document.documentElement.removeAttribute('class');
+}
+document.addEventListener("MozReftestInvalidate", doTest);
+</script>
+</head>
+<body style="white-space:pre; padding: 2px; font-family: sans-serif;">
+Line 1
+Line 3
+Line 4
+Line 5
+Line 6
+Line 7
+Line X
+Line 9
+</body>
+</html>
diff --git a/layout/reftests/text/line-editing-1c.html b/layout/reftests/text/line-editing-1c.html
new file mode 100644
index 0000000000..ceaf095317
--- /dev/null
+++ b/layout/reftests/text/line-editing-1c.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<script>
+function doTest() {
+ var text = document.body.firstChild;
+ // Just make a change
+ text.replaceData(55, 1, "8");
+ document.documentElement.removeAttribute('class');
+}
+document.addEventListener("MozReftestInvalidate", doTest);
+</script>
+</head>
+<body style="white-space:pre; padding: 2px; font-family: sans-serif;">
+Line 1
+Line 2
+Line 3
+Line 4
+Line 5
+Line 6
+Line 7
+Line X
+Line 9
+</body>
+</html>
diff --git a/layout/reftests/text/line-editing-1d.html b/layout/reftests/text/line-editing-1d.html
new file mode 100644
index 0000000000..a3ce054631
--- /dev/null
+++ b/layout/reftests/text/line-editing-1d.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<script>
+function doTest() {
+ var text = document.body.firstChild;
+ // Replace three lines with two lines (but not at line boundaries)
+ text.replaceData(34, 21, "5\nLine 6\nLine ");
+ document.documentElement.removeAttribute('class');
+}
+document.addEventListener("MozReftestInvalidate", doTest);
+</script>
+</head>
+<body style="white-space:pre; padding: 2px; font-family: sans-serif;">
+Line 1
+Line 2
+Line 3
+Line 4
+Line X
+Line X
+Line X
+Line 7
+Line 8
+Line 9
+</body>
+</html>
diff --git a/layout/reftests/text/line-editing-1e.html b/layout/reftests/text/line-editing-1e.html
new file mode 100644
index 0000000000..d149957c0a
--- /dev/null
+++ b/layout/reftests/text/line-editing-1e.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<script>
+function doTest() {
+ var text = document.body.firstChild;
+ // Replace two lines with three lines (but not at line boundaries)
+ text.replaceData(34, 7, "5\nLine 6\nLine ");
+ document.documentElement.removeAttribute('class');
+}
+document.addEventListener("MozReftestInvalidate", doTest);
+</script>
+</head>
+<body style="white-space:pre; padding: 2px; font-family: sans-serif;">
+Line 1
+Line 2
+Line 3
+Line 4
+Line X
+Line 7
+Line 8
+Line 9
+</body>
+</html>
diff --git a/layout/reftests/text/lineheight-metrics-1-ref.html b/layout/reftests/text/lineheight-metrics-1-ref.html
new file mode 100644
index 0000000000..756b705329
--- /dev/null
+++ b/layout/reftests/text/lineheight-metrics-1-ref.html
@@ -0,0 +1,17 @@
+<title>Reference, bug 643781</title>
+<style>
+html { background: white; }
+body {
+ padding: 1px;
+ background: blue;
+ width: 100px;
+ font-size: 0px; /* remove the effect of the strut ascent and descent */
+}
+div {
+ background: aqua;
+ height: 33px;
+}
+</style>
+<body>
+<div></div>
+</body>
diff --git a/layout/reftests/text/lineheight-metrics-1.html b/layout/reftests/text/lineheight-metrics-1.html
new file mode 100644
index 0000000000..76f4482412
--- /dev/null
+++ b/layout/reftests/text/lineheight-metrics-1.html
@@ -0,0 +1,31 @@
+<title>Testcase, bug 643781</title>
+<style>
+html { background: white; }
+@font-face {
+ font-family: "MarkA-lineheight1500";
+ src: url(../fonts/markA-lineheight1500.ttf);
+}
+body {
+ padding: 1px;
+ background: blue;
+ width: 100px;
+ height: 33px;
+ font-size: 0px; /* remove the effect of the strut ascent and descent */
+}
+div {
+ background: aqua;
+}
+/*
+MarkA-lineheight1500 at 22 pixel em-size has a line height that is an --
+integer number of pixels but the components (ascent/descent/leading) are not
+integer. This test checks that the line-height remains accurate.
+*/
+span {
+ color: transparent;
+ font-family: MarkA-lineheight1500;
+ font-size: 22px;
+}
+</style>
+<body>
+<div><span>A</span></div>
+</body>
diff --git a/layout/reftests/text/lineheight-metrics-2-ref.html b/layout/reftests/text/lineheight-metrics-2-ref.html
new file mode 100644
index 0000000000..ecf9fbf1ca
--- /dev/null
+++ b/layout/reftests/text/lineheight-metrics-2-ref.html
@@ -0,0 +1,17 @@
+<title>Testcase, bug 947650 and 598900</title>
+<style>
+html { background: white; }
+body {
+ padding: 1px;
+ background: blue;
+ width: 100px;
+ font-size: 0px; /* remove the effect of the strut ascent and descent */
+}
+div {
+ background: aqua;
+ height: 27px;
+}
+</style>
+<body>
+<div></div>
+</body>
diff --git a/layout/reftests/text/lineheight-metrics-2a.html b/layout/reftests/text/lineheight-metrics-2a.html
new file mode 100644
index 0000000000..1d4e00129c
--- /dev/null
+++ b/layout/reftests/text/lineheight-metrics-2a.html
@@ -0,0 +1,29 @@
+<title>Testcase, bug 947650 and 598900</title>
+<style>
+html { background: white; }
+@font-face {
+ font-family: "MarkA-lineheight6000-typolineheight2700";
+ src: url(../fonts/markA-lineheight6000-typolineheight2700.otf);
+}
+body {
+ padding: 1px;
+ background: blue;
+ width: 100px;
+ height: 27px;
+ font-size: 0px; /* remove the effect of the strut ascent and descent */
+}
+div {
+ background: aqua;
+}
+span {
+ /* Choose 10px so that all the metrics are integers and we avoid rounding
+ issues. See lineheight-metrics-1.html for a test with non-integer values.
+ */
+ color: transparent;
+ font-family: MarkA-lineheight6000-typolineheight2700;
+ font-size: 10px;
+}
+</style>
+<body>
+<div><span>A</span></div>
+</body>
diff --git a/layout/reftests/text/lineheight-metrics-2b.html b/layout/reftests/text/lineheight-metrics-2b.html
new file mode 100644
index 0000000000..4859211823
--- /dev/null
+++ b/layout/reftests/text/lineheight-metrics-2b.html
@@ -0,0 +1,29 @@
+<title>Testcase, bug 947650 and 598900</title>
+<style>
+html { background: white; }
+@font-face {
+ font-family: "MarkA-lineheight6000-typolineheight2700";
+ src: url(../fonts/markA-lineheight6000-typolineheight2700.ttf);
+}
+body {
+ padding: 1px;
+ background: blue;
+ width: 100px;
+ height: 27px;
+ font-size: 0px; /* remove the effect of the strut ascent and descent */
+}
+div {
+ background: aqua;
+}
+span {
+ /* Choose 10px so that all the metrics are integers and we avoid rounding
+ issues. See lineheight-metrics-1.html for a test with non-integer values.
+ */
+ color: transparent;
+ font-family: MarkA-lineheight6000-typolineheight2700;
+ font-size: 10px;
+}
+</style>
+<body>
+<div><span>A</span></div>
+</body>
diff --git a/layout/reftests/text/lineheight-percentage-1-ref.html b/layout/reftests/text/lineheight-percentage-1-ref.html
new file mode 100644
index 0000000000..bf834f59e2
--- /dev/null
+++ b/layout/reftests/text/lineheight-percentage-1-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<body style="font-size: 50px">
+<p style="line-height: 20.5px">20.5px
diff --git a/layout/reftests/text/lineheight-percentage-1.html b/layout/reftests/text/lineheight-percentage-1.html
new file mode 100644
index 0000000000..346ef24314
--- /dev/null
+++ b/layout/reftests/text/lineheight-percentage-1.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<body style="font-size: 50px">
+<p style="line-height: 41%">
+<script>
+document.write(window.getComputedStyle(document.getElementsByTagName("p")[0]).lineHeight);
+</script>
diff --git a/layout/reftests/text/long-1.html b/layout/reftests/text/long-1.html
new file mode 100644
index 0000000000..f65e7e763a
--- /dev/null
+++ b/layout/reftests/text/long-1.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <pre style="font-size:20px;">
+Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems.
+Very long textruns may cause problems.
+ </pre>
+ </body>
+</html>
diff --git a/layout/reftests/text/long-ref.html b/layout/reftests/text/long-ref.html
new file mode 100644
index 0000000000..3db6e454c9
--- /dev/null
+++ b/layout/reftests/text/long-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <pre style="font-size:20px;">
+Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems. Very long textruns may cause problems.<br>Very long textruns may cause problems.
+ </pre>
+ </body>
+</html>
diff --git a/layout/reftests/text/negative-letter-spacing-1-ref.html b/layout/reftests/text/negative-letter-spacing-1-ref.html
new file mode 100644
index 0000000000..3411c34a1f
--- /dev/null
+++ b/layout/reftests/text/negative-letter-spacing-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<head>
+ <style>
+ div {
+ float: left;
+ border: 1px solid black;
+ }
+ </style>
+</head>
+<body>
+ <div><span>same</span><span>line?</span></div>
diff --git a/layout/reftests/text/negative-letter-spacing-1.html b/layout/reftests/text/negative-letter-spacing-1.html
new file mode 100644
index 0000000000..69c1f6fa4b
--- /dev/null
+++ b/layout/reftests/text/negative-letter-spacing-1.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<meta charset=utf-8>
+<head>
+ <style>
+ div {
+ /* This letter-spacing value only impacts a single space character. */
+ letter-spacing: -60px;
+ float: left;
+ border: 1px solid black;
+ }
+ span {
+ letter-spacing: 0;
+ }
+ </style>
+</head>
+<body>
+ <div><span>same</span> <span>line?</span></div>
diff --git a/layout/reftests/text/osx-font-smoothing-2-notref.html b/layout/reftests/text/osx-font-smoothing-2-notref.html
new file mode 100644
index 0000000000..3cf80f8d71
--- /dev/null
+++ b/layout/reftests/text/osx-font-smoothing-2-notref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<!-- testcase for https://bugzilla.mozilla.org/show_bug.cgi?id=900975 -->
+<html>
+<head>
+<style type="text/css">
+p {
+ margin: 20px;
+ font-family: Arial, sans-serif;
+ background-color: black;
+ color: white;
+}
+.smoothing-gray {
+ -moz-osx-font-smoothing: grayscale;
+}
+.smoothing-auto {
+ -moz-osx-font-smoothing: auto;
+}
+</style>
+</head>
+<body lang="en">
+<p class="smoothing-auto"><span>foo</span> <span>bar</span></p>
+</body>
+</html>
diff --git a/layout/reftests/text/osx-font-smoothing-2-ref.html b/layout/reftests/text/osx-font-smoothing-2-ref.html
new file mode 100644
index 0000000000..fc7ca44af1
--- /dev/null
+++ b/layout/reftests/text/osx-font-smoothing-2-ref.html
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML>
+<!-- testcase for https://bugzilla.mozilla.org/show_bug.cgi?id=900975 -->
+<html>
+<head>
+<style type="text/css">
+p {
+ margin: 20px;
+ font-family: Arial, sans-serif;
+ background-color: black;
+ color: white;
+}
+.smoothing-gray {
+ -moz-osx-font-smoothing: grayscale;
+}
+.smoothing-auto {
+ -moz-osx-font-smoothing: auto;
+}
+span {
+ display: inline-block;
+}
+</style>
+</head>
+<body lang="en">
+<p class="smoothing-auto"><span>foo</span> <span class="smoothing-gray">bar</span></p>
+</body>
+</html>
diff --git a/layout/reftests/text/osx-font-smoothing-2.html b/layout/reftests/text/osx-font-smoothing-2.html
new file mode 100644
index 0000000000..2ef3b3ff48
--- /dev/null
+++ b/layout/reftests/text/osx-font-smoothing-2.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<!-- testcase for https://bugzilla.mozilla.org/show_bug.cgi?id=900975 -->
+<html>
+<head>
+<style type="text/css">
+p {
+ margin: 20px;
+ font-family: Arial, sans-serif;
+ background-color: black;
+ color: white;
+}
+.smoothing-gray {
+ -moz-osx-font-smoothing: grayscale;
+}
+.smoothing-auto {
+ -moz-osx-font-smoothing: auto;
+}
+</style>
+</head>
+<body lang="en">
+<p class="smoothing-auto"><span>foo</span> <span class="smoothing-gray">bar</span></p>
+</body>
+</html>
diff --git a/layout/reftests/text/osx-font-smoothing-ref.html b/layout/reftests/text/osx-font-smoothing-ref.html
new file mode 100644
index 0000000000..4fb59bdec1
--- /dev/null
+++ b/layout/reftests/text/osx-font-smoothing-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+body {
+ margin: 20px;
+ font-family: Futura, Helvetica, Arial, sans-serif;
+ background-color: black;
+ color: white;
+}
+p {
+ margin: 0;
+ line-height: 1.3em;
+}
+</style>
+</head>
+<body lang="en">
+<p style="font-size: 9px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 10px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 11px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 12px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 13px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 14px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 15px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 16px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 17px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 18px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 19px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 20px;">I have stood still and stopped the sound of feet.</p>
+</body>
+</html>
diff --git a/layout/reftests/text/osx-font-smoothing.html b/layout/reftests/text/osx-font-smoothing.html
new file mode 100644
index 0000000000..46a4c85451
--- /dev/null
+++ b/layout/reftests/text/osx-font-smoothing.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+body {
+ margin: 20px;
+ font-family: Futura, Helvetica, Arial, sans-serif;
+ background-color: black;
+ color: white;
+}
+p {
+ margin: 0;
+ line-height: 1.3em;
+ -moz-osx-font-smoothing: grayscale;
+}
+</style>
+</head>
+<body lang="en">
+<p style="font-size: 9px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 10px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 11px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 12px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 13px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 14px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 15px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 16px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 17px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 18px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 19px;">I have stood still and stopped the sound of feet.</p>
+<p style="font-size: 20px;">I have stood still and stopped the sound of feet.</p>
+</body>
+</html>
diff --git a/layout/reftests/text/overflowwrap-04.html b/layout/reftests/text/overflowwrap-04.html
new file mode 100644
index 0000000000..8552310dca
--- /dev/null
+++ b/layout/reftests/text/overflowwrap-04.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<!-- Test setting overflow-wrap: break-word dynamically -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test Overflowwrap</title>
+ <script type="text/javascript">
+function SwapStyle()
+{
+ par = document.getElementById("pp");
+ par.style.overflowWrap = "break-word";
+}
+ </script>
+ </head>
+ <body onload="SwapStyle()">
+ <p id="pp" style="width: 100px; overflow-wrap: normal;">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/overflowwrap-05.html b/layout/reftests/text/overflowwrap-05.html
new file mode 100644
index 0000000000..4b5b11e658
--- /dev/null
+++ b/layout/reftests/text/overflowwrap-05.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<!-- Test unsetting overflow-wrap: break-word dynamically -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test Overflowwrap</title>
+ <script type="text/javascript">
+function SwapStyle()
+{
+ par = document.getElementById("pp");
+ par.style.overflowWrap = "normal";
+}
+ </script>
+ </head>
+ <body onload="SwapStyle()">
+ <p id="pp" style="width: 100px; overflow-wrap: break-word;">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/overflowwrap-06.html b/layout/reftests/text/overflowwrap-06.html
new file mode 100644
index 0000000000..899585b138
--- /dev/null
+++ b/layout/reftests/text/overflowwrap-06.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>http://www.mozilla.org/projects/minefield/</title>
+ <style type="text/css">
+#viewsource {
+ font-family: -moz-fixed;
+ font-weight: normal;
+ font-size: 16px;
+ color: black;
+ white-space: pre;
+}
+#viewsource.wrap {
+ white-space: pre-wrap;
+ overflow-wrap: break-word;
+}
+pre {
+ font: inherit;
+ color: inherit;
+ white-space: inherit;
+ margin: 0;
+ width: 475px;
+}
+.attribute-name {
+ color: black;
+ font-weight: bold;
+}
+.attribute-value {
+ color: blue;
+ font-weight: normal;
+}
+ </style>
+ </head>
+ <body id="viewsource" class="wrap">
+ <pre id="line1"><span class="attribute-name">href</span>=<span class="attribute-value">"../../css/cavendish/content.css" </span><span class="attribute-name">title</span>=<span class="attribute-value">"Cavendish"</span></pre>
+ </body>
+</html>
diff --git a/layout/reftests/text/overflowwrap-07.html b/layout/reftests/text/overflowwrap-07.html
new file mode 100644
index 0000000000..d84347837f
--- /dev/null
+++ b/layout/reftests/text/overflowwrap-07.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+div { width: 0px; overflow-wrap: break-word; }
+ </style>
+ <title>Test Overflowwrap</title>
+ </head>
+ <body>
+ <div><em>Hello</em>Kitty</div>
+ </body>
+</html>
diff --git a/layout/reftests/text/overflowwrap-09.html b/layout/reftests/text/overflowwrap-09.html
new file mode 100644
index 0000000000..b190228fa2
--- /dev/null
+++ b/layout/reftests/text/overflowwrap-09.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+textarea { overflow: scroll; overflow-wrap: normal; }
+ </style>
+ <title>Test Overflowwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="20">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/overflowwrap-10.html b/layout/reftests/text/overflowwrap-10.html
new file mode 100644
index 0000000000..249097b6dc
--- /dev/null
+++ b/layout/reftests/text/overflowwrap-10.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Test - overflow-wrap: break-word should respect clusters</title>
+ </head>
+ <body>
+ <div style="width:0px; overflow-wrap:break-word">
+ abc
+ d&#x0325;e&#x0315;f&#x0323;
+ &#x10400;&#x10401;&#x10402;
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/pre-line-1-ref.html b/layout/reftests/text/pre-line-1-ref.html
new file mode 100644
index 0000000000..c290c91a20
--- /dev/null
+++ b/layout/reftests/text/pre-line-1-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+span { background:yellow; }
+.float { float:left; background:orange; }
+.outer { overflow:auto; margin:1em; }
+</style>
+</head>
+<body>
+
+<div class="outer">My name is<br><br>Fred.</div>
+<div class="outer"><span>My name is<br><br>Fred.</span></div>
+
+<div class="outer"><div class="float">My name is<br><br>Fred.</div></div>
+<div class="outer"><div class="float"><span class="preline">My name is<br><br>Fred.</span></div></div>
+
+<div class="outer"><div style="width:0;"><div class="float">My name is<br><br>Fred.</div></div></div>
+<div class="outer"><div style="width:0;"><div class="float"><span>My name is<br><br>Fred.</span></div></div></div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/pre-line-1.html b/layout/reftests/text/pre-line-1.html
new file mode 100644
index 0000000000..0dfbef12e7
--- /dev/null
+++ b/layout/reftests/text/pre-line-1.html
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+.preline { white-space:pre-line; }
+span { background:yellow; }
+.float { float:left; background:orange; }
+.outer { overflow:auto; margin:1em; }
+</style>
+</head>
+<body>
+
+
+
+<!-- Note, in the following tests there are trailing spaces after "is" and on the second
+ blank line. -->
+
+<div class="outer"><div class="preline">My name is
+
+ Fred.</div></div>
+<div class="outer"><span class="preline">My name is
+
+ Fred.</span></div>
+
+
+
+
+
+<div class="outer"><div class="preline float">My name is
+
+ Fred.</div></div>
+<div class="outer"><div class="float"><span class="preline">My name is
+
+ Fred.</span></div></div>
+
+
+
+
+
+<div class="outer"><div style="width:0;"><div class="preline float">My name is
+
+ Fred.</div></div></div>
+<div class="outer"><div style="width:0;"><div class="float"><span class="preline">My name is
+
+ Fred.</span></div></div></div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/pre-line-2-ref.html b/layout/reftests/text/pre-line-2-ref.html
new file mode 100644
index 0000000000..70242146d8
--- /dev/null
+++ b/layout/reftests/text/pre-line-2-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+Hello
+<div style="height:100px;"></div>
+<br>
+<div style="height:100px;"></div>
+Kitty
+</body>
+</html>
diff --git a/layout/reftests/text/pre-line-2.html b/layout/reftests/text/pre-line-2.html
new file mode 100644
index 0000000000..48fde61d90
--- /dev/null
+++ b/layout/reftests/text/pre-line-2.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+
+<!-- Check that a pre-line newline inhibits margin collapsing -->
+
+<div style="margin-bottom:100px;">Hello</div>
+<span style="white-space:pre-line;">
+</span>
+<div style="margin-top:100px;">Kitty</div>
+</body>
+</html>
diff --git a/layout/reftests/text/pre-line-3-ref.html b/layout/reftests/text/pre-line-3-ref.html
new file mode 100644
index 0000000000..d79ddfaea7
--- /dev/null
+++ b/layout/reftests/text/pre-line-3-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML>
+<html>
+<body style="white-space:pre-line; color:black;">
+Hello
+</body>
+</html>
diff --git a/layout/reftests/text/pre-line-3.html b/layout/reftests/text/pre-line-3.html
new file mode 100644
index 0000000000..b5f7f235f3
--- /dev/null
+++ b/layout/reftests/text/pre-line-3.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+body::first-letter { color:white; }
+</style>
+</head>
+<!-- Check that a pre-line newline stops first-letter processing -->
+<body style="white-space:pre-line; color:black;">
+Hello
+</body>
+</html>
diff --git a/layout/reftests/text/pre-line-4-ref.html b/layout/reftests/text/pre-line-4-ref.html
new file mode 100644
index 0000000000..d4da208db8
--- /dev/null
+++ b/layout/reftests/text/pre-line-4-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+<html>
+<!-- pre-line: check lines are broken at \A -->
+<body>
+<p style="white-space:pre-line;">Hello<br>Kitty</p>
+</body>
+</html>
diff --git a/layout/reftests/text/pre-line-4.html b/layout/reftests/text/pre-line-4.html
new file mode 100644
index 0000000000..af410ba1ab
--- /dev/null
+++ b/layout/reftests/text/pre-line-4.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+<html>
+<!-- pre-line: check lines are broken at \A -->
+<body>
+<p style="white-space:pre-line;">Hello&#xA;Kitty</p>
+</body>
+</html>
diff --git a/layout/reftests/text/pre-space-1-ref.html b/layout/reftests/text/pre-space-1-ref.html
new file mode 100644
index 0000000000..b2c82820c4
--- /dev/null
+++ b/layout/reftests/text/pre-space-1-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<style>
+p { font: 16px monospace; white-space: pre; }
+span { background-color: lime }
+</style>
+<p><span>a b</span></p>
+<p><span>a b</span></p>
+<p><span>a b</span></p>
+<p><span> a b </span></p>
+<p><span>a </span></p>
+<p><span> </span></p>
+<p><span> </span></p>
+<p><span>. </span></p>
+<p><span>a b</span></p>
+<p><span>a b</span></p>
+<p><span> a b </span></p>
+<p><span>a </span></p>
+<p><span> </span></p>
+<p><span> </span></p>
+<p><span>. </span></p>
diff --git a/layout/reftests/text/pre-space-1.html b/layout/reftests/text/pre-space-1.html
new file mode 100644
index 0000000000..b1adad2fd8
--- /dev/null
+++ b/layout/reftests/text/pre-space-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<style>
+p { font: 16px monospace; white-space: -moz-pre-space; }
+span { background-color: lime }
+</style>
+<p><span>a b</span></p>
+<p><span>a&#xA;b</span></p>
+<p><span>a &#xA; b</span></p>
+<p><span>&#xA; a&#xA; b&#xA;</span></p>
+<p><span>a </span></p>
+<p><span>&#xA;&#xA;&#xA;</span></p>
+<p><span> &#xA;&#xA;&#xA; </span></p>
+<p><span>. &#xA;</span></p>
+<p><span>a&#x9;b</span></p>
+<p><span>a &#x9; b</span></p>
+<p><span>&#x9; a&#x9; b&#x9;</span></p>
+<p><span>a </span></p>
+<p><span>&#x9;&#x9;&#x9;</span></p>
+<p><span> &#x9;&#x9;&#x9; </span></p>
+<p><span>. &#x9;</span></p>
diff --git a/layout/reftests/text/pre-wrap-1-ref.html b/layout/reftests/text/pre-wrap-1-ref.html
new file mode 100644
index 0000000000..7cda9fba13
--- /dev/null
+++ b/layout/reftests/text/pre-wrap-1-ref.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<title>test for bug 1008019</title>
+<style>
+#test {
+ white-space: pre;
+ font-family: monospace;
+ width: 16ch;
+ border: 1px solid blue;
+ padding: 3px;
+}
+</style>
+</head>
+<body>
+<div id="test">ab c d e f
+g h i
+j k
+l m
+n o
+p
+q
+r
+s</div>
+</body>
+</html>
diff --git a/layout/reftests/text/pre-wrap-1.html b/layout/reftests/text/pre-wrap-1.html
new file mode 100644
index 0000000000..782acc146c
--- /dev/null
+++ b/layout/reftests/text/pre-wrap-1.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+<title>test for bug 1008019</title>
+<style>
+#test {
+ white-space: pre-wrap;
+ font-family: monospace;
+ width: 16ch;
+ border: 1px solid blue;
+ padding: 3px;
+}
+</style>
+</head>
+<body>
+<div id="test">ab c d e f g h i j k<!--
+--> l m n o p<!--
+--> q r s</div>
+</body>
+</html>
diff --git a/layout/reftests/text/reftest.list b/layout/reftests/text/reftest.list
new file mode 100644
index 0000000000..983d66946e
--- /dev/null
+++ b/layout/reftests/text/reftest.list
@@ -0,0 +1,364 @@
+# Font-dependent reftests may fail intermittently/transiently due to asynch fallback,
+# so we disable the async mechanism for this directory.
+defaults pref(gfx.font_rendering.fallback.async,false)
+
+fails-if(Android) == fallback-01.xhtml fallback-01-ref.xhtml
+== font-selection-by-lang-01.html font-selection-by-lang-01-ref.html
+== font-selection-fallback-1.html font-selection-fallback-1-ref.html
+== font-selection-generic-1.html font-selection-generic-1-ref.html
+!= font-size-adjust-01.html font-size-adjust-01-ref.html
+# The following test passes consistently only on Mac OS X;
+# both Windows and Linux give results that vary depending on the font size/zoom factor used,
+# because hinting affects the metrics used to compute the font size adjustment. See bug 429605.
+random-if(!cocoaWidget) == font-size-adjust-02.html font-size-adjust-02-ref.html
+# This currently fails because line spacing does not respect font-size-adjust
+# in the "obvious" way, but it is unclear what the behavior should really be;
+# see bug #366138 for some (inconclusive) discussion
+# == font-size-adjust-03.html font-size-adjust-03-ref.html
+== justification-1.html justification-1-ref.html
+== justification-2a.html justification-2-ref.html
+== justification-2b.html justification-2-ref.html
+== justification-2c.html justification-2-ref.html
+!= justification-2d.html justification-2-ref.html
+== justification-cjk-extension.html justification-cjk-extension-ref.html
+== justification-space-diacritic.html justification-space-diacritic-ref.html
+load ligature-with-space-1.html
+== line-editing-1a.html line-editing-1-ref.html
+== line-editing-1b.html line-editing-1-ref.html
+== line-editing-1c.html line-editing-1-ref.html
+== line-editing-1d.html line-editing-1-ref.html
+== line-editing-1e.html line-editing-1-ref.html
+fails-if(cocoaWidget) == lineheight-metrics-1.html lineheight-metrics-1-ref.html # bug 657864
+== lineheight-metrics-2a.html lineheight-metrics-2-ref.html
+== lineheight-metrics-2b.html lineheight-metrics-2-ref.html
+== lineheight-percentage-1.html lineheight-percentage-1-ref.html
+== long-1.html long-ref.html
+fuzzy-if(Android,0-255,0-325) == pre-line-1.html pre-line-1-ref.html
+== pre-line-2.html pre-line-2-ref.html
+== pre-line-3.html pre-line-3-ref.html
+== pre-line-4.html pre-line-4-ref.html
+== pre-space-1.html pre-space-1-ref.html
+== pre-wrap-1.html pre-wrap-1-ref.html
+== soft-hyphens-1a.html soft-hyphens-1-ref.html
+== soft-hyphens-1b.html soft-hyphens-1-ref.html
+== soft-hyphens-1c.html soft-hyphens-1-ref.html
+== soft-hyphens-break-word-1a.html soft-hyphens-break-word-1-ref.html
+== soft-hyphens-break-word-1b.html soft-hyphens-break-word-1-ref.html
+== soft-hyphens-break-word-1c.html soft-hyphens-break-word-1-ref.html
+# Tests for soft hyphens in table cells, bug 418975
+!= soft-hyphen-in-table-1.html soft-hyphen-in-table-1-notref.html
+== soft-hyphen-in-table-1.html soft-hyphen-in-table-1-ref.html
+== soft-hyphen-in-table-2.html soft-hyphen-in-table-2-ref.html
+# Cairo's FreeType and GDI backends snap glyphs to pixels, while Mac (usually),
+# D2D, and Skia have subpixel positioning. The tests for pixel-snapping assume that
+# 1 CSS pixel == 1 device pixel
+skip == subpixel-glyphs-x-1a.html subpixel-glyphs-x-1b.html
+# Platforms with subpixel positioning already have inconsistent glyphs by
+# design, but that is considered more tolerable because they are subpixel
+# inconsistencies. On those platforms we just test that glyph positions are
+# subpixel.
+# D2D/DirectWrite results depend on the rendering mode chosen, so considering this as random for now.
+skip-if(!(d2d||cocoaWidget)) random-if(d2d) != subpixel-glyphs-x-2a.html subpixel-glyphs-x-2b.html
+== subpixel-glyphs-x-3a.html subpixel-glyphs-x-3b.html
+# No platforms do subpixel positioning vertically
+fuzzy-if(Android,0-19,0-2) == subpixel-glyphs-y-1a.html subpixel-glyphs-y-1b.html
+fuzzy-if(Android,0-231,0-653) == subpixel-lineheight-1a.html subpixel-lineheight-1b.html
+== swash-1.html swash-1-ref.html
+!= synthetic-bold-metrics-01.html synthetic-bold-metrics-01-notref.html
+== synthetic-bold-papyrus-01.html synthetic-bold-papyrus-01-ref.html
+== synthetic-bold-zero-width-01.html synthetic-bold-zero-width-01-ref.html
+== text-align-left-in-rtl-block.html text-align-left-in-rtl-block-ref.html
+== variation-selector-unsupported-1.html variation-selector-unsupported-1-ref.html
+== white-space-1a.html white-space-1-ref.html
+== white-space-1b.html white-space-1-ref.html
+== white-space-2.html white-space-2-ref.html
+== white-space-3.html white-space-3-ref.html
+pref(intl.icu4x.segmenter.enabled,false) == wordbreak-1.html wordbreak-1-ref.html
+== wordbreak-3.html wordbreak-3-ref.html
+== wordbreak-4b.html wordbreak-4b-ref.html
+== wordbreak-5.html wordbreak-5-ref.html
+fails-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu)) == wordbreak-6.html wordbreak-6-ref.html # Bug 1258239
+== wordbreak-7a.html wordbreak-7a-ref.html
+fails == wordbreak-7b.html wordbreak-7b-ref.html # bug 479829
+== wordbreak-8.html wordbreak-8-ref.html
+pref(gfx.font_rendering.graphite.enabled,true) == wordbreak-9.html wordbreak-9-ref.html
+== wordbreak-dynamic-1.html wordbreak-dynamic-1-ref.html
+== wordwrap-01.html wordwrap-01-ref.html
+fuzzy-if(Android,0-1,0-1) == wordwrap-02.html wordwrap-02-ref.html # bug 1363940
+fuzzy(0-1,0-50) == wordwrap-03.html wordwrap-03-ref.html # Fuzzy on Linux because the native textbox gradient is painted in a slightly different position depending on the invalid area.
+== wordwrap-04.html wordwrap-04-ref.html
+== overflowwrap-04.html wordwrap-04-ref.html
+== wordwrap-05.html wordwrap-05-ref.html
+== overflowwrap-05.html wordwrap-05-ref.html
+== wordwrap-06.html wordwrap-06-ref.html
+== overflowwrap-06.html wordwrap-06-ref.html
+== wordwrap-07.html wordwrap-07-ref.html
+== overflowwrap-07.html wordwrap-07-ref.html
+!= wordwrap-08.html wordwrap-01-ref.html
+== wordwrap-08.html wordwrap-08-ref.html
+!= wordwrap-09.html wordwrap-01-ref.html
+!= overflowwrap-09.html wordwrap-01-ref.html
+== wordwrap-09.html wordwrap-09-ref.html
+== overflowwrap-09.html wordwrap-09-ref.html
+== wordwrap-10.html wordwrap-10-ref.html # bug 752459
+== overflowwrap-10.html wordwrap-10-ref.html
+== word-spacing-01.html word-spacing-01-ref.html
+# the following will fail when rendering with Core Text (see bug 389074) due to what appears to be
+# an Apple bug: the presence of ZWNJ disturbs the positioning of an adjacent glyph. rdar://6427865
+random-if(cocoaWidget) random-if(gtkWidget) == zwnj-01.xhtml zwnj-01-ref.xhtml # gtkWidget:bug 1309113
+== zwnj-02.xhtml zwnj-02-ref.xhtml
+!= zwnj-01.html zwnj-01-notref.html
+== initial-zwj-1.html initial-zwj-1-ref.html
+== cgj-01.html cgj-01-ref.html
+== 444656.html 444656-ref.html
+fuzzy-if(geckoview,0-4,0-1) == 449555-1.html 449555-1-ref.html
+== 467722.html 467722-ref.html
+fuzzy(0-1,0-600) == 475092-sub.html 475092-ref.html
+fails-if(Android) fuzzy-if(!Android,0-90,0-3100) fuzzy-if(cocoaWidget,72-72,353-353) == 475092-pos.html 475092-sub.html # bug 482596
+== 476378-soft-hyphen-fallback.html 476378-soft-hyphen-fallback-ref.html
+# Test for bug 484954
+== rgba-text.html rgba-text-ref.html
+# Test for bug 575695, 'kern' table support
+!= kerning-01.html kerning-01-notref.html
+# Test for bug 577380, support for AAT layout (on OS X only)
+random-if(!cocoaWidget) == 577380.html 577380-ref.html
+# Test for OpenType Arabic shaping support
+== arabic-shaping-1.html arabic-shaping-1-ref.html
+# check ligature in Arial Bold on Windows, for bug 644184; may fail on other platforms depending on fonts
+random-if(!winWidget) == arial-bold-lam-alef-1.html arial-bold-lam-alef-1-ref.html
+# Fallback (presentation-forms) shaping with a font that lacks GSUB/GPOS
+== arabic-fallback-1.html arabic-fallback-1-ref.html
+== arabic-fallback-2.html arabic-fallback-2-ref.html
+== arabic-fallback-3.html arabic-fallback-3-ref.html
+== arabic-fallback-4.html arabic-fallback-4-ref.html
+== arabic-marks-1.html arabic-marks-1-ref.html
+== arabic-final-ligature-spacing.html arabic-final-ligature-spacing-ref.html
+# harfbuzz fallback mark stacking in the absence of GPOS:
+!= fallback-mark-stacking-1.html fallback-mark-stacking-1-notref.html
+
+== 726392-1.html 726392-1-ref.html
+== 726392-2.html 726392-2-ref.html
+== 726392-3.html 726392-3-ref.html
+== 745555-1.html 745555-1-ref.html
+== 745555-2.html 745555-2-ref.html
+== 820255.html 820255-ref.html
+!= 1170688.html 1170688-ref.html
+== 1320665-cmap-format-13.html 1320665-cmap-format-13-ref.html # see bug 1320665 comments 8-9
+== 1331339-script-extensions-shaping-1.html 1331339-script-extensions-shaping-1-ref.html
+skip-if(!cocoaWidget) != 1349308-1.html 1349308-notref.html # macOS-specific test for -apple-system glyph metrics
+fuzzy-if(Android,0-128,0-233) == 1463020-letter-spacing-text-transform-1.html 1463020-letter-spacing-text-transform-1-ref.html
+fails-if(Android) == 1463020-letter-spacing-text-transform-2.html 1463020-letter-spacing-text-transform-2-ref.html # missing font coverage on Android
+pref(intl.icu4x.segmenter.enabled,false) == 1507661-spurious-hyphenation-after-explicit.html 1507661-spurious-hyphenation-after-explicit-ref.html
+fuzzy-if(useDrawSnapshot,255-255,50-50) == 1522857-1.html 1522857-1-ref.html # antialiasing fuzz in non-webrender cases
+!= 1637405-pua-shaping-1.html 1637405-pua-shaping-1-notref.html
+fuzzy-if(useDrawSnapshot,255-255,50-50) == 1655364-1.html 1655364-1-ref.html
+== 1670581-1.html 1670581-1-ref.html
+== 1673098-1.html 1673098-1-ref.html
+
+# ensure emoji chars don't render blank (bug 715798, bug 779042);
+# should at least render hexboxes if there's no font support
+random-if(geckoview) != emoji-01.html emoji-01-notref.html
+!= emoji-02.html emoji-02-notref.html
+
+# Bug 727276: tests with variation selectors 15 and 16 to control emoji rendering style
+== emoji-03.html emoji-03-ref.html
+# the next two will fail on OS X 10.6 because no color emoji font is present,
+# and also on Android platforms until we have color emoji fonts there.
+# Tests rely on bundled Twemoji Mozilla to pass on Windows <8.1 and Linux.
+!= emoji-03.html emoji-03-notref.html
+== emoji-04.html emoji-04-ref.html
+!= emoji-05.html emoji-05-notref.html
+
+# check that Graphite shaping (bug 631479) is working
+pref(gfx.font_rendering.graphite.enabled,true) == graphite-01.html graphite-01-ref.html
+# Test 02 (using Pig Latin) is fuzzy on Win7 because glyph positioning is not guaranteed to match exactly
+# between a sequence of simple glyphs rendered individually, and the same sequence treated as a single cluster.
+fuzzy-if(winWidget,0-49,0-220) pref(gfx.font_rendering.graphite.enabled,true) == graphite-02.html graphite-02-ref.html
+pref(gfx.font_rendering.graphite.enabled,true) != graphite-03a.html graphite-03-notref.html
+pref(gfx.font_rendering.graphite.enabled,true) != graphite-03b.html graphite-03-notref.html
+pref(gfx.font_rendering.graphite.enabled,false) != graphite-01.html graphite-01-ref.html
+pref(gfx.font_rendering.graphite.enabled,false) != graphite-02.html graphite-02-ref.html
+# test 03a (lang setting in Padauk font) now works in opentype/harfbuzz as well
+pref(gfx.font_rendering.graphite.enabled,false) != graphite-03a.html graphite-03-notref.html
+pref(gfx.font_rendering.graphite.enabled,false) == graphite-03b.html graphite-03-notref.html
+
+# tests for graphite rendering with valid and invalid lang tags
+pref(gfx.font_rendering.graphite.enabled,true) == graphite-04-fa.html graphite-04-ref.html
+pref(gfx.font_rendering.graphite.enabled,true) != graphite-04-sd.html graphite-04-ref.html
+pref(gfx.font_rendering.graphite.enabled,true) == graphite-04-snd.html graphite-04-ref.html
+pref(gfx.font_rendering.graphite.enabled,true) != graphite-04-ur.html graphite-04-ref.html
+pref(gfx.font_rendering.graphite.enabled,true) == graphite-04-urd.html graphite-04-ref.html
+pref(gfx.font_rendering.graphite.enabled,true) != graphite-04-sd.html graphite-04-ur.html
+
+# tests to compare graphite to opentype (will trivially pass when graphite not enabled)
+== graphite-05-ot-only.html graphite-05-ref.html
+!= graphite-05-ot-only.html graphite-05-fail.html
+== graphite-05-simple.html graphite-05-ref.html
+== graphite-05-multipass.html graphite-05-ref.html
+== graphite-05-lang.html graphite-05-ref.html
+== graphite-05-badlang.html graphite-05-ref.html
+== graphite-05-feat.html graphite-05-ref.html
+
+# comparing composed and decomposed characters that should render identically
+# under both OpenType and Graphite shaping
+pref(gfx.font_rendering.graphite.enabled,false) == glyph-decomposition-opentype.html glyph-decomposition-opentype-ref.html
+pref(gfx.font_rendering.graphite.enabled,true) == glyph-decomposition-graphite.html glyph-decomposition-graphite-ref.html
+
+# test for bidi bug in graphite 1.3.2, fixed in 1.3.3 (bug 1207061)
+== graphite-bidi-1.html graphite-bidi-1-ref.html
+
+== graphite-surrogate-selection.html graphite-surrogate-selection-ref.html
+
+# Tests for hyphenation with hyphens property
+== auto-hyphenation-1.html auto-hyphenation-1-ref.html
+!= auto-hyphenation-1.html auto-hyphenation-1-notref.html
+== auto-hyphenation-1a.html auto-hyphenation-1-ref.html
+== auto-hyphenation-2.html auto-hyphenation-2-ref.html
+== auto-hyphenation-3.html auto-hyphenation-3-ref.html
+== auto-hyphenation-4.html auto-hyphenation-4-ref.html
+== auto-hyphenation-5.html auto-hyphenation-5-ref.html
+== auto-hyphenation-6.html auto-hyphenation-6-ref.html
+== auto-hyphenation-7.html auto-hyphenation-7-ref.html
+== auto-hyphenation-8.html auto-hyphenation-8-ref.html
+== auto-hyphenation-9.html auto-hyphenation-9-ref.html
+== auto-hyphenation-10.html auto-hyphenation-10-ref.html
+== auto-hyphenation-xmllang-1.xhtml auto-hyphenation-1-ref.html
+!= auto-hyphenation-xmllang-1.xhtml auto-hyphenation-1-notref.html
+== auto-hyphenation-xmllang-1a.xhtml auto-hyphenation-1-ref.html
+== auto-hyphenation-xmllang-2.xhtml auto-hyphenation-2-ref.html
+== auto-hyphenation-xmllang-3.xhtml auto-hyphenation-3-ref.html
+== auto-hyphenation-xmllang-4.xhtml auto-hyphenation-4-ref.html
+== auto-hyphenation-xmllang-5.xhtml auto-hyphenation-5-ref.html
+== auto-hyphenation-xmllang-6.xhtml auto-hyphenation-6-ref.html
+== auto-hyphenation-xmllang-7.xhtml auto-hyphenation-7-ref.html
+== auto-hyphenation-xmllang-8.xhtml auto-hyphenation-8-ref.html
+== auto-hyphenation-xmllang-9.xhtml auto-hyphenation-9-ref.html
+== auto-hyphenation-xmllang-10.xhtml auto-hyphenation-10-ref.html
+== auto-hyphenation-xmllang-11a.xhtml auto-hyphenation-1-ref.html
+== auto-hyphenation-xmllang-11b.xhtml auto-hyphenation-1-ref.html
+== auto-hyphenation-xmllang-12a.xhtml auto-hyphenation-4-ref.html
+== auto-hyphenation-xmllang-12b.xhtml auto-hyphenation-4-ref.html
+== auto-hyphenation-xmllang-13a.xhtml auto-hyphenation-1-ref.html
+== auto-hyphenation-xmllang-13b.xhtml auto-hyphenation-1-ref.html
+== auto-hyphenation-xmllang-14a.xhtml auto-hyphenation-4-ref.html
+== auto-hyphenation-xmllang-14b.xhtml auto-hyphenation-4-ref.html
+== auto-hyphenation-af-1.html auto-hyphenation-af-1-ref.html
+== auto-hyphenation-bg-1.html auto-hyphenation-bg-1-ref.html
+== auto-hyphenation-ca-1.html auto-hyphenation-ca-1-ref.html
+== auto-hyphenation-cy-1.html auto-hyphenation-cy-1-ref.html
+== auto-hyphenation-da-1.html auto-hyphenation-da-1-ref.html
+== auto-hyphenation-de-1901-1.html auto-hyphenation-de-1901-1-ref.html
+== auto-hyphenation-de-1996-1.html auto-hyphenation-de-1996-1-ref.html
+!= auto-hyphenation-de-1901-1.html auto-hyphenation-de-1996-1.html
+== auto-hyphenation-de-ch-1.html auto-hyphenation-de-ch-1-ref.html
+== auto-hyphenation-eo-1.html auto-hyphenation-eo-1-ref.html
+== auto-hyphenation-es-1.html auto-hyphenation-es-1-ref.html
+== auto-hyphenation-et-1.html auto-hyphenation-et-1-ref.html
+== auto-hyphenation-fi-1.html auto-hyphenation-fi-1-ref.html
+== auto-hyphenation-fr-1.html auto-hyphenation-fr-1-ref.html
+== auto-hyphenation-gl-1.html auto-hyphenation-gl-1-ref.html
+== auto-hyphenation-hr-1.html auto-hyphenation-hr-1-ref.html
+== auto-hyphenation-hsb-1.html auto-hyphenation-hsb-1-ref.html
+== auto-hyphenation-hu-1.html auto-hyphenation-hu-1-ref.html
+== auto-hyphenation-ia-1.html auto-hyphenation-ia-1-ref.html
+== auto-hyphenation-is-1.html auto-hyphenation-is-1-ref.html
+== auto-hyphenation-it-1.html auto-hyphenation-it-1-ref.html
+== auto-hyphenation-kmr-1.html auto-hyphenation-kmr-1-ref.html
+== auto-hyphenation-la-1.html auto-hyphenation-la-1-ref.html
+== auto-hyphenation-lt-1.html auto-hyphenation-lt-1-ref.html
+== auto-hyphenation-mn-1.html auto-hyphenation-mn-1-ref.html
+== auto-hyphenation-nb-1.html auto-hyphenation-nb-1-ref.html
+== auto-hyphenation-nl-1.html auto-hyphenation-nl-1-ref.html
+== auto-hyphenation-nn-1.html auto-hyphenation-nn-1-ref.html
+== auto-hyphenation-pl-1.html auto-hyphenation-pl-1-ref.html
+== auto-hyphenation-pt-1.html auto-hyphenation-pt-1-ref.html
+== auto-hyphenation-ru-1.html auto-hyphenation-ru-1-ref.html
+== auto-hyphenation-sh-1.html auto-hyphenation-sh-1-ref.html
+== auto-hyphenation-sl-1.html auto-hyphenation-sl-1-ref.html
+== auto-hyphenation-sr-1.html auto-hyphenation-sr-1-ref.html
+== auto-hyphenation-sv-1.html auto-hyphenation-sv-1-ref.html # test swedish patterns
+!= auto-hyphenation-sv-1.html auto-hyphenation-sv-1-notref.html # verify swedish != english
+== auto-hyphenation-tr-1.html auto-hyphenation-tr-1-ref.html
+== auto-hyphenation-uk-1.html auto-hyphenation-uk-1-ref.html
+
+== auto-hyphenation-bn-1.html auto-hyphenation-bn-1-ref.html
+== auto-hyphenation-gu-1.html auto-hyphenation-gu-1-ref.html
+== auto-hyphenation-hi-1.html auto-hyphenation-hi-1-ref.html
+== auto-hyphenation-kn-1.html auto-hyphenation-kn-1-ref.html
+== auto-hyphenation-ml-1.html auto-hyphenation-ml-1-ref.html
+== auto-hyphenation-pa-1.html auto-hyphenation-pa-1-ref.html
+== auto-hyphenation-ta-1.html auto-hyphenation-ta-1-ref.html
+== auto-hyphenation-te-1.html auto-hyphenation-te-1-ref.html
+
+== auto-hyphenation-transformed-1.html auto-hyphenation-transformed-1-ref.html
+
+== hyphenation-caps-1.html hyphenation-caps-1-ref.html
+
+== hyphenation-control-1.html hyphenation-control-1-ref.html
+== hyphenation-control-2.html hyphenation-control-2-ref.html
+== hyphenation-control-3.html hyphenation-control-3-ref.html
+== hyphenation-control-4.html hyphenation-control-4-ref.html
+fuzzy-if(Android,0-64,0-18) fuzzy-if(winWidget,0-56,0-6) == hyphenation-control-5.html hyphenation-control-5-ref.html
+== hyphenation-control-6.html hyphenation-control-6-ref.html
+== hyphenation-control-7.html hyphenation-control-7-ref.html
+
+# osx-font-smoothing - with and without subpixel AA, only under OSX
+fails-if(!cocoaWidget) != osx-font-smoothing.html osx-font-smoothing-ref.html
+fails-if(!cocoaWidget) != osx-font-smoothing-2.html osx-font-smoothing-2-notref.html
+== osx-font-smoothing-2.html osx-font-smoothing-2-ref.html
+
+# stray control chars should be visible by default, bug 1099557
+pref(layout.css.moz-control-character-visibility.enabled,true) != control-chars-01a.html control-chars-01-notref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) != control-chars-01b.html control-chars-01-notref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) != control-chars-01c.html control-chars-01-notref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) != control-chars-01d.html control-chars-01-notref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) != control-chars-02.html control-chars-02-notref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) == control-chars-03a.html control-chars-03-ref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) == control-chars-03b.html control-chars-03-ref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) pref(layout.css.control-characters.visible,true) != control-chars-04a.html control-chars-04-notref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) pref(layout.css.control-characters.visible,true) != control-chars-04b.html control-chars-04-notref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) pref(layout.css.control-characters.visible,true) != control-chars-04c.html control-chars-04-notref.html
+pref(layout.css.moz-control-character-visibility.enabled,true) pref(layout.css.control-characters.visible,true) != control-chars-04d.html control-chars-04-notref.html
+
+# font fallback for <space> when not supported in the primary font family - bug 970891
+== space-font-1.html space-font-1-ref.html
+
+# handling of highly negative letter-spacing and intrinsic width
+== negative-letter-spacing-1.html negative-letter-spacing-1-ref.html
+== segment-break-transformation-1.html segment-break-transformation-1-ref.html
+
+# color glyphs, opacity, and RTL runs - bug 1318539
+== color-opacity-rtl-1.html color-opacity-rtl-1-ref.html
+fuzzy-if(cocoaWidget,0-1,0-1421) == color-opacity-rtl-2.html color-opacity-rtl-2-ref.html
+
+== letter-spacing-nolig-1.html letter-spacing-nolig-1-ref.html
+== letter-spacing-nolig-2.html letter-spacing-nolig-2.html
+
+pref(intl.icu4x.segmenter.enabled,false) == ethiopic-wordspace.html ethiopic-wordspace-ref.html
+
+# sub and sup elements should be influenced by their container's line-height - bug 1524897
+== sub-sup-and-line-height.html sub-sup-and-line-height-ref.html
+
+# Basic rendering tests for the (nonstandard/compatibility) -webkit-text-security property.
+== webkit-text-security-1.html?test#none webkit-text-security-1.html?ref#none
+!= webkit-text-security-1.html?test#none webkit-text-security-1.html?ref#square
+== webkit-text-security-1.html?test#circle webkit-text-security-1.html?ref#circle
+== webkit-text-security-1.html?test#disc webkit-text-security-1.html?ref#disc
+== webkit-text-security-1.html?test#square webkit-text-security-1.html?ref#square
+!= webkit-text-security-1.html?test#circle webkit-text-security-1.html?ref#square
+# Exact matching to a reference is trickier for these, but we can mismatch-test that the property has an effect.
+!= webkit-text-security-2.html?circle webkit-text-security-2.html?none
+!= webkit-text-security-2.html?disc webkit-text-security-2.html?circle
+!= webkit-text-security-2.html?square webkit-text-security-2.html?circle
+!= webkit-text-security-3.html?circle webkit-text-security-3.html?none
+!= webkit-text-security-3.html?disc webkit-text-security-3.html?circle
+!= webkit-text-security-3.html?square webkit-text-security-3.html?circle
+!= webkit-text-security-4.html?circle webkit-text-security-4.html?none
+!= webkit-text-security-4.html?disc webkit-text-security-4.html?circle
+!= webkit-text-security-4.html?square webkit-text-security-4.html?circle
+!= webkit-text-security-5.html?circle webkit-text-security-5.html?none
+!= webkit-text-security-5.html?disc webkit-text-security-5.html?circle
+!= webkit-text-security-5.html?square webkit-text-security-5.html?circle
+
+# Reset default prefs.
+defaults
diff --git a/layout/reftests/text/rgba-text-ref.html b/layout/reftests/text/rgba-text-ref.html
new file mode 100644
index 0000000000..8bf7036eb5
--- /dev/null
+++ b/layout/reftests/text/rgba-text-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML>
+<html>
+<body style="background: #000">
+ <!-- A regular old red box -->
+ <div style="background: red; position:absolute; top:30px; left:0px; padding:50px"></div>
+</body>
+</html>
diff --git a/layout/reftests/text/rgba-text.html b/layout/reftests/text/rgba-text.html
new file mode 100644
index 0000000000..a482ed76ee
--- /dev/null
+++ b/layout/reftests/text/rgba-text.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html>
+<body style="background: #000">
+ <div style="color: rgba(255, 255, 255, 0.2); font-size:48px;">_</div>
+ <!-- the red box should totally obscure the drawn portion of the text
+ however if the text is painted as a box instead of an underscore it
+ will show above the top of the red box.
+ This test would have caught bug 484954
+ -->
+ <div style="background: red; position:absolute; top:30px; left:0px; padding:50px"></div>
+</body>
+</html>
diff --git a/layout/reftests/text/segment-break-transformation-1-ref.html b/layout/reftests/text/segment-break-transformation-1-ref.html
new file mode 100644
index 0000000000..824fd97065
--- /dev/null
+++ b/layout/reftests/text/segment-break-transformation-1-ref.html
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<style type="text/css">
+div { border:1px solid black; }
+b { font-weight:normal; background-color:yellow; font-size: 16px; line-height: 16px;}
+</style>
+</head>
+<body>
+<div>
+<p><b><span>&#x65b7;&#x884c;&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;<br>
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;<br>
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;<br>
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span>Hello Kitty</span></b>
+<p><b><span>HelloKitty</span></b>
+<p><b><span>HelloKitty</span></b>
+<p><b><span>HelloKitty</span></b>
+<!-- test surrogates handling -->
+<p><b><span>&#x20000;&#x20001;&#x20002;&#x20003;</span></b>
+<p><b><span>&#x20000;&#x6e2c;&#x20002;&#x20003;</span></b>
+<p><b><span>&#x20000;&#x20001;&#x6e2c;&#x20003;</span></b>
+<!-- test emoji handling -->
+<p><b><span>&#x65b7;&#x1f600; &#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c; &#x1f601;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x1f600; &#x1f601;&#x8a66;</span></b>
+<p><b><span>Hello&#x1f600; &#x1f601;Kitty</span></b>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/segment-break-transformation-1.html b/layout/reftests/text/segment-break-transformation-1.html
new file mode 100644
index 0000000000..a11ba6b1c1
--- /dev/null
+++ b/layout/reftests/text/segment-break-transformation-1.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<style type="text/css">
+div { border:1px solid black; }
+b { font-weight:normal; background-color:yellow; font-size: 16px; line-height: 16px;}
+.nowrap { white-space:nowrap; }
+.pre { white-space:pre; }
+.prewrap { white-space:pre-wrap; }
+.preline { white-space:pre-line; }
+</style>
+</head>
+<body>
+<div>
+<p><b><span>&#x65b7;&#x884c;
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;&#x200B;
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;
+&#x200B;&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;&#x200B;
+&#x200B;&#x6e2c;&#x8a66;</span></b>
+<p><b><span class="nowrap">&#x65b7;&#x884c;
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span class="pre">&#x65b7;&#x884c;
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span class="prewrap">&#x65b7;&#x884c;
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span class="preline">&#x65b7;&#x884c;
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span>Hello
+Kitty</span></b>
+<p><b><span>Hello&#x200B;
+Kitty</span></b>
+<p><b><span>Hello
+&#x200B;Kitty</span></b>
+<p><b><span>Hello&#x200B;
+&#x200B;Kitty</span></b>
+<!-- test surrogates handling -->
+<p><b><span>&#x20000;&#x20001;
+&#x20002;&#x20003;</span></b>
+<p><b><span>&#x20000;&#x6e2c;
+&#x20002;&#x20003;</span></b>
+<p><b><span>&#x20000;&#x20001;
+&#x6e2c;&#x20003;</span></b>
+<!-- test emoji handling -->
+<p><b><span>&#x65b7;&#x1f600;
+&#x6e2c;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x884c;
+&#x1f601;&#x8a66;</span></b>
+<p><b><span>&#x65b7;&#x1f600;
+&#x1f601;&#x8a66;</span></b>
+<p><b><span>Hello&#x1f600;
+&#x1f601;Kitty</span></b>
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphen-in-table-1-notref.html b/layout/reftests/text/soft-hyphen-in-table-1-notref.html
new file mode 100644
index 0000000000..d22c20da29
--- /dev/null
+++ b/layout/reftests/text/soft-hyphen-in-table-1-notref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+table {
+ border: 1px solid red;
+}
+</style>
+</head>
+
+<body>
+
+<table>
+<tr><td style="width:10em">supercalifragilisticexpialidocious</td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphen-in-table-1-ref.html b/layout/reftests/text/soft-hyphen-in-table-1-ref.html
new file mode 100644
index 0000000000..905c9db3f5
--- /dev/null
+++ b/layout/reftests/text/soft-hyphen-in-table-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+table {
+ border: 1px solid red;
+}
+</style>
+</head>
+
+<body>
+
+<table>
+<tr><td style="width:10em">supercalifragilistic- expialidocious</td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphen-in-table-1.html b/layout/reftests/text/soft-hyphen-in-table-1.html
new file mode 100644
index 0000000000..530a674b92
--- /dev/null
+++ b/layout/reftests/text/soft-hyphen-in-table-1.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+table {
+ border: 1px solid red;
+}
+</style>
+</head>
+
+<body>
+
+<table>
+<tr><td style="width:10em">supercalifragilistic&shy;expialidocious</td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphen-in-table-2-ref.html b/layout/reftests/text/soft-hyphen-in-table-2-ref.html
new file mode 100644
index 0000000000..3e8ec5f985
--- /dev/null
+++ b/layout/reftests/text/soft-hyphen-in-table-2-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+table {
+ border: 1px solid red;
+}
+</style>
+</head>
+
+<body>
+
+<table>
+<tr><td style="width:1em">supercalifragilistic- expialidocious</td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphen-in-table-2.html b/layout/reftests/text/soft-hyphen-in-table-2.html
new file mode 100644
index 0000000000..00de48b5ea
--- /dev/null
+++ b/layout/reftests/text/soft-hyphen-in-table-2.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style type="text/css">
+table {
+ border: 1px solid red;
+}
+</style>
+</head>
+
+<body>
+
+<table>
+<tr><td style="width:1em">supercalifragilistic&shy;expialidocious</td></tr>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphens-1-ref.html b/layout/reftests/text/soft-hyphens-1-ref.html
new file mode 100644
index 0000000000..b405be7cfb
--- /dev/null
+++ b/layout/reftests/text/soft-hyphens-1-ref.html
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<div>
+<p>Hy-<br>phen.
+<p>Hy-<br>phen.
+<p>Hy-<br>phen.
+<p>Hy-<br>phen.
+<p>Hy-<br>phen.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphens-1a.html b/layout/reftests/text/soft-hyphens-1a.html
new file mode 100644
index 0000000000..9f6decdb54
--- /dev/null
+++ b/layout/reftests/text/soft-hyphens-1a.html
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<div style="width:0;">
+<p>Hy&shy;phen.
+<p><span>H</span>y&shy;phen.
+<p><span>Hy</span>&shy;phen.
+<p><span>Hy&shy;</span>phen.
+<p><span>Hy&shy;p</span>hen.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphens-1b.html b/layout/reftests/text/soft-hyphens-1b.html
new file mode 100644
index 0000000000..eb537773ae
--- /dev/null
+++ b/layout/reftests/text/soft-hyphens-1b.html
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<div style="width:0;">
+<p>Hy&shy;&shy;phen.
+<p><span>Hy</span>&shy;&shy;phen.
+<p><span>Hy&shy;</span>&shy;phen.
+<p><span>Hy&shy;&shy;</span>phen.
+<p><span>Hy&shy;&shy;p</span>hen.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphens-1c.html b/layout/reftests/text/soft-hyphens-1c.html
new file mode 100644
index 0000000000..dad1766341
--- /dev/null
+++ b/layout/reftests/text/soft-hyphens-1c.html
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<div style="width:0;">
+<p><span>H</span><span>y&shy;phen</span>.
+<p><span>Hy</span><span>&shy;phen</span>.
+<p><span>Hy</span>&shy;<span>phen</span>.
+<p><span>Hy&shy;</span><span>phen</span>.
+<p><span>Hy&shy;p</span><span>hen</span>.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphens-break-word-1-ref.html b/layout/reftests/text/soft-hyphens-break-word-1-ref.html
new file mode 100644
index 0000000000..e33081021e
--- /dev/null
+++ b/layout/reftests/text/soft-hyphens-break-word-1-ref.html
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<div>
+<p>H<br>y-<br>p<br>h<br>e<br>n<br>.
+<p>H<br>y-<br>p<br>h<br>e<br>n<br>.
+<p>H<br>y-<br>p<br>h<br>e<br>n<br>.
+<p>H<br>y-<br>p<br>h<br>e<br>n<br>.
+<p>H<br>y-<br>p<br>h<br>e<br>n<br>.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphens-break-word-1a.html b/layout/reftests/text/soft-hyphens-break-word-1a.html
new file mode 100644
index 0000000000..fd5a8099b3
--- /dev/null
+++ b/layout/reftests/text/soft-hyphens-break-word-1a.html
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<div style="width:0; word-wrap:break-word;">
+<p>Hy&shy;phen.
+<p><span>H</span>y&shy;phen.
+<p><span>Hy</span>&shy;phen.
+<p><span>Hy&shy;</span>phen.
+<p><span>Hy&shy;p</span>hen.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphens-break-word-1b.html b/layout/reftests/text/soft-hyphens-break-word-1b.html
new file mode 100644
index 0000000000..74d58cc6a2
--- /dev/null
+++ b/layout/reftests/text/soft-hyphens-break-word-1b.html
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<div style="width:0; word-wrap:break-word;">
+<p>Hy&shy;&shy;phen.
+<p><span>Hy</span>&shy;&shy;phen.
+<p><span>Hy&shy;</span>&shy;phen.
+<p><span>Hy&shy;&shy;</span>phen.
+<p><span>Hy&shy;&shy;p</span>hen.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/soft-hyphens-break-word-1c.html b/layout/reftests/text/soft-hyphens-break-word-1c.html
new file mode 100644
index 0000000000..130f0c26b1
--- /dev/null
+++ b/layout/reftests/text/soft-hyphens-break-word-1c.html
@@ -0,0 +1,13 @@
+<html>
+<body>
+
+<div style="width:0; word-wrap:break-word;">
+<p><span>H</span><span>y&shy;phen</span>.
+<p><span>Hy</span><span>&shy;phen</span>.
+<p><span>Hy</span>&shy;<span>phen</span>.
+<p><span>Hy&shy;</span><span>phen</span>.
+<p><span>Hy&shy;p</span><span>hen</span>.
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/space-font-1-ref.html b/layout/reftests/text/space-font-1-ref.html
new file mode 100644
index 0000000000..9d92b95a35
--- /dev/null
+++ b/layout/reftests/text/space-font-1-ref.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Bug 970891</title>
+ <style type="text/css">
+ @font-face {
+ font-family: "test";
+ src: url(../fonts/markA-nospace.ttf);
+ }
+ div {
+ font-family: test, monospace;
+ font-size: 16px;
+ line-height: 32px;
+ }
+ span {
+ font-family: monospace;
+ }
+ </style>
+</head>
+
+<body>
+ <div><b>A</b><span> </span><b>A</b><span> </span><i>A</i><span> </span><i>A</i></div>
+</body>
+
+</html>
diff --git a/layout/reftests/text/space-font-1.html b/layout/reftests/text/space-font-1.html
new file mode 100644
index 0000000000..e7cbd02271
--- /dev/null
+++ b/layout/reftests/text/space-font-1.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <title>Bug 970891</title>
+ <style type="text/css">
+ @font-face {
+ font-family: "test";
+ src: url(../fonts/markA-nospace.ttf);
+ }
+ div {
+ font-family: test, monospace;
+ font-size: 16px;
+ line-height: 32px;
+ }
+ span {
+ font-family: monospace;
+ }
+ </style>
+</head>
+
+<body>
+ <!-- markA-nospace does not have a glyph for the <space> character,
+ so the spaces should fall back to 'monospace'. -->
+ <div><b>A</b> <b>A</b> <i>A</i> <i>A</i><span>&nbsp;</span></div>
+</body>
+
+</html>
diff --git a/layout/reftests/text/sub-sup-and-line-height-ref.html b/layout/reftests/text/sub-sup-and-line-height-ref.html
new file mode 100644
index 0000000000..168159b2a6
--- /dev/null
+++ b/layout/reftests/text/sub-sup-and-line-height-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <style>
+ p { line-height: 44px; }
+ sub, sup { vertical-align: top; }
+ </style>
+ </head>
+ <body>
+ <p>Test<sup style="line-height: inherit">Test</sup><sub style="line-height: inherit">Test</sub></p>
+ </body>
+</html>
+
+
diff --git a/layout/reftests/text/sub-sup-and-line-height.html b/layout/reftests/text/sub-sup-and-line-height.html
new file mode 100644
index 0000000000..2931246e79
--- /dev/null
+++ b/layout/reftests/text/sub-sup-and-line-height.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <style>
+ p { line-height: 44px; }
+ sub, sup { vertical-align: top; }
+ </style>
+ </head>
+ <body>
+ <p>Test<sup>Test</sup><sub>Test</sub></p>
+ </body>
+</html>
+
diff --git a/layout/reftests/text/subpixel-glyphs-x-1a.html b/layout/reftests/text/subpixel-glyphs-x-1a.html
new file mode 100644
index 0000000000..8d51b1c9d3
--- /dev/null
+++ b/layout/reftests/text/subpixel-glyphs-x-1a.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <style type="text/css">
+ body {
+ text-rendering: optimizeLegibility;
+ font-size: 13px;
+ }
+ div {
+ border: none;
+ padding: 0px;
+ }
+ </style>
+</head>
+<body>
+ <div style="position:fixed; left:9.6px">
+ <div style="font-family: DejaVu Sans, Tahoma, sans-serif">
+ oxoxoxoxoxoxox
+ </div>
+ <div style="font-family: DejaVu Sans, sans-serif">
+ rnrnrnrnrnrnrn
+ </div>
+ <div style="font-family: Tahoma, sans-serif">
+ zezezezezezeze
+ </div>
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-glyphs-x-1b.html b/layout/reftests/text/subpixel-glyphs-x-1b.html
new file mode 100644
index 0000000000..504a51ccb8
--- /dev/null
+++ b/layout/reftests/text/subpixel-glyphs-x-1b.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <style type="text/css">
+ body {
+ text-rendering: optimizeLegibility;
+ font-size: 13px;
+ }
+ div {
+ border: none;
+ padding: 0px;
+ }
+ </style>
+</head>
+<body>
+ <div style="position:fixed; left:10.4px">
+ <div style="font-family: DejaVu Sans, Tahoma, sans-serif">
+ oxoxoxoxoxoxox
+ </div>
+ <div style="font-family: DejaVu Sans, sans-serif">
+ rnrnrnrnrnrnrn
+ </div>
+ <div style="font-family: Tahoma, sans-serif">
+ zezezezezezeze
+ </div>
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-glyphs-x-2a.html b/layout/reftests/text/subpixel-glyphs-x-2a.html
new file mode 100644
index 0000000000..cfa0f7b896
--- /dev/null
+++ b/layout/reftests/text/subpixel-glyphs-x-2a.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <style type="text/css">
+ body {
+ text-rendering: optimizeLegibility;
+ font-size: 13px;
+ }
+ div {
+ border: none;
+ padding: 0px;
+ }
+ </style>
+</head>
+<body>
+ <div style="position:fixed; left:9.6px">
+ o
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-glyphs-x-2b.html b/layout/reftests/text/subpixel-glyphs-x-2b.html
new file mode 100644
index 0000000000..e79312b118
--- /dev/null
+++ b/layout/reftests/text/subpixel-glyphs-x-2b.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <style type="text/css">
+ body {
+ text-rendering: optimizeLegibility;
+ font-size: 13px;
+ }
+ div {
+ border: none;
+ padding: 0px;
+ }
+ </style>
+</head>
+<body>
+ <div style="position:fixed; left:10.4px">
+ o
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-glyphs-x-3a.html b/layout/reftests/text/subpixel-glyphs-x-3a.html
new file mode 100644
index 0000000000..34f8368d21
--- /dev/null
+++ b/layout/reftests/text/subpixel-glyphs-x-3a.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Test for consistent kerning, bug 716402</title>
+ <style type="text/css">
+ @font-face {
+ font-family: mplus;
+ src: url(../fonts/mplus/mplus-1p-regular-no-OT.ttf);
+ /* a copy of M+ with OpenType tables removed,
+ so only legacy 'kern' is present */
+ }
+ body {
+ text-rendering: optimizeLegibility;
+ font-family: mplus;
+ font-size: 15px;
+ background: white;
+ color: black;
+ }
+ .right {
+ text-align: right;
+ }
+ </style>
+</head>
+<body>
+ <div>
+ AVAV
+ </div>
+ <div class="right">
+ AVAV
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-glyphs-x-3b.html b/layout/reftests/text/subpixel-glyphs-x-3b.html
new file mode 100644
index 0000000000..83b5aa34db
--- /dev/null
+++ b/layout/reftests/text/subpixel-glyphs-x-3b.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <title>Reference for consistent kerning, bug 716402</title>
+ <style type="text/css">
+ @font-face {
+ font-family: mplus;
+ src: url(../fonts/mplus/mplus-1p-regular-no-OT.ttf);
+ /* a copy of M+ with OpenType tables removed,
+ so only legacy 'kern' is present */
+ }
+ body {
+ text-rendering: optimizeLegibility;
+ font-family: mplus;
+ font-size: 15px;
+ background: white;
+ color: black;
+ }
+ .right {
+ text-align: right;
+ }
+ span {
+ color: white;
+ }
+ </style>
+</head>
+<body>
+ <div>
+ AVAV<span>AV</span>
+ </div>
+ <div class="right">
+ <span>AV</span>AVAV
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-glyphs-y-1a.html b/layout/reftests/text/subpixel-glyphs-y-1a.html
new file mode 100644
index 0000000000..3f55015f03
--- /dev/null
+++ b/layout/reftests/text/subpixel-glyphs-y-1a.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <style type="text/css">
+ body {
+ text-rendering: optimizeLegibility;
+ font-size: 14.5px;
+ }
+ div, span {
+ border: none;
+ padding: 0px;
+ }
+ span {
+ /* Offset the baseline by an integer number of pixels */
+ display: inline-block;
+ vertical-align: baseline;
+ height: 30px;
+ }
+ </style>
+</head>
+<body>
+ <div style="position:fixed; left:10px; top:9.6px; font-family: sans-serif">
+ e&#x306;&#x327;<span></span>
+ </div>
+ <div style="position:fixed; left:100px; top:9.6px; font-family: serif">
+ e&#x306;&#x327;<span></span>
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-glyphs-y-1b.html b/layout/reftests/text/subpixel-glyphs-y-1b.html
new file mode 100644
index 0000000000..696efb26b3
--- /dev/null
+++ b/layout/reftests/text/subpixel-glyphs-y-1b.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <style type="text/css">
+ body {
+ text-rendering: optimizeLegibility;
+ font-size: 14.5px;
+ }
+ div, span {
+ border: none;
+ padding: 0px;
+ }
+ span {
+ /* Offset the baseline by an integer number of pixels */
+ display: inline-block;
+ vertical-align: baseline;
+ height: 30px;
+ }
+ </style>
+</head>
+<body>
+ <div style="position:fixed; left:10px; top:10.4px; font-family: sans-serif">
+ e&#x306;&#x327<span></span>
+ </div>
+ <div style="position:fixed; left:100px; top:10.4px; font-family: serif">
+ e&#x306;&#x327<span></span>
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-lineheight-1a.html b/layout/reftests/text/subpixel-lineheight-1a.html
new file mode 100644
index 0000000000..4bd857beba
--- /dev/null
+++ b/layout/reftests/text/subpixel-lineheight-1a.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <style type="text/css">
+ body {
+ text-rendering: optimizeLegibility;
+ font-size: 14.5px;
+ }
+ div, span {
+ border: none;
+ padding: 0px;
+ }
+ span {
+ /* Offset the baseline by an integer number of pixels */
+ display: inline-block;
+ vertical-align: baseline;
+ height: 30px;
+ }
+ </style>
+</head>
+<body>
+ <div style="position:fixed; left:10px; top:9.6px; font-family: sans-serif">
+ e<span></span><br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ </div>
+ <div style="position:fixed; left:100px; top:9.6px; font-family: serif">
+ e<span></span><br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ </div>
+</body>
diff --git a/layout/reftests/text/subpixel-lineheight-1b.html b/layout/reftests/text/subpixel-lineheight-1b.html
new file mode 100644
index 0000000000..a9c67093f3
--- /dev/null
+++ b/layout/reftests/text/subpixel-lineheight-1b.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <style type="text/css">
+ body {
+ text-rendering: optimizeLegibility;
+ font-size: 14.5px;
+ }
+ div, span {
+ border: none;
+ padding: 0px;
+ }
+ span {
+ /* Offset the baseline by an integer number of pixels */
+ display: inline-block;
+ vertical-align: baseline;
+ height: 30px;
+ }
+ </style>
+</head>
+<body>
+ <div style="position:fixed; left:10px; top:10.4px; font-family: sans-serif">
+ e<span></span><br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ </div>
+ <div style="position:fixed; left:100px; top:10.4px; font-family: serif">
+ e<span></span><br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ e<br>
+ </div>
+</body>
diff --git a/layout/reftests/text/swash-1-ref.html b/layout/reftests/text/swash-1-ref.html
new file mode 100644
index 0000000000..ee4c636baa
--- /dev/null
+++ b/layout/reftests/text/swash-1-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<head></head>
+<body style="font-family: 'Hoefler Text'; font-size: 200%;">
+<p><span style="font-style: italic;">Free<span style="color: transparent;">$</span></span></p>
+</body>
+</html>
diff --git a/layout/reftests/text/swash-1.html b/layout/reftests/text/swash-1.html
new file mode 100644
index 0000000000..5318840395
--- /dev/null
+++ b/layout/reftests/text/swash-1.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<head></head>
+<body style="font-family: 'Hoefler Text'; font-size: 200%;">
+<p><span style="font-style: italic;">Free<span style="font-size: 0;">$</span></span></p>
+</body>
+</html>
diff --git a/layout/reftests/text/synthetic-bold-metrics-01-notref.html b/layout/reftests/text/synthetic-bold-metrics-01-notref.html
new file mode 100644
index 0000000000..47964e6f09
--- /dev/null
+++ b/layout/reftests/text/synthetic-bold-metrics-01-notref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: dejavu;
+ src: url(../fonts/dejavu-sans/DejaVuSans.ttf);
+}
+
+p {
+ font: 32px dejavu; /* family with only a single weight */
+}
+
+.test {
+ color: white; /* hide the text, we're only comparing metrics */
+}
+</style>
+</head>
+<body>
+<p>AbcdefghijklmnopqrstuvwxyZ</p>
+<p>A<span class="test">bcdefghijklmnopqrstuvwxy</span>Z</p>
+</body>
+</html>
diff --git a/layout/reftests/text/synthetic-bold-metrics-01.html b/layout/reftests/text/synthetic-bold-metrics-01.html
new file mode 100644
index 0000000000..a5331b5216
--- /dev/null
+++ b/layout/reftests/text/synthetic-bold-metrics-01.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style type="text/css">
+@font-face {
+ font-family: dejavu;
+ src: url(../fonts/dejavu-sans/DejaVuSans.ttf);
+}
+
+p {
+ font: 32px dejavu; /* family with only a single weight */
+}
+
+.test {
+ color: white; /* hide the text, we're only comparing metrics */
+ font-weight: bold; /* synthetic bold will be used */
+}
+</style>
+</head>
+<body>
+<p>AbcdefghijklmnopqrstuvwxyZ</p>
+<!-- the "test" span here uses synthetic bold, which should cause the following
+ 'Z' to appear further to the right -->
+<p>A<span class="test">bcdefghijklmnopqrstuvwxy</span>Z</p>
+</body>
+</html>
diff --git a/layout/reftests/text/synthetic-bold-papyrus-01-ref.html b/layout/reftests/text/synthetic-bold-papyrus-01-ref.html
new file mode 100644
index 0000000000..38c7dbc38d
--- /dev/null
+++ b/layout/reftests/text/synthetic-bold-papyrus-01-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+ body {
+ margin: 50px;
+ font-size: 24px;
+ }
+
+ #test1 { font-family: Papyrus, serif; }
+
+</style>
+
+</head>
+
+<body>
+ <p id="test1">Test for Papyrus font <b>within a bold tag</b>.</p>
+</body>
+
+</html>
diff --git a/layout/reftests/text/synthetic-bold-papyrus-01.html b/layout/reftests/text/synthetic-bold-papyrus-01.html
new file mode 100644
index 0000000000..1784fc7073
--- /dev/null
+++ b/layout/reftests/text/synthetic-bold-papyrus-01.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<title>Test</title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
+<style type="text/css">
+ body {
+ margin: 50px;
+ font-size: 24px;
+ }
+
+ @font-face {
+ font-family: test;
+ src: local(Papyrus);
+ }
+
+ #test2 { font-family: test, serif; }
+
+</style>
+
+</head>
+
+<body>
+ <p id="test2">Test for Papyrus font <b>within a bold tag</b>.</p>
+</body>
+
+</html>
diff --git a/layout/reftests/text/synthetic-bold-zero-width-01-ref.html b/layout/reftests/text/synthetic-bold-zero-width-01-ref.html
new file mode 100644
index 0000000000..c95bb2d04c
--- /dev/null
+++ b/layout/reftests/text/synthetic-bold-zero-width-01-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: Fira;
+ src: url(../fonts/fira/FiraSansOT-Regular.otf);
+}
+body {
+ font: 24px Apple Symbols, Segoe UI Symbol, Fira;
+}
+.bold {
+ font-weight: bold;
+}
+</style>
+<body>
+<div>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+</div>
+<div class=bold>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+ xx<br>
+</div>
diff --git a/layout/reftests/text/synthetic-bold-zero-width-01.html b/layout/reftests/text/synthetic-bold-zero-width-01.html
new file mode 100644
index 0000000000..027b419eb4
--- /dev/null
+++ b/layout/reftests/text/synthetic-bold-zero-width-01.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<style>
+@font-face {
+ font-family: Fira;
+ src: url(../fonts/fira/FiraSansOT-Regular.otf);
+}
+body {
+ /* We want a font that only has a single weight, and supports 'x' and zero-width U+0301.
+ * The Apple Symbols and Segoe UI Symbol fonts appear to meet this requirement on macOS
+ * and Win10 respectively.
+ * If they're not available, we use a single face of Fira loaded via @font-face.
+ */
+ font: 24px Apple Symbols, Segoe UI Symbol, Fira;
+}
+.bold {
+ font-weight: bold;
+}
+span {
+ color: transparent;
+}
+</style>
+<body>
+<!-- any number of zero-width characters should not result in any extra space between the 'x' glyphs ... -->
+<div>
+ xx<br>
+ x<span>&#x301;</span>x<br>
+ x<span>&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;&#x301;&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;&#x301;&#x301;&#x301;&#x301;</span>x<br>
+</div>
+<!-- ... even when synthetic bold is in effect -->
+<div class=bold>
+ xx<br>
+ x<span>&#x301;</span>x<br>
+ x<span>&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;&#x301;&#x301;&#x301;</span>x<br>
+ x<span>&#x301;&#x301;&#x301;&#x301;&#x301;&#x301;&#x301;</span>x<br>
+</div>
diff --git a/layout/reftests/text/text-align-left-in-rtl-block-iframe.html b/layout/reftests/text/text-align-left-in-rtl-block-iframe.html
new file mode 100644
index 0000000000..bee8ceee6e
--- /dev/null
+++ b/layout/reftests/text/text-align-left-in-rtl-block-iframe.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html><head>
+ <meta charset="utf-8">
+ <title>Testcase for bug 806284</title>
+ <style type="text/css">
+ html,body {
+ color:black; background-color:white; font-size:16px; padding:0; margin:0;
+ }
+ body { text-align:left; }
+</style>
+</head>
+<body>
+<div dir="rtl">
+111111111111112222222222222233333333333334444444444
+</div>
+</body>
+</html>
diff --git a/layout/reftests/text/text-align-left-in-rtl-block-ref.html b/layout/reftests/text/text-align-left-in-rtl-block-ref.html
new file mode 100644
index 0000000000..8884c2a947
--- /dev/null
+++ b/layout/reftests/text/text-align-left-in-rtl-block-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait"><head>
+ <meta charset="utf-8">
+ <title>Testcase for bug 806284</title>
+ <style type="text/css">
+ html,body {
+ color:black; background-color:white; font-size:16px; padding:0; margin:0;
+ }
+
+ #t { width:20em; border: 1px solid black; }
+ </style>
+</head>
+<body>
+<iframe id="t" src="text-align-left-in-rtl-block-iframe.html"></iframe>
+<script type="text/javascript">
+function test()
+{
+ document.documentElement.removeAttribute("class");
+}
+document.addEventListener("MozReftestInvalidate", test);
+</script>
+</body>
+</html>
diff --git a/layout/reftests/text/text-align-left-in-rtl-block.html b/layout/reftests/text/text-align-left-in-rtl-block.html
new file mode 100644
index 0000000000..57a790bce0
--- /dev/null
+++ b/layout/reftests/text/text-align-left-in-rtl-block.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait"><head>
+ <meta charset="utf-8">
+ <title>Testcase for bug 806284</title>
+ <style type="text/css">
+ html,body {
+ color:black; background-color:white; font-size:16px; padding:0; margin:0;
+ }
+
+ #t { width:10em; border: 1px solid black; }
+ </style>
+</head>
+<body>
+<iframe id="t" src="text-align-left-in-rtl-block-iframe.html"></iframe>
+<script type="text/javascript">
+function test()
+{
+ var t = document.getElementById('t');
+ t.style.width = '20em';
+ document.documentElement.removeAttribute("class");
+}
+document.addEventListener("MozReftestInvalidate", test);
+</script>
+</body>
+</html>
diff --git a/layout/reftests/text/variation-selector-unsupported-1-ref.html b/layout/reftests/text/variation-selector-unsupported-1-ref.html
new file mode 100644
index 0000000000..08832bef39
--- /dev/null
+++ b/layout/reftests/text/variation-selector-unsupported-1-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ @font-face {
+ font-family: "MarkA";
+ src: url(../fonts/markA.otf);
+ }
+
+ body { font-family: MarkA; }
+ </style>
+</head>
+<body>
+A
+</body>
+</html>
diff --git a/layout/reftests/text/variation-selector-unsupported-1.html b/layout/reftests/text/variation-selector-unsupported-1.html
new file mode 100644
index 0000000000..98b028b4da
--- /dev/null
+++ b/layout/reftests/text/variation-selector-unsupported-1.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en-US">
+<head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+
+ @font-face {
+ font-family: "MarkA";
+ src: url(../fonts/markA.otf);
+ }
+
+ body { font-family: MarkA; }
+ </style>
+</head>
+<body>
+A&#xFE00;
+</body>
+</html>
diff --git a/layout/reftests/text/webkit-text-security-1.html b/layout/reftests/text/webkit-text-security-1.html
new file mode 100644
index 0000000000..19ffaf5b49
--- /dev/null
+++ b/layout/reftests/text/webkit-text-security-1.html
@@ -0,0 +1,138 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<style>
+ .test {
+ color: blue;
+ font: 13px monospace;
+ }
+ .init {
+ -webkit-text-security: initial;
+ }
+ .before::before {
+ content: "before text";
+ }
+
+ /* these classes are added/used only in reference mode */
+ .before.circle::before {
+ content: "\25E6\25E6\25E6\25E6\25E6\25E6\25E6\25E6\25E6\25E6\25E6";
+ }
+ .before.disc::before {
+ content: "\2022\2022\2022\2022\2022\2022\2022\2022\2022\2022\2022";
+ }
+ .before.square::before {
+ content: "\25A0\25A0\25A0\25A0\25A0\25A0\25A0\25A0\25A0\25A0\25A0";
+ }
+ ol.circle {
+ list-style-type: "\25E6\25E6\25E6";
+ }
+ ol.disc {
+ list-style-type: "\2022\2022\2022";
+ }
+ ol.square {
+ list-style-type: "\25A0\25A0\25A0";
+ }
+</style>
+
+<script>
+function go() {
+ // In test mode, we just apply the requested -webkit-text-security setting.
+ maskOption = document.location.hash.substr(1);
+ if (document.location.search == "?test") {
+ document.styleSheets[0].cssRules[0].style.webkitTextSecurity = maskOption;
+ return;
+ }
+
+ if (document.location.search != "?ref") {
+ console.warn("Expected either ?test or ?ref request");
+ return;
+ }
+
+ // In reference mode, edit the content to replace text with the masking symbol.
+ // (This is hacky and incomplete, just enough to handle the things present in this example.)
+ if (maskOption == "circle") {
+ maskChar = "\u25E6";
+ } else if (maskOption == "disc") {
+ maskChar = "\u2022";
+ } else if (maskOption == "square") {
+ maskChar = "\u25A0";
+ } else if (maskOption == "none") {
+ return;
+ } else {
+ console.warn("Unknown mask character option: " + maskOption);
+ return;
+ }
+
+ testElems = document.getElementsByClassName("test");
+ for (i = 0; i < testElems.length; ++i) {
+ e = testElems[i];
+ if (e.classList.contains("before") || e.tagName == "OL" || e.tagName == "UL") {
+ e.classList.add(maskOption);
+ }
+ if (e.tagName == "INPUT") {
+ if (e.type == "password") {
+ // leave untouched
+ continue;
+ }
+ e.value = e.value.replaceAll(/./g, maskChar);
+ continue;
+ }
+ function replaceInElem(elem) {
+ if (elem.classList && elem.classList.contains("init")) {
+ return;
+ }
+ if (elem.alt) {
+ elem.alt = elem.alt.replaceAll(/./g, maskChar);
+ }
+ if (elem.firstElementChild) {
+ for (c = elem.firstElementChild; c; c = c.nextElementSibling) {
+ replaceInElem(c);
+ }
+ return;
+ }
+ if (elem.textContent != " ") {
+ elem.textContent = elem.textContent.replaceAll(/./g, maskChar);
+ }
+ }
+ replaceInElem(e);
+ }
+}
+</script>
+
+<body onload="go()">
+div: <div class="test">a b c</div>
+div with single (collapsed-away) space character: <div class="test"> </div>
+div with nbsp: <div class="test">&nbsp;</div>
+div with ::before generated content text: <div class="test before"></div>
+implicitly inheriting into div: <div class="test"><div>div inherit</div></div>
+reset on child div: <div class="test"><div class="init">div reset</div></div>
+span: <span class="test">Hello</span><br>
+img with alt text and "title" hover-text:
+<img class="test" src="broken" alt="alt text" title="hover text"><br>
+Fieldset:
+<fieldset class="test"><legend>Legend</legend><span>Fieldset</span></fieldset>
+<h4>FORM FIELDS:</h4>
+button: <button class="test">Hello</button><br>
+input: <input class="test" value="Hello"><br>
+input type="password": <input class="test" type="password" value="please"><br>
+input type="submit": <input class="test" type="submit" value="Submit"><br>
+input type="reset": <input class="test" type="reset" value="Reset"><br>
+input type="button": <input class="test" type="button" value="button"><br>
+input type="tel": <input class="test" type="tel" value="12345"><br>
+<!-- skipping input types with browser-generated content that is hard to emulate
+ and can't just be overwritten with the masking character -->
+<!--input type="number": <input class="test" type="number" value="12345"><br>-->
+input type="search": <input class="test" type="search" value="12345"><br>
+input type="url": <input class="test" type="url" value="http://example.org"><br>
+input type="email": <input class="test" type="email" value="a@example.org"><br>
+<!--input type="date": <input class="test" type="date" value="2022-01-01"><br>-->
+<!--input type="time": <input class="test" type="time" value="12:00:00"><br>-->
+<!--input type="week": <input class="test" type="week" value="12:00:00"><br>-->
+<!--input type="file": <input class="test" type="file"><br>-->
+<!--input type="image": <input class="test" type="image"><br>-->
+select: <select class="test"><option>A</option><option>BB</option></select><br>
+SVG: <svg height="30px" class="test"><text y="20">SVG Text</text></svg><br>
+
+Ordered list, first item empty: <ol class="test"><li></li><li>a</li><li>bb</li></ol>
+<!-- unordered list is tricky because of the use of -moz-bullet-font for the markers -->
+<!--Unordered list, first item empty: <ul class="test"><li></li><li>a</li><li>bb</li></ul>-->
diff --git a/layout/reftests/text/webkit-text-security-2.html b/layout/reftests/text/webkit-text-security-2.html
new file mode 100644
index 0000000000..04987bb776
--- /dev/null
+++ b/layout/reftests/text/webkit-text-security-2.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<style>
+ .test {
+ color: blue;
+ font: 13px monospace;
+ }
+</style>
+
+<script>
+function go() {
+ // Apply the requested -webkit-text-security setting.
+ maskOption = document.location.search.substr(1);
+ document.styleSheets[0].cssRules[0].style.webkitTextSecurity = maskOption;
+}
+</script>
+
+<body onload="go()">
+input type="number": <input class="test" type="number" value="12345">
diff --git a/layout/reftests/text/webkit-text-security-3.html b/layout/reftests/text/webkit-text-security-3.html
new file mode 100644
index 0000000000..1dcca393a9
--- /dev/null
+++ b/layout/reftests/text/webkit-text-security-3.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<style>
+ .test {
+ color: blue;
+ font: 13px monospace;
+ }
+</style>
+
+<script>
+function go() {
+ // Apply the requested -webkit-text-security setting.
+ maskOption = document.location.search.substr(1);
+ document.styleSheets[0].cssRules[0].style.webkitTextSecurity = maskOption;
+}
+</script>
+
+<body onload="go()">
+input type="date": <input class="test" type="date" value="2023-12-31">
diff --git a/layout/reftests/text/webkit-text-security-4.html b/layout/reftests/text/webkit-text-security-4.html
new file mode 100644
index 0000000000..df2c60751f
--- /dev/null
+++ b/layout/reftests/text/webkit-text-security-4.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<style>
+ .test {
+ color: blue;
+ font: 13px monospace;
+ }
+</style>
+
+<script>
+function go() {
+ // Apply the requested -webkit-text-security setting.
+ maskOption = document.location.search.substr(1);
+ document.styleSheets[0].cssRules[0].style.webkitTextSecurity = maskOption;
+}
+</script>
+
+<body onload="go()">
+input type="time": <input class="test" type="time" value="12:59">
diff --git a/layout/reftests/text/webkit-text-security-5.html b/layout/reftests/text/webkit-text-security-5.html
new file mode 100644
index 0000000000..49b1f90d4b
--- /dev/null
+++ b/layout/reftests/text/webkit-text-security-5.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+
+<style>
+ .test {
+ color: blue;
+ font: 13px monospace;
+ }
+</style>
+
+<script>
+function go() {
+ // Apply the requested -webkit-text-security setting.
+ maskOption = document.location.search.substr(1);
+ document.styleSheets[0].cssRules[0].style.webkitTextSecurity = maskOption;
+}
+</script>
+
+<body onload="go()">
+input type="file": <input class="test" type="file">
diff --git a/layout/reftests/text/white-space-1-ref.html b/layout/reftests/text/white-space-1-ref.html
new file mode 100644
index 0000000000..88351db062
--- /dev/null
+++ b/layout/reftests/text/white-space-1-ref.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<!-- Reference -->
+<style>
+div { border:1px solid black; }
+.container { float:left; width:20%; border-color:cyan; }
+p { width:0; }
+b { font-weight:normal; background-color:yellow; white-space:pre; }
+</style>
+</head>
+<body>
+
+<div>
+<p><b>Hello
+Kitty</b>
+<p><b>Hello Kitty</b>
+<p><b>Hello Kitty</b>
+<p><b>Hello
+Kitty</b>
+</div>
+
+<div class="container">
+<p><b>Hello
+Kitty</b>
+<p><b>Hello&nbsp;
+Kitty</b>
+<p><b>Hello
+Kitty</b>
+<p><b>Hello
+Kitty</b>
+</div>
+
+<div class="container">
+<p><b>Hello
+ Kitty</b>
+<p><b>Hello Kitty</b>
+<p><b>Hello Kitty</b>
+<p><b>Hello
+ Kitty</b>
+</div>
+
+<div class="container">
+<p><b>Hello
+Kitty</b>
+<p><b>Hello Kitty</b>
+<p><b>Hello Kitty</b>
+<p><b>Hello
+Kitty</b>
+</div>
+
+<div class="container">
+<p><b>Hello&nbsp;
+Kitty</b>
+<p><b>Hello&nbsp;
+Kitty</b>
+<p><b>Hello&nbsp;
+Kitty</b>
+<p><b>Hello
+Kitty</b>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/white-space-1a.html b/layout/reftests/text/white-space-1a.html
new file mode 100644
index 0000000000..4ae2034595
--- /dev/null
+++ b/layout/reftests/text/white-space-1a.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<!-- Testing all combinations of pre/nowrap/pre-wrap/normal space pairs -->
+<style>
+.nowrap { white-space:nowrap; }
+.pre { white-space:pre; }
+.prewrap { white-space:pre-wrap; }
+div { border:1px solid black; }
+.container { float:left; width:20%; border-color:cyan; }
+p { width:0; }
+b { font-weight:normal; background-color:yellow; }
+</style>
+</head>
+<body>
+
+<div>
+<p><b>Hello Kitty</b>
+<p><b>Hello<span class="pre"> </span>Kitty</b>
+<p><b>Hello<span class="nowrap"> </span>Kitty</b>
+<p><b>Hello<span class="prewrap"> </span>Kitty</b>
+</div>
+
+<div class="container">
+<p><b>Hello Kitty</b>
+<p><b>Hello<span class="pre"> </span> Kitty</b>
+<p><b>Hello<span class="nowrap"> </span> Kitty</b>
+<p><b>Hello<span class="prewrap"> </span> Kitty</b>
+</div>
+
+<div class="container">
+<p><b>Hello <span class="pre"> </span>Kitty</b>
+<p><b>Hello<span class="pre"> </span><span class="pre"> </span>Kitty</b>
+<p><b>Hello<span class="nowrap"> </span><span class="pre"> </span>Kitty</b>
+<p><b>Hello<span class="prewrap"> </span><span class="pre"> </span>Kitty</b>
+</div>
+
+<div class="container">
+<p><b>Hello <span class="nowrap"> </span>Kitty</b>
+<p><b>Hello<span class="pre"> </span><span class="nowrap"> </span>Kitty</b>
+<p><b>Hello<span class="nowrap"> </span><span class="nowrap"> </span>Kitty</b>
+<p><b>Hello<span class="prewrap"> </span><span class="nowrap"> </span>Kitty</b>
+</div>
+
+<div class="container">
+<p><b>Hello <span class="prewrap"> </span>Kitty</b>
+<p><b>Hello<span class="pre"> </span><span class="prewrap"> </span>Kitty</b>
+<p><b>Hello<span class="nowrap"> </span><span class="prewrap"> </span>Kitty</b>
+<p><b>Hello<span class="prewrap"> </span>Kitty</b>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/white-space-1b.html b/layout/reftests/text/white-space-1b.html
new file mode 100644
index 0000000000..715d0b2e81
--- /dev/null
+++ b/layout/reftests/text/white-space-1b.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<!-- Adding extra span boundaries -->
+<style>
+.nowrap { white-space:nowrap; }
+.pre { white-space:pre; }
+.prewrap { white-space:pre-wrap; }
+div { border:1px solid black; }
+.container { float:left; width:20%; border-color:cyan; }
+p { width:0; }
+b { font-weight:normal; background-color:yellow; }
+</style>
+</head>
+<body>
+
+<div>
+<p><b><span>Hello<span> <span>Kitty</span></b>
+<p><b><span>Hello<span><span class="pre"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="nowrap"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="prewrap"> </span><span>Kitty</span></b>
+</div>
+
+<div class="container">
+<p><b><span>Hello<span> <span>Kitty</span></b>
+<p><b><span>Hello<span><span class="pre"> </span> <span>Kitty</span></b>
+<p><b><span>Hello<span><span class="nowrap"> </span> <span>Kitty</span></b>
+<p><b><span>Hello<span><span class="prewrap"> </span> <span>Kitty</span></b>
+</div>
+
+<div class="container">
+<p><b><span>Hello<span> <span class="pre"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="pre"> </span><span class="pre"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="nowrap"> </span><span class="pre"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="prewrap"> </span><span class="pre"> </span><span>Kitty</span></b>
+</div>
+
+<div class="container">
+<p><b><span>Hello<span> <span class="nowrap"> </span>Kitty</b>
+<p><b><span>Hello<span><span class="pre"> </span><span class="nowrap"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="nowrap"> </span><span class="nowrap"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="prewrap"> </span><span class="nowrap"> </span><span>Kitty</span></b>
+</div>
+
+<div class="container">
+<p><b><span>Hello<span> <span class="prewrap"> </span>Kitty</b>
+<p><b><span>Hello<span><span class="pre"> </span><span class="prewrap"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="nowrap"> </span><span class="prewrap"> </span><span>Kitty</span></b>
+<p><b><span>Hello<span><span class="prewrap"> </span><span class="prewrap"> </span><span>Kitty</span></b>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/white-space-2-ref.html b/layout/reftests/text/white-space-2-ref.html
new file mode 100644
index 0000000000..f452f43914
--- /dev/null
+++ b/layout/reftests/text/white-space-2-ref.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<!-- Reference -->
+<style>
+div { font:16px sans-serif; border:1px solid black; }
+.container { float:left; width:20%; border-color:cyan; }
+p { width:0; }
+b { font-weight:normal; background-color:yellow; white-space:pre; }
+.cell { display:table-cell; border:1px solid green; }
+.hang { display:inline-block; width:0; overflow:visible; }
+.hang span { display:inline; background-color:yellow; }
+.clip { overflow: hidden; }
+</style>
+</head>
+<body>
+
+<div>
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+<p><span class="cell"><b>Hello Kitty</b></span>
+<p><span class="cell"><b>Hello Kitty</b></span>
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+</div>
+
+<div class="container">
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+</div>
+
+<div class="container">
+<p><span class="cell"><b>Hello
+ Kitty</b></span>
+<p><span class="cell"><b>Hello Kitty</b></span>
+<p><span class="cell"><b>Hello Kitty</b></span>
+<p><span class="cell clip"><b>Hello<span class="hang"><span> </span></span>
+ Kitty</b></span>
+</div>
+
+<div class="container">
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+<p><span class="cell"><b>Hello Kitty</b></span>
+<p><span class="cell"><b>Hello Kitty</b></span>
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+</div>
+
+<div class="container">
+<p><span class="cell"><b>Hello<span class="hang"><span> </span></span>
+Kitty</b></span>
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="hang"><span> </span></span>
+Kitty</b></span>
+<p><span class="cell"><b>Hello
+Kitty</b></span>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/white-space-2.html b/layout/reftests/text/white-space-2.html
new file mode 100644
index 0000000000..84377c7fda
--- /dev/null
+++ b/layout/reftests/text/white-space-2.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<!-- Wrapping tests in table-cell to test min-width computation -->
+<style>
+div { font:16px sans-serif; border:1px solid black; }
+.container { float:left; width:20%; border-color:cyan; }
+p { width:0; }
+b { font-weight:normal; background-color:yellow; }
+.cell { display:table-cell; border:1px solid green; }
+.nowrap { white-space:nowrap; }
+.pre { white-space:pre; }
+.prewrap { white-space:pre-wrap; }
+</style>
+</head>
+<body>
+
+<div>
+<p><span class="cell"><b>Hello Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="pre"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="nowrap"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="prewrap"> </span>Kitty</b></span>
+</div>
+
+<div class="container">
+<p><span class="cell"><b>Hello <span>Kitty</span></b></span>
+<p><span class="cell"><b>Hello<span class="pre"> </span> Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="nowrap"> </span> Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="prewrap"> </span> Kitty</b></span>
+</div>
+
+<div class="container">
+<p><span class="cell"><b>Hello <span class="pre"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="pre"> </span><span class="pre"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="nowrap"> </span><span class="pre"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="prewrap"> </span><span class="pre"> </span>Kitty</b></span>
+</div>
+
+<div class="container">
+<p><span class="cell"><b>Hello <span class="nowrap"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="pre"> </span><span class="nowrap"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="nowrap"> </span><span class="nowrap"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="prewrap"> </span><span class="nowrap"> </span>Kitty</b></span>
+</div>
+
+<div class="container">
+<p><span class="cell"><b>Hello <span class="prewrap"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="pre"> </span><span class="prewrap"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="nowrap"> </span><span class="prewrap"> </span>Kitty</b></span>
+<p><span class="cell"><b>Hello<span class="prewrap"> </span><span class="prewrap"> </span>Kitty</b></span>
+</div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/white-space-3-ref.html b/layout/reftests/text/white-space-3-ref.html
new file mode 100644
index 0000000000..1bde6bffc0
--- /dev/null
+++ b/layout/reftests/text/white-space-3-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+div { font: 24px monospace; width: 0; white-space: pre; }
+b { font-weight: normal; background: yellow; }
+.cell { display: table-cell; border: 1px solid green; }
+</style>
+</head>
+<body>
+
+<p>There should be no red:</p>
+
+<div><span class="cell"><b>Hiya <br>Kitty</b></span></div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/white-space-3.html b/layout/reftests/text/white-space-3.html
new file mode 100644
index 0000000000..1a413df09e
--- /dev/null
+++ b/layout/reftests/text/white-space-3.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+div { font: 24px monospace; width: 0; }
+b { font-weight: normal; background: yellow; }
+.cell { display: table-cell; border: 1px solid green; background: red; }
+.nowrap { white-space: nowrap; }
+.prewrap { white-space: pre-wrap; }
+</style>
+</head>
+<body>
+
+<p>There should be no red:</p>
+
+<div><span class="cell"><b>Hiya<span class="prewrap"> </span><span class="nowrap"> </span>Kitty</b></span></div>
+
+</body>
+</html>
diff --git a/layout/reftests/text/word-spacing-01-ref.html b/layout/reftests/text/word-spacing-01-ref.html
new file mode 100644
index 0000000000..5bf7c331af
--- /dev/null
+++ b/layout/reftests/text/word-spacing-01-ref.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<style>
+span { display:inline-block; width:10ch; }
+/* first tab-position will be at 2 * (space-width + word-spacing), i.e. 22ch,
+ so to advance there after the 3-ch word "tab" we need 19ch of added space */
+span.tab { width: 19ch; }
+</style>
+</head>
+<body style="font-family: monospace; width: 433px; height: 590px;">
+
+<table border="1">
+<tr><td>space <span></span>.</td>
+<tr><td>nonbreaking-space&nbsp;<span></span>.</td>
+<tr><td>ideographic-space&#x3000;.</td>
+<tr><td>newline
+<span></span>.</td>
+<tr><td>tab&#9;<span></span>.</td>
+<tr><td>form-feed&#12;.</td>
+</table>
+
+<table border="1" style="white-space:pre">
+<tr><td>space <span></span>.</td>
+<tr><td>nonbreaking-space&nbsp;<span></span>.</td>
+<tr><td>ideographic-space&#x3000;.</td>
+<tr><td>newline
+.</td>
+<tr><td>tab<span class=tab></span>.</td>
+<tr><td>form-feed&#12;.</td>
+</table>
+
+<table border="1" style="white-space:nowrap">
+<tr><td>space <span></span>.</td>
+<tr><td>nonbreaking-space&nbsp;<span></span>.</td>
+<tr><td>ideographic-space&#x3000;.</td>
+<tr><td>newline <span></span>.</td>
+<tr><td>tab&#9;<span></span>.</td>
+<tr><td>form-feed&#12;.</td>
+</table>
+
+<table border="1" style="white-space:pre-wrap">
+<tr><td>space <span></span>.</td>
+<tr><td>nonbreaking-space&nbsp;<span></span>.</td>
+<tr><td>ideographic-space&#x3000;.</td>
+<tr><td>newline
+.</td>
+<tr><td>tab<span class=tab></span>.</td>
+<tr><td>form-feed&#12;.</td>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/text/word-spacing-01.html b/layout/reftests/text/word-spacing-01.html
new file mode 100644
index 0000000000..7441e56381
--- /dev/null
+++ b/layout/reftests/text/word-spacing-01.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML>
+<html>
+<body style="font-family: monospace; word-spacing:10ch; -moz-tab-size: 2; width: 433px; height: 590px;">
+
+<table border="1">
+<tr><td>space .</td>
+<tr><td>nonbreaking-space&nbsp;.</td>
+<tr><td>ideographic-space&#x3000;.</td>
+<tr><td>newline
+.</td>
+<tr><td>tab&#9;.</td>
+<tr><td>form-feed&#12;.</td>
+</table>
+
+<table border="1" style="white-space:pre">
+<tr><td>space .</td>
+<tr><td>nonbreaking-space&nbsp;.</td>
+<tr><td>ideographic-space&#x3000;.</td>
+<tr><td>newline
+.</td>
+<tr><td>tab&#9;.</td>
+<tr><td>form-feed&#12;.</td>
+</table>
+
+<table border="1" style="white-space:nowrap">
+<tr><td>space .</td>
+<tr><td>nonbreaking-space&nbsp;.</td>
+<tr><td>ideographic-space&#x3000;.</td>
+<tr><td>newline
+.</td>
+<tr><td>tab&#9;.</td>
+<tr><td>form-feed&#12;.</td>
+</table>
+
+<table border="1" style="white-space:pre-wrap">
+<tr><td>space .</td>
+<tr><td>nonbreaking-space&nbsp;.</td>
+<tr><td>ideographic-space&#x3000;.</td>
+<tr><td>newline
+.</td>
+<tr><td>tab&#9;.</td>
+<tr><td>form-feed&#12;.</td>
+</table>
+
+</body>
+</html>
diff --git a/layout/reftests/text/wordbreak-1-ref.html b/layout/reftests/text/wordbreak-1-ref.html
new file mode 100644
index 0000000000..63cd78f60f
--- /dev/null
+++ b/layout/reftests/text/wordbreak-1-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Test - word-break: break-all</title>
+ </head>
+ <body>
+ <div>f<br/>o<br/>x<br/>f<br/>-<br/>o<br/></div><br/>
+ <div>fox<br/>f-<br>o</div><br/>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-1.html b/layout/reftests/text/wordbreak-1.html
new file mode 100644
index 0000000000..6994b70f72
--- /dev/null
+++ b/layout/reftests/text/wordbreak-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ div.breakall { width: 0px; word-break: break-all; }
+ div.keepall { width: 0px; word-break: keep-all; }
+ </style>
+ <title>Test - word-break: break-all</title>
+ </head>
+ <body>
+ <div class="breakall">fox f-o</div><br />
+ <div class="keepall">fox f-o</div><br />
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-3-ref.html b/layout/reftests/text/wordbreak-3-ref.html
new file mode 100644
index 0000000000..8bc5e4bf5e
--- /dev/null
+++ b/layout/reftests/text/wordbreak-3-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ </style>
+ <title>Test - word-break: break-all with clusters</title>
+ </head>
+ <body>
+ <div>&#x0935;&#x093F;<br/>&#x0915;&#x093F;<br/>&#x092A;&#x0940;<br/>&#x0921;&#x093F;<br/>&#x092F;&#x093E;</div><br/>
+ <div>&#x0935;&#x093F;&#x0915;&#x093F;&#x092A;&#x0940;&#x0921;&#x093F;&#x092F;&#x093E;</div><br/>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-3.html b/layout/reftests/text/wordbreak-3.html
new file mode 100644
index 0000000000..9b5cad7015
--- /dev/null
+++ b/layout/reftests/text/wordbreak-3.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ div.breakall { width: 0px; word-break: break-all; }
+ div.keepall { width: 0px; word-break: keep-all; }
+ </style>
+ <title>Test - word-break: break-all with clusters</title>
+ </head>
+ <body>
+ <div class="breakall">&#x0935;&#x093F;&#x0915;&#x093F;&#x092A;&#x0940;&#x0921;&#x093F;&#x092F;&#x093E;</div><br />
+ <div class="keepall">&#x0935;&#x093F;&#x0915;&#x093F;&#x092A;&#x0940;&#x0921;&#x093F;&#x092F;&#x093E;</div><br />
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-4b-ref.html b/layout/reftests/text/wordbreak-4b-ref.html
new file mode 100644
index 0000000000..946c407b91
--- /dev/null
+++ b/layout/reftests/text/wordbreak-4b-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ </style>
+ <title>Test - word-break: break-all with Hangul syllables</title>
+ </head>
+ <body>
+ <div>&#xC560;<br/>&#xAE30;<br/>&#xD310;<br/>&#xB2E4;</div><br/>
+ <div>&#xC560;&#xAE30;&#xD310;&#xB2E4;</div><br/>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-4b.html b/layout/reftests/text/wordbreak-4b.html
new file mode 100644
index 0000000000..296f96dd93
--- /dev/null
+++ b/layout/reftests/text/wordbreak-4b.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ div.breakall { width: 0px; word-break: break-all; }
+ div.keepall { width: 0px; word-break: keep-all; }
+ </style>
+ <title>Test - word-break: break-all with Hangul syllables</title>
+ </head>
+ <body>
+ <div class="breakall">&#xC560;&#xAE30;&#xD310;&#xB2E4;</div><br />
+ <div class="keepall">&#xC560;&#xAE30;&#xD310;&#xB2E4;</div><br />
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-5-ref.html b/layout/reftests/text/wordbreak-5-ref.html
new file mode 100644
index 0000000000..5466d255dd
--- /dev/null
+++ b/layout/reftests/text/wordbreak-5-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ </style>
+ <title>Test - word-break: break-all with supplementary characters</title>
+ </head>
+ <body>
+ <div>&#x10911;<br/>&#x10903;<br/>&#x10909;<br/>&#x10912;<br/>&#x10901;<br/>&#x10900;<br/>&#x1090C;<br/>&#x1090D;<br/>&#x10915;<br/>&#x10905;<br/>&#x10909;<br/>&#x10907;<br/>&#x10909;<br/>&#x10904;</div><br/>
+ <div>&#x10911;&#x10903;&#x10909;&#x10912;<br/>&#x10901;&#x10900;&#x1090C;&#x1090D;&#x10915;&#x10905;<br/>&#x10909;&#x10907;&#x10909;&#x10904;</div><br/>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-5.html b/layout/reftests/text/wordbreak-5.html
new file mode 100644
index 0000000000..9f20ed3e9b
--- /dev/null
+++ b/layout/reftests/text/wordbreak-5.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ div.breakall { width: 0px; word-break: break-all; }
+ div.keepall { width: 0px; word-break: keep-all; }
+ </style>
+ <title>Test - word-break: break-all with supplementary characters</title>
+ </head>
+ <body>
+ <div class="breakall">&#x10911;&#x10903;&#x10909;&#x10912; &#x10901;&#x10900;&#x1090C;&#x1090D;&#x10915;&#x10905; &#x10909;&#x10907;&#x10909;&#x10904;</div><br />
+ <div class="keepall">&#x10911;&#x10903;&#x10909;&#x10912; &#x10901;&#x10900;&#x1090C;&#x1090D;&#x10915;&#x10905; &#x10909;&#x10907;&#x10909;&#x10904;</div><br />
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-6-ref.html b/layout/reftests/text/wordbreak-6-ref.html
new file mode 100644
index 0000000000..3422ec686c
--- /dev/null
+++ b/layout/reftests/text/wordbreak-6-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ </style>
+ <title>Test - word-break: break-all with supplementary characters</title>
+ </head>
+ <body>
+ <div>&#x10a24;<br/>&#x10a2a;&#x10a0c;<br/>&#x10a2a;&#x10a3f;<br/>&#x10a17;&#x10a38;&#x10a05;&#x10a0c;&#x10a0f;</div><br/>
+ <div>&#x10a24;&#x10a2a;&#x10a0c;&#x10a2a;&#x10a3f;&#x10a17;&#x10a38;&#x10a05;&#x10a0c;&#x10a0f;</div><br/>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-6.html b/layout/reftests/text/wordbreak-6.html
new file mode 100644
index 0000000000..26ea950d80
--- /dev/null
+++ b/layout/reftests/text/wordbreak-6.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ div.breakall { width: 0px; word-break: break-all; }
+ div.keepall { width: 0px; word-break: keep-all; }
+ </style>
+ <title>Test - word-break: break-all with kharoshthi characters</title>
+ </head>
+ <body>
+ <div class="breakall">&#x10a24;&#x10a2a;&#x10a0c;&#x10a2a;&#x10a3f;&#x10a17;&#x10a38;&#x10a05;&#x10a0c;&#x10a0f;</div><br />
+ <div class="keepall">&#x10a24;&#x10a2a;&#x10a0c;&#x10a2a;&#x10a3f;&#x10a17;&#x10a38;&#x10a05;&#x10a0c;&#x10a0f;</div><br />
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-7-ref.html b/layout/reftests/text/wordbreak-7-ref.html
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/layout/reftests/text/wordbreak-7-ref.html
diff --git a/layout/reftests/text/wordbreak-7.html b/layout/reftests/text/wordbreak-7.html
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/layout/reftests/text/wordbreak-7.html
diff --git a/layout/reftests/text/wordbreak-7a-ref.html b/layout/reftests/text/wordbreak-7a-ref.html
new file mode 100644
index 0000000000..4f1d1d882e
--- /dev/null
+++ b/layout/reftests/text/wordbreak-7a-ref.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ @font-face {
+ font-family: test;
+ src: url(../fonts/dejavu-sans/DejaVuSans.ttf);
+ }
+ body {
+ font-family: test;
+ line-height: 1.5em;
+ }
+ </style>
+ <title>Test - word-break: break-all with rtl and diacritics, no ligatures</title>
+ </head>
+ <body>
+ <div>
+ &#x0627;<br>&#xFEDF;<br>&#xFECC;<br>&#xFEAE;<br>&#xFE91;<br>&#xFEF2;<br>
+ &#x0627;<br>&#xFEDF;<br>&#xFEC0;&#x064E;&#x0651;<br>&#xFE8E;<br>&#xFEDF;&#x0650;&#x0651;<br>&#xFEF4;<br>&#xFEE6;&#x064E;
+ </div>
+ <br>
+ <div>
+ &#x0627;&#x0644;&#x0639;&#x0631;&#x0628;&#x064A;<br>
+ &#x0627;&#x0644;&#x0636;&#x064E;&#x0651;&#x0627;&#x0644;&#x0650;&#x0651;&#x064A;&#x0646;&#x064E;
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-7a.html b/layout/reftests/text/wordbreak-7a.html
new file mode 100644
index 0000000000..7e22e1d6c4
--- /dev/null
+++ b/layout/reftests/text/wordbreak-7a.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ @font-face {
+ font-family: test;
+ src: url(../fonts/dejavu-sans/DejaVuSans.ttf);
+ }
+ body {
+ font-family: test;
+ line-height: 1.5em;
+ }
+ div.breakall { width: 0px; word-break: break-all; }
+ div.keepall { width: 0px; word-break: keep-all; }
+ </style>
+ <title>Test - word-break: break-all with rtl and diacritics, no ligatures</title>
+ </head>
+ <body>
+ <div class="breakall">
+ &#x0627;&#x0644;&#x0639;&#x0631;&#x0628;&#x064A;
+ &#x0627;&#x0644;&#x0636;&#x064E;&#x0651;&#x0627;&#x0644;&#x0650;&#x0651;&#x064A;&#x0646;&#x064E;
+ </div>
+ <br>
+ <div class="keepall">
+ &#x0627;&#x0644;&#x0639;&#x0631;&#x0628;&#x064A;
+ &#x0627;&#x0644;&#x0636;&#x064E;&#x0651;&#x0627;&#x0644;&#x0650;&#x0651;&#x064A;&#x0646;&#x064E;
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-7b-ref.html b/layout/reftests/text/wordbreak-7b-ref.html
new file mode 100644
index 0000000000..8b734c8f52
--- /dev/null
+++ b/layout/reftests/text/wordbreak-7b-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ @font-face {
+ font-family: test;
+ src: url(../fonts/dejavu-sans/DejaVuSans.ttf);
+ }
+ body {
+ font-family: test;
+ line-height: 1.5em;
+ }
+ </style>
+ <title>Test - word-break: break-all with rtl and diacritics, including ligatures</title>
+ </head>
+ <body>
+ <div>
+ &#x0648;&#x064E;<br>&#xFEDF;&#x064E;<br>&#xFE8E;<br>
+ &#x0627;<br>&#xFEDF;<br>&#xFEB4;&#x0651;&#x064E;<br>&#xFEE0;&#x064E;<br>&#xFE8E;<br>&#x0645;&#x064F;<br>
+ &#xFECB;&#x064E;<br>&#xFEE0;&#x064E;<br>&#xFEF4;&#x0652;<br>&#xFEDC;&#x064F;<br>&#xFEE2;&#x0652;
+ </div>
+ <br>
+ <div>
+ &#x0648;&#x064E;&#x0644;&#x064E;&#x0627;<br>
+ &#x0627;&#x0644;&#x0633;&#x0651;&#x064E;&#x0644;&#x064E;&#x0627;&#x0645;&#x064F;<br>
+ &#x0639;&#x064E;&#x0644;&#x064E;&#x064A;&#x0652;&#x0643;&#x064F;&#x0645;&#x0652;
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-7b.html b/layout/reftests/text/wordbreak-7b.html
new file mode 100644
index 0000000000..ee25cc7ff2
--- /dev/null
+++ b/layout/reftests/text/wordbreak-7b.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ @font-face {
+ font-family: test;
+ src: url(../fonts/dejavu-sans/DejaVuSans.ttf);
+ }
+ body {
+ font-family: test;
+ line-height: 1.5em;
+ }
+ div.breakall { width: 0px; word-break: break-all; }
+ div.keepall { width: 0px; word-break: keep-all; }
+ </style>
+ <title>Test - word-break: break-all with rtl and diacritics, including ligatures</title>
+ </head>
+ <body>
+ <div class="breakall">
+ &#x0648;&#x064E;&#x0644;&#x064E;&#x0627;
+ &#x0627;&#x0644;&#x0633;&#x0651;&#x064E;&#x0644;&#x064E;&#x0627;&#x0645;&#x064F;
+ &#x0639;&#x064E;&#x0644;&#x064E;&#x064A;&#x0652;&#x0643;&#x064F;&#x0645;&#x0652;
+ </div>
+ <br>
+ <div class="keepall">
+ &#x0648;&#x064E;&#x0644;&#x064E;&#x0627;
+ &#x0627;&#x0644;&#x0633;&#x0651;&#x064E;&#x0644;&#x064E;&#x0627;&#x0645;&#x064F;
+ &#x0639;&#x064E;&#x0644;&#x064E;&#x064A;&#x0652;&#x0643;&#x064F;&#x0645;&#x0652;
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-8-ref.html b/layout/reftests/text/wordbreak-8-ref.html
new file mode 100644
index 0000000000..b51019e989
--- /dev/null
+++ b/layout/reftests/text/wordbreak-8-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ .lc { text-transform: lowercase; }
+ .uc { text-transform: uppercase; }
+ </style>
+ <title>Test - word-break:break-all with text-transform and clusters</title>
+ </head>
+ <body>
+ <div class="lc">f<br>o<br>x<br>f<br>o&#x0325;<br>x&#x0307;</div><br>
+ <div class="lc">fox<br>fo&#x0325;x&#x0307;</div><br>
+ <div class="uc">f<br>o<br>x<br>f<br>o&#x0325;<br>x&#x0307;</div><br>
+ <div class="uc">fox<br>fo&#x0325;x&#x0307;</div><br>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-8.html b/layout/reftests/text/wordbreak-8.html
new file mode 100644
index 0000000000..9a85f61070
--- /dev/null
+++ b/layout/reftests/text/wordbreak-8.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ .breakall { width: 0px; word-break: break-all; }
+ .keepall { width: 0px; word-break: keep-all; }
+ .lc { text-transform: lowercase; }
+ .uc { text-transform: uppercase; }
+ </style>
+ <title>Test - word-break:break-all with text-transform and clusters</title>
+ </head>
+ <body>
+ <div class="breakall lc">fox fo&#x0325;x&#x0307;</div><br>
+ <div class="keepall lc">fox fo&#x0325;x&#x0307;</div><br>
+ <div class="breakall uc">fox fo&#x0325;x&#x0307;</div><br>
+ <div class="keepall uc">fox fo&#x0325;x&#x0307;</div><br>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-9-ref.html b/layout/reftests/text/wordbreak-9-ref.html
new file mode 100644
index 0000000000..bd70c084d5
--- /dev/null
+++ b/layout/reftests/text/wordbreak-9-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ @font-face {
+ font-family: latin;
+ src: url("../fonts/sil/GenR102.ttf");
+ }
+ @font-face {
+ font-family: arabic;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+ }
+ body {
+ font-family: latin, arabic, sans-serif;
+ font-size: 24px;
+ line-height: 2em;
+ }
+ </style>
+ <title>Test - word-break:break-all across font fallback</title>
+ </head>
+ <body>
+ <!-- the arabic diacritics here will fall back to font 'arabic', which
+ is a graphite-enabled arabic font, and be shaped separately;
+ nevertheless, they must remain clustered with the preceding letters,
+ no additional line-breaks are allowed before them (bug 833297) -->
+ <div>f<br>o&#x064c;<br>o&#x0650;<br>b<br>a&#x0654;<br>r</div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-9.html b/layout/reftests/text/wordbreak-9.html
new file mode 100644
index 0000000000..5186e9a6e1
--- /dev/null
+++ b/layout/reftests/text/wordbreak-9.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+ @font-face {
+ font-family: latin;
+ src: url("../fonts/sil/GenR102.ttf");
+ }
+ @font-face {
+ font-family: arabic;
+ src: url("../fonts/sil/Scheherazade-R 2012-07-03c.ttf");
+ }
+ body {
+ font-family: latin, arabic, sans-serif;
+ font-size: 24px;
+ line-height: 2em;
+ }
+ div {
+ width: 0px;
+ word-break: break-all;
+ }
+ </style>
+ <title>Test - word-break:break-all across font fallback</title>
+ </head>
+ <body>
+ <!-- the arabic diacritics here will fall back to font 'arabic', which
+ is a graphite-enabled arabic font, and be shaped separately;
+ nevertheless, they must remain clustered with the preceding letters,
+ no additional line-breaks are allowed before them (bug 833297) -->
+ <div>fo&#x064c;o&#x0650;ba&#x0654;r</div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordbreak-dynamic-1-ref.html b/layout/reftests/text/wordbreak-dynamic-1-ref.html
new file mode 100644
index 0000000000..f8feb44cbf
--- /dev/null
+++ b/layout/reftests/text/wordbreak-dynamic-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Reference - word-break: break-all with dynamic change</title>
+ <style>
+ div {
+ font-family: monospace;
+ width: 3ch;
+ background: pink;
+ word-break: break-all;
+ }
+ </style>
+</head>
+<body>
+ <div>a bcdef</div>
+</body>
+</html>
diff --git a/layout/reftests/text/wordbreak-dynamic-1.html b/layout/reftests/text/wordbreak-dynamic-1.html
new file mode 100644
index 0000000000..930ba6efb5
--- /dev/null
+++ b/layout/reftests/text/wordbreak-dynamic-1.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <meta charset="UTF-8">
+ <title>Test - word-break: break-all with dynamic change</title>
+ <style>
+ div {
+ font-family: monospace;
+ width: 3ch;
+ background: pink;
+ word-break: break-all;
+ }
+ </style>
+</head>
+<body>
+ <div>a bcdef<div></div></div>
+ <script>
+ document.addEventListener("DOMContentLoaded", function() {
+ document.body.offsetHeight;
+ document.querySelector('div > div').style.display = 'none';
+ document.documentElement.classList.remove('reftest-wait');
+ });
+ </script>
+</body>
+</html>
diff --git a/layout/reftests/text/wordwrap-01-ref.html b/layout/reftests/text/wordwrap-01-ref.html
new file mode 100644
index 0000000000..8f88fae973
--- /dev/null
+++ b/layout/reftests/text/wordwrap-01-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+textarea { overflow: scroll; }
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="20">It's
+lipsmackinthirstquen
+chinacetastinmotivat
+ingoodbuzzincooltalk
+inhighwalkinfastlivi
+nevergivincoolfizzin
+Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-01.html b/layout/reftests/text/wordwrap-01.html
new file mode 100644
index 0000000000..da2d6c56a5
--- /dev/null
+++ b/layout/reftests/text/wordwrap-01.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+textarea { overflow: scroll; }
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="20">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-02-ref.html b/layout/reftests/text/wordwrap-02-ref.html
new file mode 100644
index 0000000000..760eb1efd9
--- /dev/null
+++ b/layout/reftests/text/wordwrap-02-ref.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<!-- tests that Arabic characters shape across word breaks -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+@font-face {
+ font-family: dvm;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+textarea {
+ font-family: dvm;
+ line-height: 1.5em;
+ overflow: scroll;
+}
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="20" dir="rtl">ذهعقروبلجيكا،الموسوﻋ
+ﺔكل,تمبوابةاقتصاديةﻫ
+ﺬه.ضمنهاالروسوحرماﻧﺒ
+ﻠﻌﺪد,يكنجسيمةلإعادةلم
+.يكنوالحلفاءبالقناﺑﻠ
+ﻬﻮ,بحثخسائرالدفاعباﻟ
+ﻬﺠﻮمعن.فرنسيةمارشاﻟﺒ
+ﻴﻨﻴﺘﻮدحرثم,وصلبشريةا
+لرايخبالحربتم.</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-02.html b/layout/reftests/text/wordwrap-02.html
new file mode 100644
index 0000000000..8dcac75ecb
--- /dev/null
+++ b/layout/reftests/text/wordwrap-02.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<!-- tests that Arabic characters shape across word breaks -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+@font-face {
+ font-family: dvm;
+ src: url(../fonts/DejaVuSansMono.woff);
+}
+textarea {
+ font-family: dvm;
+ line-height: 1.5em;
+ overflow: scroll;
+}
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <!-- spellcheck="false" added as a workaround to our maximum length of words for the spell checker -->
+ <textarea spellcheck="false" rows="10" cols="20" dir="rtl">ذهعقروبلجيكا،الموسوعةكل,تمبوابةاقتصاديةهذه.ضمنهاالروسوحرمانبلعدد,يكنجسيمةلإعادةلم.يكنوالحلفاءبالقنابلهو,بحثخسائرالدفاعبالهجومعن.فرنسيةمارشالبينيتودحرثم,وصلبشريةالرايخبالحربتم.</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-03-ref.html b/layout/reftests/text/wordwrap-03-ref.html
new file mode 100644
index 0000000000..66cc0089e8
--- /dev/null
+++ b/layout/reftests/text/wordwrap-03-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<!-- tests that words don't break in mid-cluster -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+@font-face { font-family: dvm; src: url(../fonts/DejaVuSansMono.woff); }
+textarea { font-family: dvm, monospace; font-size: 12px; overflow: scroll; }
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="27">It's
+lipsmackinthirstquenchinace&#x300;
+tastinmotivatingoodbuzzinco&#x301;
+oltalkinhighwalkinfastlivin&#x303;
+evergivincoolfizzin
+Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-03.html b/layout/reftests/text/wordwrap-03.html
new file mode 100644
index 0000000000..453e013846
--- /dev/null
+++ b/layout/reftests/text/wordwrap-03.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<!-- tests that words don't break in mid-cluster -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+@font-face { font-family: dvm; src: url(../fonts/DejaVuSansMono.woff); }
+textarea { font-family: dvm, monospace; font-size: 12px; overflow: scroll; }
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="27">It's lipsmackinthirstquenchinace&#x300;tastinmotivatingoodbuzzinco&#x301;oltalkinhighwalkinfastlivin&#x303;evergivincoolfizzin Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-04-ref.html b/layout/reftests/text/wordwrap-04-ref.html
new file mode 100644
index 0000000000..4be06cef64
--- /dev/null
+++ b/layout/reftests/text/wordwrap-04-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <p style="width: 100px; word-wrap: break-word;">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-04.html b/layout/reftests/text/wordwrap-04.html
new file mode 100644
index 0000000000..b35fcbdf98
--- /dev/null
+++ b/layout/reftests/text/wordwrap-04.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<!-- Test setting word-wrap: break-word dynamically -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test Wordwrap</title>
+ <script type="text/javascript">
+function SwapStyle()
+{
+ par = document.getElementById("pp");
+ par.style.wordWrap = "break-word";
+}
+ </script>
+ </head>
+ <body onload="SwapStyle()">
+ <p id="pp" style="width: 100px; word-wrap: normal;">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-05-ref.html b/layout/reftests/text/wordwrap-05-ref.html
new file mode 100644
index 0000000000..b0b397eb17
--- /dev/null
+++ b/layout/reftests/text/wordwrap-05-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <p style="width: 100px;">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-05.html b/layout/reftests/text/wordwrap-05.html
new file mode 100644
index 0000000000..56c03a7f2a
--- /dev/null
+++ b/layout/reftests/text/wordwrap-05.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<!-- Test unsetting word-wrap: break-word dynamically -->
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test Wordwrap</title>
+ <script type="text/javascript">
+function SwapStyle()
+{
+ par = document.getElementById("pp");
+ par.style.wordWrap = "normal";
+}
+ </script>
+ </head>
+ <body onload="SwapStyle()">
+ <p id="pp" style="width: 100px; word-wrap: break-word;">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-06-ref.html b/layout/reftests/text/wordwrap-06-ref.html
new file mode 100644
index 0000000000..3294803185
--- /dev/null
+++ b/layout/reftests/text/wordwrap-06-ref.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>http://www.mozilla.org/projects/minefield/</title>
+ <style type="text/css">
+#viewsource {
+ font-family: -moz-fixed;
+ font-weight: normal;
+ font-size: 16px;
+ color: black;
+ white-space: pre;
+}
+pre {
+ font: inherit;
+ color: inherit;
+ white-space: inherit;
+ margin: 0;
+ width: 475px;
+}
+.attribute-name {
+ color: black;
+ font-weight: bold;
+}
+.attribute-value {
+ color: blue;
+ font-weight: normal;
+}
+ </style>
+ </head>
+ <body id="viewsource">
+ <pre id="line1"><span class="attribute-name">href</span>=<span class="attribute-value">"../../css/cavendish/content.css" </span>
+<span class="attribute-name">title</span>=<span class="attribute-value">"Cavendish"</span></pre>
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/text/wordwrap-06.html b/layout/reftests/text/wordwrap-06.html
new file mode 100644
index 0000000000..a299a0a08e
--- /dev/null
+++ b/layout/reftests/text/wordwrap-06.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>http://www.mozilla.org/projects/minefield/</title>
+ <style type="text/css">
+#viewsource {
+ font-family: -moz-fixed;
+ font-weight: normal;
+ font-size: 16px;
+ color: black;
+ white-space: pre;
+}
+#viewsource.wrap {
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+pre {
+ font: inherit;
+ color: inherit;
+ white-space: inherit;
+ margin: 0;
+ width: 475px;
+}
+.attribute-name {
+ color: black;
+ font-weight: bold;
+}
+.attribute-value {
+ color: blue;
+ font-weight: normal;
+}
+ </style>
+ </head>
+ <body id="viewsource" class="wrap">
+ <pre id="line1"><span class="attribute-name">href</span>=<span class="attribute-value">"../../css/cavendish/content.css" </span><span class="attribute-name">title</span>=<span class="attribute-value">"Cavendish"</span></pre>
+ </body>
+</html> \ No newline at end of file
diff --git a/layout/reftests/text/wordwrap-07-ref.html b/layout/reftests/text/wordwrap-07-ref.html
new file mode 100644
index 0000000000..c6cae567b5
--- /dev/null
+++ b/layout/reftests/text/wordwrap-07-ref.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <div><em>H<br>e<br>l<br>l<br>o</em><br>K<br>i<br>t<br>t<br>y</div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-07.html b/layout/reftests/text/wordwrap-07.html
new file mode 100644
index 0000000000..b0259d68ef
--- /dev/null
+++ b/layout/reftests/text/wordwrap-07.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+div { width: 0px; word-wrap: break-word; }
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <div><em>Hello</em>Kitty</div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-08-ref.html b/layout/reftests/text/wordwrap-08-ref.html
new file mode 100644
index 0000000000..d0c5bded39
--- /dev/null
+++ b/layout/reftests/text/wordwrap-08-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+textarea { overflow: scroll; word-wrap: normal; white-space: pre}
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="20">It's&nbsp;lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin&nbsp;Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-08.html b/layout/reftests/text/wordwrap-08.html
new file mode 100644
index 0000000000..d9b02b83f0
--- /dev/null
+++ b/layout/reftests/text/wordwrap-08.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+textarea { overflow: scroll}
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="20" wrap="off">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-09-ref.html b/layout/reftests/text/wordwrap-09-ref.html
new file mode 100644
index 0000000000..a6dcbe642f
--- /dev/null
+++ b/layout/reftests/text/wordwrap-09-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+textarea { overflow: scroll; word-wrap: normal; white-space: pre; }
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="20">It's
+lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin
+Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-09.html b/layout/reftests/text/wordwrap-09.html
new file mode 100644
index 0000000000..033a8f2691
--- /dev/null
+++ b/layout/reftests/text/wordwrap-09.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <style type="text/css">
+textarea { overflow: scroll; word-wrap: normal; }
+ </style>
+ <title>Test Wordwrap</title>
+ </head>
+ <body>
+ <textarea rows="10" cols="20">It's lipsmackinthirstquenchinacetastinmotivatingoodbuzzincooltalkinhighwalkinfastlivinevergivincoolfizzin Firefox!</textarea>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-10-ref.html b/layout/reftests/text/wordwrap-10-ref.html
new file mode 100644
index 0000000000..1c370bc4c7
--- /dev/null
+++ b/layout/reftests/text/wordwrap-10-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Test - word-wrap: break-word should respect clusters</title>
+ </head>
+ <body>
+ <div>
+ a<br>b<br>c<br>
+ d&#x0325;<br>e&#x0315;<br>f&#x0323;<br>
+ &#x10400;<br>&#x10401;<br>&#x10402;
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/wordwrap-10.html b/layout/reftests/text/wordwrap-10.html
new file mode 100644
index 0000000000..5a892c6adf
--- /dev/null
+++ b/layout/reftests/text/wordwrap-10.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <title>Test - word-wrap: break-word should respect clusters</title>
+ </head>
+ <body>
+ <div style="width:0px; word-wrap:break-word">
+ abc
+ d&#x0325;e&#x0315;f&#x0323;
+ &#x10400;&#x10401;&#x10402;
+ </div>
+ </body>
+</html>
diff --git a/layout/reftests/text/zwnj-01-notref.html b/layout/reftests/text/zwnj-01-notref.html
new file mode 100644
index 0000000000..20a642b624
--- /dev/null
+++ b/layout/reftests/text/zwnj-01-notref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<!-- Reference rendering for zwnj-02.html. No spans, no ZWNJs. Everything
+ should connect -->
+<html>
+ <head>
+ <title>ZWNJ test</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <style type="text/css">
+ body {
+ font-size: 36px;
+ }
+ </style>
+ </head>
+ <body lang="ar">
+ <p>&#x647;&#x641;&#x62A;&#x647;&#x647;&#x627;</p>
+ <p>&#x645;&#x648;&#x632;&#x647;&#x647;&#x627;</p>
+ <p>&#x633;&#x647;&#x634;&#x646;&#x628;&#x647;</p>
+ <p>&#x631;&#x627;&#x647;&#x622;&#x647;&#x646;</p>
+ <p>&#x646;&#x631;&#x645;&#x627;&#x641;&#x632;&#x627;&#x631;</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/zwnj-01-ref.html b/layout/reftests/text/zwnj-01-ref.html
new file mode 100644
index 0000000000..a7b77f46df
--- /dev/null
+++ b/layout/reftests/text/zwnj-01-ref.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!-- Reference rendering for zwnj-01.html. This uses spans with
+ display:inline-block to prevent the letters from connecting -->
+<html>
+ <head>
+ <title>ZWNJ test</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <style type="text/css">
+ body {
+ font-size: 36px;
+ }
+ span {
+ display: inline-block;
+ }
+ </style>
+ </head>
+ <body lang="ar">
+ <p><span>&#x647;&#x627;</span><span>&#x647;&#x641;&#x62A;&#x647;</span></p>
+ <p><span>&#x647;&#x627;</span><span>&#x645;&#x648;&#x632;&#x647;</span></p>
+ <p><span>&#x634;&#x646;&#x628;&#x647;</span><span>&#x633;&#x647;</span></p>
+ <p><span>&#x622;&#x647;&#x646;</span><span>&#x631;&#x627;&#x647;</span></p>
+ <p><span>&#x627;&#x641;&#x632;&#x627;&#x631;</span><span>&#x646;&#x631;&#x645;</span></p>
+ </body>
+</html>
diff --git a/layout/reftests/text/zwnj-01-ref.xhtml b/layout/reftests/text/zwnj-01-ref.xhtml
new file mode 100644
index 0000000000..deb3382dba
--- /dev/null
+++ b/layout/reftests/text/zwnj-01-ref.xhtml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1">
+
+ <!-- use an empty g to force filters.svg to load before onload -->
+ <use xlink:href="../filters.svg#empty" />
+
+ <foreignObject filter="url(../filters.svg#NonWhiteToBlack)"
+ x="0" y="0" height="100%" width="100%">
+<!-- Reference rendering for zwnj-01.html. This uses spans with
+ display:inline-block to prevent the letters from connecting -->
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>ZWNJ test</title>
+ <style type="text/css">
+ body {
+ font-size: 36px;
+ background: white;
+ color: black;
+ }
+ span {
+ display: inline-block;
+ }
+ </style>
+ </head>
+ <body lang="ar">
+ <p><span>&#x647;&#x627;</span><span>&#x647;&#x641;&#x62A;&#x647;</span></p>
+ <p><span>&#x647;&#x627;</span><span>&#x645;&#x648;&#x632;&#x647;</span></p>
+ <p><span>&#x634;&#x646;&#x628;&#x647;</span><span>&#x633;&#x647;</span></p>
+ <p><span>&#x622;&#x647;&#x646;</span><span>&#x631;&#x627;&#x647;</span></p>
+ <p><span>&#x627;&#x641;&#x632;&#x627;&#x631;</span><span>&#x646;&#x631;&#x645;</span></p>
+ </body>
+</html>
+</foreignObject>
+</svg>
diff --git a/layout/reftests/text/zwnj-01.html b/layout/reftests/text/zwnj-01.html
new file mode 100644
index 0000000000..03b1715957
--- /dev/null
+++ b/layout/reftests/text/zwnj-01.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<!-- ZWNJ test #1. Persian words containing a ZWNJ (copied from
+ http://www.unics.uni-hannover.de/nhtcapri/bidirectional-text.html) -->
+<html>
+ <head>
+ <title>ZWNJ test</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <style type="text/css">
+ body {
+ font-size: 36px;
+ }
+ </style>
+ </head>
+ <body lang="ar">
+ <p>&#x647;&#x641;&#x62A;&#x647;&#x200C;&#x647;&#x627;</p>
+ <p>&#x645;&#x648;&#x632;&#x647;&#x200C;&#x647;&#x627;</p>
+ <p>&#x633;&#x647;&#x200C;&#x634;&#x646;&#x628;&#x647;</p>
+ <p>&#x631;&#x627;&#x647;&#x200C;&#x622;&#x647;&#x646;</p>
+ <p>&#x646;&#x631;&#x645;&#x200C;&#x627;&#x641;&#x632;&#x627;&#x631;</p>
+ </body>
+</html>
diff --git a/layout/reftests/text/zwnj-01.xhtml b/layout/reftests/text/zwnj-01.xhtml
new file mode 100644
index 0000000000..25cec48356
--- /dev/null
+++ b/layout/reftests/text/zwnj-01.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1">
+
+ <!-- use an empty g to force filters.svg to load before onload -->
+ <use xlink:href="../filters.svg#empty" />
+
+ <foreignObject filter="url(../filters.svg#NonWhiteToBlack)"
+ x="0" y="0" height="100%" width="100%">
+<!-- ZWNJ test #1. Persian words containing a ZWNJ (copied from
+ http://www.unics.uni-hannover.de/nhtcapri/bidirectional-text.html) -->
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title>ZWNJ test</title>
+ <style type="text/css">
+ body {
+ font-size: 36px;
+ background: white;
+ color: black;
+ }
+ </style>
+ </head>
+ <body lang="ar">
+ <p>&#x647;&#x641;&#x62A;&#x647;&#x200C;&#x647;&#x627;</p>
+ <p>&#x645;&#x648;&#x632;&#x647;&#x200C;&#x647;&#x627;</p>
+ <p>&#x633;&#x647;&#x200C;&#x634;&#x646;&#x628;&#x647;</p>
+ <p>&#x631;&#x627;&#x647;&#x200C;&#x622;&#x647;&#x646;</p>
+ <p>&#x646;&#x631;&#x645;&#x200C;&#x627;&#x641;&#x632;&#x627;&#x631;</p>
+ </body>
+</html>
+</foreignObject>
+</svg>
diff --git a/layout/reftests/text/zwnj-02-ref.xhtml b/layout/reftests/text/zwnj-02-ref.xhtml
new file mode 100644
index 0000000000..bc0b434590
--- /dev/null
+++ b/layout/reftests/text/zwnj-02-ref.xhtml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1">
+
+ <!-- use an empty g to force filters.svg to load before onload -->
+ <use xlink:href="../filters.svg#empty" />
+
+ <foreignObject filter="url(../filters.svg#NonWhiteToBlack)"
+ x="0" y="0" height="100%" width="100%">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!-- Reference rendering for zwnj-02.html. No spans, no ZWNJs. Everything
+ should connect -->
+ <head>
+ <title>ZWNJ test</title>
+ <style type="text/css">
+ html, body { margin: 0; background: white; color: black; height: 100%; width: 100%; }
+ body {
+ font-size: 36px;
+ }
+ </style>
+ </head>
+ <body lang="ar">
+ <p>&#x647;&#x641;&#x62A;&#x647;&#x647;&#x627;</p>
+ <p>&#x645;&#x648;&#x632;&#x647;&#x647;&#x627;</p>
+ <p>&#x633;&#x647;&#x634;&#x646;&#x628;&#x647;</p>
+ <p>&#x631;&#x627;&#x647;&#x622;&#x647;&#x646;</p>
+ <p>&#x646;&#x631;&#x645;&#x627;&#x641;&#x632;&#x627;&#x631;</p>
+ </body>
+</html>
+</foreignObject>
+</svg>
diff --git a/layout/reftests/text/zwnj-02.xhtml b/layout/reftests/text/zwnj-02.xhtml
new file mode 100644
index 0000000000..7a1b37633a
--- /dev/null
+++ b/layout/reftests/text/zwnj-02.xhtml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1">
+
+ <!-- use an empty g to force filters.svg to load before onload -->
+ <use xlink:href="../filters.svg#empty" />
+
+ <foreignObject filter="url(../filters.svg#NonWhiteToBlack)"
+ x="0" y="0" height="100%" width="100%">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<!-- ZWNJ test #2. The words from zwnj-01.html with the ZWNJs replaced by
+ span boundaries. Correct behaviour is for the letters to connect across the
+ spans -->
+ <head>
+ <title>ZWNJ test</title>
+ <style type="text/css">
+ html, body { margin: 0; background: white; color: black; height: 100%; width: 100%; }
+ body {
+ font-size: 36px;
+ }
+ </style>
+ </head>
+ <body lang="ar">
+ <p><span>&#x647;&#x641;&#x62A;&#x647;</span><span>&#x647;&#x627;</span></p>
+ <p><span>&#x645;&#x648;&#x632;&#x647;</span><span>&#x647;&#x627;</span></p>
+ <p><span>&#x633;&#x647;</span><span>&#x634;&#x646;&#x628;&#x647;</span></p>
+ <p><span>&#x631;&#x627;&#x647;</span><span>&#x622;&#x647;&#x646;</span></p>
+ <p><span>&#x646;&#x631;&#x645;</span><span>&#x627;&#x641;&#x632;&#x627;&#x631;</span></p>
+ </body>
+</html>
+</foreignObject>
+</svg>