layout/style/test/test_system_font_serialization.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=475214
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 475214</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 10 </head>
michael@0 11 <body>
michael@0 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=475214">Mozilla Bug 475214</a>
michael@0 13 <p id="display"></p>
michael@0 14 <div id="content">
michael@0 15
michael@0 16 </div>
michael@0 17 <pre id="test">
michael@0 18 <script type="application/javascript">
michael@0 19
michael@0 20 /** Test for Bug 475214 **/
michael@0 21
michael@0 22 var e = document.getElementById("content");
michael@0 23 var s = e.style;
michael@0 24
michael@0 25 e.style.font = "menu";
michael@0 26 is(e.style.cssText, "font: menu;", "serialize system font alone");
michael@0 27 is(e.style.font, "menu", "font getter returns value");
michael@0 28
michael@0 29 e.style.fontFamily = "inherit";
michael@0 30 is(e.style.cssText, "font: menu; font-family: inherit;", "serialize system font and font-family");
michael@0 31 is(e.style.font, "", "font getter should be empty");
michael@0 32
michael@0 33 e.style.font = "message-box";
michael@0 34 is(e.style.cssText, "font: message-box;", "serialize system font alone");
michael@0 35 is(e.style.font, "message-box", "font getter returns value");
michael@0 36
michael@0 37 e.setAttribute("style", "font-weight:bold;font:caption;line-height:3;");
michael@0 38 is(e.style.cssText, "font: caption; line-height: 3;", "serialize system font and font-family");
michael@0 39 is(e.style.font, "", "font getter should be empty");
michael@0 40
michael@0 41 e.setAttribute("style", "font: menu; font-weight: -moz-use-system-font");
michael@0 42 is(e.style.cssText, "font: menu;", "serialize system font alone");
michael@0 43 is(e.style.font, "menu", "font getter returns value");
michael@0 44
michael@0 45 e.setAttribute("style", "font: menu; font-weight: -moz-use-system-font ! important");
michael@0 46 is(e.style.cssText, "font: menu; font-weight: -moz-use-system-font ! important;", "serialize system font and subproperty that is important");
michael@0 47 is(e.style.font, "", "font getter returns nothing");
michael@0 48
michael@0 49 e.setAttribute("style", "font: inherit; font-family: Helvetica;");
michael@0 50
michael@0 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;";
michael@0 52 if (SpecialPowers.getBoolPref("layout.css.font-features.enabled")) {
michael@0 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;"
michael@0 54 }
michael@0 55
michael@0 56 is(e.style.cssText, cssTextStr + " font-family: Helvetica;", "don't serialize system font for font:inherit");
michael@0 57 is(e.style.font, "", "font getter returns nothing");
michael@0 58
michael@0 59 </script>
michael@0 60 </pre>
michael@0 61 </body>
michael@0 62 </html>

mercurial