Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/runner.js"></script> | |
| 3 <style> | |
| 4 .a .b { background-color: green } | |
| 5 </style> | |
| 6 <div id="root"></div> | |
| 7 <script> | |
| 8 function appendDivChildren(root, childCount, levels) { | |
| 9 if (levels <= 0) | |
| 10 return; | |
| 11 for (var i = 0; i < childCount; i++) { | |
| 12 var div = document.createElement("div"); | |
| 13 appendDivChildren(div, childCount, levels - 1) | |
| 14 root.appendChild(div); | |
| 15 } | |
| 16 } | |
| 17 | |
| 18 var root = document.createElement("div"); | |
| 19 appendDivChildren(root, 5, 5); | |
| 20 root.firstChild.className = "b"; | |
| 21 document.body.appendChild(root); | |
| 22 document.body.offsetTop; // force style recalc. | |
| 23 | |
| 24 PerfTestRunner.measureRunsPerSecond({ | |
| 25 description: "Measure the style recalc performance when changing a class aff ecting the style of a single descendant.", | |
| 26 run: function() { | |
| 27 // Modifying top on a static positioned, which should not cause a layout , in order | |
|
rune
2014/06/04 21:23:15
Ouch. Copy-past issue.
rune
2014/06/04 21:26:57
Done.
| |
| 28 // to measure style recalc only. | |
| 29 root.className = "a"; | |
| 30 root.offsetLeft; // force recalc. | |
| 31 root.className = ""; | |
| 32 root.offsetLeft; // force recalc. | |
| 33 }}); | |
| 34 </script> | |
| OLD | NEW |