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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ImeAdapter.java

Issue 11741036: Adding a call to clear text composition on tap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: change java method name to restartInput Created 7 years, 11 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 | « no previous file | content/renderer/render_view_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ImeAdapter.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ImeAdapter.java b/content/public/android/java/src/org/chromium/content/browser/ImeAdapter.java
index 9614b54f60d13848ce890824a5a42e98ae6bf96c..88f9578f731751adf0b262c3155a8aa4fa608839 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ImeAdapter.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ImeAdapter.java
@@ -324,7 +324,7 @@ class ImeAdapter {
@CalledByNative
private void cancelComposition() {
if (mInputConnection != null) {
- mInputConnection.cancelComposition();
+ mInputConnection.restartInput();
}
}
@@ -546,13 +546,6 @@ class ImeAdapter {
return;
}
- // When a programmatic change has been made to the editable field, both the start
- // and end positions for the composition will equal zero. In this case we cancel the
- // active composition in the editor as this no longer is relevant.
- if (textUnchanged && compositionStart == 0 && compositionEnd == 0) {
- cancelComposition();
- }
-
if (!textUnchanged) {
editable.replace(0, editable.length(), text);
}
@@ -566,6 +559,13 @@ class ImeAdapter {
getInputMethodManager().updateSelection(mInternalView,
selectionStart, selectionEnd, compositionStart, compositionEnd);
}
+
+ // When WebKit changes the editable field, both the start and the end positions for
+ // the composition will be set to -1. In this case we have to call restart input
+ // for the IME to update its state.
+ if (textUnchanged && compositionStart == -1 && compositionEnd == -1) {
+ restartInput();
+ }
}
@Override
@@ -586,7 +586,7 @@ class ImeAdapter {
public boolean performEditorAction(int actionCode) {
switch (actionCode) {
case EditorInfo.IME_ACTION_NEXT:
- cancelComposition();
+ restartInput();
// Send TAB key event
long timeStampMs = System.currentTimeMillis();
mImeAdapter.sendSyntheticKeyEvent(
@@ -687,11 +687,10 @@ class ImeAdapter {
}
/**
- * Informs the InputMethodManager and InputMethodSession (i.e. the IME) that there
- * is no longer a current composition. Note this differs from finishComposingText, which
- * is called by the IME when it wants to end a composition.
+ * Informs the InputMethodManager and InputMethodSession (i.e. the IME) that the text
+ * state is no longer what the IME has and that it needs to be updated.
*/
- void cancelComposition() {
+ void restartInput() {
getInputMethodManager().restartInput(mInternalView);
}
« no previous file with comments | « no previous file | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698