layout/style/test/test_system_font_serialization.html

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=475214
     5 -->
     6 <head>
     7   <title>Test for Bug 475214</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=475214">Mozilla Bug 475214</a>
    13 <p id="display"></p>
    14 <div id="content">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 475214 **/
    22 var e = document.getElementById("content");
    23 var s = e.style;
    25 e.style.font = "menu";
    26 is(e.style.cssText, "font: menu;", "serialize system font alone");
    27 is(e.style.font, "menu", "font getter returns value");
    29 e.style.fontFamily = "inherit";
    30 is(e.style.cssText, "font: menu; font-family: inherit;", "serialize system font and font-family");
    31 is(e.style.font, "", "font getter should be empty");
    33 e.style.font = "message-box";
    34 is(e.style.cssText, "font: message-box;", "serialize system font alone");
    35 is(e.style.font, "message-box", "font getter returns value");
    37 e.setAttribute("style", "font-weight:bold;font:caption;line-height:3;");
    38 is(e.style.cssText, "font: caption; line-height: 3;", "serialize system font and font-family");
    39 is(e.style.font, "", "font getter should be empty");
    41 e.setAttribute("style", "font: menu; font-weight: -moz-use-system-font");
    42 is(e.style.cssText, "font: menu;", "serialize system font alone");
    43 is(e.style.font, "menu", "font getter returns value");
    45 e.setAttribute("style", "font: menu; font-weight: -moz-use-system-font ! important");
    46 is(e.style.cssText, "font: menu; font-weight: -moz-use-system-font ! important;", "serialize system font and subproperty that is important");
    47 is(e.style.font, "", "font getter returns nothing");
    49 e.setAttribute("style", "font: inherit; font-family: Helvetica;");
    51 var cssTextStr = "font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; -moz-font-feature-settings: inherit; -moz-font-language-override: inherit;";
    52 if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) {
    53   cssTextStr += " font-kerning: inherit; font-synthesis: inherit; font-variant-alternates: inherit; font-variant-caps: inherit; font-variant-east-asian: inherit; font-variant-ligatures: inherit; font-variant-numeric: inherit; font-variant-position: inherit;"
    54 }
    56 is(e.style.cssText, cssTextStr + " font-family: Helvetica;", "don't serialize system font for font:inherit");
    57 is(e.style.font, "", "font getter returns nothing");
    59 </script>
    60 </pre>
    61 </body>
    62 </html>

mercurial