| <!DOCTYPE html> |
| <html> |
| <head> |
| <script type="text/javascript" src="../resources/runner.js"></script> |
| </head> |
| <body> |
| |
| <div id="wrapper"> |
| <div id="host"></div> |
| </div> |
| |
| <script> |
| var numDivsInHost = 100; |
| var typeNames = ['A', 'B', 'C']; |
| var array = new Array(numDivsInHost); |
| |
| function setup() |
| { |
| var nDivs = numDivsInHost; |
| |
| window.shadowRoot = host.createShadowRoot(); |
| shadowRoot.innerHTML = '<h2>Selected</h2><div id="selected"><content select=".selected"></content></div><h2>NonSelected</h2><div id="nonselected"><content></content></div>'; |
| |
| for (var i = 0; i < nDivs; ++i) { |
| var div = document.createElement('div'); |
| div.appendChild(document.createTextNode('div' + i)); |
| div.className = typeNames[i % typeNames.length]; |
| host.appendChild(div); |
| array[i] = div; |
| } |
| } |
| |
| function run() |
| { |
| var nDivs = numDivsInHost; |
| var array = window.array; |
| |
| var selected = shadowRoot.getElementById('selected'); |
| var nonSelected = shadowRoot.getElementById('nonselected'); |
| var contentSelected = selected.querySelector('content'); |
| |
| for (var i = 0; i < 100; ++i) { |
| for (var j = 0; j < typeNames.length; ++j) { |
| contentSelected.select = '.' + typeNames[j]; |
| PerfTestRunner.forceLayout(); |
| } |
| } |
| } |
| |
| function done() |
| { |
| wrapper.innerHTML = ''; |
| } |
| |
| |
| setup(); |
| |
| PerfTestRunner.measureTime({ |
| description: "Measure distribution and layout performance when select attribute is changed", |
| run: run, |
| done: done |
| }); |
| </script> |
| </body> |
| </html> |