diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/win/TextCheckerWin.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/win/TextCheckerWin.cpp | 80 |
1 files changed, 58 insertions, 22 deletions
diff --git a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp index dbc6fdc..9f7c766 100644 --- a/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp +++ b/Source/WebKit2/UIProcess/win/TextCheckerWin.cpp @@ -27,6 +27,7 @@ #include "TextChecker.h" #include "TextCheckerState.h" +#include "WebTextChecker.h" #include <WebCore/NotImplemented.h> using namespace WebCore; @@ -37,68 +38,103 @@ 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(WebPageProxy* page) +{ + return WebTextChecker::shared()->client().uniqueSpellDocumentTag(page); +} + +void TextChecker::closeSpellDocumentWithTag(int64_t tag) +{ + 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); } -int64_t TextChecker::uniqueSpellDocumentTag() +void TextChecker::checkGrammarOfString(int64_t spellDocumentTag, const UChar* text, uint32_t length, Vector<WebCore::GrammarDetail>& grammarDetails, int32_t& badGrammarLocation, int32_t& badGrammarLength) { - notImplemented(); - return 0; + WebTextChecker::shared()->client().checkGrammarOfString(spellDocumentTag, String(text, length), grammarDetails, badGrammarLocation, badGrammarLength); } -void TextChecker::closeSpellDocumentWithTag(int64_t) +bool TextChecker::spellingUIIsShowing() { - notImplemented(); + return WebTextChecker::shared()->client().spellingUIIsShowing(); } -Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes) +void TextChecker::toggleSpellingUIIsShowing() { - notImplemented(); - return Vector<WebCore::TextCheckingResult>(); + WebTextChecker::shared()->client().toggleSpellingUIIsShowing(); } -void TextChecker::updateSpellingUIWithMisspelledWord(const String& misspelledWord) +void TextChecker::updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String& misspelledWord) { - notImplemented(); + WebTextChecker::shared()->client().updateSpellingUIWithMisspelledWord(spellDocumentTag, misspelledWord); } -void TextChecker::updateSpellingUIWithGrammarString(const String& badGrammarPhrase, const GrammarDetail& 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(const String& word) +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 |