Title: [97385] trunk/Source/WebKit2
Revision
97385
Author
[email protected]
Date
2011-10-13 12:36:34 -0700 (Thu, 13 Oct 2011)

Log Message

Implement TextChecker for WebKit2 GTK+
https://bugs.webkit.org/show_bug.cgi?id=68548

Patch by Ravi Phaneendra Kasibhatla <[email protected]> on 2011-10-13
Reviewed by Anders Carlsson.

Added implementation for all functions in TextCheckerGtk.cpp removing earlier stubbed implementations.
Moved couple of API earlier specific to win port to common section and added stubbed implementation
of the same for remaining ports of Qt, Efl and Mac.

* GNUmakefile.am: Added TextChecker implementation files.
* UIProcess/TextChecker.h: Moved spellCheckingEnabled and grammarCheckingEnabled API outside of win port.
* UIProcess/efl/TextCheckerEfl.cpp: Stubbed implementation of API which was moved outside win port.
* UIProcess/gtk/TextCheckerGtk.cpp: Implementation of all TextChecker API.
(WebKit::TextChecker::state):
(WebKit::TextChecker::isContinuousSpellCheckingAllowed):
(WebKit::TextChecker::setContinuousSpellCheckingEnabled):
(WebKit::TextChecker::setGrammarCheckingEnabled):
(WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
(WebKit::TextChecker::grammarCheckingEnabledStateChanged):
(WebKit::TextChecker::uniqueSpellDocumentTag):
(WebKit::TextChecker::closeSpellDocumentWithTag):
(WebKit::TextChecker::checkSpellingOfString):
(WebKit::TextChecker::checkGrammarOfString):
(WebKit::TextChecker::spellingUIIsShowing):
(WebKit::TextChecker::toggleSpellingUIIsShowing):
(WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
(WebKit::TextChecker::updateSpellingUIWithGrammarString):
(WebKit::TextChecker::getGuessesForWord):
(WebKit::TextChecker::learnWord):
(WebKit::TextChecker::ignoreWord):
* UIProcess/mac/TextCheckerMac.mm: Implementation of API which was moved outside win port.
* UIProcess/qt/TextCheckerQt.cpp: Stubbed implementation of API which was moved outside win port.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (97384 => 97385)


--- trunk/Source/WebKit2/ChangeLog	2011-10-13 19:30:41 UTC (rev 97384)
+++ trunk/Source/WebKit2/ChangeLog	2011-10-13 19:36:34 UTC (rev 97385)
@@ -1,3 +1,38 @@
+2011-10-13  Ravi Phaneendra Kasibhatla  <[email protected]>
+
+        Implement TextChecker for WebKit2 GTK+
+        https://bugs.webkit.org/show_bug.cgi?id=68548
+
+        Reviewed by Anders Carlsson.
+
+        Added implementation for all functions in TextCheckerGtk.cpp removing earlier stubbed implementations.
+        Moved couple of API earlier specific to win port to common section and added stubbed implementation
+        of the same for remaining ports of Qt, Efl and Mac.
+
+        * GNUmakefile.am: Added TextChecker implementation files.
+        * UIProcess/TextChecker.h: Moved spellCheckingEnabled and grammarCheckingEnabled API outside of win port.
+        * UIProcess/efl/TextCheckerEfl.cpp: Stubbed implementation of API which was moved outside win port.
+        * UIProcess/gtk/TextCheckerGtk.cpp: Implementation of all TextChecker API.
+        (WebKit::TextChecker::state):
+        (WebKit::TextChecker::isContinuousSpellCheckingAllowed):
+        (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
+        (WebKit::TextChecker::setGrammarCheckingEnabled):
+        (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
+        (WebKit::TextChecker::grammarCheckingEnabledStateChanged):
+        (WebKit::TextChecker::uniqueSpellDocumentTag):
+        (WebKit::TextChecker::closeSpellDocumentWithTag):
+        (WebKit::TextChecker::checkSpellingOfString):
+        (WebKit::TextChecker::checkGrammarOfString):
+        (WebKit::TextChecker::spellingUIIsShowing):
+        (WebKit::TextChecker::toggleSpellingUIIsShowing):
+        (WebKit::TextChecker::updateSpellingUIWithMisspelledWord):
+        (WebKit::TextChecker::updateSpellingUIWithGrammarString):
+        (WebKit::TextChecker::getGuessesForWord):
+        (WebKit::TextChecker::learnWord):
+        (WebKit::TextChecker::ignoreWord):
+        * UIProcess/mac/TextCheckerMac.mm: Implementation of API which was moved outside win port.
+        * UIProcess/qt/TextCheckerQt.cpp: Stubbed implementation of API which was moved outside win port.
+
 2011-10-13  Jesus Sanchez-Palencia  <[email protected]>
 
         [Qt][WK2] Implement decidePolicyForResponse in our PolicyClient

Modified: trunk/Source/WebKit2/GNUmakefile.am (97384 => 97385)


--- trunk/Source/WebKit2/GNUmakefile.am	2011-10-13 19:30:41 UTC (rev 97384)
+++ trunk/Source/WebKit2/GNUmakefile.am	2011-10-13 19:36:34 UTC (rev 97385)
@@ -48,6 +48,7 @@
 	$(WebKit2)/UIProcess/API/C/WKFormSubmissionListener.h \
 	$(WebKit2)/UIProcess/API/C/WKFrame.h \
 	$(WebKit2)/UIProcess/API/C/WKFramePolicyListener.h \
+	$(WebKit2)/UIProcess/API/C/WKGrammarDetail.h \
 	$(WebKit2)/UIProcess/API/C/WKHitTestResult.h \
 	$(WebKit2)/UIProcess/API/C/WKInspector.h \
 	$(WebKit2)/UIProcess/API/C/WKKeyValueStorageManager.h \
@@ -65,6 +66,7 @@
 	$(WebKit2)/UIProcess/API/C/WKProtectionSpace.h \
 	$(WebKit2)/UIProcess/API/C/WKProtectionSpaceTypes.h \
 	$(WebKit2)/UIProcess/API/C/WKResourceCacheManager.h \
+	$(WebKit2)/UIProcess/API/C/WKTextChecker.h \
 	$(WebKit2)/UIProcess/API/cpp/WKRetainPtr.h
 
 libwebkit2gtkincludedir = $(libwebkitgtkincludedir)/webkit2
@@ -432,6 +434,8 @@
 	Source/WebKit2/UIProcess/API/C/WKFrame.h \
 	Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.cpp \
 	Source/WebKit2/UIProcess/API/C/WKFramePolicyListener.h \
+	Source/WebKit2/UIProcess/API/C/WKGrammarDetail.cpp \
+	Source/WebKit2/UIProcess/API/C/WKGrammarDetail.h \
 	Source/WebKit2/UIProcess/API/C/WKHitTestResult.cpp \
 	Source/WebKit2/UIProcess/API/C/WKHitTestResult.h \
 	Source/WebKit2/UIProcess/API/C/WKIconDatabase.cpp \
@@ -464,6 +468,8 @@
 	Source/WebKit2/UIProcess/API/C/WKProtectionSpaceTypes.h \
 	Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.h \
 	Source/WebKit2/UIProcess/API/C/WKResourceCacheManager.cpp \
+	Source/WebKit2/UIProcess/API/C/WKTextChecker.h \
+	Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp \
 	Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h \
 	Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h \
 	Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp \
@@ -582,6 +588,8 @@
 	Source/WebKit2/UIProcess/WebGeolocationManagerProxy.h \
 	Source/WebKit2/UIProcess/WebGeolocationProvider.cpp \
 	Source/WebKit2/UIProcess/WebGeolocationProvider.h \
+	Source/WebKit2/UIProcess/WebGrammarDetail.cpp \
+	Source/WebKit2/UIProcess/WebGrammarDetail.h \
 	Source/WebKit2/UIProcess/WebHistoryClient.cpp \
 	Source/WebKit2/UIProcess/WebHistoryClient.h \
 	Source/WebKit2/UIProcess/WebIconDatabase.cpp \
@@ -617,6 +625,10 @@
 	Source/WebKit2/UIProcess/WebResourceCacheManagerProxy.cpp \
 	Source/WebKit2/UIProcess/WebResourceLoadClient.cpp \
 	Source/WebKit2/UIProcess/WebResourceLoadClient.h \
+	Source/WebKit2/UIProcess/WebTextChecker.cpp \
+	Source/WebKit2/UIProcess/WebTextChecker.h \
+	Source/WebKit2/UIProcess/WebTextCheckerClient.cpp \
+	Source/WebKit2/UIProcess/WebTextCheckerClient.h \
 	Source/WebKit2/UIProcess/WebUIClient.cpp \
 	Source/WebKit2/UIProcess/WebUIClient.h \
 	Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.h \

Modified: trunk/Source/WebKit2/UIProcess/TextChecker.h (97384 => 97385)


--- trunk/Source/WebKit2/UIProcess/TextChecker.h	2011-10-13 19:30:41 UTC (rev 97384)
+++ trunk/Source/WebKit2/UIProcess/TextChecker.h	2011-10-13 19:36:34 UTC (rev 97385)
@@ -54,11 +54,10 @@
 
     static bool substitutionsPanelIsShowing();
     static void toggleSubstitutionsPanelIsShowing();
-#elif PLATFORM(WIN)
-    static void continuousSpellCheckingEnabledStateChanged(bool);
-    static void grammarCheckingEnabledStateChanged(bool);
 #endif
 
+    static void continuousSpellCheckingEnabledStateChanged(bool);
+    static void grammarCheckingEnabledStateChanged(bool);
     static int64_t uniqueSpellDocumentTag(WebPageProxy*);
     static void closeSpellDocumentWithTag(int64_t);
 #if USE(UNIFIED_TEXT_CHECKING)

Modified: trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp (97384 => 97385)


--- trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp	2011-10-13 19:30:41 UTC (rev 97384)
+++ trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp	2011-10-13 19:36:34 UTC (rev 97385)
@@ -57,6 +57,16 @@
     notImplemented();
 }
 
+void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+    notImplemented();
+}
+
+void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+    notImplemented();
+}
+
 int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy*)
 {
     notImplemented();

Modified: trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp (97384 => 97385)


--- trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp	2011-10-13 19:30:41 UTC (rev 97384)
+++ trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp	2011-10-13 19:36:34 UTC (rev 97385)
@@ -28,7 +28,7 @@
 #include "TextChecker.h"
 
 #include "TextCheckerState.h"
-#include <WebCore/NotImplemented.h>
+#include "WebTextChecker.h"
 
 using namespace WebCore;
  
@@ -38,81 +38,103 @@
 
 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);
 }
 
-int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy*)
+void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
 {
-    notImplemented();
-    return 0;
+    textCheckerState.isContinuousSpellCheckingEnabled = enabled;
 }
 
-void TextChecker::closeSpellDocumentWithTag(int64_t)
+void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
 {
-    notImplemented();
+    textCheckerState.isGrammarCheckingEnabled = enabled;
 }
 
-void TextChecker::checkSpellingOfString(int64_t, const UChar*, uint32_t, int32_t&, int32_t&)
+int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy* page)
 {
-    notImplemented();
+    return WebTextChecker::shared()->client().uniqueSpellDocumentTag(page);
 }
 
-void TextChecker::checkGrammarOfString(int64_t, const UChar*, uint32_t, Vector<WebCore::GrammarDetail>&, int32_t&, int32_t&)
+void TextChecker::closeSpellDocumentWithTag(int64_t tag)
 {
-    notImplemented();
+    WebTextChecker::shared()->client().closeSpellDocumentWithTag(tag);
 }
 
+void TextChecker::checkSpellingOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, int32_t& misspellingLocation, int32_t& misspellingLength)
+{
+    WebTextChecker::shared()->client().checkSpellingOfString(spellDocumentTag, String(text, length), misspellingLocation, misspellingLength);
+}
+
+void TextChecker::checkGrammarOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, Vector<WebCore::GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength)
+{
+    WebTextChecker::shared()->client().checkGrammarOfString(spellDocumentTag, String(text, length), grammarDetails, badGrammarLocation, badGrammarLength);
+}
+
 bool TextChecker::spellingUIIsShowing()
 {
-    notImplemented();
-    return false;
+    return WebTextChecker::shared()->client().spellingUIIsShowing();
 }
 
 void TextChecker::toggleSpellingUIIsShowing()
 {
-    notImplemented();
+    WebTextChecker::shared()->client().toggleSpellingUIIsShowing();
 }
 
-void TextChecker::updateSpellingUIWithMisspelledWord(int64_t, const String&)
+void TextChecker::updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String& misspelledWord)
 {
-    notImplemented();
+    WebTextChecker::shared()->client().updateSpellingUIWithMisspelledWord(spellDocumentTag, misspelledWord);
 }
 
-void TextChecker::updateSpellingUIWithGrammarString(int64_t, const String&, const GrammarDetail&)
+void TextChecker::updateSpellingUIWithGrammarString(int64_t spellDocumentTag, const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
 {
-    notImplemented();
+    WebTextChecker::shared()->client().updateSpellingUIWithGrammarString(spellDocumentTag, badGrammarPhrase, grammarDetail);
 }
 
 void TextChecker::getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses)
 {
-    notImplemented();
+    WebTextChecker::shared()->client().guessesForWord(spellDocumentTag, word, guesses);
 }
 
-void TextChecker::learnWord(int64_t, const String&)
+void TextChecker::learnWord(int64_t spellDocumentTag, const String& word)
 {
-    notImplemented();
+    WebTextChecker::shared()->client().learnWord(spellDocumentTag, word);
 }
 
 void TextChecker::ignoreWord(int64_t spellDocumentTag, const String& word)
 {
-    notImplemented();
+    WebTextChecker::shared()->client().ignoreWord(spellDocumentTag, word);
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm (97384 => 97385)


--- trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2011-10-13 19:30:41 UTC (rev 97384)
+++ trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2011-10-13 19:36:34 UTC (rev 97385)
@@ -213,6 +213,16 @@
     [substitutionsPanel orderFront:nil];
 }
 
+void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+    textCheckerState.isContinuousSpellCheckingEnabled = enabled;
+}
+
+void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+    textCheckerState.isGrammarCheckingEnabled = enabled;
+}
+
 int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy*)
 {
     return [NSSpellChecker uniqueSpellDocumentTag];

Modified: trunk/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp (97384 => 97385)


--- trunk/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp	2011-10-13 19:30:41 UTC (rev 97384)
+++ trunk/Source/WebKit2/UIProcess/qt/TextCheckerQt.cpp	2011-10-13 19:36:34 UTC (rev 97385)
@@ -59,6 +59,16 @@
     notImplemented();
 }
 
+void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
+{
+    notImplemented();
+}
+
+void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
+{
+    notImplemented();
+}
+
 int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy*)
 {
     notImplemented();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to