diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 21:16:05 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-09 21:16:05 +0000 |
commit | 98324891649cf5fa7430c2e231ad5493fdb76c8e (patch) | |
tree | 4c48f7d44d002691e717526bdb2d7870296b10df /webkit/glue/editor_client_impl.cc | |
parent | 1edc999cee504ed756ee798dfb1bfd95f53b4262 (diff) | |
download | chromium_src-98324891649cf5fa7430c2e231ad5493fdb76c8e.zip chromium_src-98324891649cf5fa7430c2e231ad5493fdb76c8e.tar.gz chromium_src-98324891649cf5fa7430c2e231ad5493fdb76c8e.tar.bz2 |
Adds support for the os x spelling panel to chromium. Users can
now access it from the main menu and context menu and use it to perform
spelling tasks. For more detail, see
http://code.google.com/p/chromium/wiki/SpellingPanelPlanningDoc
Patch from pwicks86@gmail.com (Paul Wicks).
BUG=None
TEST=The spelling panel should work in os x.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/editor_client_impl.cc')
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index a090eb7..f7d2561 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -152,7 +152,13 @@ void EditorClientImpl::toggleGrammarChecking() { } int EditorClientImpl::spellCheckerDocumentTag() { +#if defined(OS_MACOSX) + WebViewDelegate* d = web_view_->delegate(); + if (d) + return d->SpellCheckerDocumentTag(); +#else NOTIMPLEMENTED(); +#endif // OS_MACOSX return 0; } @@ -838,7 +844,8 @@ void EditorClientImpl::checkSpellingOfString(const UChar* str, int length, if (isContinuousSpellCheckingEnabled() && d) { std::wstring word = webkit_glue::StringToStdWString(WebCore::String(str, length)); - d->SpellCheck(word, &spell_location, &spell_length); + d->SpellCheck(word, spellCheckerDocumentTag(), + &spell_location, &spell_length); } else { spell_location = 0; spell_length = 0; @@ -867,7 +874,8 @@ WebCore::String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord( return WebCore::String(); } - std::wstring autocorrect_word = d->GetAutoCorrectWord(word); + std::wstring autocorrect_word = + d->GetAutoCorrectWord(word, spellCheckerDocumentTag()); return webkit_glue::StdWStringToString(autocorrect_word); } @@ -887,16 +895,28 @@ void EditorClientImpl::updateSpellingUIWithGrammarString(const WebCore::String&, NOTIMPLEMENTED(); } -void EditorClientImpl::updateSpellingUIWithMisspelledWord(const WebCore::String&) { - NOTIMPLEMENTED(); +void EditorClientImpl::updateSpellingUIWithMisspelledWord( + const WebCore::String& misspelled_word) { + std::wstring word = webkit_glue::StringToStdWString(misspelled_word); + WebViewDelegate* d = web_view_->delegate(); + if (d) { + d->UpdateSpellingUIWithMisspelledWord(word); + } } void EditorClientImpl::showSpellingUI(bool show) { - NOTIMPLEMENTED(); + WebViewDelegate* d = web_view_->delegate(); + if (d) { + d->ShowSpellingUI(show); + } } bool EditorClientImpl::spellingUIIsShowing() { - return false; + // SpellingPanel visibility is stored in the web_view_ every time a toggle + // message is sent from the browser. If we were to send a message to the + // browser and ask for the visibility, then we run into problems accessing + // cocoa methods on the UI thread. + return web_view_->GetSpellingPanelVisibility(); } void EditorClientImpl::getGuessesForWord(const WebCore::String&, |