diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-10 22:32:21 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-10 22:32:21 +0000 |
commit | 26ea6c409fedeabdabb53f41fcc80b79d2575cf9 (patch) | |
tree | 462cc525d12f6cebe47b60094aa5a346e46a92fd /webkit/glue/editor_client_impl.cc | |
parent | fda8974e0a1daa704be0dc33fe04ae4564310c12 (diff) | |
download | chromium_src-26ea6c409fedeabdabb53f41fcc80b79d2575cf9.zip chromium_src-26ea6c409fedeabdabb53f41fcc80b79d2575cf9.tar.gz chromium_src-26ea6c409fedeabdabb53f41fcc80b79d2575cf9.tar.bz2 |
Stop auto-correcting abbreviations.BUG= www.crbug.com/12921TEST= For command line --auto-spell-correct, "IMB" should not change to "IBM"
Review URL: http://codereview.chromium.org/119210
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/editor_client_impl.cc')
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index a4b8380..04f7321 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -686,7 +686,7 @@ void EditorClientImpl::textFieldDidEndEditing(WebCore::Element* element) { // Hide any showing popup. web_view_->HideAutoCompletePopup(); - + // Notify any password-listener of the focus change. WebCore::HTMLInputElement* input_element = webkit_glue::ElementToHTMLInputElement(element); @@ -846,6 +846,8 @@ void EditorClientImpl::checkSpellingOfString(const UChar* str, int length, int spell_location = -1; int spell_length = 0; WebViewDelegate* d = web_view_->delegate(); + + // Check to see if the provided str is spelled correctly. if (isContinuousSpellCheckingEnabled() && d) { std::wstring word = webkit_glue::StringToStdWString(WebCore::String(str, length)); @@ -866,12 +868,19 @@ void EditorClientImpl::checkSpellingOfString(const UChar* str, int length, WebCore::String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord( const WebCore::String& misspelledWord) { WebViewDelegate* d = web_view_->delegate(); - std::wstring autocorrect_word; - if (isContinuousSpellCheckingEnabled() && d) { - std::wstring word = webkit_glue::StringToStdWString(misspelledWord); - d->GetAutoCorrectWord(word, autocorrect_word); + if (!(isContinuousSpellCheckingEnabled() && d)) + return WebCore::String(); + + std::wstring word = webkit_glue::StringToStdWString(misspelledWord); + + // Do not autocorrect words with capital letters in it except the + // first letter. This will remove cases changing "IMB" to "IBM". + for (size_t i = 1; i < word.length(); i++) { + if (u_isupper(static_cast<UChar32>(word[i]))) + return WebCore::String(); } + std::wstring autocorrect_word = d->GetAutoCorrectWord(word); return webkit_glue::StdWStringToString(autocorrect_word); } |