Home | History | Annotate | Download | only in Layout
      1 <!DOCTYPE html>
      2 <html>
      3 <body>
      4 <script src="../resources/runner.js"></script>
      5 <script>
      6 function buildTree()
      7 {
      8     wrapper = document.createElement("div");
      9     for (i = 0; i < 1000; ++i) {
     10         var child = document.createElement("div");
     11         for (j = 0; j < 1000; ++j) {
     12             var grandChild = document.createElement("div");
     13             child.appendChild(grandChild);
     14         }
     15         wrapper.appendChild(child);
     16     }
     17     document.body.appendChild(wrapper);
     18 }
     19 
     20 function setup() {
     21     wrapper.style.display = "block";
     22     // Force a layout so that everything is up-to-date.
     23     wrapper.offsetTop;
     24 }
     25 
     26 function runTest() {
     27     setup();
     28 
     29     var now = PerfTestRunner.now();
     30 
     31     wrapper.style.display = "none";
     32     wrapper.offsetTop;
     33 
     34     return PerfTestRunner.now() - now;
     35 }
     36 
     37 buildTree();
     38 
     39 PerfTestRunner.measureTime({run: runTest, description: "This benchmark checks the time spend in detaching an tree." });
     40 </script>
     41 </body>
     42 </html>
     43