Title: [274011] trunk
Revision
274011
Author
[email protected]
Date
2021-03-05 15:07:35 -0800 (Fri, 05 Mar 2021)

Log Message

[GTK] Clean up GTK-specific text checker stuff
https://bugs.webkit.org/show_bug.cgi?id=222818

Patch by Michael Catanzaro <[email protected]> on 2021-03-05
Reviewed by Don Olmstead.

Source/WebKit:

This moves the GTK-specific classes WebTextChecker and WebTextCheckerClient into
GTK-specific directories.

This also moves most of WKTextChecker, except for WKTextCheckerSetTestingMode, which is
cross-platform. This is not quite how we normally do it -- normally we try to have one
cross-platform header with platform-specific conditionals and only separate out platform-
specific source files -- but in this case the header is almost entirely GTK-specific, so it
makes sense to do it this way.

This also exposes WKTextCheckerSetContinuousSpellCheckingEnabled and uses it in
UIScriptControllerGtk, which is needed for bug #181916.

This code is all pretty messy, especially the WKTextCheckerClient (which actually has its
own WKTextCheckerSetContinuousSpellCheckingEnabled!), but now it's a *platform-specific*
mess, which is a small improvement.

* SourcesGTK.txt:
* UIProcess/API/C/WKTextChecker.cpp:
(WKTextCheckerSetTestingMode):
(WKTextCheckerSetClient): Deleted.
(WKTextCheckerContinuousSpellCheckingEnabledStateChanged): Deleted.
(WKTextCheckerGrammarCheckingEnabledStateChanged): Deleted.
(WKTextCheckerCheckSpelling): Deleted.
(WKTextCheckerChangeSpellingToWord): Deleted.
* UIProcess/API/C/WKTextChecker.h:
* UIProcess/API/C/gtk/WKTextCheckerGtk.cpp:
(WKTextCheckerSetClient):
(WKTextCheckerContinuousSpellCheckingEnabledStateChanged):
(WKTextCheckerGrammarCheckingEnabledStateChanged):
(WKTextCheckerCheckSpelling):
(WKTextCheckerChangeSpellingToWord):
(WKTextCheckerSetContinuousSpellCheckingEnabled):
* UIProcess/API/C/gtk/WKTextCheckerGtk.h:
* UIProcess/gtk/WebTextChecker.cpp: Renamed from Source/WebKit/UIProcess/WebTextChecker.cpp.
(WebKit::WebTextChecker::singleton):
(WebKit::WebTextChecker::WebTextChecker):
(WebKit::WebTextChecker::setClient):
(WebKit::updateStateForAllContexts):
(WebKit::WebTextChecker::continuousSpellCheckingEnabledStateChanged):
(WebKit::WebTextChecker::grammarCheckingEnabledStateChanged):
(WebKit::WebTextChecker::checkSpelling):
(WebKit::WebTextChecker::changeSpellingToWord):
* UIProcess/gtk/WebTextChecker.h: Renamed from Source/WebKit/UIProcess/WebTextChecker.h.
(WebKit::WebTextChecker::client):
* UIProcess/gtk/WebTextCheckerClient.cpp: Renamed from Source/WebKit/UIProcess/WebTextCheckerClient.cpp.
(WebKit::WebTextCheckerClient::continuousSpellCheckingAllowed):
(WebKit::WebTextCheckerClient::continuousSpellCheckingEnabled):
(WebKit::WebTextCheckerClient::setContinuousSpellCheckingEnabled):
(WebKit::WebTextCheckerClient::grammarCheckingEnabled):
(WebKit::WebTextCheckerClient::setGrammarCheckingEnabled):
(WebKit::WebTextCheckerClient::uniqueSpellDocumentTag):
(WebKit::WebTextCheckerClient::closeSpellDocumentWithTag):
(WebKit::WebTextCheckerClient::checkSpellingOfString):
(WebKit::WebTextCheckerClient::checkGrammarOfString):
(WebKit::WebTextCheckerClient::spellingUIIsShowing):
(WebKit::WebTextCheckerClient::toggleSpellingUIIsShowing):
(WebKit::WebTextCheckerClient::updateSpellingUIWithMisspelledWord):
(WebKit::WebTextCheckerClient::updateSpellingUIWithGrammarString):
(WebKit::WebTextCheckerClient::guessesForWord):
(WebKit::WebTextCheckerClient::learnWord):
(WebKit::WebTextCheckerClient::ignoreWord):
* UIProcess/gtk/WebTextCheckerClient.h: Renamed from Source/WebKit/UIProcess/WebTextCheckerClient.h.

Tools:

* WebKitTestRunner/gtk/TestControllerGtk.cpp:
* WebKitTestRunner/gtk/UIScriptControllerGtk.cpp:
(WTR::UIScriptControllerGtk::setContinuousSpellCheckingEnabled):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (274010 => 274011)


--- trunk/Source/WebKit/ChangeLog	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/ChangeLog	2021-03-05 23:07:35 UTC (rev 274011)
@@ -1,3 +1,73 @@
+2021-03-05  Michael Catanzaro  <[email protected]>
+
+        [GTK] Clean up GTK-specific text checker stuff
+        https://bugs.webkit.org/show_bug.cgi?id=222818
+
+        Reviewed by Don Olmstead.
+
+        This moves the GTK-specific classes WebTextChecker and WebTextCheckerClient into
+        GTK-specific directories.
+
+        This also moves most of WKTextChecker, except for WKTextCheckerSetTestingMode, which is
+        cross-platform. This is not quite how we normally do it -- normally we try to have one
+        cross-platform header with platform-specific conditionals and only separate out platform-
+        specific source files -- but in this case the header is almost entirely GTK-specific, so it
+        makes sense to do it this way.
+
+        This also exposes WKTextCheckerSetContinuousSpellCheckingEnabled and uses it in
+        UIScriptControllerGtk, which is needed for bug #181916.
+
+        This code is all pretty messy, especially the WKTextCheckerClient (which actually has its
+        own WKTextCheckerSetContinuousSpellCheckingEnabled!), but now it's a *platform-specific*
+        mess, which is a small improvement.
+
+        * SourcesGTK.txt:
+        * UIProcess/API/C/WKTextChecker.cpp:
+        (WKTextCheckerSetTestingMode):
+        (WKTextCheckerSetClient): Deleted.
+        (WKTextCheckerContinuousSpellCheckingEnabledStateChanged): Deleted.
+        (WKTextCheckerGrammarCheckingEnabledStateChanged): Deleted.
+        (WKTextCheckerCheckSpelling): Deleted.
+        (WKTextCheckerChangeSpellingToWord): Deleted.
+        * UIProcess/API/C/WKTextChecker.h:
+        * UIProcess/API/C/gtk/WKTextCheckerGtk.cpp:
+        (WKTextCheckerSetClient):
+        (WKTextCheckerContinuousSpellCheckingEnabledStateChanged):
+        (WKTextCheckerGrammarCheckingEnabledStateChanged):
+        (WKTextCheckerCheckSpelling):
+        (WKTextCheckerChangeSpellingToWord):
+        (WKTextCheckerSetContinuousSpellCheckingEnabled):
+        * UIProcess/API/C/gtk/WKTextCheckerGtk.h:
+        * UIProcess/gtk/WebTextChecker.cpp: Renamed from Source/WebKit/UIProcess/WebTextChecker.cpp.
+        (WebKit::WebTextChecker::singleton):
+        (WebKit::WebTextChecker::WebTextChecker):
+        (WebKit::WebTextChecker::setClient):
+        (WebKit::updateStateForAllContexts):
+        (WebKit::WebTextChecker::continuousSpellCheckingEnabledStateChanged):
+        (WebKit::WebTextChecker::grammarCheckingEnabledStateChanged):
+        (WebKit::WebTextChecker::checkSpelling):
+        (WebKit::WebTextChecker::changeSpellingToWord):
+        * UIProcess/gtk/WebTextChecker.h: Renamed from Source/WebKit/UIProcess/WebTextChecker.h.
+        (WebKit::WebTextChecker::client):
+        * UIProcess/gtk/WebTextCheckerClient.cpp: Renamed from Source/WebKit/UIProcess/WebTextCheckerClient.cpp.
+        (WebKit::WebTextCheckerClient::continuousSpellCheckingAllowed):
+        (WebKit::WebTextCheckerClient::continuousSpellCheckingEnabled):
+        (WebKit::WebTextCheckerClient::setContinuousSpellCheckingEnabled):
+        (WebKit::WebTextCheckerClient::grammarCheckingEnabled):
+        (WebKit::WebTextCheckerClient::setGrammarCheckingEnabled):
+        (WebKit::WebTextCheckerClient::uniqueSpellDocumentTag):
+        (WebKit::WebTextCheckerClient::closeSpellDocumentWithTag):
+        (WebKit::WebTextCheckerClient::checkSpellingOfString):
+        (WebKit::WebTextCheckerClient::checkGrammarOfString):
+        (WebKit::WebTextCheckerClient::spellingUIIsShowing):
+        (WebKit::WebTextCheckerClient::toggleSpellingUIIsShowing):
+        (WebKit::WebTextCheckerClient::updateSpellingUIWithMisspelledWord):
+        (WebKit::WebTextCheckerClient::updateSpellingUIWithGrammarString):
+        (WebKit::WebTextCheckerClient::guessesForWord):
+        (WebKit::WebTextCheckerClient::learnWord):
+        (WebKit::WebTextCheckerClient::ignoreWord):
+        * UIProcess/gtk/WebTextCheckerClient.h: Renamed from Source/WebKit/UIProcess/WebTextCheckerClient.h.
+
 2021-03-05  Chris Dumez  <[email protected]>
 
         Regression(r268097): WKWebView.URL is nil in the processDidTerminate delegate

Modified: trunk/Source/WebKit/SourcesGTK.txt (274010 => 274011)


--- trunk/Source/WebKit/SourcesGTK.txt	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/SourcesGTK.txt	2021-03-05 23:07:35 UTC (rev 274011)
@@ -107,8 +107,6 @@
 UIProcess/ViewSnapshotStore.cpp
 UIProcess/WebGrammarDetail.cpp
 UIProcess/WebMemoryPressureHandler.cpp
-UIProcess/WebTextChecker.cpp
-UIProcess/WebTextCheckerClient.cpp
 UIProcess/WebViewportAttributes.cpp
 
 UIProcess/API/C/WKGrammarDetail.cpp
@@ -268,6 +266,8 @@
 UIProcess/gtk/WebPasteboardProxyGtk.cpp
 UIProcess/gtk/WebPopupMenuProxyGtk.cpp
 UIProcess/gtk/WebPreferencesGtk.cpp
+UIProcess/gtk/WebTextChecker.cpp
+UIProcess/gtk/WebTextCheckerClient.cpp
 
 UIProcess/soup/WebCookieManagerProxySoup.cpp
 UIProcess/soup/WebProcessPoolSoup.cpp

Modified: trunk/Source/WebKit/UIProcess/API/C/WKTextChecker.cpp (274010 => 274011)


--- trunk/Source/WebKit/UIProcess/API/C/WKTextChecker.cpp	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/UIProcess/API/C/WKTextChecker.cpp	2021-03-05 23:07:35 UTC (rev 274011)
@@ -25,14 +25,9 @@
 
 #include "config.h"
 #include "WKTextChecker.h"
+
 #include "TextChecker.h"
 
-#if defined(BUILDING_GTK__)
-#include "WKAPICast.h"
-#include "WebPageProxy.h"
-#include "WebTextChecker.h"
-#endif
-
 using namespace WebKit;
 
 void WKTextCheckerSetTestingMode(bool enabled)
@@ -39,34 +34,3 @@
 {
     TextChecker::setTestingMode(enabled);
 }
-
-#if defined(BUILDING_GTK__)
-
-void WKTextCheckerSetClient(const WKTextCheckerClientBase* wkClient)
-{
-    if (wkClient && wkClient->version)
-        return;
-    WebTextChecker::singleton()->setClient(wkClient);
-}
-
-void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool enabled)
-{
-    WebTextChecker::singleton()->continuousSpellCheckingEnabledStateChanged(enabled);
-}
-
-void WKTextCheckerGrammarCheckingEnabledStateChanged(bool enabled)
-{
-    WebTextChecker::singleton()->grammarCheckingEnabledStateChanged(enabled);
-}
-
-void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection)
-{
-    WebTextChecker::singleton()->checkSpelling(toImpl(page), startBeforeSelection);
-}
-
-void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word)
-{
-    WebTextChecker::singleton()->changeSpellingToWord(toImpl(page), toWTFString(word));
-}
-
-#endif

Modified: trunk/Source/WebKit/UIProcess/API/C/WKTextChecker.h (274010 => 274011)


--- trunk/Source/WebKit/UIProcess/API/C/WKTextChecker.h	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/UIProcess/API/C/WKTextChecker.h	2021-03-05 23:07:35 UTC (rev 274011)
@@ -34,64 +34,8 @@
 
 WK_EXPORT void WKTextCheckerSetTestingMode(bool enabled);
 
-#if defined(BUILDING_GTK__)
-
-// 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);
-typedef uint64_t (*WKTextCheckerUniqueSpellDocumentTag)(WKPageRef page, const void *clientInfo);
-typedef void (*WKTextCheckerCloseSpellDocumentWithTag)(uint64_t tag, const void *clientInfo);
-typedef void (*WKTextCheckerCheckSpellingOfString)(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void *clientInfo);
-typedef void (*WKTextCheckerCheckGrammarOfString)(uint64_t tag, WKStringRef text, WKArrayRef* grammarDetails, int32_t* badGrammarLocation, int32_t* badGrammarLength, const void *clientInfo);
-typedef bool (*WKTextCheckerSpellingUIIsShowing)(const void *clientInfo);
-typedef void (*WKTextCheckerToggleSpellingUIIsShowing)(const void *clientInfo);
-typedef void (*WKTextCheckerUpdateSpellingUIWithMisspelledWord)(uint64_t tag, WKStringRef misspelledWord, const void *clientInfo);
-typedef void (*WKTextCheckerUpdateSpellingUIWithGrammarString)(uint64_t tag, WKStringRef badGrammarPhrase, WKGrammarDetailRef grammarDetail, const void *clientInfo);
-typedef WKArrayRef (*WKTextCheckerGuessesForWord)(uint64_t tag, WKStringRef word, const void *clientInfo);
-typedef void (*WKTextCheckerLearnWord)(uint64_t tag, WKStringRef word, const void *clientInfo);
-typedef void (*WKTextCheckerIgnoreWord)(uint64_t tag, WKStringRef word, const void *clientInfo);
-
-typedef struct WKTextCheckerClientBase {
-    int                                                                     version;
-    const void *                                                            clientInfo;
-} WKTextCheckerClientBase;
-
-typedef struct WKTextCheckerClientV0 {
-    WKTextCheckerClientBase                                                 base;
-
-    WKTextCheckerContinousSpellCheckingAllowed                              continuousSpellCheckingAllowed;
-    WKTextCheckerContinousSpellCheckingEnabled                              continuousSpellCheckingEnabled;
-    WKTextCheckerSetContinousSpellCheckingEnabled                           setContinuousSpellCheckingEnabled;
-    WKTextCheckerGrammarCheckingEnabled                                     grammarCheckingEnabled;
-    WKTextCheckerSetGrammarCheckingEnabled                                  setGrammarCheckingEnabled;
-    WKTextCheckerUniqueSpellDocumentTag                                     uniqueSpellDocumentTag;
-    WKTextCheckerCloseSpellDocumentWithTag                                  closeSpellDocumentWithTag;
-    WKTextCheckerCheckSpellingOfString                                      checkSpellingOfString;
-    WKTextCheckerCheckGrammarOfString                                       checkGrammarOfString;
-    WKTextCheckerSpellingUIIsShowing                                        spellingUIIsShowing;
-    WKTextCheckerToggleSpellingUIIsShowing                                  toggleSpellingUIIsShowing;
-    WKTextCheckerUpdateSpellingUIWithMisspelledWord                         updateSpellingUIWithMisspelledWord;
-    WKTextCheckerUpdateSpellingUIWithGrammarString                          updateSpellingUIWithGrammarString;
-    WKTextCheckerGuessesForWord                                             guessesForWord;
-    WKTextCheckerLearnWord                                                  learnWord;
-    WKTextCheckerIgnoreWord                                                 ignoreWord;
-} WKTextCheckerClientV0;
-
-WK_EXPORT void WKTextCheckerSetClient(const WKTextCheckerClientBase* client);
-
-WK_EXPORT void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool);
-WK_EXPORT void WKTextCheckerGrammarCheckingEnabledStateChanged(bool);
-
-WK_EXPORT void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection);
-WK_EXPORT void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word);
-
-#endif
-
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* WKTextChecker_h */
+#endif

Modified: trunk/Source/WebKit/UIProcess/API/C/gtk/WKTextCheckerGtk.cpp (274010 => 274011)


--- trunk/Source/WebKit/UIProcess/API/C/gtk/WKTextCheckerGtk.cpp	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/UIProcess/API/C/gtk/WKTextCheckerGtk.cpp	2021-03-05 23:07:35 UTC (rev 274011)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Igalia S.L.
+ * 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
@@ -27,7 +27,39 @@
 #include "WKTextCheckerGtk.h"
 
 #include "TextChecker.h"
+#include "WKAPICast.h"
+#include "WebPageProxy.h"
+#include "WebTextChecker.h"
 
+using namespace WebKit;
+
+void WKTextCheckerSetClient(const WKTextCheckerClientBase* wkClient)
+{
+    if (wkClient && wkClient->version)
+        return;
+    WebTextChecker::singleton()->setClient(wkClient);
+}
+
+void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+    WebTextChecker::singleton()->continuousSpellCheckingEnabledStateChanged(enabled);
+}
+
+void WKTextCheckerGrammarCheckingEnabledStateChanged(bool enabled)
+{
+    WebTextChecker::singleton()->grammarCheckingEnabledStateChanged(enabled);
+}
+
+void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection)
+{
+    WebTextChecker::singleton()->checkSpelling(toImpl(page), startBeforeSelection);
+}
+
+void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word)
+{
+    WebTextChecker::singleton()->changeSpellingToWord(toImpl(page), toWTFString(word));
+}
+
 void WKTextCheckerSetSpellCheckingLanguages(const char* const* languages)
 {
 #if ENABLE(SPELLCHECK)
@@ -37,3 +69,8 @@
     WebKit::TextChecker::setSpellCheckingLanguages(spellCheckingLanguages);
 #endif
 }
+
+void WKTextCheckerSetContinuousSpellCheckingEnabled(bool enabled)
+{
+    WebKit::TextChecker::setContinuousSpellCheckingEnabled(enabled);
+}

Modified: trunk/Source/WebKit/UIProcess/API/C/gtk/WKTextCheckerGtk.h (274010 => 274011)


--- trunk/Source/WebKit/UIProcess/API/C/gtk/WKTextCheckerGtk.h	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/UIProcess/API/C/gtk/WKTextCheckerGtk.h	2021-03-05 23:07:35 UTC (rev 274011)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Igalia S.L.
+ * 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
@@ -27,15 +27,71 @@
 #define WKTextCheckerGtk_h
 
 #include <WebKit/WKBase.h>
+#include <WebKit/WKTextChecker.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+WK_EXPORT void WKTextCheckerSetTestingMode(bool enabled);
+
+// 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);
+typedef uint64_t (*WKTextCheckerUniqueSpellDocumentTag)(WKPageRef page, const void *clientInfo);
+typedef void (*WKTextCheckerCloseSpellDocumentWithTag)(uint64_t tag, const void *clientInfo);
+typedef void (*WKTextCheckerCheckSpellingOfString)(uint64_t tag, WKStringRef text, int32_t* misspellingLocation, int32_t* misspellingLength, const void *clientInfo);
+typedef void (*WKTextCheckerCheckGrammarOfString)(uint64_t tag, WKStringRef text, WKArrayRef* grammarDetails, int32_t* badGrammarLocation, int32_t* badGrammarLength, const void *clientInfo);
+typedef bool (*WKTextCheckerSpellingUIIsShowing)(const void *clientInfo);
+typedef void (*WKTextCheckerToggleSpellingUIIsShowing)(const void *clientInfo);
+typedef void (*WKTextCheckerUpdateSpellingUIWithMisspelledWord)(uint64_t tag, WKStringRef misspelledWord, const void *clientInfo);
+typedef void (*WKTextCheckerUpdateSpellingUIWithGrammarString)(uint64_t tag, WKStringRef badGrammarPhrase, WKGrammarDetailRef grammarDetail, const void *clientInfo);
+typedef WKArrayRef (*WKTextCheckerGuessesForWord)(uint64_t tag, WKStringRef word, const void *clientInfo);
+typedef void (*WKTextCheckerLearnWord)(uint64_t tag, WKStringRef word, const void *clientInfo);
+typedef void (*WKTextCheckerIgnoreWord)(uint64_t tag, WKStringRef word, const void *clientInfo);
+
+typedef struct WKTextCheckerClientBase {
+    int                                                                     version;
+    const void *                                                            clientInfo;
+} WKTextCheckerClientBase;
+
+typedef struct WKTextCheckerClientV0 {
+    WKTextCheckerClientBase                                                 base;
+
+    WKTextCheckerContinousSpellCheckingAllowed                              continuousSpellCheckingAllowed;
+    WKTextCheckerContinousSpellCheckingEnabled                              continuousSpellCheckingEnabled;
+    WKTextCheckerSetContinousSpellCheckingEnabled                           setContinuousSpellCheckingEnabled;
+    WKTextCheckerGrammarCheckingEnabled                                     grammarCheckingEnabled;
+    WKTextCheckerSetGrammarCheckingEnabled                                  setGrammarCheckingEnabled;
+    WKTextCheckerUniqueSpellDocumentTag                                     uniqueSpellDocumentTag;
+    WKTextCheckerCloseSpellDocumentWithTag                                  closeSpellDocumentWithTag;
+    WKTextCheckerCheckSpellingOfString                                      checkSpellingOfString;
+    WKTextCheckerCheckGrammarOfString                                       checkGrammarOfString;
+    WKTextCheckerSpellingUIIsShowing                                        spellingUIIsShowing;
+    WKTextCheckerToggleSpellingUIIsShowing                                  toggleSpellingUIIsShowing;
+    WKTextCheckerUpdateSpellingUIWithMisspelledWord                         updateSpellingUIWithMisspelledWord;
+    WKTextCheckerUpdateSpellingUIWithGrammarString                          updateSpellingUIWithGrammarString;
+    WKTextCheckerGuessesForWord                                             guessesForWord;
+    WKTextCheckerLearnWord                                                  learnWord;
+    WKTextCheckerIgnoreWord                                                 ignoreWord;
+} WKTextCheckerClientV0;
+
+WK_EXPORT void WKTextCheckerSetClient(const WKTextCheckerClientBase* client);
+
+WK_EXPORT void WKTextCheckerContinuousSpellCheckingEnabledStateChanged(bool);
+WK_EXPORT void WKTextCheckerGrammarCheckingEnabledStateChanged(bool);
+
+WK_EXPORT void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection);
+WK_EXPORT void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word);
+
 WK_EXPORT void WKTextCheckerSetSpellCheckingLanguages(const char* const* languages);
+WK_EXPORT void WKTextCheckerSetContinuousSpellCheckingEnabled(bool);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* WKTextCheckerGtk_h */
+#endif

Deleted: trunk/Source/WebKit/UIProcess/WebTextChecker.cpp (274010 => 274011)


--- trunk/Source/WebKit/UIProcess/WebTextChecker.cpp	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/UIProcess/WebTextChecker.cpp	2021-03-05 23:07:35 UTC (rev 274011)
@@ -1,81 +0,0 @@
-/*
- * 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 "WKAPICast.h"
-#include "WebPageProxy.h"
-#include "WebProcessPool.h"
-#include <wtf/RefPtr.h>
-
-namespace WebKit {
-
-WebTextChecker* WebTextChecker::singleton()
-{
-    static WebTextChecker* textChecker = adoptRef(new WebTextChecker).leakRef();
-    return textChecker;
-}
-
-WebTextChecker::WebTextChecker()
-{
-}
-
-void WebTextChecker::setClient(const WKTextCheckerClientBase* client)
-{
-    m_client.initialize(client);
-}
-
-static void updateStateForAllContexts()
-{
-    const Vector<WebProcessPool*>& contexts = WebProcessPool::allProcessPools();
-    for (size_t i = 0; i < contexts.size(); ++i)
-        contexts[i]->textCheckerStateChanged();
-}
-
-void WebTextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
-{
-    TextChecker::continuousSpellCheckingEnabledStateChanged(enabled);
-    updateStateForAllContexts();
-}
-
-void WebTextChecker::grammarCheckingEnabledStateChanged(bool enabled)
-{
-    TextChecker::grammarCheckingEnabledStateChanged(enabled);
-    updateStateForAllContexts();
-}
-
-void WebTextChecker::checkSpelling(WebPageProxy* page, bool startBeforeSelection)
-{
-    page->advanceToNextMisspelling(startBeforeSelection);
-}
-
-void WebTextChecker::changeSpellingToWord(WebPageProxy* page, const String& text)
-{
-    page->changeSpellingToWord(text);
-}
-
-} // namespace WebKit

Deleted: trunk/Source/WebKit/UIProcess/WebTextChecker.h (274010 => 274011)


--- trunk/Source/WebKit/UIProcess/WebTextChecker.h	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/UIProcess/WebTextChecker.h	2021-03-05 23:07:35 UTC (rev 274011)
@@ -1,59 +0,0 @@
-/*
- * 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 WebPageProxy;
-
-class WebTextChecker : public API::ObjectImpl<API::Object::Type::TextChecker> {
-public:
-    static WebTextChecker* singleton();
-
-    void setClient(const WKTextCheckerClientBase*);
-    WebTextCheckerClient& client() { return m_client; }
-
-    void continuousSpellCheckingEnabledStateChanged(bool);
-    void grammarCheckingEnabledStateChanged(bool);
-
-    void checkSpelling(WebPageProxy*, bool startBeforeSelection);
-    void changeSpellingToWord(WebPageProxy*, const String&);
-
-private:
-    WebTextChecker();
-
-    WebTextCheckerClient m_client;
-};
-
-} // namespace WebKit
-
-#endif // WebTextChecker_h

Deleted: trunk/Source/WebKit/UIProcess/WebTextCheckerClient.cpp (274010 => 274011)


--- trunk/Source/WebKit/UIProcess/WebTextCheckerClient.cpp	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/UIProcess/WebTextCheckerClient.cpp	2021-03-05 23:07:35 UTC (rev 274011)
@@ -1,181 +0,0 @@
-/*
- * 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"
-
-#include "APIArray.h"
-#include "WKAPICast.h"
-#include "WKSharedAPICast.h"
-#include "WebGrammarDetail.h"
-#include "WebPageProxy.h"
-#include <wtf/text/WTFString.h>
-
-namespace WebKit {
-
-bool WebTextCheckerClient::continuousSpellCheckingAllowed()
-{
-    if (!m_client.continuousSpellCheckingAllowed)
-        return false;
-
-    return m_client.continuousSpellCheckingAllowed(m_client.base.clientInfo);
-}
-
-bool WebTextCheckerClient::continuousSpellCheckingEnabled()
-{
-    if (!m_client.continuousSpellCheckingEnabled)
-        return false;
-
-    return m_client.continuousSpellCheckingEnabled(m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::setContinuousSpellCheckingEnabled(bool enabled)
-{
-    if (!m_client.setContinuousSpellCheckingEnabled)
-        return;
-
-    m_client.setContinuousSpellCheckingEnabled(enabled, m_client.base.clientInfo);
-}
-
-bool WebTextCheckerClient::grammarCheckingEnabled()
-{
-    if (!m_client.grammarCheckingEnabled)
-        return false;
-
-    return m_client.grammarCheckingEnabled(m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::setGrammarCheckingEnabled(bool enabled)
-{
-    if (!m_client.setGrammarCheckingEnabled)
-        return;
-
-    m_client.setGrammarCheckingEnabled(enabled, m_client.base.clientInfo);
-}
-
-uint64_t WebTextCheckerClient::uniqueSpellDocumentTag(WebPageProxy* page)
-{
-    if (!m_client.uniqueSpellDocumentTag)
-        return 0;
-
-    return m_client.uniqueSpellDocumentTag(toAPI(page), m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::closeSpellDocumentWithTag(uint64_t tag)
-{
-    if (!m_client.closeSpellDocumentWithTag)
-        return;
-
-    m_client.closeSpellDocumentWithTag(tag, m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::checkSpellingOfString(uint64_t tag, const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
-{
-    misspellingLocation = -1;
-    misspellingLength = 0;
-
-    if (!m_client.checkSpellingOfString)
-        return;
-
-    m_client.checkSpellingOfString(tag, toAPI(text.impl()), &misspellingLocation, &misspellingLength, m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::checkGrammarOfString(uint64_t tag, const String& text, Vector<WebCore::GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
-{
-    badGrammarLocation = -1;
-    badGrammarLength = 0;
-
-    if (!m_client.checkGrammarOfString)
-        return;
-
-    WKArrayRef wkGrammarDetailsRef = 0;
-    m_client.checkGrammarOfString(tag, toAPI(text.impl()), &wkGrammarDetailsRef, &badGrammarLocation, &badGrammarLength, m_client.base.clientInfo);
-
-    RefPtr<API::Array> wkGrammarDetails = adoptRef(toImpl(wkGrammarDetailsRef));
-    size_t numGrammarDetails = wkGrammarDetails->size();
-    for (size_t i = 0; i < numGrammarDetails; ++i)
-        grammarDetails.append(wkGrammarDetails->at<WebGrammarDetail>(i)->grammarDetail());
-}
-
-bool WebTextCheckerClient::spellingUIIsShowing()
-{
-    if (!m_client.spellingUIIsShowing)
-        return false;
-
-    return m_client.spellingUIIsShowing(m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::toggleSpellingUIIsShowing()
-{
-    if (!m_client.toggleSpellingUIIsShowing)
-        return;
-
-    return m_client.toggleSpellingUIIsShowing(m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::updateSpellingUIWithMisspelledWord(uint64_t tag, const String& misspelledWord)
-{
-    if (!m_client.updateSpellingUIWithMisspelledWord)
-        return;
-
-    m_client.updateSpellingUIWithMisspelledWord(tag, toAPI(misspelledWord.impl()), m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::updateSpellingUIWithGrammarString(uint64_t tag, const String& badGrammarPhrase, const WebCore::GrammarDetail& grammarDetail)
-{
-    if (!m_client.updateSpellingUIWithGrammarString)
-        return;
-
-    m_client.updateSpellingUIWithGrammarString(tag, toAPI(badGrammarPhrase.impl()), toAPI(grammarDetail), m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::guessesForWord(uint64_t tag, const String& word, Vector<String>& guesses)
-{
-    if (!m_client.guessesForWord)
-        return;
-
-    RefPtr<API::Array> wkGuesses = adoptRef(toImpl(m_client.guessesForWord(tag, toAPI(word.impl()), m_client.base.clientInfo)));
-    size_t numGuesses = wkGuesses->size();
-    for (size_t i = 0; i < numGuesses; ++i)
-        guesses.append(wkGuesses->at<API::String>(i)->string());
-}
-
-void WebTextCheckerClient::learnWord(uint64_t tag, const String& word)
-{
-    if (!m_client.learnWord)
-        return;
-
-    m_client.learnWord(tag, toAPI(word.impl()), m_client.base.clientInfo);
-}
-
-void WebTextCheckerClient::ignoreWord(uint64_t tag, const String& word)
-{
-    if (!m_client.ignoreWord)
-        return;
-
-    m_client.ignoreWord(tag, toAPI(word.impl()), m_client.base.clientInfo);
-}
-
-} // namespace WebKit

Deleted: trunk/Source/WebKit/UIProcess/WebTextCheckerClient.h (274010 => 274011)


--- trunk/Source/WebKit/UIProcess/WebTextCheckerClient.h	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Source/WebKit/UIProcess/WebTextCheckerClient.h	2021-03-05 23:07:35 UTC (rev 274011)
@@ -1,66 +0,0 @@
-/*
- * 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 <WebCore/TextCheckerClient.h>
-#include <wtf/Forward.h>
-
-namespace API {
-template<> struct ClientTraits<WKTextCheckerClientBase> {
-    typedef std::tuple<WKTextCheckerClientV0> Versions;
-};
-}
-
-namespace WebKit {
-
-class WebPageProxy;
-
-class WebTextCheckerClient : public API::Client<WKTextCheckerClientBase> {
-public:
-    bool continuousSpellCheckingAllowed();
-    bool continuousSpellCheckingEnabled();
-    void setContinuousSpellCheckingEnabled(bool);
-    bool grammarCheckingEnabled();
-    void setGrammarCheckingEnabled(bool);
-    uint64_t uniqueSpellDocumentTag(WebPageProxy*);
-    void closeSpellDocumentWithTag(uint64_t);
-    void checkSpellingOfString(uint64_t tag, const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
-    void checkGrammarOfString(uint64_t tag, const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
-    bool spellingUIIsShowing();
-    void toggleSpellingUIIsShowing();
-    void updateSpellingUIWithMisspelledWord(uint64_t tag, const String& misspelledWord);
-    void updateSpellingUIWithGrammarString(uint64_t tag, const String& badGrammarPhrase, const WebCore::GrammarDetail&);
-    void guessesForWord(uint64_t tag, const String& word, Vector<String>& guesses);
-    void learnWord(uint64_t tag, const String& word);
-    void ignoreWord(uint64_t tag, const String& word);
-};
-
-} // namespace WebKit
-
-#endif // WebTextCheckerClient_h

Copied: trunk/Source/WebKit/UIProcess/gtk/WebTextChecker.cpp (from rev 274010, trunk/Source/WebKit/UIProcess/WebTextChecker.cpp) (0 => 274011)


--- trunk/Source/WebKit/UIProcess/gtk/WebTextChecker.cpp	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/gtk/WebTextChecker.cpp	2021-03-05 23:07:35 UTC (rev 274011)
@@ -0,0 +1,81 @@
+/*
+ * 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 "WKAPICast.h"
+#include "WebPageProxy.h"
+#include "WebProcessPool.h"
+#include <wtf/RefPtr.h>
+
+namespace WebKit {
+
+WebTextChecker* WebTextChecker::singleton()
+{
+    static WebTextChecker* textChecker = adoptRef(new WebTextChecker).leakRef();
+    return textChecker;
+}
+
+WebTextChecker::WebTextChecker()
+{
+}
+
+void WebTextChecker::setClient(const WKTextCheckerClientBase* client)
+{
+    m_client.initialize(client);
+}
+
+static void updateStateForAllContexts()
+{
+    const Vector<WebProcessPool*>& contexts = WebProcessPool::allProcessPools();
+    for (size_t i = 0; i < contexts.size(); ++i)
+        contexts[i]->textCheckerStateChanged();
+}
+
+void WebTextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+    TextChecker::continuousSpellCheckingEnabledStateChanged(enabled);
+    updateStateForAllContexts();
+}
+
+void WebTextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+    TextChecker::grammarCheckingEnabledStateChanged(enabled);
+    updateStateForAllContexts();
+}
+
+void WebTextChecker::checkSpelling(WebPageProxy* page, bool startBeforeSelection)
+{
+    page->advanceToNextMisspelling(startBeforeSelection);
+}
+
+void WebTextChecker::changeSpellingToWord(WebPageProxy* page, const String& text)
+{
+    page->changeSpellingToWord(text);
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/UIProcess/gtk/WebTextChecker.h (from rev 274010, trunk/Source/WebKit/UIProcess/WebTextChecker.h) (0 => 274011)


--- trunk/Source/WebKit/UIProcess/gtk/WebTextChecker.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/gtk/WebTextChecker.h	2021-03-05 23:07:35 UTC (rev 274011)
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "APIObject.h"
+#include "WKTextCheckerGtk.h"
+#include "WebTextCheckerClient.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebTextChecker : public API::ObjectImpl<API::Object::Type::TextChecker> {
+public:
+    static WebTextChecker* singleton();
+
+    void setClient(const WKTextCheckerClientBase*);
+    WebTextCheckerClient& client() { return m_client; }
+
+    void continuousSpellCheckingEnabledStateChanged(bool);
+    void grammarCheckingEnabledStateChanged(bool);
+
+    void checkSpelling(WebPageProxy*, bool startBeforeSelection);
+    void changeSpellingToWord(WebPageProxy*, const String&);
+
+private:
+    WebTextChecker();
+
+    WebTextCheckerClient m_client;
+};
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/UIProcess/gtk/WebTextCheckerClient.cpp (from rev 274010, trunk/Source/WebKit/UIProcess/WebTextCheckerClient.cpp) (0 => 274011)


--- trunk/Source/WebKit/UIProcess/gtk/WebTextCheckerClient.cpp	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/gtk/WebTextCheckerClient.cpp	2021-03-05 23:07:35 UTC (rev 274011)
@@ -0,0 +1,181 @@
+/*
+ * 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"
+
+#include "APIArray.h"
+#include "WKAPICast.h"
+#include "WKSharedAPICast.h"
+#include "WebGrammarDetail.h"
+#include "WebPageProxy.h"
+#include <wtf/text/WTFString.h>
+
+namespace WebKit {
+
+bool WebTextCheckerClient::continuousSpellCheckingAllowed()
+{
+    if (!m_client.continuousSpellCheckingAllowed)
+        return false;
+
+    return m_client.continuousSpellCheckingAllowed(m_client.base.clientInfo);
+}
+
+bool WebTextCheckerClient::continuousSpellCheckingEnabled()
+{
+    if (!m_client.continuousSpellCheckingEnabled)
+        return false;
+
+    return m_client.continuousSpellCheckingEnabled(m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::setContinuousSpellCheckingEnabled(bool enabled)
+{
+    if (!m_client.setContinuousSpellCheckingEnabled)
+        return;
+
+    m_client.setContinuousSpellCheckingEnabled(enabled, m_client.base.clientInfo);
+}
+
+bool WebTextCheckerClient::grammarCheckingEnabled()
+{
+    if (!m_client.grammarCheckingEnabled)
+        return false;
+
+    return m_client.grammarCheckingEnabled(m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::setGrammarCheckingEnabled(bool enabled)
+{
+    if (!m_client.setGrammarCheckingEnabled)
+        return;
+
+    m_client.setGrammarCheckingEnabled(enabled, m_client.base.clientInfo);
+}
+
+uint64_t WebTextCheckerClient::uniqueSpellDocumentTag(WebPageProxy* page)
+{
+    if (!m_client.uniqueSpellDocumentTag)
+        return 0;
+
+    return m_client.uniqueSpellDocumentTag(toAPI(page), m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::closeSpellDocumentWithTag(uint64_t tag)
+{
+    if (!m_client.closeSpellDocumentWithTag)
+        return;
+
+    m_client.closeSpellDocumentWithTag(tag, m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::checkSpellingOfString(uint64_t tag, const String& text, int32_t& misspellingLocation, int32_t& misspellingLength)
+{
+    misspellingLocation = -1;
+    misspellingLength = 0;
+
+    if (!m_client.checkSpellingOfString)
+        return;
+
+    m_client.checkSpellingOfString(tag, toAPI(text.impl()), &misspellingLocation, &misspellingLength, m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::checkGrammarOfString(uint64_t tag, const String& text, Vector<WebCore::GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
+{
+    badGrammarLocation = -1;
+    badGrammarLength = 0;
+
+    if (!m_client.checkGrammarOfString)
+        return;
+
+    WKArrayRef wkGrammarDetailsRef = 0;
+    m_client.checkGrammarOfString(tag, toAPI(text.impl()), &wkGrammarDetailsRef, &badGrammarLocation, &badGrammarLength, m_client.base.clientInfo);
+
+    RefPtr<API::Array> wkGrammarDetails = adoptRef(toImpl(wkGrammarDetailsRef));
+    size_t numGrammarDetails = wkGrammarDetails->size();
+    for (size_t i = 0; i < numGrammarDetails; ++i)
+        grammarDetails.append(wkGrammarDetails->at<WebGrammarDetail>(i)->grammarDetail());
+}
+
+bool WebTextCheckerClient::spellingUIIsShowing()
+{
+    if (!m_client.spellingUIIsShowing)
+        return false;
+
+    return m_client.spellingUIIsShowing(m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::toggleSpellingUIIsShowing()
+{
+    if (!m_client.toggleSpellingUIIsShowing)
+        return;
+
+    return m_client.toggleSpellingUIIsShowing(m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::updateSpellingUIWithMisspelledWord(uint64_t tag, const String& misspelledWord)
+{
+    if (!m_client.updateSpellingUIWithMisspelledWord)
+        return;
+
+    m_client.updateSpellingUIWithMisspelledWord(tag, toAPI(misspelledWord.impl()), m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::updateSpellingUIWithGrammarString(uint64_t tag, const String& badGrammarPhrase, const WebCore::GrammarDetail& grammarDetail)
+{
+    if (!m_client.updateSpellingUIWithGrammarString)
+        return;
+
+    m_client.updateSpellingUIWithGrammarString(tag, toAPI(badGrammarPhrase.impl()), toAPI(grammarDetail), m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::guessesForWord(uint64_t tag, const String& word, Vector<String>& guesses)
+{
+    if (!m_client.guessesForWord)
+        return;
+
+    RefPtr<API::Array> wkGuesses = adoptRef(toImpl(m_client.guessesForWord(tag, toAPI(word.impl()), m_client.base.clientInfo)));
+    size_t numGuesses = wkGuesses->size();
+    for (size_t i = 0; i < numGuesses; ++i)
+        guesses.append(wkGuesses->at<API::String>(i)->string());
+}
+
+void WebTextCheckerClient::learnWord(uint64_t tag, const String& word)
+{
+    if (!m_client.learnWord)
+        return;
+
+    m_client.learnWord(tag, toAPI(word.impl()), m_client.base.clientInfo);
+}
+
+void WebTextCheckerClient::ignoreWord(uint64_t tag, const String& word)
+{
+    if (!m_client.ignoreWord)
+        return;
+
+    m_client.ignoreWord(tag, toAPI(word.impl()), m_client.base.clientInfo);
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/UIProcess/gtk/WebTextCheckerClient.h (from rev 274010, trunk/Source/WebKit/UIProcess/WebTextCheckerClient.h) (0 => 274011)


--- trunk/Source/WebKit/UIProcess/gtk/WebTextCheckerClient.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/gtk/WebTextCheckerClient.h	2021-03-05 23:07:35 UTC (rev 274011)
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include "APIClient.h"
+#include "WKTextCheckerGtk.h"
+#include <WebCore/TextCheckerClient.h>
+#include <wtf/Forward.h>
+
+namespace API {
+template<> struct ClientTraits<WKTextCheckerClientBase> {
+    typedef std::tuple<WKTextCheckerClientV0> Versions;
+};
+}
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebTextCheckerClient : public API::Client<WKTextCheckerClientBase> {
+public:
+    bool continuousSpellCheckingAllowed();
+    bool continuousSpellCheckingEnabled();
+    void setContinuousSpellCheckingEnabled(bool);
+    bool grammarCheckingEnabled();
+    void setGrammarCheckingEnabled(bool);
+    uint64_t uniqueSpellDocumentTag(WebPageProxy*);
+    void closeSpellDocumentWithTag(uint64_t);
+    void checkSpellingOfString(uint64_t tag, const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
+    void checkGrammarOfString(uint64_t tag, const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
+    bool spellingUIIsShowing();
+    void toggleSpellingUIIsShowing();
+    void updateSpellingUIWithMisspelledWord(uint64_t tag, const String& misspelledWord);
+    void updateSpellingUIWithGrammarString(uint64_t tag, const String& badGrammarPhrase, const WebCore::GrammarDetail&);
+    void guessesForWord(uint64_t tag, const String& word, Vector<String>& guesses);
+    void learnWord(uint64_t tag, const String& word);
+    void ignoreWord(uint64_t tag, const String& word);
+};
+
+} // namespace WebKit

Modified: trunk/Tools/ChangeLog (274010 => 274011)


--- trunk/Tools/ChangeLog	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Tools/ChangeLog	2021-03-05 23:07:35 UTC (rev 274011)
@@ -1,5 +1,16 @@
 2021-03-05  Michael Catanzaro  <[email protected]>
 
+        [GTK] Clean up GTK-specific text checker stuff
+        https://bugs.webkit.org/show_bug.cgi?id=222818
+
+        Reviewed by Don Olmstead.
+
+        * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+        * WebKitTestRunner/gtk/UIScriptControllerGtk.cpp:
+        (WTR::UIScriptControllerGtk::setContinuousSpellCheckingEnabled):
+
+2021-03-05  Michael Catanzaro  <[email protected]>
+
         [GTK] Remove ADD_WHOLE_ARCHIVE_TO_LIBRARIES
         https://bugs.webkit.org/show_bug.cgi?id=222826
 

Modified: trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp (274010 => 274011)


--- trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp	2021-03-05 23:07:35 UTC (rev 274011)
@@ -28,7 +28,7 @@
 #include "TestController.h"
 
 #include "PlatformWebView.h"
-#include <WebKit/WKTextChecker.h>
+#include <WebKit/WKTextCheckerGtk.h>
 #include <gtk/gtk.h>
 #include <wtf/Platform.h>
 #include <wtf/RunLoop.h>

Modified: trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp (274010 => 274011)


--- trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp	2021-03-05 22:56:54 UTC (rev 274010)
+++ trunk/Tools/WebKitTestRunner/gtk/UIScriptControllerGtk.cpp	2021-03-05 23:07:35 UTC (rev 274011)
@@ -29,9 +29,9 @@
 #include "EventSenderProxy.h"
 #include "PlatformWebView.h"
 #include "TestController.h"
-#include "TextChecker.h"
 #include "UIScriptContext.h"
 #include <_javascript_Core/OpaqueJSString.h>
+#include <WebKit/WKTextCheckerGtk.h>
 #include <WebKit/WKViewPrivate.h>
 #include <gtk/gtk.h>
 #include <wtf/RunLoop.h>
@@ -77,7 +77,7 @@
 
 void UIScriptControllerGtk::setContinuousSpellCheckingEnabled(bool enabled)
 {
-    WebKit::TextChecker::setContinuousSpellCheckingEnabled(enabled);
+    WKTextCheckerSetContinuousSpellCheckingEnabled(enabled);
 }
 
 void UIScriptControllerGtk::copyText(JSStringRef text)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to