Index: content/browser/renderer_host/text_input_manager.cc |
diff --git a/content/browser/renderer_host/text_input_manager.cc b/content/browser/renderer_host/text_input_manager.cc |
index faee51cc3cb9aad16e0cc340afe87ed2c3f54296..c21c03ab74f26dcdf629dc00f6380e67ba853690 100644 |
--- a/content/browser/renderer_host/text_input_manager.cc |
+++ b/content/browser/renderer_host/text_input_manager.cc |
@@ -86,7 +86,6 @@ void TextInputManager::UpdateTextInputState( |
RenderWidgetHostViewBase* view, |
const TextInputState& text_input_state) { |
DCHECK(IsRegistered(view)); |
- |
// Since |view| is registgered, we already have a previous value for its |
// TextInputState. |
bool changed = AreDifferentTextInputStates(text_input_state_map_[view], |
@@ -94,9 +93,25 @@ void TextInputManager::UpdateTextInputState( |
text_input_state_map_[view] = text_input_state; |
- // |active_view_| is only updated when the state for |view| is not none. |
- if (text_input_state.type != ui::TEXT_INPUT_TYPE_NONE) |
+ // If |view| is different from |active_view| and its |TextInputState.type| is |
+ // not NONE, |active_view_| should change to |view|. |
+ if (text_input_state.type != ui::TEXT_INPUT_TYPE_NONE && |
+ active_view_ != view) { |
+ if (active_view_) { |
+ // Ideally, we should always receive an IPC from |active_view_|'s |
+ // RenderWidget to reset its |TextInputState.type| to NONE, before any |
+ // other RenderWidget updates its TextInputState. But there is no |
+ // guarantee in the order of IPCs from different RenderWidges and another |
kenrb
2016/07/26 20:40:38
nit: Typo 'RenderWidges'
EhsanK
2016/07/26 21:27:56
Done.
|
+ // RenderWidget's IPC might arrive sooner and we reach here. To make the |
+ // IME behavior identical to the non-OOPIF case, we have to manually reset |
+ // the state for |active_view_|. |
+ text_input_state_map_[active_view_].type = ui::TEXT_INPUT_TYPE_NONE; |
+ RenderWidgetHostViewBase* active_view = active_view_; |
+ active_view_ = nullptr; |
+ NotifyObserversAboutInputStateUpdate(active_view, true); |
+ } |
active_view_ = view; |
+ } |
// If the state for |active_view_| is none, then we no longer have an |
// |active_view_|. |