tor-browser

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

test_prerendered_transforms.html (1769B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test that active transformed elements coming into view are prerendered so we don't have to redraw constantly</title>
      5  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
      6  <script src="chrome://mochikit/content/tests/SimpleTest/paint_listener.js"></script>
      7  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
      8 </head>
      9 <body onload="startTest()">
     10 <div>
     11 <div id="t" style="position:absolute; left:0; top:500px; transform: translatex(-100px); width:200px; height:100px; background:yellow;">
     12  <div style="text-align:right">Hello</div>
     13  <div style="text-align:left">Kitty</div>
     14 </div>
     15 </div>
     16 <pre id="test">
     17 <script type="application/javascript">
     18 SimpleTest.waitForExplicitFinish();
     19 
     20 var t = document.getElementById("t");
     21 var utils = window.windowUtils;
     22 
     23 function startTest() {
     24  // Do a couple of transform changes to ensure we've triggered activity heuristics
     25  waitForAllPaintsFlushed(function () {
     26    t.style.transform = "translatex(-75px)";
     27    waitForAllPaintsFlushed(function () {
     28      t.style.transform = "translatex(-50px)";
     29      waitForAllPaintsFlushed(function () {
     30        // Clear paint state now and move again.
     31        utils.checkAndClearPaintedState(t);
     32        // Don't move to 0 since that might trigger some special case that turns off transforms.
     33        t.style.transform = "translatex(-1px)";
     34        waitForAllPaintsFlushed(function () {
     35          var painted = utils.checkAndClearPaintedState(t);
     36          is(painted, false, "Transformed element should not have been painted");
     37          SimpleTest.finish();
     38        });
     39      });
     40    });
     41  });
     42 }
     43 </script>
     44 </pre>
     45 </body>
     46 </html>