dom/base/test/test_innersize_scrollport.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_innersize_scrollport.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <meta charset="UTF-8">
     1.8 +  <title>Test for Bug 919437</title>
     1.9 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.10 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.11 +</head>
    1.12 +<body>
    1.13 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=919437">Mozilla Bug 919437</a>
    1.14 +<div id="content" style="display: none"></div>
    1.15 +<pre id="test">
    1.16 +<script type="application/javascript">
    1.17 +/** Test for Bug 919437 **/
    1.18 +
    1.19 +SimpleTest.waitForExplicitFinish();
    1.20 +
    1.21 +function run()
    1.22 +{
    1.23 +  var oldWidth = window.innerWidth;
    1.24 +  var oldHeight = window.innerHeight;
    1.25 +  var newWidth = oldWidth / 2;
    1.26 +  var newHeight = oldHeight / 2;
    1.27 +
    1.28 +  var utils = SpecialPowers.getDOMWindowUtils(window);
    1.29 +  utils.setScrollPositionClampingScrollPortSize(newWidth, newHeight);
    1.30 +  is(window.innerWidth, newWidth, "innerWidth not updated to scroll port width");
    1.31 +  is(window.innerHeight, newHeight, "innerHeight not updated to scroll port height");
    1.32 +
    1.33 +  window.innerWidth = oldWidth;
    1.34 +  window.innerHeight = oldHeight;
    1.35 +  is(window.innerWidth, newWidth, "innerWidth clobbered by direct set");
    1.36 +  is(window.innerHeight, newHeight, "innerHeight clobbered by direct set");
    1.37 +
    1.38 +  SimpleTest.finish();
    1.39 +}
    1.40 +
    1.41 +window.addEventListener("load", run, false);
    1.42 +
    1.43 +</script>
    1.44 +</pre>
    1.45 +</body>
    1.46 +</html>

mercurial