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

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: Fix the failing test on ASAN bots 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 | « chrome/browser/renderer_host/site_per_process_text_input_browsertest.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 eed20121103d96cdaaec68cdcafea5ecacc241a6..474f0f6f8b7dfba9dc6eef1256413d552ef9c355 100644
--- a/content/browser/renderer_host/text_input_manager.cc
+++ b/content/browser/renderer_host/text_input_manager.cc
@@ -85,8 +85,16 @@ void TextInputManager::UpdateTextInputState(
text_input_state_map_[view] = text_input_state;
// |active_view_| is only updated when the state for |view| is not none.
Charlie Reis 2016/07/21 23:48:18 Let's update this as well. Maybe that it "only ne
EhsanK 2016/07/25 21:09:57 Acknowledged.
- if (text_input_state.type != ui::TEXT_INPUT_TYPE_NONE)
+ if (text_input_state.type != ui::TEXT_INPUT_TYPE_NONE &&
+ active_view_ != view) {
+ // |view| will become the new |active_view_|, which means the IPC to reset
+ // the TextInputState for |active_view_| has not arrived yet (and will be
+ // ignored later). So we should reset the TextInputState for |active_view_|
+ // manually.
+ if (active_view_)
+ UpdateTextInputState(active_view_, TextInputState());
Charlie Reis 2016/07/21 23:48:18 This has a small risk of becoming an infinite recu
EhsanK 2016/07/25 21:09:57 The only reason I used recursion like this was to
active_view_ = view;
+ }
// If the state for |active_view_| is none, then we no longer have an
// |active_view_|.
@@ -233,4 +241,4 @@ TextInputManager::CompositionRangeInfo::CompositionRangeInfo(
TextInputManager::CompositionRangeInfo::~CompositionRangeInfo() {}
-} // namespace content
+} // namespace content
« no previous file with comments | « chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698