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

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

Issue 1011523002: Confirm the compostion text on TAP gesture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
Index: content/browser/renderer_host/render_widget_host_view_android.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 339fec9359479b8e4d1c9ffaf578260748595c82..c65266ef7ee1cd848d317db98c9ae1be4eb4f31d 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -1744,6 +1744,11 @@ void RenderWidgetHostViewAndroid::RunAckCallbacks() {
void RenderWidgetHostViewAndroid::OnGestureEvent(
const ui::GestureEventData& gesture) {
+ // Confirm existing composition text on TAP gesture, to make sure the input
+ // caret won't be moved with an ongoing composition text.
+ if (gesture.type() == ui::ET_GESTURE_TAP)
+ FinishImeCompositionSession();
+
blink::WebGestureEvent web_gesture =
CreateWebGestureEventFromGestureEventData(gesture);
// TODO(jdduke): Remove this workaround after Android fixes UiAutomator to
@@ -1928,6 +1933,16 @@ void RenderWidgetHostViewAndroid::OnStylusSelectTap(base::TimeTicks time,
SendGestureEvent(long_press);
}
+void RenderWidgetHostViewAndroid::FinishImeCompositionSession() {
+ if (!ime_adapter_android_.HasComposition())
+ return;
+ if (host_) {
+ host_->ImeConfirmComposition(base::string16(), gfx::Range::InvalidRange(),
aurimas (slooooooooow) 2015/03/19 05:40:30 This will get called even if the user taps inside
+ false);
+ }
+ ImeCancelComposition();
+}
+
// static
void RenderWidgetHostViewBase::GetDefaultScreenInfo(
blink::WebScreenInfo* results) {

Powered by Google App Engine
This is Rietveld 408576698