Commit 270fc232 authored by kov@webkit.org's avatar kov@webkit.org

2009-04-24 Diego Escalante Urrelo <diegoe@gnome.org>

        Reviewed by Gustavo Noronha.

        https://bugs.webkit.org/show_bug.cgi?id=15616
        [GTK] Add spell checking

        Implement EditorClient::ignoreWordInSpellDocument,
        EditorClient::learnWord and EditorClient::getGuessesForWord. This
        enables the corresponding user actions.

        * WebCoreSupport/EditorClientGtk.cpp:
        (WebKit::EditorClient::ignoreWordInSpellDocument):
        (WebKit::EditorClient::learnWord):
        (WebKit::EditorClient::getGuessesForWord):

git-svn-id: svn://svn.chromium.org/blink/trunk@42820 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c4b039ad
2009-04-24 Diego Escalante Urrelo <diegoe@gnome.org>
Reviewed by Gustavo Noronha.
https://bugs.webkit.org/show_bug.cgi?id=15616
[GTK] Add spell checking
Implement EditorClient::ignoreWordInSpellDocument,
EditorClient::learnWord and EditorClient::getGuessesForWord. This
enables the corresponding user actions.
* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::ignoreWordInSpellDocument):
(WebKit::EditorClient::learnWord):
(WebKit::EditorClient::getGuessesForWord):
2009-04-24 Diego Escalante Urrelo <diegoe@gnome.org> 2009-04-24 Diego Escalante Urrelo <diegoe@gnome.org>
Reviewed by Gustavo Noronha. Reviewed by Gustavo Noronha.
......
...@@ -517,14 +517,26 @@ void EditorClient::textDidChangeInTextArea(Element*) ...@@ -517,14 +517,26 @@ void EditorClient::textDidChangeInTextArea(Element*)
notImplemented(); notImplemented();
} }
void EditorClient::ignoreWordInSpellDocument(const String&) void EditorClient::ignoreWordInSpellDocument(const String& text)
{ {
notImplemented(); GSList* langs = webkit_web_settings_get_spell_languages(m_webView);
for (; langs; langs = langs->next) {
SpellLanguage* lang = static_cast<SpellLanguage*>(langs->data);
enchant_dict_add_to_session(lang->speller, text.utf8().data(), -1);
}
} }
void EditorClient::learnWord(const String&) void EditorClient::learnWord(const String& text)
{ {
notImplemented(); GSList* langs = webkit_web_settings_get_spell_languages(m_webView);
for (; langs; langs = langs->next) {
SpellLanguage* lang = static_cast<SpellLanguage*>(langs->data);
enchant_dict_add_to_personal(lang->speller, text.utf8().data(), -1);
}
} }
void EditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength) void EditorClient::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength)
...@@ -606,9 +618,24 @@ bool EditorClient::spellingUIIsShowing() ...@@ -606,9 +618,24 @@ bool EditorClient::spellingUIIsShowing()
return false; return false;
} }
void EditorClient::getGuessesForWord(const String&, Vector<String>&) void EditorClient::getGuessesForWord(const String& word, WTF::Vector<String>& guesses)
{ {
notImplemented(); GSList* langs = webkit_web_settings_get_spell_languages(m_webView);
guesses.clear();
for (; langs; langs = langs->next) {
size_t numberOfSuggestions;
size_t i;
SpellLanguage* lang = static_cast<SpellLanguage*>(langs->data);
gchar** suggestions = enchant_dict_suggest(lang->speller, word.utf8().data(), -1, &numberOfSuggestions);
for (i = 0; i < numberOfSuggestions && i < 10; i++)
guesses.append(String::fromUTF8(suggestions[i]));
if (numberOfSuggestions > 0)
enchant_dict_free_suggestions(lang->speller, suggestions);
}
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment