layout/style/test/test_bug319381.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=319381
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 319381</title>
michael@0 8 <script type="text/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=319381">Mozilla Bug 319381</a>
michael@0 13 <p id="display"></p>
michael@0 14 <div id="content" style="display: none">
michael@0 15 <div id="t"></div>
michael@0 16 </div>
michael@0 17 <pre id="test">
michael@0 18 <script class="testbody" type="text/javascript">
michael@0 19
michael@0 20 /** Test for Bug 319381 **/
michael@0 21
michael@0 22 function c() {
michael@0 23 return document.defaultView.getComputedStyle($('t'), "").
michael@0 24 getPropertyValue("overflow");
michael@0 25 }
michael@0 26
michael@0 27 function cval() {
michael@0 28 return document.defaultView.getComputedStyle($('t'), "").
michael@0 29 getPropertyCSSValue("overflow");
michael@0 30 }
michael@0 31
michael@0 32 var vals = ["visible", "hidden", "auto", "scroll"];
michael@0 33 var mozVals = ["-moz-scrollbars-vertical", "-moz-scrollbars-horizontal"];
michael@0 34 var i, j;
michael@0 35
michael@0 36 for (i = 0; i < vals.length; ++i) {
michael@0 37 $('t').style.overflow = vals[i];
michael@0 38 is($('t').style.overflow, vals[i], "Roundtrip");
michael@0 39 is(c(), vals[i], "Simple property set");
michael@0 40 isnot(cval(), null, "Simple property as CSSValue");
michael@0 41 }
michael@0 42
michael@0 43 $('t').style.overflow = mozVals[0];
michael@0 44 is($('t').style.getPropertyValue("overflow-y"), "scroll", "Roundtrip");
michael@0 45 is($('t').style.getPropertyValue("overflow-x"), "hidden", "Roundtrip");
michael@0 46 is($('t').style.overflow, "", "Shorthand read directly");
michael@0 47 is(c(), "", "Shorthand computed");
michael@0 48 is(cval(), null, "Shorthand as CSSValue");
michael@0 49
michael@0 50 $('t').style.overflow = mozVals[1];
michael@0 51 is($('t').style.getPropertyValue("overflow-x"), "scroll", "Roundtrip");
michael@0 52 is($('t').style.getPropertyValue("overflow-y"), "hidden", "Roundtrip");
michael@0 53 is($('t').style.overflow, "", "Shorthand read directly");
michael@0 54 is(c(), "", "Shorthand computed");
michael@0 55 is(cval(), null, "Shorthand as CSSValue");
michael@0 56
michael@0 57 for (i = 0; i < vals.length; ++i) {
michael@0 58 for (j = 0; j < vals.length; ++j) {
michael@0 59 $('t').setAttribute("style",
michael@0 60 "overflow-x: " + vals[i] + "; overflow-y: " + vals[j]);
michael@0 61 is($('t').style.getPropertyValue("overflow-x"), vals[i], "Roundtrip");
michael@0 62 is($('t').style.getPropertyValue("overflow-y"), vals[j], "Roundtrip");
michael@0 63
michael@0 64 if (i == j) {
michael@0 65 is($('t').style.overflow, vals[i], "Shorthand serialization");
michael@0 66 } else {
michael@0 67 is($('t').style.overflow, "", "Shorthand serialization");
michael@0 68 }
michael@0 69
michael@0 70 // "visible" overflow-x and overflow-y become "auto" in computed style if
michael@0 71 // the other direction is not also "visible".
michael@0 72 if (i == j || (vals[i] == "visible" && vals[j] == "auto")) {
michael@0 73 is(c(), vals[j], "Shorthand computation");
michael@0 74 isnot(cval(), null, "Shorthand computation as CSSValue");
michael@0 75 } else if (vals[j] == "visible" && vals[i] == "auto") {
michael@0 76 is(c(), vals[i], "Shorthand computation");
michael@0 77 isnot(cval(), null, "Shorthand computation as CSSValue");
michael@0 78 } else {
michael@0 79 is(c(), "", "Shorthand computation");
michael@0 80 is(cval(), null, "Shorthand computation as CSSValue");
michael@0 81 }
michael@0 82 }
michael@0 83 }
michael@0 84
michael@0 85 </script>
michael@0 86 </pre>
michael@0 87 </body>
michael@0 88 </html>
michael@0 89

mercurial