OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../LayoutTests/editing/editing.js"></script> |
| 5 <script src="../../LayoutTests/editing/spelling/resources/util.js"></script> |
| 6 <script src="../resources/runner.js"></script> |
| 7 </head> |
| 8 <body onload="start()"> |
| 9 <textarea style="border:2px solid red;" id="huge_text"> |
| 10 </textarea><br/> |
| 11 <textarea id="destination"> |
| 12 </textarea> |
| 13 <p id="helper" contenteditable spellcheck="false"></p> |
| 14 <script> |
| 15 var srcNode = null; |
| 16 var dstNode = null; |
| 17 var auxNode = null; |
| 18 var startTime = 0; |
| 19 |
| 20 function start() |
| 21 { |
| 22 if (window.internals) { |
| 23 internals.settings.setUnifiedTextCheckerEnabled(true); |
| 24 internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| 25 internals.setContinuousSpellCheckingEnabled(true); |
| 26 internals.settings.setJavaScriptCanAccessClipboard(true); |
| 27 internals.settings.setDOMPasteAllowed(true); |
| 28 } |
| 29 |
| 30 var testText = ""; |
| 31 for (var i = 0; i < 260; i++) |
| 32 testText += "zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz zz
zz zz zz zz.\n"; |
| 33 |
| 34 srcNode = document.getElementById('huge_text'); |
| 35 srcNode.innerText = testText; |
| 36 |
| 37 PerfTestRunner.prepareToMeasureValuesAsync({ unit: "ms", done:done }); |
| 38 |
| 39 test(); |
| 40 } |
| 41 |
| 42 function test() |
| 43 { |
| 44 startTime = PerfTestRunner.now(); |
| 45 stepSelectAllInSrc(); |
| 46 } |
| 47 |
| 48 function stepSelectAllInSrc() |
| 49 { |
| 50 srcNode.focus(); |
| 51 document.execCommand('SelectAll'); |
| 52 waitUntilSelectedAndSpellchecked(); |
| 53 } |
| 54 |
| 55 function waitUntilSelectedAndSpellchecked() |
| 56 { |
| 57 if (!window.getSelection().toString().length) { |
| 58 setTimeout(waitUntilSelectedAndSpellchecked, 0); |
| 59 return; |
| 60 } else { |
| 61 if (window.internals) { |
| 62 if (!internals.markerCountForNode(findFirstTextNode(srcNode), "spell
ing")) { |
| 63 setTimeout(waitUntilSelectedAndSpellchecked, 0); |
| 64 return; |
| 65 } |
| 66 } |
| 67 } |
| 68 document.execCommand("Copy"); |
| 69 stepHelper(); |
| 70 } |
| 71 |
| 72 function stepHelper() |
| 73 { |
| 74 auxNode = document.getElementById('helper'); |
| 75 var textToType = 'good'; |
| 76 typeText(auxNode, textToType); |
| 77 var textNode = findFirstTextNode(auxNode); |
| 78 if (!textNode || textNode.textContent != textToType) { |
| 79 setTimeout(stepHelper, 0); |
| 80 return; |
| 81 } |
| 82 stepPaste(); |
| 83 } |
| 84 |
| 85 function stepPaste() |
| 86 { |
| 87 dstNode = document.getElementById('destination'); |
| 88 dstNode.focus(); |
| 89 document.execCommand("Paste"); |
| 90 check(); |
| 91 } |
| 92 |
| 93 function check() |
| 94 { |
| 95 if (window.internals) { |
| 96 if (!internals.markerCountForNode(findFirstTextNode(dstNode), "spelling"
)) { |
| 97 setTimeout(check, 0); |
| 98 return; |
| 99 } |
| 100 } else { |
| 101 if (dstNode.scrollTop > 0) { |
| 102 dstNode.scrollTop = dstNode.scrollTop - 1; |
| 103 setTimeout(check, 0); |
| 104 return; |
| 105 } |
| 106 } |
| 107 |
| 108 PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime); |
| 109 PerfTestRunner.gc(); |
| 110 dstNode.innerText = ""; |
| 111 auxNode.innerText = ""; |
| 112 setTimeout(test, 0); |
| 113 } |
| 114 |
| 115 function done() |
| 116 { |
| 117 srcNode.innerText = ""; |
| 118 dstNode.innerText = ""; |
| 119 auxNode.innerText = ""; |
| 120 } |
| 121 |
| 122 </script> |
| 123 </body> |
| 124 </html> |
OLD | NEW |