dom/base/test/test_innersize_scrollport.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4   <meta charset="UTF-8">
     5   <title>Test for Bug 919437</title>
     6   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     7   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     8 </head>
     9 <body>
    10 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=919437">Mozilla Bug 919437</a>
    11 <div id="content" style="display: none"></div>
    12 <pre id="test">
    13 <script type="application/javascript">
    14 /** Test for Bug 919437 **/
    16 SimpleTest.waitForExplicitFinish();
    18 function run()
    19 {
    20   var oldWidth = window.innerWidth;
    21   var oldHeight = window.innerHeight;
    22   var newWidth = oldWidth / 2;
    23   var newHeight = oldHeight / 2;
    25   var utils = SpecialPowers.getDOMWindowUtils(window);
    26   utils.setScrollPositionClampingScrollPortSize(newWidth, newHeight);
    27   is(window.innerWidth, newWidth, "innerWidth not updated to scroll port width");
    28   is(window.innerHeight, newHeight, "innerHeight not updated to scroll port height");
    30   window.innerWidth = oldWidth;
    31   window.innerHeight = oldHeight;
    32   is(window.innerWidth, newWidth, "innerWidth clobbered by direct set");
    33   is(window.innerHeight, newHeight, "innerHeight clobbered by direct set");
    35   SimpleTest.finish();
    36 }
    38 window.addEventListener("load", run, false);
    40 </script>
    41 </pre>
    42 </body>
    43 </html>

mercurial