Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: content/browser/renderer_host/text_input_manager.cc

Issue 2171443003: In TextInputManager, reset input type to none before switching active widgets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed a typo in comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_|.
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698