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> | |
|
rune
2014/06/04 22:42:40
This is not in use. I must go to sleep now.
rune
2014/06/04 22:44:52
Fixed.
| |
| 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 root.className = "a"; | |
| 28 root.offsetTop; // force recalc. | |
| 29 root.className = ""; | |
| 30 root.offsetTop; // force recalc. | |
| 31 }}); | |
| 32 </script> | |
| OLD | NEW |