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..2659c136fd7fa8c655770d00a0d9e4311841ec00 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_auto_completion = |
falken
2012/10/10 09:51:33
nit: I think this can just be prevent_inline_autoc
Seigo Nonaka
2012/10/10 10:18:22
Done.
|
+ (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 |
falken
2012/10/10 09:51:33
I think the CUAS acronym isn't widely known. Consi
Seigo Nonaka
2012/10/10 10:18:22
Done.
|
+ // translates it into IMM32 protocol like WM_IME_COMPOSITION. As a result, |
falken
2012/10/10 09:51:33
"into an IMM32 protocol message"
Seigo Nonaka
2012/10/10 10:18:22
Done.
|
+ // auto-completed text will not be updated as expected. To workaround this |
+ // issue, temporary disable auto-completion 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; |
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; |
} |