Index: chrome/browser/renderer_host/gtk_im_context_wrapper.cc |
diff --git a/chrome/browser/renderer_host/gtk_im_context_wrapper.cc b/chrome/browser/renderer_host/gtk_im_context_wrapper.cc |
index 4b7f7ad7a43bb876f92d99e519ee862e36e0ab91..0705682c512511cac34f5085ee0b2611ef6c6a10 100644 |
--- a/chrome/browser/renderer_host/gtk_im_context_wrapper.cc |
+++ b/chrome/browser/renderer_host/gtk_im_context_wrapper.cc |
@@ -270,10 +270,12 @@ void GtkIMContextWrapper::CancelComposition() { |
gtk_im_context_reset(context_); |
gtk_im_context_reset(context_simple_); |
- // Some input methods may not honour the reset call. Focusing out/in the |
- // |context_| to make sure it gets reset correctly. |
- gtk_im_context_focus_out(context_); |
- gtk_im_context_focus_in(context_); |
+ if (is_focused_) { |
+ // Some input methods may not honour the reset call. Focusing out/in the |
+ // |context_| to make sure it gets reset correctly. |
+ gtk_im_context_focus_out(context_); |
+ gtk_im_context_focus_in(context_); |
+ } |
is_composing_text_ = false; |
preedit_text_.clear(); |