[GTK] Build error with -DENABLE_SPELLCHECK=OFF
authorclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Sep 2015 12:55:17 +0000 (12:55 +0000)
committerclopez@igalia.com <clopez@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Sep 2015 12:55:17 +0000 (12:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146904

Reviewed by Carlos Garcia Campos.

Add ifdef guards to allow building when SPELLCHECK is not enabled.

* UIProcess/gtk/TextCheckerGtk.cpp:
(WebKit::TextChecker::isContinuousSpellCheckingAllowed):
(WebKit::TextChecker::setContinuousSpellCheckingEnabled):
(WebKit::TextChecker::setGrammarCheckingEnabled):
(WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
(WebKit::TextChecker::grammarCheckingEnabledStateChanged):
(WebKit::TextChecker::checkSpellingOfString):
(WebKit::TextChecker::getGuessesForWord):
(WebKit::TextChecker::learnWord):
(WebKit::TextChecker::ignoreWord):
(WebKit::TextChecker::requestCheckingOfString):
(WebKit::TextChecker::checkTextOfParagraph):
(WebKit::TextChecker::setSpellCheckingLanguages):
(WebKit::TextChecker::loadedSpellCheckingLanguages):

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp

index bd8a90a..08dbd99 100644 (file)
@@ -1,3 +1,27 @@
+2015-09-30  Carlos Alberto Lopez Perez  <clopez@igalia.com>
+
+        [GTK] Build error with -DENABLE_SPELLCHECK=OFF
+        https://bugs.webkit.org/show_bug.cgi?id=146904
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add ifdef guards to allow building when SPELLCHECK is not enabled.
+
+        * UIProcess/gtk/TextCheckerGtk.cpp:
+        (WebKit::TextChecker::isContinuousSpellCheckingAllowed):
+        (WebKit::TextChecker::setContinuousSpellCheckingEnabled):
+        (WebKit::TextChecker::setGrammarCheckingEnabled):
+        (WebKit::TextChecker::continuousSpellCheckingEnabledStateChanged):
+        (WebKit::TextChecker::grammarCheckingEnabledStateChanged):
+        (WebKit::TextChecker::checkSpellingOfString):
+        (WebKit::TextChecker::getGuessesForWord):
+        (WebKit::TextChecker::learnWord):
+        (WebKit::TextChecker::ignoreWord):
+        (WebKit::TextChecker::requestCheckingOfString):
+        (WebKit::TextChecker::checkTextOfParagraph):
+        (WebKit::TextChecker::setSpellCheckingLanguages):
+        (WebKit::TextChecker::loadedSpellCheckingLanguages):
+
 2015-09-30  Gwang Yoon Hwang  <yoon@igalia.com>
 
         [GTK] Support HiDPI Properly in WebKitGtk+ with the TextureMapper
index 35b3f39..1592cd7 100644 (file)
@@ -31,7 +31,6 @@
 #include "TextBreakIterator.h"
 #include "TextCheckerState.h"
 #include "WebProcessPool.h"
-#include "WebTextChecker.h"
 #include <WebCore/NotImplemented.h>
 #include <WebCore/TextCheckerEnchant.h>
 #include <wtf/NeverDestroyed.h>
@@ -40,11 +39,13 @@ using namespace WebCore;
 
 namespace WebKit {
 
+#if ENABLE(SPELLCHECK)
 static WebCore::TextCheckerEnchant& enchantTextChecker()
 {
     static NeverDestroyed<WebCore::TextCheckerEnchant> checker;
     return checker;
 }
+#endif
 
 TextCheckerState& checkerState()
 {
@@ -63,41 +64,63 @@ const TextCheckerState& TextChecker::state()
     return checkerState();
 }
 
+#if ENABLE(SPELLCHECK)
 static void updateStateForAllProcessPools()
 {
     for (const auto& processPool : WebProcessPool::allProcessPools())
         processPool->textCheckerStateChanged();
 }
+#endif
 
 bool TextChecker::isContinuousSpellCheckingAllowed()
 {
+#if ENABLE(SPELLCHECK)
     return true;
+#else
+    return false;
+#endif
 }
 
 void TextChecker::setContinuousSpellCheckingEnabled(bool isContinuousSpellCheckingEnabled)
 {
+#if ENABLE(SPELLCHECK)
     if (checkerState().isContinuousSpellCheckingEnabled == isContinuousSpellCheckingEnabled)
         return;
     checkerState().isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled;
     updateStateForAllProcessPools();
+#else
+    UNUSED_PARAM(isContinuousSpellCheckingEnabled);
+#endif
 }
 
 void TextChecker::setGrammarCheckingEnabled(bool isGrammarCheckingEnabled)
 {
+#if ENABLE(SPELLCHECK)
     if (checkerState().isGrammarCheckingEnabled == isGrammarCheckingEnabled)
         return;
     checkerState().isGrammarCheckingEnabled = isGrammarCheckingEnabled;
     updateStateForAllProcessPools();
+#else
+    UNUSED_PARAM(isGrammarCheckingEnabled);
+#endif
 }
 
 void TextChecker::continuousSpellCheckingEnabledStateChanged(bool enabled)
 {
+#if ENABLE(SPELLCHECK)
     checkerState().isContinuousSpellCheckingEnabled = enabled;
+#else
+    UNUSED_PARAM(enabled);
+#endif
 }
 
 void TextChecker::grammarCheckingEnabledStateChanged(bool enabled)
 {
+#if ENABLE(SPELLCHECK)
     checkerState().isGrammarCheckingEnabled = enabled;
+#else
+    UNUSED_PARAM(enabled);
+#endif
 }
 
 int64_t TextChecker::uniqueSpellDocumentTag(WebPageProxy*)
@@ -111,9 +134,15 @@ void TextChecker::closeSpellDocumentWithTag(int64_t /* tag */)
 
 void TextChecker::checkSpellingOfString(int64_t /* spellDocumentTag */, StringView text, int32_t& misspellingLocation, int32_t& misspellingLength)
 {
+#if ENABLE(SPELLCHECK)
     misspellingLocation = -1;
     misspellingLength = 0;
     enchantTextChecker().checkSpellingOfString(text.toStringWithoutCopying(), misspellingLocation, misspellingLength);
+#else
+    UNUSED_PARAM(text);
+    UNUSED_PARAM(misspellingLocation);
+    UNUSED_PARAM(misspellingLength);
+#endif
 }
 
 void TextChecker::checkGrammarOfString(int64_t /* spellDocumentTag */, StringView /* text */, Vector<WebCore::GrammarDetail>& /* grammarDetails */, int32_t& /* badGrammarLocation */, int32_t& /* badGrammarLength */)
@@ -139,21 +168,35 @@ void TextChecker::updateSpellingUIWithGrammarString(int64_t /* spellDocumentTag
 
 void TextChecker::getGuessesForWord(int64_t /* spellDocumentTag */, const String& word, const String& /* context */, Vector<String>& guesses)
 {
+#if ENABLE(SPELLCHECK)
     guesses = enchantTextChecker().getGuessesForWord(word);
+#else
+    UNUSED_PARAM(word);
+    UNUSED_PARAM(guesses);
+#endif
 }
 
 void TextChecker::learnWord(int64_t /* spellDocumentTag */, const String& word)
 {
+#if ENABLE(SPELLCHECK)
     enchantTextChecker().learnWord(word);
+#else
+    UNUSED_PARAM(word);
+#endif
 }
 
 void TextChecker::ignoreWord(int64_t /* spellDocumentTag */, const String& word)
 {
+#if ENABLE(SPELLCHECK)
     enchantTextChecker().ignoreWord(word);
+#else
+    UNUSED_PARAM(word);
+#endif
 }
 
 void TextChecker::requestCheckingOfString(PassRefPtr<TextCheckerCompletion> completion)
 {
+#if ENABLE(SPELLCHECK)
     if (!completion)
         return;
 
@@ -162,9 +205,12 @@ void TextChecker::requestCheckingOfString(PassRefPtr<TextCheckerCompletion> comp
     ASSERT(request.mask() != TextCheckingTypeNone);
 
     completion->didFinishCheckingText(checkTextOfParagraph(completion->spellDocumentTag(), request.text(), request.mask()));
+#else
+    UNUSED_PARAM(completion);
+#endif
 }
 
-#if USE(UNIFIED_TEXT_CHECKING)
+#if USE(UNIFIED_TEXT_CHECKING) && ENABLE(SPELLCHECK)
 static unsigned nextWordOffset(StringView text, unsigned currentOffset)
 {
     // FIXME: avoid creating textIterator object here, it could be passed as a parameter.
@@ -190,9 +236,12 @@ static unsigned nextWordOffset(StringView text, unsigned currentOffset)
 
     return wordOffset;
 }
+#endif
 
+#if USE(UNIFIED_TEXT_CHECKING)
 Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, StringView text, uint64_t checkingTypes)
 {
+#if ENABLE(SPELLCHECK)
     if (!(checkingTypes & TextCheckingTypeSpelling))
         return Vector<TextCheckingResult>();
 
@@ -225,17 +274,31 @@ Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocume
         offset = nextWordOffset(text.substring(0, lengthStrip), offset);
     }
     return paragraphCheckingResult;
+#else
+    UNUSED_PARAM(spellDocumentTag);
+    UNUSED_PARAM(text);
+    UNUSED_PARAM(checkingTypes);
+    return Vector<TextCheckingResult>();
+#endif // ENABLE(SPELLCHECK)
 }
-#endif
+#endif // USE(UNIFIED_TEXT_CHECKING)
 
 void TextChecker::setSpellCheckingLanguages(const Vector<String>& languages)
 {
+#if ENABLE(SPELLCHECK)
     enchantTextChecker().updateSpellCheckingLanguages(languages);
+#else
+    UNUSED_PARAM(languages);
+#endif
 }
 
 Vector<String> TextChecker::loadedSpellCheckingLanguages()
 {
+#if ENABLE(SPELLCHECK)
     return enchantTextChecker().loadedSpellCheckingLanguages();
+#else
+    return Vector<String>();
+#endif
 }
 
 } // namespace WebKit