| OLD | NEW |
| (Empty) |
| 1 (function() { | |
| 2 function createElement(tag, parent, className, id) { | |
| 3 var el = document.createElement(tag); | |
| 4 el.className = className; | |
| 5 if (id) | |
| 6 el.id = id; | |
| 7 parent.appendChild(el); | |
| 8 return el; | |
| 9 } | |
| 10 | |
| 11 function createSet(width, height, nested) { | |
| 12 var container = createElement("div", document.body, "container"); | |
| 13 for (var y = 0; y < height; ++y) { | |
| 14 createElement("div", container, "float", "float" + x + "_" + y); | |
| 15 for (var x = 0; x < width; ++x) | |
| 16 createElement("div", container, "normal", "normal" + x + "_" + y
); | |
| 17 | |
| 18 var nestedContainer = container; | |
| 19 for ( ; nested > 0; --nested) | |
| 20 nestedContainer = createElement("div", nestedContainer, "normal"
, "normal" + x + "_" + nested); | |
| 21 } | |
| 22 return container; | |
| 23 } | |
| 24 | |
| 25 function createTestFunction(width, height, nested, runs) { | |
| 26 var container = createSet(width, height, nested); | |
| 27 nested = nested || 0; | |
| 28 runs = runs || 10; | |
| 29 return function() { | |
| 30 for (var i = 0; i < runs; ++i) { | |
| 31 // Force a layout. | |
| 32 var body = document.getElementById("body") | |
| 33 body.style['height'] = 800 + i + "px"; | |
| 34 document.body.offsetTop; | |
| 35 } | |
| 36 PerfTestRunner.resetRandomSeed(); | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 window.createBodyRelayoutTestFunction = createTestFunction; | |
| 41 })(); | |
| OLD | NEW |