Replacement text should be available from the marker.
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 05:23:21 +0000 (05:23 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2012 05:23:21 +0000 (05:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77934

.:

Reviewed by Kent Tamura.

* Source/autotools/symbols.filter: Added an exporting symbol.

Source/WebCore:

Reviewed by Kent Tamura.

On spellchecking, TextCheckingResult can contain a replacement text
which is usable both for an automatic replacement and for showing a suggestion.

But when marking a misspelled word ragarding to returned
TextCheckingResult, Editor uses only the misspelled range data and
discards the replacement value. Then it asks the same value again
when showing suggestion/autocorrection.

It would be great if the marker holds the replacement text
and Editor can use it on suggesting a correction, without any re-request.
This is especially true in the case when it needs IPC messaging for spellchecking:
We can save one round-trip by this technique.

Here is actual change:

- Passed the replacement text to addMarker() for for misspelling markers.
  Note that this is done only for the unified checker path because legacy
  TextCheckerClient API doesn't provide such a replacement.
- Added an Internals API to retrieve a description text on a marker.

Test: editing/spelling/spelling-marker-description.html

* WebCore.exp.in:
* editing/Editor.cpp:
(WebCore::Editor::markAndReplaceFor):
* testing/Internals.cpp:
(WebCore::Internals::markerAt):
(WebCore):
(WebCore::Internals::markerRangeForNode):
(WebCore::Internals::markerDescriptionForNode):
* testing/Internals.h:
(WebCore):
(Internals):
* testing/Internals.idl:

Source/WebKit/chromium:

didFinishCheckingText() accidentally dropped the description text
given from the backend. Fixed to copy it on the API-to-Core
convertion. The test won't work without this fix.

Reviewed by Kent Tamura.

* src/WebTextCheckingCompletionImpl.cpp:
(WebKit::toCoreResults):

Source/WebKit/win:

Reviewed by Kent Tamura.

* WebKit.vcproj/WebKit_Cairo.def:
* WebKit.vcproj/WebKit_Cairo_debug.def:

Source/WebKit2:

Reviewed by Kent Tamura.

* win/WebKit2.def:
* win/WebKit2CFLite.def:

Tools:

Made the mock requestCheckingOfText() implementation to return
a replacement text for each misspelled word if available.

Reviewed by Kent Tamura.

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

LayoutTests:

Reviewed by Kent Tamura.

* editing/spelling/spelling-marker-description-expected.txt: Added.
* editing/spelling/spelling-marker-description.html: Added.
* platform/gtk/Skipped:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107176 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/editing/spelling/spelling-marker-description-expected.txt [new file with mode: 0644]
LayoutTests/editing/spelling/spelling-marker-description.html [new file with mode: 0644]
LayoutTests/platform/gtk/Skipped
LayoutTests/platform/mac/Skipped
LayoutTests/platform/qt/Skipped
LayoutTests/platform/win/Skipped
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/editing/Editor.cpp
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebKit.vcproj/WebKit_Cairo.def
Source/WebKit/win/WebKit.vcproj/WebKit_Cairo_debug.def
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def
Source/WebKit2/win/WebKit2CFLite.def
Source/autotools/symbols.filter
Tools/ChangeLog
Tools/DumpRenderTree/chromium/WebViewHost.cpp

index 28ee8fa..73a12ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-02-07  MORITA Hajime  <morrita@google.com>
+
+        Replacement text should be available from the marker.
+        https://bugs.webkit.org/show_bug.cgi?id=77934
+
+        Reviewed by Kent Tamura.
+
+        * Source/autotools/symbols.filter: Added an exporting symbol.
+
 2012-02-07  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         [CMAKE] Use *bin* and *lib* directories for executable and libraries.
index 830bcb4..36ce104 100644 (file)
@@ -1,3 +1,17 @@
+2012-02-07  MORITA Hajime  <morrita@google.com>
+
+        Replacement text should be available from the marker.
+        https://bugs.webkit.org/show_bug.cgi?id=77934
+
+        Reviewed by Kent Tamura.
+
+        * editing/spelling/spelling-marker-description-expected.txt: Added.
+        * editing/spelling/spelling-marker-description.html: Added.
+        * platform/gtk/Skipped:
+        * platform/mac/Skipped:
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+
 2012-02-08  Igor Oliveira  <igor.o@sisa.samsung.com>
 
         Implement reverse animation direction
diff --git a/LayoutTests/editing/spelling/spelling-marker-description-expected.txt b/LayoutTests/editing/spelling/spelling-marker-description-expected.txt
new file mode 100644 (file)
index 0000000..770b4c9
--- /dev/null
@@ -0,0 +1,11 @@
+The spellchecker should store replacement text in each marker.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS markedText is "wellcome"
+PASS markerDescription is "welcome"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+wellcome.
diff --git a/LayoutTests/editing/spelling/spelling-marker-description.html b/LayoutTests/editing/spelling/spelling-marker-description.html
new file mode 100644 (file)
index 0000000..8164511
--- /dev/null
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<div id="container">
+  <div id="destination" contentEditable></div>
+</div>
+
+<script>
+
+function done()
+{
+    layoutTestController.setAsynchronousSpellCheckingEnabled(false);
+    internals.settings.setUnifiedTextCheckingEnabled(false);
+    finishJSTest()
+}
+
+function verify(nretry)
+{
+    if (!nretry) {
+       done();
+       return;
+    }
+
+    var texts = destination.childNodes;
+    for (var i = 0; i < texts.length; ++i) {
+        if (internals.markerCountForNode(texts[i], "spelling")) { 
+            markedText = internals.markerRangeForNode(texts[i], "spelling", 0).toString();
+            markerDescription = internals.markerDescriptionForNode(texts[i], "spelling", 0);
+            break;
+        }
+    }
+
+    if (markedText) {
+        shouldBeEqualToString("markedText", "wellcome");
+        shouldBeEqualToString("markerDescription", "welcome");
+        done();
+    }
+
+    // Wait until the async spellchecking is done.
+    window.setTimeout(function() { verify(nretry - 1); }, 0);
+}
+
+function test()
+{
+    jsTestIsAsync = true;
+    internals.settings.setUnifiedTextCheckingEnabled(true);
+    layoutTestController.setAsynchronousSpellCheckingEnabled(true);
+
+    var sel = window.getSelection();
+    var destination = document.getElementById("destination");
+    destination.focus();
+    document.execCommand("InsertHTML", false, "wellcome");
+    document.execCommand("InsertText", false, ".");
+
+    window.setTimeout(function() { verify(10); }, 0);
+}
+
+description("The spellchecker should store replacement text in each marker.");
+if (window.internals)
+    test();
+
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
index 1d5bfaf..dce8de4 100644 (file)
@@ -124,6 +124,9 @@ editing/pasteboard/paste-text-008.html
 editing/undo/undo-smart-delete-reversed-selection.html
 editing/selection/directionality-after-undo-replace.html
 
+# EditorClient::checkTextOfParagraph() is not implemented
+editing/spelling/spelling-marker-description.html
+
 # https://bugs.webkit.org/show_bug.cgi?id=64530
 editing/selection/editable-html-element.html
 
index 9865730..22da73e 100644 (file)
@@ -342,6 +342,10 @@ editing/pasteboard/data-transfer-items-image-png.html
 editing/pasteboard/data-transfer-items-drag-drop-file.html
 editing/pasteboard/data-transfer-items-drag-drop-string.html
 
+# Replacement text for misspelling is not given from NSSpellChecker.
+# https://bugs.webkit.org/show_bug.cgi?id=77934
+editing/spelling/spelling-marker-description.html
+
 # Custom MIME type support in DataTransfer is not yet implemented.
 editing/pasteboard/clipboard-customData.html
 fast/events/drag-customData.html
index d8ae7a2..12ce674 100644 (file)
@@ -736,6 +736,8 @@ editing/spelling/spellcheck-paste.html
 editing/spelling/spellcheck-queue.html
 editing/spelling/spellcheck-sequencenum.html
 editing/spelling/spellcheck-async-mutation.html
+# EditorClient::checkTextOfParagraph() is not implemented
+editing/spelling/spelling-marker-description.html
 
 # [Qt][GTK] editing/spelling/spellcheck-async.html fails
 # https://bugs.webkit.org/show_bug.cgi?id=73003
index fd1000a..254c313 100644 (file)
@@ -1057,6 +1057,9 @@ editing/spelling/markers.html
 
 # EditorClient::requestCheckingOfString() is not implemented
 editing/spelling/spellcheck-paste.html
+# Replacement text for misspelling is not given.
+# https://bugs.webkit.org/show_bug.cgi?id=77934
+editing/spelling/spelling-marker-description.html
 
 # IndexedDB is not yet enabled.
 storage/indexeddb
index 51c5a79..33f8368 100644 (file)
@@ -1,3 +1,45 @@
+2012-02-07  MORITA Hajime  <morrita@google.com>
+
+        Replacement text should be available from the marker.
+        https://bugs.webkit.org/show_bug.cgi?id=77934
+
+        Reviewed by Kent Tamura.
+
+        On spellchecking, TextCheckingResult can contain a replacement text
+        which is usable both for an automatic replacement and for showing a suggestion.
+
+        But when marking a misspelled word ragarding to returned
+        TextCheckingResult, Editor uses only the misspelled range data and
+        discards the replacement value. Then it asks the same value again
+        when showing suggestion/autocorrection.
+
+        It would be great if the marker holds the replacement text
+        and Editor can use it on suggesting a correction, without any re-request.
+        This is especially true in the case when it needs IPC messaging for spellchecking:
+        We can save one round-trip by this technique.
+
+        Here is actual change:
+
+        - Passed the replacement text to addMarker() for for misspelling markers.
+          Note that this is done only for the unified checker path because legacy
+          TextCheckerClient API doesn't provide such a replacement.
+        - Added an Internals API to retrieve a description text on a marker.
+
+        Test: editing/spelling/spelling-marker-description.html
+
+        * WebCore.exp.in:
+        * editing/Editor.cpp:
+        (WebCore::Editor::markAndReplaceFor):
+        * testing/Internals.cpp:
+        (WebCore::Internals::markerAt):
+        (WebCore):
+        (WebCore::Internals::markerRangeForNode):
+        (WebCore::Internals::markerDescriptionForNode):
+        * testing/Internals.h:
+        (WebCore):
+        (Internals):
+        * testing/Internals.idl:
+
 2012-02-08  Eric Seidel  <eric@webkit.org>
 
         Remove more cruft now that HTMLIsIndexElement is gone
index ec27aec..d839c53 100644 (file)
@@ -1246,6 +1246,7 @@ __ZNK7WebCore14DocumentLoader19originalRequestCopyEv
 __ZNK7WebCore14DocumentLoader21isLoadingMainResourceEv
 __ZNK7WebCore14DocumentLoader28urlForHistoryReflectsFailureEv
 __ZNK7WebCore14DocumentLoader3urlEv
+__ZNK7WebCore14DocumentMarker11descriptionEv
 __ZNK7WebCore14FrameSelection11currentFormEv
 __ZNK7WebCore14FrameSelection15copyTypingStyleEv
 __ZNK7WebCore14FrameSelection17isInPasswordFieldEv
index 7fe95f7..97b1533 100644 (file)
@@ -2090,7 +2090,7 @@ void Editor::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, const Vect
             RefPtr<Range> misspellingRange = paragraph.subrange(resultLocation, resultLength);
             if (!m_spellingCorrector->isSpellingMarkerAllowed(misspellingRange))
                 continue;
-            misspellingRange->startContainer()->document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling);
+            misspellingRange->startContainer()->document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling, result->replacement);
         } else if (shouldMarkGrammar && result->type == TextCheckingTypeGrammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) {
             ASSERT(resultLength > 0 && resultLocation >= 0);
             for (unsigned j = 0; j < result->details.size(); j++) {
index 1212f8d..06e34cd 100644 (file)
@@ -281,7 +281,7 @@ unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc
     return node->document()->markers()->markersFor(node, markerTypes).size();
 }
 
-PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
 {
     if (!node) {
         ec = INVALID_ACCESS_ERR;
@@ -297,7 +297,23 @@ PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker
     Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(node, markerTypes);
     if (markers.size() <= index)
         return 0;
-    return Range::create(node->document(), node, markers[index]->startOffset(), node, markers[index]->endOffset());
+    return markers[index];
+}
+
+PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+{
+    DocumentMarker* marker = markerAt(node, markerType, index, ec);
+    if (!marker)
+        return 0;
+    return Range::create(node->document(), node, marker->startOffset(), node, marker->endOffset());
+}
+
+String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec)
+{
+    DocumentMarker* marker = markerAt(node, markerType, index, ec);
+    if (!marker)
+        return String();
+    return marker->description();
 }
 
 void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionCode& ec)
index 58d75d6..439dc75 100644 (file)
@@ -36,6 +36,7 @@ namespace WebCore {
 
 class ClientRect;
 class Document;
+class DocumentMarker;
 class Element;
 class InternalSettings;
 class Node;
@@ -79,7 +80,8 @@ public:
     PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&);
 
     unsigned markerCountForNode(Node*, const String&, ExceptionCode&);
-    PassRefPtr<Range> markerRangeForNode(Node*, const String&, unsigned, ExceptionCode&);
+    PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
+    String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
 
     void setScrollViewPosition(Document*, long x, long y, ExceptionCode&);
 
@@ -113,6 +115,7 @@ public:
 
 private:
     explicit Internals(Document*);
+    DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
 
     RefPtr<InternalSettings> m_settings;
 };
index 54f3d55..9bf0575 100644 (file)
@@ -53,6 +53,7 @@ module window {
         ClientRect boundingBox(in Element element) raises(DOMException);
         unsigned long markerCountForNode(in Node node, in DOMString markerType) raises(DOMException);
         Range markerRangeForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException);
+        DOMString markerDescriptionForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException);
 
         void setScrollViewPosition(in Document document, in long x, in long y) raises(DOMException);
 
index bb46cb3..a764b88 100644 (file)
@@ -1,3 +1,17 @@
+2012-02-07  MORITA Hajime  <morrita@google.com>
+
+        Replacement text should be available from the marker.
+        https://bugs.webkit.org/show_bug.cgi?id=77934
+
+        didFinishCheckingText() accidentally dropped the description text
+        given from the backend. Fixed to copy it on the API-to-Core
+        convertion. The test won't work without this fix.
+
+        Reviewed by Kent Tamura.
+
+        * src/WebTextCheckingCompletionImpl.cpp:
+        (WebKit::toCoreResults):
+
 2012-02-08  Dmitry Lomov  <dslomov@chromium.org>
 
         [V8][Chromium] Race between worker accessing WebDatabase and frame closing down.
index 0f59a93..0d6e4db 100644 (file)
@@ -41,25 +41,11 @@ using namespace WebCore;
 
 namespace WebKit {
 
-static TextCheckingType toCoreCheckingType(WebTextCheckingResult::Error error)
-{
-    if (error == WebTextCheckingResult::ErrorSpelling)
-        return TextCheckingTypeSpelling;
-    ASSERT(error == WebTextCheckingResult::ErrorGrammar);
-    return TextCheckingTypeGrammar;
-}
-
 static Vector<TextCheckingResult> toCoreResults(const WebVector<WebTextCheckingResult>& results)
 {
     Vector<TextCheckingResult> coreResults;
-    for (size_t i = 0; i < results.size(); ++i) { 
-        TextCheckingResult coreResult;
-        coreResult.type = toCoreCheckingType(results[i].error);
-        coreResult.location = results[i].position;
-        coreResult.length = results[i].length;
-        coreResults.append(coreResult);
-    }
-
+    for (size_t i = 0; i < results.size(); ++i)
+        coreResults.append(results[i]);
     return coreResults;
 }
 
index d3e463a..32db318 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-07  MORITA Hajime  <morrita@google.com>
+
+        Replacement text should be available from the marker.
+        https://bugs.webkit.org/show_bug.cgi?id=77934
+
+        Reviewed by Kent Tamura.
+
+        * WebKit.vcproj/WebKit_Cairo.def:
+        * WebKit.vcproj/WebKit_Cairo_debug.def:
+
 2012-02-02  Jon Lee  <jonlee@apple.com>
 
         Clear shown notifications when context is no longer active
index 8d35281..89b0a2a 100644 (file)
@@ -110,6 +110,7 @@ EXPORTS
         ??0ClientRect@WebCore@@AAE@ABVIntRect@1@@Z
         ??0ClientRect@WebCore@@AAE@XZ
         ?absoluteBoundingBoxRect@RenderObject@WebCore@@QAE?AVIntRect@2@_N@Z
+       ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
         ?fastMalloc@WTF@@YAPAXI@Z
         ?fastZeroedMalloc@WTF@@YAPAXI@Z
         ?fastFree@WTF@@YAXPAX@Z
index 5522672..1b1b72d 100644 (file)
@@ -110,6 +110,7 @@ EXPORTS
         ??0ClientRect@WebCore@@AAE@ABVIntRect@1@@Z
         ??0ClientRect@WebCore@@AAE@XZ
         ?absoluteBoundingBoxRect@RenderObject@WebCore@@QAE?AVIntRect@2@_N@Z
+       ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
         ?fastMalloc@WTF@@YAPAXI@Z
         ?fastZeroedMalloc@WTF@@YAPAXI@Z
         ?fastFree@WTF@@YAXPAX@Z
index c0cd8e4..af850d1 100644 (file)
@@ -1,3 +1,13 @@
+2012-02-07  MORITA Hajime  <morrita@google.com>
+
+        Replacement text should be available from the marker.
+        https://bugs.webkit.org/show_bug.cgi?id=77934
+
+        Reviewed by Kent Tamura.
+
+        * win/WebKit2.def:
+        * win/WebKit2CFLite.def:
+
 2012-02-08  Anders Carlsson  <andersca@apple.com>
 
         Don't use the wheel event handler count to track if a page has horizontal scrollbars
index 54785c4..76830e0 100644 (file)
@@ -146,6 +146,7 @@ EXPORTS
         ??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z
         ?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z
         ?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ
+       ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
         ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z
         ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z
         ?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z
index fa5cbf7..3a927c2 100644 (file)
@@ -140,6 +140,7 @@ EXPORTS
         ??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z
         ?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z
         ?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ
+       ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ
         ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z
         ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z
         ?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z
index 8ec7fd9..f0cdc1a 100644 (file)
@@ -83,6 +83,7 @@ _ZNK7WebCore8Document4pageEv;
 _ZNK7WebCore8Document8settingsEv;
 _ZNK7WebCore8Document4viewEv;
 _ZNK7WebCore9TreeScope14getElementByIdERKN3WTF12AtomicStringE;
+_ZNK7WebCore14DocumentMarker11descriptionEv;
 _ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE;
 _ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb;
 _ZN7WebCore8Settings24setMockScrollbarsEnabledEb;
index 2958533..cfd0c65 100644 (file)
@@ -1,3 +1,16 @@
+2012-02-07  MORITA Hajime  <morrita@google.com>
+
+        Replacement text should be available from the marker.
+        https://bugs.webkit.org/show_bug.cgi?id=77934
+
+        Made the mock requestCheckingOfText() implementation to return
+        a replacement text for each misspelled word if available.
+
+        Reviewed by Kent Tamura.
+
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::finishLastTextCheck):
+
 2012-02-08  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
 
         [Qt][DRT] DumpRenderTreeQt should support --no-timeout and --timeout options
index 32b20db..befa3b7 100644 (file)
@@ -471,7 +471,10 @@ void WebViewHost::finishLastTextCheck()
         m_spellcheck.spellCheckWord(WebString(text.characters(), text.length()), &misspelledPosition, &misspelledLength);
         if (!misspelledLength)
             break;
-        results.append(WebTextCheckingResult(WebTextCheckingResult::ErrorSpelling, offset + misspelledPosition, misspelledLength));
+        Vector<WebString> suggestions;
+        m_spellcheck.fillSuggestionList(WebString(text.characters() + misspelledPosition, misspelledLength), &suggestions);
+        results.append(WebTextCheckingResult(WebTextCheckingTypeSpelling, offset + misspelledPosition, misspelledLength,
+                                             suggestions.isEmpty() ? WebString() : suggestions[0]));
         text = text.substring(misspelledPosition + misspelledLength);
         offset += misspelledPosition + misspelledLength;
     }