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.)

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

mercurial