WebKit2: Implement TextChecker on Windows
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 15:15:36 +0000 (15:15 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Apr 2011 15:15:36 +0000 (15:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=57862

Reviewed by Anders Carlsson.

Part 1: Get and set the state.

* Shared/API/c/win/WKBaseWin.h:
* Shared/APIObject.h:
* UIProcess/API/C/win/WKAPICastWin.h:

* UIProcess/API/C/win/WKTextChecker.cpp: Added.
(WKTextCheckerSetClient):
(WKTextCheckerContinuousSpellCheckingEnabledStateChanged):
(WKTextCheckerGrammarCheckingEnabledStateChanged):
* UIProcess/API/C/win/WKTextChecker.h: Added.

* UIProcess/TextChecker.h:
* UIProcess/win/TextCheckerWin.cpp:
(WebKit::TextChecker::state):
Do the initalization for the state only once so that it is not necessary to call the client
every time the state is requested.
(WebKit::TextChecker::isContinuousSpellCheckingAllowed):
Call the client.
(WebKit::TextChecker::setContinuousSpellCheckingEnabled):
Update the state and tell the client.
(WebKit::TextChecker::setGrammarCheckingEnabled):
Ditto.
(WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
Update the state.
(WebKit::TextChecker::grammarCheckingEnabledStateChanged):
Update the state.

* UIProcess/win/WebTextChecker.cpp: Added.
(WebKit::WebTextChecker::shared):
Make the WebTextChecker available globally.
(WebKit::WebTextChecker::WebTextChecker):
(WebKit::WebTextChecker::setClient):
(WebKit::updateStateForAllWebProcesses):
(WebKit::WebTextChecker::continuousSpellCheckingEnabledStateChanged):
Tell the TextChecker that the state has changed, and then tell the
WebProcessProxies to send the new state to the WebProcesses.
(WebKit::WebTextChecker::grammarCheckingEnabledStateChanged):
Ditto.
* UIProcess/win/WebTextChecker.h: Added.
(WebKit::WebTextChecker::client):
(WebKit::WebTextChecker::type):

* UIProcess/win/WebTextCheckerClient.cpp: Added.
(WebKit::WebTextCheckerClient::continuousSpellCheckingAllowed):
(WebKit::WebTextCheckerClient::continuousSpellCheckingEnabled):
(WebKit::WebTextCheckerClient::setContinuousSpellCheckingEnabled):
(WebKit::WebTextCheckerClient::grammarCheckingEnabled):
(WebKit::WebTextCheckerClient::setGrammarCheckingEnabled):
* UIProcess/win/WebTextCheckerClient.h: Added.

* win/WebKit2.vcproj:
Add WKTextChecker.h/.cpp, WebTextChecker.h/.cpp, and WebTextCheckerClient.h/.cpp.
* win/WebKit2Generated.make:
Copy over WKTextChecker.h.

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

14 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/c/win/WKBaseWin.h
Source/WebKit2/Shared/APIObject.h
Source/WebKit2/UIProcess/API/C/win/WKAPICastWin.h
Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h [new file with mode: 0644]
Source/WebKit2/UIProcess/TextChecker.h
Source/WebKit2/UIProcess/win/TextCheckerWin.cpp
Source/WebKit2/UIProcess/win/WebTextChecker.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/win/WebTextChecker.h [new file with mode: 0644]
Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/win/WebTextCheckerClient.h [new file with mode: 0644]
Source/WebKit2/win/WebKit2.vcproj
Source/WebKit2/win/WebKit2Generated.make

index f70b215..5e24e07 100644 (file)
@@ -1,3 +1,66 @@
+2011-04-06  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        WebKit2: Implement TextChecker on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=57862
+
+        Part 1: Get and set the state.
+
+        * Shared/API/c/win/WKBaseWin.h:
+        * Shared/APIObject.h:
+        * UIProcess/API/C/win/WKAPICastWin.h:
+        * UIProcess/API/C/win/WKTextChecker.cpp: Added.
+        (WKTextCheckerSetClient):
+        (WKTextCheckerContinuousSpellCheckingEnabledStateChanged):
+        (WKTextCheckerGrammarCheckingEnabledStateChanged):
+        * UIProcess/API/C/win/WKTextChecker.h: Added.
+        * UIProcess/TextChecker.h:
+        * UIProcess/win/TextCheckerWin.cpp:
+        (WebKit::TextChecker::state):
+        Do the initalization for the state only once so that it is not necessary to call the client
+        every time the state is requested.
+        (WebKit::TextChecker::isContinuousSpellCheckingAllowed):
+        Call the client.
+        (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
+        Update the state and tell the client.
+        (WebKit::TextChecker::setGrammarCheckingEnabled):
+        Ditto.
+        (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
+        Update the state.
+        (WebKit::TextChecker::grammarCheckingEnabledStateChanged):
+        Update the state.
+
+        * UIProcess/win/WebTextChecker.cpp: Added.
+        (WebKit::WebTextChecker::shared):
+        Make the WebTextChecker available globally.
+        (WebKit::WebTextChecker::WebTextChecker):
+        (WebKit::WebTextChecker::setClient):
+        (WebKit::updateStateForAllWebProcesses):
+        (WebKit::WebTextChecker::continuousSpellCheckingEnabledStateChanged):
+        Tell the TextChecker that the state has changed, and then tell the
+        WebProcessProxies to send the new state to the WebProcesses.
+        (WebKit::WebTextChecker::grammarCheckingEnabledStateChanged):
+        Ditto.
+        * UIProcess/win/WebTextChecker.h: Added.
+        (WebKit::WebTextChecker::client):
+        (WebKit::WebTextChecker::type):
+
+        * UIProcess/win/WebTextCheckerClient.cpp: Added.
+        (WebKit::WebTextCheckerClient::continuousSpellCheckingAllowed):
+        (WebKit::WebTextCheckerClient::continuousSpellCheckingEnabled):
+        (WebKit::WebTextCheckerClient::setContinuousSpellCheckingEnabled):
+        (WebKit::WebTextCheckerClient::grammarCheckingEnabled):
+        (WebKit::WebTextCheckerClient::setGrammarCheckingEnabled):
+        * UIProcess/win/WebTextCheckerClient.h: Added.
+        * win/WebKit2.vcproj:
+        Add WKTextChecker.h/.cpp, WebTextChecker.h/.cpp, and WebTextCheckerClient.h/.cpp.
+        * win/WebKit2Generated.make:
+        Copy over WKTextChecker.h.
+
 2011-04-05  Chang Shu  <cshu@webkit.org>
 
         Reviewed by Darin Adler.
index fdd4607..1fa4150 100644 (file)
@@ -32,5 +32,6 @@
 
 typedef const struct OpaqueWKView* WKViewRef;
 typedef const struct OpaqueWKEditCommand* WKEditCommandRef;
+typedef const struct OpaqueWKTextChecker* WKTextCheckerRef;
 
 #endif /* WKBaseWin_h */
index 7f50b51..1555452 100644 (file)
@@ -105,7 +105,8 @@ public:
 
         // Platform specific
         TypeView,
-        TypeEditCommandProxy
+        TypeEditCommandProxy,
+        TypeTextChecker
     };
 
     virtual ~APIObject()
index 09cf06f..0761f5a 100644 (file)
@@ -34,9 +34,11 @@ namespace WebKit {
 
 class WebView;
 class WebEditCommandProxy;
+class WebTextChecker;
 
 WK_ADD_API_MAPPING(WKViewRef, WebView)
 WK_ADD_API_MAPPING(WKEditCommandRef, WebEditCommandProxy)
+WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
 
 }
 
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.cpp
new file mode 100644 (file)
index 0000000..a0c2ffe
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "WKTextChecker.h"
+
+#include "WKAPICast.h"
+#include "WebTextChecker.h"
+
+using namespace WebKit;
+
+void WKTextCheckerSetClient(const WKTextCheckerClient* wkClient)
+{
+    if (wkClient && wkClient->version)
+        return;
+    WebTextChecker::shared()->setClient(wkClient);
+}
+
+void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+    WebTextChecker::shared()->continuousSpellCheckingEnabledStateChanged(enabled);
+}
+
+void WKTextCheckerGrammarCheckingEnabledStateChanged(bool enabled)
+{
+    WebTextChecker::shared()->grammarCheckingEnabledStateChanged(enabled);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h b/Source/WebKit2/UIProcess/API/C/win/WKTextChecker.h
new file mode 100644 (file)
index 0000000..8fb6597
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 WKTextChecker_h
+#define WKTextChecker_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// TextChecker Client
+typedef bool (*WKTextCheckerContinousSpellCheckingAllowed)(const void *clientInfo);
+typedef bool (*WKTextCheckerContinousSpellCheckingEnabled)(const void *clientInfo);
+typedef void (*WKTextCheckerSetContinousSpellCheckingEnabled)(bool enabled, const void *clientInfo);
+typedef bool (*WKTextCheckerGrammarCheckingEnabled)(const void *clientInfo);
+typedef void (*WKTextCheckerSetGrammarCheckingEnabled)(bool enabled, const void *clientInfo);
+
+struct WKTextCheckerClient {
+    int                                                                     version;
+    const void *                                                            clientInfo;
+    WKTextCheckerContinousSpellCheckingAllowed                              continuousSpellCheckingAllowed;
+    WKTextCheckerContinousSpellCheckingEnabled                              continuousSpellCheckingEnabled;
+    WKTextCheckerSetContinousSpellCheckingEnabled                           setContinuousSpellCheckingEnabled;
+    WKTextCheckerGrammarCheckingEnabled                                     grammarCheckingEnabled;
+    WKTextCheckerSetGrammarCheckingEnabled                                  setGrammarCheckingEnabled;
+};
+typedef struct WKTextCheckerClient WKTextCheckerClient;
+
+WK_EXPORT void WKTextCheckerSetClient(const WKTextCheckerClient* client);
+
+WK_EXPORT void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool);
+WK_EXPORT void WKTextCheckerGrammarCheckingEnabledStateChanged(bool);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKTextChecker_h */
index 7a5d535..5f45008 100644 (file)
@@ -50,6 +50,9 @@ public:
 
     static bool isSmartInsertDeleteEnabled();
     static void setSmartInsertDeleteEnabled(bool);
+#elif PLATFORM(WIN)
+    static void continuousSpellCheckingEnabledStateChanged(bool);
+    static void grammarCheckingEnabledStateChanged(bool);
 #endif
 
     static int64_t uniqueSpellDocumentTag();
index dbc6fdc..357597a 100644 (file)
@@ -27,6 +27,7 @@
 #include "TextChecker.h"
 
 #include "TextCheckerState.h"
+#include "WebTextChecker.h"
 #include <WebCore/NotImplemented.h>
 
 using namespace WebCore;
@@ -37,26 +38,48 @@ static TextCheckerState textCheckerState;
 
 const TextCheckerState& TextChecker::state()
 {
-    notImplemented();
+    static bool didInitializeState;
+    if (didInitializeState)
+        return textCheckerState;
+
+    WebTextCheckerClient& client = WebTextChecker::shared()->client();
+    textCheckerState.isContinuousSpellCheckingEnabled = client.continuousSpellCheckingEnabled();
+    textCheckerState.isGrammarCheckingEnabled =  client.grammarCheckingEnabled();
+
+    didInitializeState = true;
 
     return textCheckerState;
 }
   
 bool TextChecker::isContinuousSpellCheckingAllowed()
 {
-    notImplemented();
-
-    return false;
+    return WebTextChecker::shared()->client().continuousSpellCheckingAllowed();
 }
 
 void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled)
 {
-    notImplemented();
+    if (state().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled)
+        return;
+    textCheckerState.isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled;
+    WebTextChecker::shared()->client().setContinuousSpellCheckingEnabled(isContinuousSpellCheckingEnabled);
 }
 
 void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled)
 {
-    notImplemented();
+    if (state().isGrammarCheckingEnabled == isGrammarCheckingEnabled)
+        return;
+    textCheckerState.isGrammarCheckingEnabled = isGrammarCheckingEnabled;
+    WebTextChecker::shared()->client().setGrammarCheckingEnabled(isGrammarCheckingEnabled);
+}
+
+void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+    textCheckerState.isContinuousSpellCheckingEnabled = enabled;
+}
+
+void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+    textCheckerState.isGrammarCheckingEnabled = enabled;
 }
 
 int64_t TextChecker::uniqueSpellDocumentTag()
diff --git a/Source/WebKit2/UIProcess/win/WebTextChecker.cpp b/Source/WebKit2/UIProcess/win/WebTextChecker.cpp
new file mode 100644 (file)
index 0000000..d06a78f
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "WebTextChecker.h"
+
+#include "TextChecker.h"
+#include "WebContext.h"
+#include <wtf/RefPtr.h>
+
+namespace WebKit {
+
+WebTextChecker* WebTextChecker::shared()
+{
+    static WebTextChecker* textChecker = adoptRef(new WebTextChecker).leakRef();
+    return textChecker;
+}
+
+WebTextChecker::WebTextChecker()
+{
+}
+
+void WebTextChecker::setClient(const WKTextCheckerClient* client)
+{
+    m_client.initialize(client);
+}
+
+static void updateStateForAllWebProcesses()
+{
+    const Vector<WebContext*>& contexts = WebContext::allContexts();
+    for (size_t i = 0; i < contexts.size(); ++i) {
+        WebProcessProxy* webProcess = contexts[i]->process();
+        if (!webProcess)
+            continue;
+        webProcess->updateTextCheckerState();
+    }
+}
+
+void WebTextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+    TextChecker::continuousSpellCheckingEnabledStateChanged(enabled);
+    updateStateForAllWebProcesses();
+}
+
+void WebTextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+    TextChecker::grammarCheckingEnabledStateChanged(enabled);
+    updateStateForAllWebProcesses();
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebTextChecker.h b/Source/WebKit2/UIProcess/win/WebTextChecker.h
new file mode 100644 (file)
index 0000000..b0e396f
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 WebTextChecker_h
+#define WebTextChecker_h
+
+#include "APIObject.h"
+#include "WKTextChecker.h"
+#include "WebTextCheckerClient.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebTextChecker : public APIObject {
+public:
+    static const Type APIType = TypeTextChecker;
+
+    static WebTextChecker* shared();
+
+    void setClient(const WKTextCheckerClient*);
+    WebTextCheckerClient& client() { return m_client; }
+
+    void continuousSpellCheckingEnabledStateChanged(bool);
+    void grammarCheckingEnabledStateChanged(bool);
+
+private:
+    WebTextChecker();
+
+    virtual Type type() const { return APIType; }
+
+    WebTextCheckerClient m_client;
+};
+
+} // namespace WebKit
+
+#endif // WebTextChecker_h
diff --git a/Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp b/Source/WebKit2/UIProcess/win/WebTextCheckerClient.cpp
new file mode 100644 (file)
index 0000000..b11fe31
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "WebTextCheckerClient.h"
+
+namespace WebKit {
+
+bool WebTextCheckerClient::continuousSpellCheckingAllowed()
+{
+    if (!m_client.continuousSpellCheckingAllowed)
+        return false;
+
+    return m_client.continuousSpellCheckingAllowed(m_client.clientInfo);
+}
+
+bool WebTextCheckerClient::continuousSpellCheckingEnabled()
+{
+    if (!m_client.continuousSpellCheckingEnabled)
+        return false;
+
+    return m_client.continuousSpellCheckingEnabled(m_client.clientInfo);
+}
+
+void WebTextCheckerClient::setContinuousSpellCheckingEnabled(bool enabled)
+{
+    if (!m_client.setContinuousSpellCheckingEnabled)
+        return;
+
+    m_client.setContinuousSpellCheckingEnabled(enabled, m_client.clientInfo);
+}
+
+bool WebTextCheckerClient::grammarCheckingEnabled()
+{
+    if (!m_client.grammarCheckingEnabled)
+        return false;
+
+    return m_client.grammarCheckingEnabled(m_client.clientInfo);
+}
+
+void WebTextCheckerClient::setGrammarCheckingEnabled(bool enabled)
+{
+    if (!m_client.setGrammarCheckingEnabled)
+        return;
+
+    m_client.setGrammarCheckingEnabled(enabled, m_client.clientInfo);
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/win/WebTextCheckerClient.h b/Source/WebKit2/UIProcess/win/WebTextCheckerClient.h
new file mode 100644 (file)
index 0000000..2e32e16
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * 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 APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 WebTextCheckerClient_h
+#define WebTextCheckerClient_h
+
+#include "APIClient.h"
+#include "WKTextChecker.h"
+#include <wtf/Vector.h>
+
+namespace WebKit {
+
+class WebTextCheckerClient : public APIClient<WKTextCheckerClient> {
+public:
+    bool continuousSpellCheckingAllowed();
+    bool continuousSpellCheckingEnabled();
+    void setContinuousSpellCheckingEnabled(bool);
+    bool grammarCheckingEnabled();
+    void setGrammarCheckingEnabled(bool);
+};
+
+} // namespace WebKit
+
+#endif // WebTextCheckerClient_h
index aefb54f..b31958f 100755 (executable)
                                                        >
                                                </File>
                                                <File
+                                                       RelativePath="..\UIProcess\API\C\win\WKTextChecker.cpp"
+                                                       >
+                                               </File>
+                                               <File
+                                                       RelativePath="..\UIProcess\API\C\win\WKTextChecker.h"
+                                                       >
+                                               </File>
+                                               <File
                                                        RelativePath="..\UIProcess\API\C\win\WKView.cpp"
                                                        >
                                                </File>
                                        >
                                </File>
                                <File
+                                       RelativePath="..\UIProcess\win\WebTextChecker.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\UIProcess\win\WebTextChecker.h"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\UIProcess\win\WebTextCheckerClient.cpp"
+                                       >
+                               </File>
+                               <File
+                                       RelativePath="..\UIProcess\win\WebTextCheckerClient.h"
+                                       >
+                               </File>
+                               <File
                                        RelativePath="..\UIProcess\win\WebUndoClient.cpp"
                                        >
                                </File>
index 4159c84..a1c6a1e 100644 (file)
@@ -75,6 +75,7 @@ all:
     xcopy /y /d "..\UIProcess\API\C\WKProtectionSpaceTypes.h" "%ConfigurationBuildDir%\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\WKResourceCacheManager.h" "%ConfigurationBuildDir%\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\win\WKContextPrivateWin.h" "%ConfigurationBuildDir%\include\WebKit2"
+    xcopy /y /d "..\UIProcess\API\C\win\WKTextChecker.h" "%ConfigurationBuildDir%\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\win\WKView.h" "%ConfigurationBuildDir%\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\C\win\WKViewPrivate.h" "%ConfigurationBuildDir%\include\WebKit2"
     xcopy /y /d "..\UIProcess\API\cpp\WKRetainPtr.h" "%ConfigurationBuildDir%\include\WebKit2"