ojan@chromium.org | 12aca25 | 2010-08-18 17:34:51 +0000 | [diff] [blame] | 1 | <body> |
| 2 | <script src="../resources/magnitude-perf.js"></script> |
| 3 | <script> |
| 4 | document.designMode = 'on'; |
| 5 | |
| 6 | function placeSelectionAfterFirstBr() |
| 7 | { |
| 8 | var children = document.body.childNodes; |
| 9 | for (var i = 0, len = children.length; i < len; i++) { |
| 10 | if (children[i].localName == 'br') { |
| 11 | window.getSelection().setBaseAndExtent(document.body, i, document.body, i); |
| 12 | return; |
| 13 | } |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | function setupFunction(magnitude) |
| 18 | { |
| 19 | document.body.innerHTML = new Array(magnitude + 1).join('a<br>'); |
| 20 | placeSelectionAfterFirstBr(); |
| 21 | } |
| 22 | |
| 23 | function test(magnitude) |
| 24 | { |
| 25 | if (window.eventSender) |
| 26 | eventSender.keyDown('z'); |
| 27 | } |
| 28 | |
| 29 | Magnitude.description("Tests that typing at the end of a line where the line-breaks are all BRs is linear in the number of lines."); |
| 30 | Magnitude.run(setupFunction, test, Magnitude.LINEAR); |
| 31 | </script> |
| 32 | </body> |