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

Unified Diff: content/renderer/render_widget.cc

Issue 1865143003: DO NOT SUBMIT: Handle nested message correctly for OnRequestTextInputState() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_widget.cc
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 0f53306133004e870e0fbca12970d1156fdd0860..a4b480084e91c581ecfb80f9c0b54f5fdce4c0a2 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -1662,9 +1662,8 @@ void RenderWidget::OnImeEventAck() {
}
void RenderWidget::OnRequestTextInputStateUpdate() {
- DCHECK(!ime_event_guard_);
Changwan Ryu 2016/04/07 11:48:18 FYI, this DCHECK was introduced in https://codere
- UpdateSelectionBounds();
- UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME);
+ ImeEventGuard guard(this);
+ ime_event_guard_->set_from_ime(true);
}
#endif
@@ -1785,13 +1784,21 @@ void RenderWidget::OnImeEventGuardStart(ImeEventGuard* guard) {
void RenderWidget::OnImeEventGuardFinish(ImeEventGuard* guard) {
if (ime_event_guard_ != guard) {
#if defined(OS_ANDROID)
- // In case a from-IME event (e.g. touch) ends up in not-from-IME event
- // (e.g. long press gesture), we want to treat it as not-from-IME event
- // so that ReplicaInputConnection can make changes to its Editable model.
- // Therefore, we want to mark this text state update as 'from IME' only
- // when all the nested events are all originating from IME.
- ime_event_guard_->set_from_ime(
- ime_event_guard_->from_ime() && guard->from_ime());
+ if (IsUsingImeThread()) {
+ // When a from-IME event (OnRequestTextInputStateUpdate) as nested by a
+ // not-from-IME event (e.g. HandleInputEvent), then we still need to
+ // deliver the data. Otherwise, ThreadedInputConnection might hang.
+ ime_event_guard_->set_from_ime(
+ ime_event_guard_->from_ime() || guard->from_ime());
+ } else {
+ // In case a from-IME event (e.g. touch) ends up in not-from-IME event
+ // (e.g. long press gesture), we want to treat it as not-from-IME event
+ // so that ReplicaInputConnection can make changes to its Editable model.
+ // Therefore, we want to mark this text state update as 'from IME' only
+ // when all the nested events are all originating from IME.
+ ime_event_guard_->set_from_ime(
+ ime_event_guard_->from_ime() && guard->from_ime());
+ }
#endif
return;
}
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698