Chromium Code Reviews| Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| index ca7e4c575737eca669711b7c6a025afbb7c9694d..1e02470091f9956b3eeaf1dd53b6b87d5f7d4f3b 100644 |
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| @@ -477,7 +477,8 @@ OmniboxViewWin::OmniboxViewWin(OmniboxEditController* controller, |
| chrome::search::IsInstantExtendedAPIEnabled(parent_view_->profile()), |
| ToolbarModel::NONE, LocationBarView::BACKGROUND))), |
| security_level_(ToolbarModel::NONE), |
| - text_object_model_(NULL) { |
| + text_object_model_(NULL), |
| + in_on_ime_composition_(false) { |
| if (!loaded_library_module_) |
| loaded_library_module_ = LoadLibrary(kRichEditDLLName); |
| @@ -751,8 +752,22 @@ void OmniboxViewWin::UpdatePopup() { |
| // * The user is trying to compose something in an IME |
| CHARRANGE sel; |
| GetSel(sel); |
| + bool prevent_inline_autocompletion = |
| + (sel.cpMax < GetTextLength()) || IsImeComposing(); |
| + |
| + // SetSel doesn't work when the TSF based text input modules such as CJK |
| + // on-screen keyboards on Windows 8 insert a character and then CUAS (Cicero |
| + // Unaware Application Support) translates it into an IMM32 protocol message |
| + // like WM_IME_COMPOSITION. As a result, autocompleted text will not be |
| + // updated as expected. To workaround this issue, temporary disable |
| + // autocompletion during WM_IME_COMPOSITION iff Windows 8. |
| + // TODO(nona): Re-enable auto-completion for Korean, where this issue is not |
| + // reproducible for some reasons. |
| + // TODO(nona): Remove this workaround after fixing crbug.com/154379. |
| + if (base::win::GetVersion() >= base::win::VERSION_WIN8) |
| + prevent_inline_auto_completion |= in_on_ime_composition_; |
| model()->StartAutocomplete(sel.cpMax != sel.cpMin, |
| - (sel.cpMax < GetTextLength()) || IsImeComposing()); |
| + prevent_inline_auto_completion); |
| } |
| void OmniboxViewWin::SetFocus() { |
| @@ -1408,6 +1423,7 @@ LRESULT OmniboxViewWin::OnImeComposition(UINT message, |
| return DefWindowProc(message, wparam, lparam); |
| } |
| + in_on_ime_composition_ = true; |
|
Yohei Yukawa
2012/10/11 01:02:10
AutoReset<bool> auto_reset_in_on_ime_composition(&
Seigo Nonaka
2012/10/11 02:11:33
Done.
|
| ScopedFreeze freeze(this, GetTextObjectModel()); |
| OnBeforePossibleChange(); |
| LRESULT result = DefWindowProc(message, wparam, lparam); |
| @@ -1415,6 +1431,7 @@ LRESULT OmniboxViewWin::OnImeComposition(UINT message, |
| // code in OnAfterPossibleChange(), even if identical contents are confirmed, |
| // to make sure the model can update its internal states correctly. |
| OnAfterPossibleChangeInternal((lparam & GCS_RESULTSTR) != 0); |
| + in_on_ime_composition_ = false; |
| return result; |
| } |