From 105dffb48c7035e19144347625e796cc7f9d8fe1 Mon Sep 17 00:00:00 2001
From: "yusufo@chromium.org"
 <yusufo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 20 Feb 2013 03:46:21 +0000
Subject: Ignore textInputState updates during a batch edit

According to the Android spec, when the Ime is in a batchEdit we should not
be calling updateSelection which we currently do through the setEditableText call.
This calls gets triggered by updateTextInputState calls coming from the
render_widget. This patch adds one browser->renderer and one renderer-> browser
IPC so that the Java IME adapter can distinguish between updates coming during a
batch edit and ignore them properly.

BUG=172845
NOTRY=true

Review URL: https://chromiumcodereview.appspot.com/12262026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183400 0039d316-1c4b-4281-b951-d872f2087c98
---
 content/browser/renderer_host/ime_adapter_android.cc | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'content/browser/renderer_host/ime_adapter_android.cc')

diff --git a/content/browser/renderer_host/ime_adapter_android.cc b/content/browser/renderer_host/ime_adapter_android.cc
index ee622bd..c5c4ad8 100644
--- a/content/browser/renderer_host/ime_adapter_android.cc
+++ b/content/browser/renderer_host/ime_adapter_android.cc
@@ -153,6 +153,16 @@ void ImeAdapterAndroid::SetComposingText(JNIEnv* env, jobject, jstring text,
   rwhi->ImeSetComposition(text16, underlines, new_cursor_pos, new_cursor_pos);
 }
 
+void ImeAdapterAndroid::ImeBatchStateChanged(JNIEnv* env,
+                                             jobject,
+                                             jboolean is_begin) {
+  RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(
+      rwhva_->GetRenderWidgetHost());
+  if (!rwhi)
+    return;
+
+  rwhi->Send(new ViewMsg_ImeBatchStateChanged(rwhi->GetRoutingID(), is_begin));
+}
 
 void ImeAdapterAndroid::CommitText(JNIEnv* env, jobject, jstring text) {
   RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(
-- 
cgit v1.1