Title: [144436] trunk/Source/WebKit2
Revision
144436
Author
[email protected]
Date
2013-03-01 03:39:02 -0800 (Fri, 01 Mar 2013)

Log Message

[WK2] Asynchronous spell checking implementation
https://bugs.webkit.org/show_bug.cgi?id=109577

Patch by Grzegorz Czajkowski  <[email protected]>, Mariusz Grzegorczyk <[email protected]> on 2013-03-01
Reviewed by Enrica Casucci.

Associate the abstract 'WebCore::TextCheckingRequest' object with the unique identifier
on WebProcess side. The request data from the 'TextCheckingRequest' are retrieved and
passed to the UIProcess. The WK2 client (TextChecker{Gtk/Mac/Efl/Qt}.cpp) gets
the 'TextCheckerCompletion' object with the request data and possibility to notify
the WebProcess about the spelling results.
Finally, the WebPage object calls on the proper 'TextCheckingRequest' object
didSuccess/didCancel method to notify the WebCore about the spelling result.

* CMakeLists.txt:
* GNUmakefile.list.am:
Add 'TextCheckerCompletion.{h/cpp}' to the WebKit2 cmake based and
WK2-Gtk+ builds.

* Scripts/webkit2/messages.py:
(headers_for_type):
Add exception for 'TextCheckingRequestData' class to properly find header
file for it.

* Shared/WebCoreArgumentCoders.cpp:
* Shared/WebCoreArgumentCoders.h:
Teach 'ArgumentCoder' how to encode/decode 'TextCheckingRequestData' class.

* Target.pri:
Add 'TextCheckerCompletion.{h/cpp}' to the WK2-Qt build.

* UIProcess/TextChecker.h:
Add 'requestCheckingOfString' method to the TextChecker's interface.

* UIProcess/TextCheckerCompletion.cpp: Added.
(WebKit::TextCheckerCompletion::create):
(WebKit::TextCheckerCompletion::TextCheckerCompletion):

(WebKit::TextCheckerCompletion::spellDocumentTag):
Return the WebPageProxy's spellDocumentTag as the client might be
interested in from which page the request came.

(WebKit::TextCheckerCompletion::textCheckingRequestData):
Allow to retrieve 'TextCheckingRequestData' object.

(WebKit::TextCheckerCompletion::didFinishCheckingText):
(WebKit::TextCheckerCompletion::didCancelCheckingText):
Notify the 'WebPageProxy' object that the given request has been
handled or canceled.

* UIProcess/TextCheckerCompletion.h: Added.
Introduce a new class for WK2 to retrieve the request data and
call didFinishCheckingText/didCancelCheckingText.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestCheckingOfString):
Create 'TextCheckerCompletion' object and pass it
to the 'TextChecker::requestCheckingOfString' method.

(WebKit::WebPageProxy::didFinishCheckingText):
(WebKit::WebPageProxy::didCancelCheckingText):
Send the messages to WebProcess that the given request has been
handled or canceled.

* UIProcess/WebPageProxy.h:
(WebPageProxy):
Add public declarations for 'didFinishCheckingText', 'didCancelCheckingText'.
Add private declarations for 'requestCheckingOfString'.
Move the 'spellDocumentTag()' method to to the public section to be
accessible from 'TextCheckerCompletion' class.

* UIProcess/WebPageProxy.messages.in:
A new entry for 'RequestCheckingOfString'.

* UIProcess/efl/TextCheckerEfl.cpp:
(WebKit::TextChecker::requestCheckingOfString):
(WebKit):
* UIProcess/gtk/TextCheckerGtk.cpp:
(WebKit::TextChecker::requestCheckingOfString):
(WebKit):
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::TextChecker::requestCheckingOfString):
(WebKit):
* UIProcess/qt/TextCheckerQt.cpp:
(WebKit::TextChecker::requestCheckingOfString):
(WebKit):
Add dummy implementations for 'requestCheckingOfString'.

* WebKit2.xcodeproj/project.pbxproj:
Add 'TextCheckerCompletion.{h/cpp} to Mac build.

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::generateTextCheckingRequestID):
Helper function to generate the unique identifier for the abstract
'TextCheckingRequest' object.

(WebKit::WebEditorClient::requestCheckingOfString):
Associate 'TextCheckingRequest' with the unique identifier and add them
to the map object.
Get the request data and send it to the UIProcess.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addTextCheckingRequest):
Add the identifier and the request to the map object.

(WebKit::WebPage::didFinishCheckingText):
(WebKit::WebPage::didCancelCheckingText):
Call didSucceed/didCancel on the 'TextCheckingRequest' to notify the WebCore
about spellcheking results.
Remove the request from the map object.

* WebProcess/WebPage/WebPage.h:
Add declarations for 'addTextCheckingRequest', 'didFinishCheckingText' and
'didCancelCheckingText.'

* WebProcess/WebPage/WebPage.messages.in:
Add a new entry for DidFinishCheckingText, DidCancelCheckingText.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/CMakeLists.txt (144435 => 144436)


--- trunk/Source/WebKit2/CMakeLists.txt	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/CMakeLists.txt	2013-03-01 11:39:02 UTC (rev 144436)
@@ -244,6 +244,7 @@
     UIProcess/PageViewportController.cpp
     UIProcess/ResponsivenessTimer.cpp
     UIProcess/StatisticsRequest.cpp
+    UIProcess/TextCheckerCompletion.cpp
     UIProcess/VisitedLinkProvider.cpp
     UIProcess/WebApplicationCacheManagerProxy.cpp
     UIProcess/WebBackForwardList.cpp

Modified: trunk/Source/WebKit2/ChangeLog (144435 => 144436)


--- trunk/Source/WebKit2/ChangeLog	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/ChangeLog	2013-03-01 11:39:02 UTC (rev 144436)
@@ -1,3 +1,122 @@
+2013-03-01  Grzegorz Czajkowski  <[email protected]>, Mariusz Grzegorczyk <[email protected]>
+
+        [WK2] Asynchronous spell checking implementation
+        https://bugs.webkit.org/show_bug.cgi?id=109577
+
+        Reviewed by Enrica Casucci.
+
+        Associate the abstract 'WebCore::TextCheckingRequest' object with the unique identifier
+        on WebProcess side. The request data from the 'TextCheckingRequest' are retrieved and
+        passed to the UIProcess. The WK2 client (TextChecker{Gtk/Mac/Efl/Qt}.cpp) gets
+        the 'TextCheckerCompletion' object with the request data and possibility to notify
+        the WebProcess about the spelling results.
+        Finally, the WebPage object calls on the proper 'TextCheckingRequest' object
+        didSuccess/didCancel method to notify the WebCore about the spelling result.
+
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        Add 'TextCheckerCompletion.{h/cpp}' to the WebKit2 cmake based and
+        WK2-Gtk+ builds.
+
+        * Scripts/webkit2/messages.py:
+        (headers_for_type):
+        Add exception for 'TextCheckingRequestData' class to properly find header
+        file for it.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        * Shared/WebCoreArgumentCoders.h:
+        Teach 'ArgumentCoder' how to encode/decode 'TextCheckingRequestData' class.
+
+        * Target.pri:
+        Add 'TextCheckerCompletion.{h/cpp}' to the WK2-Qt build.
+
+        * UIProcess/TextChecker.h:
+        Add 'requestCheckingOfString' method to the TextChecker's interface.
+
+        * UIProcess/TextCheckerCompletion.cpp: Added.
+        (WebKit::TextCheckerCompletion::create):
+        (WebKit::TextCheckerCompletion::TextCheckerCompletion):
+
+        (WebKit::TextCheckerCompletion::spellDocumentTag):
+        Return the WebPageProxy's spellDocumentTag as the client might be
+        interested in from which page the request came.
+
+        (WebKit::TextCheckerCompletion::textCheckingRequestData):
+        Allow to retrieve 'TextCheckingRequestData' object.
+
+        (WebKit::TextCheckerCompletion::didFinishCheckingText):
+        (WebKit::TextCheckerCompletion::didCancelCheckingText):
+        Notify the 'WebPageProxy' object that the given request has been
+        handled or canceled.
+
+        * UIProcess/TextCheckerCompletion.h: Added.
+        Introduce a new class for WK2 to retrieve the request data and
+        call didFinishCheckingText/didCancelCheckingText.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::requestCheckingOfString):
+        Create 'TextCheckerCompletion' object and pass it
+        to the 'TextChecker::requestCheckingOfString' method.
+
+        (WebKit::WebPageProxy::didFinishCheckingText):
+        (WebKit::WebPageProxy::didCancelCheckingText):
+        Send the messages to WebProcess that the given request has been
+        handled or canceled.
+
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        Add public declarations for 'didFinishCheckingText', 'didCancelCheckingText'.
+        Add private declarations for 'requestCheckingOfString'.
+        Move the 'spellDocumentTag()' method to to the public section to be
+        accessible from 'TextCheckerCompletion' class.
+
+        * UIProcess/WebPageProxy.messages.in:
+        A new entry for 'RequestCheckingOfString'.
+
+        * UIProcess/efl/TextCheckerEfl.cpp:
+        (WebKit::TextChecker::requestCheckingOfString):
+        (WebKit):
+        * UIProcess/gtk/TextCheckerGtk.cpp:
+        (WebKit::TextChecker::requestCheckingOfString):
+        (WebKit):
+        * UIProcess/mac/TextCheckerMac.mm:
+        (WebKit::TextChecker::requestCheckingOfString):
+        (WebKit):
+        * UIProcess/qt/TextCheckerQt.cpp:
+        (WebKit::TextChecker::requestCheckingOfString):
+        (WebKit):
+        Add dummy implementations for 'requestCheckingOfString'.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add 'TextCheckerCompletion.{h/cpp} to Mac build.
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::generateTextCheckingRequestID):
+        Helper function to generate the unique identifier for the abstract
+        'TextCheckingRequest' object.
+
+        (WebKit::WebEditorClient::requestCheckingOfString):
+        Associate 'TextCheckingRequest' with the unique identifier and add them
+        to the map object.
+        Get the request data and send it to the UIProcess.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::addTextCheckingRequest):
+        Add the identifier and the request to the map object.
+
+        (WebKit::WebPage::didFinishCheckingText):
+        (WebKit::WebPage::didCancelCheckingText):
+        Call didSucceed/didCancel on the 'TextCheckingRequest' to notify the WebCore
+        about spellcheking results.
+        Remove the request from the map object.
+
+        * WebProcess/WebPage/WebPage.h:
+        Add declarations for 'addTextCheckingRequest', 'didFinishCheckingText' and
+        'didCancelCheckingText.'
+
+        * WebProcess/WebPage/WebPage.messages.in:
+        Add a new entry for DidFinishCheckingText, DidCancelCheckingText.
+
 2013-02-28  Alexey Proskuryakov  <[email protected]>
 
         Reduce amount of rebuilding when touching networking headers

Modified: trunk/Source/WebKit2/GNUmakefile.list.am (144435 => 144436)


--- trunk/Source/WebKit2/GNUmakefile.list.am	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/GNUmakefile.list.am	2013-03-01 11:39:02 UTC (rev 144436)
@@ -858,6 +858,8 @@
 	Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.cpp \
 	Source/WebKit2/UIProcess/soup/WebSoupRequestManagerProxy.h \
 	Source/WebKit2/UIProcess/TextChecker.h \
+	Source/WebKit2/UIProcess/TextCheckerCompletion.h \
+	Source/WebKit2/UIProcess/TextCheckerCompletion.cpp \
 	Source/WebKit2/UIProcess/VisitedLinkProvider.cpp \
 	Source/WebKit2/UIProcess/VisitedLinkProvider.h \
 	Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h \

Modified: trunk/Source/WebKit2/Scripts/webkit2/messages.py (144435 => 144436)


--- trunk/Source/WebKit2/Scripts/webkit2/messages.py	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/Scripts/webkit2/messages.py	2013-03-01 11:39:02 UTC (rev 144436)
@@ -405,6 +405,7 @@
         'WebCore::KeypressCommand': ['<WebCore/KeyboardEvent.h>'],
         'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'],
         'WebCore::PluginInfo': ['<WebCore/PluginData.h>'],
+        'WebCore::TextCheckingRequestData': ['<WebCore/TextChecking.h>'],
         'WebCore::TextCheckingResult': ['<WebCore/TextCheckerClient.h>'],
         'WebCore::ViewportAttributes': ['<WebCore/ViewportArguments.h>'],
         'WebKit::InjectedBundleUserMessageEncoder': [],

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (144435 => 144436)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp	2013-03-01 11:39:02 UTC (rev 144436)
@@ -829,7 +829,36 @@
     return true;
 }
 
+void ArgumentCoder<TextCheckingRequestData>::encode(ArgumentEncoder& encoder, const TextCheckingRequestData& request)
+{
+    encoder << request.sequence();
+    encoder << request.text();
+    encoder << request.mask();
+    encoder.encodeEnum(request.processType());
+}
 
+bool ArgumentCoder<TextCheckingRequestData>::decode(ArgumentDecoder& decoder, TextCheckingRequestData& request)
+{
+    int sequence;
+    if (!decoder.decode(sequence))
+        return false;
+
+    String text;
+    if (!decoder.decode(text))
+        return false;
+
+    TextCheckingTypeMask mask;
+    if (!decoder.decode(mask))
+        return false;
+
+    TextCheckingProcessType processType;
+    if (!decoder.decodeEnum(processType))
+        return false;
+
+    request = TextCheckingRequestData(sequence, text, mask, processType);
+    return true;
+}
+
 void ArgumentCoder<TextCheckingResult>::encode(ArgumentEncoder& encoder, const TextCheckingResult& result)
 {
     encoder.encodeEnum(result.type);

Modified: trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h (144435 => 144436)


--- trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/Shared/WebCoreArgumentCoders.h	2013-03-01 11:39:02 UTC (rev 144436)
@@ -49,6 +49,7 @@
     class ResourceError;
     class ResourceRequest;
     class ResourceResponse;
+    class TextCheckingRequestData;
     class UserStyleSheet;
     class UserScript;
     struct CompositionUnderline;
@@ -233,6 +234,11 @@
     static bool decode(ArgumentDecoder&, WebCore::GrammarDetail&);
 };
 
+template<> struct ArgumentCoder<WebCore::TextCheckingRequestData> {
+    static void encode(ArgumentEncoder&, const WebCore::TextCheckingRequestData&);
+    static bool decode(ArgumentDecoder&, WebCore::TextCheckingRequestData&);
+};
+
 template<> struct ArgumentCoder<WebCore::TextCheckingResult> {
     static void encode(ArgumentEncoder&, const WebCore::TextCheckingResult&);
     static bool decode(ArgumentDecoder&, WebCore::TextCheckingResult&);

Modified: trunk/Source/WebKit2/Target.pri (144435 => 144436)


--- trunk/Source/WebKit2/Target.pri	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/Target.pri	2013-03-01 11:39:02 UTC (rev 144436)
@@ -232,6 +232,7 @@
     UIProcess/StatisticsRequest.h \
     UIProcess/Storage/StorageManager.h \
     UIProcess/TextChecker.h \
+    UIProcess/TextCheckerCompletion.h \
     UIProcess/VisitedLinkProvider.h \
     UIProcess/WebApplicationCacheManagerProxy.h \
     UIProcess/WebBackForwardList.h \
@@ -563,6 +564,7 @@
     UIProcess/FindIndicator.cpp \
     UIProcess/GeolocationPermissionRequestManagerProxy.cpp \
     UIProcess/GeolocationPermissionRequestProxy.cpp \
+    UIProcess/TextCheckerCompletion.cpp \
     UIProcess/Launcher/ProcessLauncher.cpp \
     UIProcess/Launcher/qt/ProcessLauncherQt.cpp \
     UIProcess/Notifications/NotificationPermissionRequest.cpp \

Modified: trunk/Source/WebKit2/UIProcess/TextChecker.h (144435 => 144436)


--- trunk/Source/WebKit2/UIProcess/TextChecker.h	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/UIProcess/TextChecker.h	2013-03-01 11:39:02 UTC (rev 144436)
@@ -26,6 +26,7 @@
 #ifndef TextChecker_h
 #define TextChecker_h
 
+#include "TextCheckerCompletion.h"
 #include <WebCore/EditorClient.h>
 #include <WebCore/TextCheckerClient.h>
 
@@ -72,6 +73,7 @@
     static void getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses);
     static void learnWord(int64_t spellDocumentTag, const String& word);
     static void ignoreWord(int64_t spellDocumentTag, const String& word);
+    static void requestCheckingOfString(PassRefPtr<TextCheckerCompletion>);
 };
 
 } // namespace WebKit

Added: trunk/Source/WebKit2/UIProcess/TextCheckerCompletion.cpp (0 => 144436)


--- trunk/Source/WebKit2/UIProcess/TextCheckerCompletion.cpp	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/TextCheckerCompletion.cpp	2013-03-01 11:39:02 UTC (rev 144436)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "TextCheckerCompletion.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<TextCheckerCompletion> TextCheckerCompletion::create(uint64_t requestID, const TextCheckingRequestData& requestData, WebPageProxy* page)
+{
+    return adoptRef(new TextCheckerCompletion(requestID, requestData, page));
+}
+
+TextCheckerCompletion::TextCheckerCompletion(uint64_t requestID, const TextCheckingRequestData& requestData, WebPageProxy* page)
+    : m_requestID(requestID)
+    , m_requestData(requestData)
+    , m_page(page)
+{
+}
+
+const TextCheckingRequestData& TextCheckerCompletion::textCheckingRequestData() const
+{
+    return m_requestData;
+}
+
+int64_t TextCheckerCompletion::spellDocumentTag()
+{
+    return m_page->spellDocumentTag();
+}
+
+void TextCheckerCompletion::didFinishCheckingText(const Vector<TextCheckingResult>& result) const
+{
+    if (result.isEmpty())
+        didCancelCheckingText();
+
+    m_page->didFinishCheckingText(m_requestID, result);
+}
+
+void TextCheckerCompletion::didCancelCheckingText() const
+{
+    m_page->didCancelCheckingText(m_requestID);
+}
+
+} // namespace WebKit

Added: trunk/Source/WebKit2/UIProcess/TextCheckerCompletion.h (0 => 144436)


--- trunk/Source/WebKit2/UIProcess/TextCheckerCompletion.h	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/TextCheckerCompletion.h	2013-03-01 11:39:02 UTC (rev 144436)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2013 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextCheckerCompletion_h
+#define TextCheckerCompletion_h
+
+#include "WebPageProxy.h"
+#include <WebCore/TextChecking.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+
+class TextCheckerCompletion : public RefCounted<TextCheckerCompletion> {
+public:
+    static PassRefPtr<TextCheckerCompletion> create(uint64_t requestID, const WebCore::TextCheckingRequestData&, WebPageProxy*);
+
+    const WebCore::TextCheckingRequestData& textCheckingRequestData() const;
+    int64_t spellDocumentTag();
+    void didFinishCheckingText(const Vector<WebCore::TextCheckingResult>&) const;
+    void didCancelCheckingText() const;
+
+private:
+    TextCheckerCompletion(uint64_t requestID, const WebCore::TextCheckingRequestData&, WebPageProxy*);
+
+    const uint64_t m_requestID;
+    const WebCore::TextCheckingRequestData m_requestData;
+    WebPageProxy* m_page;
+};
+
+} // namespace WebKit
+
+#endif // TextCheckerCompletion_h

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (144435 => 144436)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-03-01 11:39:02 UTC (rev 144436)
@@ -3401,6 +3401,20 @@
     TextChecker::ignoreWord(spellDocumentTag(), word);
 }
 
+void WebPageProxy::requestCheckingOfString(uint64_t requestID, const TextCheckingRequestData& request)
+{
+    TextChecker::requestCheckingOfString(TextCheckerCompletion::create(requestID, request, this));
+}
+
+void WebPageProxy::didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>& result) const
+{
+    m_process->send(Messages::WebPage::DidFinishCheckingText(requestID, result), m_pageID);
+}
+
+void WebPageProxy::didCancelCheckingText(uint64_t requestID) const
+{
+    m_process->send(Messages::WebPage::DidCancelCheckingText(requestID), m_pageID);
+}
 // Other
 
 void WebPageProxy::setFocus(bool focused)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (144435 => 144436)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2013-03-01 11:39:02 UTC (rev 144436)
@@ -756,6 +756,10 @@
 
     void didReceiveAuthenticationChallengeProxy(uint64_t frameID, PassRefPtr<AuthenticationChallengeProxy>);
 
+    int64_t spellDocumentTag();
+    void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&) const;
+    void didCancelCheckingText(uint64_t requestID) const;
+
     void connectionWillOpen(CoreIPC::Connection*);
     void connectionWillClose(CoreIPC::Connection*);
 
@@ -954,7 +958,6 @@
 #endif
 
     // Spelling and grammar.
-    int64_t spellDocumentTag();
 #if USE(UNIFIED_TEXT_CHECKING)
     void checkTextOfParagraph(const String& text, uint64_t checkingTypes, Vector<WebCore::TextCheckingResult>& results);
 #endif
@@ -966,6 +969,7 @@
     void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses);
     void learnWord(const String& word);
     void ignoreWord(const String& word);
+    void requestCheckingOfString(uint64_t requestID, const WebCore::TextCheckingRequestData&);
 
     void setFocus(bool focused);
     void takeFocus(uint32_t direction);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (144435 => 144436)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2013-03-01 11:39:02 UTC (rev 144436)
@@ -233,6 +233,7 @@
     GetGuessesForWord(WTF::String word, WTF::String context) -> (Vector<WTF::String> guesses)
     LearnWord(WTF::String word);
     IgnoreWord(WTF::String word);
+    RequestCheckingOfString(uint64_t requestID, WebCore::TextCheckingRequestData request)
 
     # Drag and drop messages
 #if ENABLE(DRAG_SUPPORT)

Modified: trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp (144435 => 144436)


--- trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp	2013-03-01 11:39:02 UTC (rev 144436)
@@ -28,6 +28,7 @@
 #include "config.h"
 #include "TextChecker.h"
 
+#include "NotImplemented.h"
 #include "TextCheckerState.h"
 
 #if ENABLE(SPELLCHECK)
@@ -290,4 +291,9 @@
 #endif
 }
 
+void TextChecker::requestCheckingOfString(PassRefPtr<TextCheckerCompletion>)
+{
+    notImplemented();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp (144435 => 144436)


--- trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp	2013-03-01 11:39:02 UTC (rev 144436)
@@ -29,6 +29,7 @@
 
 #include "TextCheckerState.h"
 #include "WebTextChecker.h"
+#include <WebCore/NotImplemented.h>
 
 using namespace WebCore;
  
@@ -137,4 +138,9 @@
     WebTextChecker::shared()->client().ignoreWord(spellDocumentTag, word);
 }
 
+void TextChecker::requestCheckingOfString(PassRefPtr<TextCheckerCompletion>)
+{
+    notImplemented();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm (144435 => 144436)


--- trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2013-03-01 11:39:02 UTC (rev 144436)
@@ -391,4 +391,9 @@
     [[NSSpellChecker sharedSpellChecker] ignoreWord:word inSpellDocumentWithTag:spellDocumentTag];
 }
 
+void TextChecker::requestCheckingOfString(PassRefPtr<TextCheckerCompletion>)
+{
+    notImplemented();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp (144435 => 144436)


--- trunk/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp	2013-03-01 11:39:02 UTC (rev 144436)
@@ -126,4 +126,9 @@
     notImplemented();
 }
 
+void TextChecker::requestCheckingOfString(PassRefPtr<TextCheckerCompletion>)
+{
+    notImplemented();
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (144435 => 144436)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-03-01 11:39:02 UTC (rev 144436)
@@ -209,6 +209,8 @@
 		1AA3D7621651B7D3008713D0 /* RemoteLayerTreeHostMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA3D7601651B7D3008713D0 /* RemoteLayerTreeHostMessages.h */; };
 		1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA417C912C00CCA002BE67B /* TextChecker.h */; };
 		1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA417ED12C00D87002BE67B /* TextCheckerMac.mm */; };
+		1ZZ417EF12C00D87002BE67B /* TextCheckerCompletion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1BB417C912C00CCA002BE67B /* TextCheckerCompletion.cpp */; };
+		1QQ417CB12C00CCA002BE67B /* TextCheckerCompletion.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CC417C912C00CCA002BE67B /* TextCheckerCompletion.h */; };
 		1AA41AB512C02EC4002BE67B /* EditorState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA41AB412C02EC4002BE67B /* EditorState.h */; };
 		1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA4792212A59FD9008236C3 /* PluginProcessMac.mm */; };
 		1AA479B012A5A436008236C3 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; };
@@ -1495,6 +1497,8 @@
 		1A50DB1E110A3BDC000D3FE5 /* WebProcess.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebProcess.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		1A594AB8112A1FB6009DE7C7 /* WebUIClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebUIClient.cpp; sourceTree = "<group>"; };
 		1A594AB9112A1FB6009DE7C7 /* WebUIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebUIClient.h; sourceTree = "<group>"; };
+		1BB417C912C00CCA002BE67B /* TextCheckerCompletion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCheckerCompletion.cpp; sourceTree = "<group>"; };
+		1CC417C912C00CCA002BE67B /* TextCheckerCompletion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerCompletion.h; sourceTree = "<group>"; };
 		1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerState.h; sourceTree = "<group>"; };
 		1A6420E212DCE2FF00CAAE2C /* ShareableBitmap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShareableBitmap.cpp; sourceTree = "<group>"; };
 		1A6420E312DCE2FF00CAAE2C /* ShareableBitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShareableBitmap.h; sourceTree = "<group>"; };
@@ -3828,6 +3832,8 @@
 				51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */,
 				514BDED216C98EDD00E4E25E /* StatisticsRequest.h */,
 				1AA417C912C00CCA002BE67B /* TextChecker.h */,
+				1BB417C912C00CCA002BE67B /* TextCheckerCompletion.cpp */,
+				1CC417C912C00CCA002BE67B /* TextCheckerCompletion.h */,
 				1A0F29E1120B44420053D1B9 /* VisitedLinkProvider.cpp */,
 				1A0F29E2120B44420053D1B9 /* VisitedLinkProvider.h */,
 				512E3520130B550100ABD19A /* WebApplicationCacheManagerProxy.cpp */,
@@ -5246,6 +5252,7 @@
 				296BD85D15019BC30071F424 /* StringUtilities.h in Headers */,
 				51815BA016A622210054501F /* SyncNetworkResourceLoader.h in Headers */,
 				1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */,
+				1QQ417CB12C00CCA002BE67B /* TextCheckerCompletion.h in Headers */,
 				1A5E4DA412D3BD3D0099A2BB /* TextCheckerState.h in Headers */,
 				1AAF263914687C39004A1E8A /* TiledCoreAnimationDrawingArea.h in Headers */,
 				1AF05D8714688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.h in Headers */,
@@ -6461,6 +6468,7 @@
 				1A13BEB31635A9C800F19C03 /* StringReference.cpp in Sources */,
 				296BD85E15019BC30071F424 /* StringUtilities.mm in Sources */,
 				51815B9F16A622210054501F /* SyncNetworkResourceLoader.cpp in Sources */,
+				1ZZ417EF12C00D87002BE67B /* TextCheckerCompletion.cpp in Sources */,
 				1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */,
 				1AAF263814687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm in Sources */,
 				1AF05D8614688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.mm in Sources */,

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (144435 => 144436)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp	2013-03-01 11:39:02 UTC (rev 144436)
@@ -45,6 +45,7 @@
 #include <WebCore/KeyboardEvent.h>
 #include <WebCore/NotImplemented.h>
 #include <WebCore/Page.h>
+#include <WebCore/SpellChecker.h>
 #include <WebCore/StylePropertySet.h>
 #include <WebCore/TextIterator.h>
 #include <WebCore/UndoStep.h>
@@ -61,6 +62,12 @@
 
 namespace WebKit {
 
+static uint64_t generateTextCheckingRequestID()
+{
+    static uint64_t uniqueTextCheckingRequestID = 1;
+    return uniqueTextCheckingRequestID++;
+}
+
 void WebEditorClient::pageDestroyed()
 {
     delete this;
@@ -468,6 +475,16 @@
     m_page->sendSync(Messages::WebPageProxy::GetGuessesForWord(word, context), Messages::WebPageProxy::GetGuessesForWord::Reply(guesses));
 }
 
+void WebEditorClient::requestCheckingOfString(WTF::PassRefPtr<TextCheckingRequest> prpRequest)
+{
+    RefPtr<TextCheckingRequest> request = prpRequest;
+
+    uint64_t requestID = generateTextCheckingRequestID();
+    m_page->addTextCheckingRequest(requestID, request);
+
+    m_page->send(Messages::WebPageProxy::RequestCheckingOfString(requestID, request->data()));
+}
+
 void WebEditorClient::willSetInputMethodState()
 {
 #if PLATFORM(QT)
@@ -482,11 +499,6 @@
     notImplemented();
 }
 
-void WebEditorClient::requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>)
-{
-    notImplemented();
-}
-
 bool WebEditorClient::supportsGlobalSelection()
 {
 #if PLATFORM(QT) && !defined(QT_NO_CLIPBOARD)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (144435 => 144436)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-03-01 11:39:02 UTC (rev 144436)
@@ -3809,4 +3809,29 @@
     return false;
 }
 
+void WebPage::addTextCheckingRequest(uint64_t requestID, PassRefPtr<TextCheckingRequest> request)
+{
+    m_pendingTextCheckingRequestMap.add(requestID, request);
+}
+
+void WebPage::didFinishCheckingText(uint64_t requestID, const Vector<TextCheckingResult>& result)
+{
+    TextCheckingRequest* request = m_pendingTextCheckingRequestMap.get(requestID).get();
+    if (!request)
+        return;
+
+    request->didSucceed(result);
+    m_pendingTextCheckingRequestMap.remove(requestID);
+}
+
+void WebPage::didCancelCheckingText(uint64_t requestID)
+{
+    TextCheckingRequest* request = m_pendingTextCheckingRequestMap.get(requestID).get();
+    if (!request)
+        return;
+
+    request->didCancel();
+    m_pendingTextCheckingRequestMap.remove(requestID);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (144435 => 144436)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-03-01 11:39:02 UTC (rev 144436)
@@ -59,6 +59,7 @@
 #include <WebCore/PageVisibilityState.h>
 #include <WebCore/PlatformScreen.h>
 #include <WebCore/ScrollTypes.h>
+#include <WebCore/TextChecking.h>
 #include <WebCore/WebCoreKeyboardUIMode.h>
 #include <wtf/HashMap.h>
 #include <wtf/OwnPtr.h>
@@ -116,8 +117,10 @@
     class ResourceResponse;
     class ResourceRequest;
     class SharedBuffer;
+    class TextCheckingRequest;
     class VisibleSelection;
     struct KeypressCommand;
+    struct TextCheckingResult;
 }
 
 namespace WebKit {
@@ -612,6 +615,10 @@
 
     bool canShowMIMEType(const String& MIMEType) const;
 
+    void addTextCheckingRequest(uint64_t requestID, PassRefPtr<WebCore::TextCheckingRequest>);
+    void didFinishCheckingText(uint64_t requestID, const Vector<WebCore::TextCheckingResult>&);
+    void didCancelCheckingText(uint64_t requestID);
+
 private:
     WebPage(uint64_t pageID, const WebPageCreationParameters&);
 
@@ -801,6 +808,8 @@
 
     HashSet<PluginView*> m_pluginViews;
 
+    HashMap<uint64_t, RefPtr<WebCore::TextCheckingRequest> > m_pendingTextCheckingRequestMap;
+
     bool m_useFixedLayout;
 
     bool m_drawsBackground;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (144435 => 144436)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2013-03-01 11:36:57 UTC (rev 144435)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2013-03-01 11:39:02 UTC (rev 144436)
@@ -195,6 +195,8 @@
     # Spelling and grammar.
     AdvanceToNextMisspelling(bool startBeforeSelection)
     ChangeSpellingToWord(WTF::String word)
+    DidFinishCheckingText(uint64_t requestID, WTF::Vector<WebCore::TextCheckingResult> result)
+    DidCancelCheckingText(uint64_t requestID)
 #if USE(APPKIT)
     UppercaseWord()
     LowercaseWord()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to