Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: PerformanceTests/Interactive/spellcheck-paste-huge-text.html

Issue 22859062: Chunk up the text to spell check also when the text is pasted. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/editing/Editor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PerformanceTests/Interactive/spellcheck-paste-huge-text.html
diff --git a/PerformanceTests/Interactive/spellcheck-paste-huge-text.html b/PerformanceTests/Interactive/spellcheck-paste-huge-text.html
new file mode 100644
index 0000000000000000000000000000000000000000..3f5073d476fc20a48f6ff2124bc54bd8e61e69fa
--- /dev/null
+++ b/PerformanceTests/Interactive/spellcheck-paste-huge-text.html
@@ -0,0 +1,124 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<script src="../../LayoutTests/editing/editing.js"></script>
+<script src="../../LayoutTests/editing/spelling/resources/util.js"></script>
+<script src="../resources/runner.js"></script>
+</head>
+<body onload="start()">
+<textarea style="border:2px solid red;" id="huge_text">
+</textarea><br/>
+<textarea id="destination">
+</textarea>
+<p id="helper" contenteditable spellcheck="false"></p>
+<script>
+var srcNode = null;
+var dstNode = null;
+var auxNode = null;
+var startTime = 0;
+
+function start()
+{
+ if (window.internals) {
+ internals.settings.setUnifiedTextCheckerEnabled(true);
+ internals.settings.setAsynchronousSpellCheckingEnabled(true);
+ internals.setContinuousSpellCheckingEnabled(true);
+ internals.settings.setJavaScriptCanAccessClipboard(true);
+ internals.settings.setDOMPasteAllowed(true);
+ }
+
+ var testText = "";
+ for (var i = 0; i < 260; i++)
+ 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";
+
+ srcNode = document.getElementById('huge_text');
+ srcNode.innerText = testText;
+
+ PerfTestRunner.prepareToMeasureValuesAsync({ unit: "ms", done:done });
+
+ test();
+}
+
+function test()
+{
+ startTime = PerfTestRunner.now();
+ stepSelectAllInSrc();
+}
+
+function stepSelectAllInSrc()
+{
+ srcNode.focus();
+ document.execCommand('SelectAll');
+ waitUntilSelectedAndSpellchecked();
+}
+
+function waitUntilSelectedAndSpellchecked()
+{
+ if (!window.getSelection().toString().length) {
+ setTimeout(waitUntilSelectedAndSpellchecked, 0);
+ return;
+ } else {
+ if (window.internals) {
+ if (!internals.markerCountForNode(findFirstTextNode(srcNode), "spelling")) {
+ setTimeout(waitUntilSelectedAndSpellchecked, 0);
+ return;
+ }
+ }
+ }
+ document.execCommand("Copy");
+ stepHelper();
+}
+
+function stepHelper()
+{
+ auxNode = document.getElementById('helper');
+ var textToType = 'good';
+ typeText(auxNode, textToType);
+ var textNode = findFirstTextNode(auxNode);
+ if (!textNode || textNode.textContent != textToType) {
+ setTimeout(stepHelper, 0);
+ return;
+ }
+ stepPaste();
+}
+
+function stepPaste()
+{
+ dstNode = document.getElementById('destination');
+ dstNode.focus();
+ document.execCommand("Paste");
+ check();
+}
+
+function check()
+{
+ if (window.internals) {
+ if (!internals.markerCountForNode(findFirstTextNode(dstNode), "spelling")) {
+ setTimeout(check, 0);
+ return;
+ }
+ } else {
+ if (dstNode.scrollTop > 0) {
+ dstNode.scrollTop = dstNode.scrollTop - 1;
+ setTimeout(check, 0);
+ return;
+ }
+ }
+
+ PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
+ PerfTestRunner.gc();
+ dstNode.innerText = "";
+ auxNode.innerText = "";
+ setTimeout(test, 0);
+}
+
+function done()
+{
+ srcNode.innerText = "";
+ dstNode.innerText = "";
+ auxNode.innerText = "";
+}
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | Source/core/editing/Editor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698