tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_resize_flush.html (1720B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1279202
      5 -->
      6 <head>
      7  <title>Test for Bug 1279202</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 </head>
     11 <body onload="run()">
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1279202">Mozilla Bug 1279202</a>
     13 <iframe src="resize_flush_iframe.html" id="iframe" height="200" width="200" style="border:none"></iframe>
     14 <pre id="test">
     15 <script type="application/javascript">
     16 
     17 /** Test for Bug 1279202 */
     18 
     19 SimpleTest.waitForExplicitFinish();
     20 
     21 function run() {
     22 
     23  var iframe = document.getElementById("iframe");
     24  var doc = iframe.contentDocument.documentElement;
     25  var win = iframe.contentWindow;
     26  var body = iframe.contentDocument.body;
     27 
     28  // Flush any pending layout changes before we start.
     29  var width = doc.clientWidth;
     30 
     31  // Resize the iframe
     32  iframe.width = '300px';
     33 
     34  // Flush pending style changes, but not layout ones. We do this twice because the first flush
     35  // does a partial flush of the resize (setting the size on the pres context) which sets the
     36  // need style flush flag again. The second call makes sure mNeedStyleFlush is false.
     37  var color = win.getComputedStyle(body).getPropertyValue("background-color");
     38  color = win.getComputedStyle(body).getPropertyValue("background-color");
     39  is(color, "rgb(0, 128, 0)", "Style flush not completed when resizing an iframe!");
     40 
     41  // Query the size of the inner document and make sure it has had a layout flush.
     42  width = doc.clientWidth;
     43 
     44  is(width, 300, "Layout flush not completed when resizing an iframe!");
     45  SimpleTest.finish();
     46 }
     47 
     48 </script>
     49 </pre>
     50 </body>
     51 </html>