tor-browser

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

test_change_hint_optimizations.html (1646B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>Test for style change hint optimizations</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      8  <script type="application/javascript">
      9 
     10  SimpleTest.waitForExplicitFinish();
     11 
     12  function runTests() {
     13 
     14    /** Test for Bug 1251075 */
     15    function test_bug1251075_div(id) {
     16      var utils = SpecialPowers.DOMWindowUtils;
     17 
     18      var div = document.getElementById(id);
     19      div.style.display = "";
     20 
     21      var description = div.style.cssText;
     22 
     23      div.firstElementChild.offsetTop;
     24      var constructedBefore = utils.framesConstructed;
     25 
     26      div.style.transform = "translateX(10px)";
     27      div.firstElementChild.offsetTop;
     28      is(utils.framesConstructed, constructedBefore,
     29         "adding a transform style to an element with " + description +
     30         " should not cause frame reconstruction even when the element " +
     31         "has absolutely positioned descendants");
     32 
     33      div.style.display = "none";
     34    }
     35 
     36    test_bug1251075_div("bug1251075_a");
     37    test_bug1251075_div("bug1251075_b");
     38 
     39 
     40    SimpleTest.finish();
     41  }
     42 
     43  </script>
     44 </head>
     45 <body onload="runTests()">
     46 <div id="bug1251075_a" style="will-change: transform; display:none">
     47  <div style="position: absolute; top: 0; left: 0;"></div>
     48  <div style="position: fixed; top: 0; left: 0;"></div>
     49 </div>
     50 <div id="bug1251075_b" style="filter: blur(3px); display:none">
     51  <div style="position: absolute; top: 0; left: 0;"></div>
     52  <div style="position: fixed; top: 0; left: 0;"></div>
     53 </div>
     54 <pre id="test">
     55 </pre>
     56 </body>
     57 </html>