Title: [100887] trunk
Revision
100887
Author
[email protected]
Date
2011-11-20 22:28:06 -0800 (Sun, 20 Nov 2011)

Log Message

[Chromium] Layout test does not return correct misspelling positions if there are multiple misspelled words.
https://bugs.webkit.org/show_bug.cgi?id=72655

Patch by Shinya Kawanaka <[email protected]> on 2011-11-20
Reviewed by Hajime Morita.

Tools:

Fixed the calculation of offset.

* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::finishLastTextCheck):

LayoutTests:

Fixed the calculation of offset, and added test cases having multiple misspelled words.

* editing/spelling/script-tests/spellcheck-paste.js:
  Added test cases having multiple misspelled words.
(verifyMarker):
(tests):
* editing/spelling/spellcheck-paste-expected.txt: Recreated.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (100886 => 100887)


--- trunk/LayoutTests/ChangeLog	2011-11-21 06:10:24 UTC (rev 100886)
+++ trunk/LayoutTests/ChangeLog	2011-11-21 06:28:06 UTC (rev 100887)
@@ -1,3 +1,18 @@
+2011-11-20  Shinya Kawanaka  <[email protected]>
+
+        [Chromium] Layout test does not return correct misspelling positions if there are multiple misspelled words.
+        https://bugs.webkit.org/show_bug.cgi?id=72655
+
+        Reviewed by Hajime Morita.
+
+        Fixed the calculation of offset, and added test cases having multiple misspelled words.
+
+        * editing/spelling/script-tests/spellcheck-paste.js:
+          Added test cases having multiple misspelled words.
+        (verifyMarker):
+        (tests):
+        * editing/spelling/spellcheck-paste-expected.txt: Recreated.
+
 2011-11-20  Kenichi Ishibashi  <[email protected]>
 
         [Chromium] Remove old getFontFamilyForCharacters() and familyForChars() APIs.

Modified: trunk/LayoutTests/editing/spelling/script-tests/spellcheck-paste.js (100886 => 100887)


--- trunk/LayoutTests/editing/spelling/script-tests/spellcheck-paste.js	2011-11-21 06:10:24 UTC (rev 100886)
+++ trunk/LayoutTests/editing/spelling/script-tests/spellcheck-paste.js	2011-11-21 06:28:06 UTC (rev 100887)
@@ -25,6 +25,10 @@
 testSourceDecorated.innerHTML = "fo<b>o ba</b>r";
 testRoot.appendChild(testSourceDecorated);
 
+var testSourceMulti = document.createElement("div");
+testSourceMulti.innerHTML = "zz zz zz";
+testRoot.appendChild(testSourceMulti);
+
 var sel = window.getSelection();
 
 var tests = [];
@@ -45,7 +49,11 @@
     } else {
         sel.selectAllChildren(node);
     }
-    return layoutTestController.hasSpellingMarker(expectedMarked[0], expectedMarked[1]);
+
+    var ok = true;
+    for (var i = 0; ok && i < expectedMarked.length; ++i)
+        ok = layoutTestController.hasSpellingMarker(expectedMarked[i][0], expectedMarked[i][1]);
+    return ok;
 }
 
 function pasteAndVerify(source, dest, expectedMarked)
@@ -87,12 +95,15 @@
 if (window.layoutTestController)
     layoutTestController.setAsynchronousSpellCheckingEnabled(true);
 
-tests.push(function() { pasteAndVerify(testSourcePlain, testInput, [0, 3]); });
-tests.push(function() { pasteAndVerify(testSourceDecorated, testInput, [0, 3]); });
-tests.push(function() { pasteAndVerify(testSourcePlain, testTextArea, [0, 3]); });
-tests.push(function() { pasteAndVerify(testSourceDecorated, testTextArea, [0, 3]); });
-tests.push(function() { pasteAndVerify(testSourcePlain, testEditable, [0, 3]); });
-tests.push(function() { pasteAndVerify(testSourceDecorated, testEditable, [0, 2]); }); // To check "fo" part of foo.
+tests.push(function() { pasteAndVerify(testSourcePlain, testInput, [[0, 3]]); });
+tests.push(function() { pasteAndVerify(testSourceDecorated, testInput, [[0, 3]]); });
+tests.push(function() { pasteAndVerify(testSourceMulti, testInput, [[0, 2], [3, 2]]); });
+tests.push(function() { pasteAndVerify(testSourcePlain, testTextArea, [[0, 3]]); });
+tests.push(function() { pasteAndVerify(testSourceDecorated, testTextArea, [[0, 3]]); });
+tests.push(function() { pasteAndVerify(testSourceMulti, testTextArea, [[0, 2], [3, 2]]); });
+tests.push(function() { pasteAndVerify(testSourcePlain, testEditable, [[0, 3]]); });
+tests.push(function() { pasteAndVerify(testSourceDecorated, testEditable, [[0, 2]]); }); // To check "fo" part of foo.
+tests.push(function() { pasteAndVerify(testSourceMulti, testEditable, [[0, 2], [3, 2]]); });
 done();
 
 var successfullyParsed = true;

Modified: trunk/LayoutTests/editing/spelling/spellcheck-paste-expected.txt (100886 => 100887)


--- trunk/LayoutTests/editing/spelling/spellcheck-paste-expected.txt	2011-11-21 06:10:24 UTC (rev 100886)
+++ trunk/LayoutTests/editing/spelling/spellcheck-paste-expected.txt	2011-11-21 06:28:06 UTC (rev 100887)
@@ -8,8 +8,11 @@
 TEST COMPLETE
 PASS INPUT has a marker on 'foo bar'
 PASS INPUT has a marker on 'fo<b>o ba</b>r'
+PASS INPUT has a marker on 'zz zz zz'
 PASS TEXTAREA has a marker on 'foo bar'
 PASS TEXTAREA has a marker on 'fo<b>o ba</b>r'
+PASS TEXTAREA has a marker on 'zz zz zz'
 PASS DIV has a marker on 'foo bar'
 PASS DIV has a marker on 'fo<b>o ba</b>r'
+PASS DIV has a marker on 'zz zz zz'
 

Modified: trunk/Tools/ChangeLog (100886 => 100887)


--- trunk/Tools/ChangeLog	2011-11-21 06:10:24 UTC (rev 100886)
+++ trunk/Tools/ChangeLog	2011-11-21 06:28:06 UTC (rev 100887)
@@ -1,3 +1,15 @@
+2011-11-20  Shinya Kawanaka  <[email protected]>
+
+        [Chromium] Layout test does not return correct misspelling positions if there are multiple misspelled words.
+        https://bugs.webkit.org/show_bug.cgi?id=72655
+
+        Reviewed by Hajime Morita.
+
+        Fixed the calculation of offset.
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::finishLastTextCheck):
+
 2011-11-20  Ojan Vafai  <[email protected]>
 
         Change the final place where we use version 3 of the results json output

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (100886 => 100887)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2011-11-21 06:10:24 UTC (rev 100886)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2011-11-21 06:28:06 UTC (rev 100887)
@@ -458,7 +458,7 @@
             break;
         results.append(WebTextCheckingResult(WebTextCheckingResult::ErrorSpelling, offset + misspelledPosition, misspelledLength));
         text = text.substring(misspelledPosition + misspelledLength);
-        offset += misspelledPosition;
+        offset += misspelledPosition + misspelledLength;
     }
 
     m_lastRequestedTextCheckingCompletion->didFinishCheckingText(results);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to