Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java |
| index 5467df76b7b4c3a693e2f05c1f9cbb21e70afc49..33724eec99b9589305e25de76b7956c4f4f6e0a2 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/ThreadedInputConnection.java |
| @@ -272,12 +272,23 @@ public class ThreadedInputConnection implements ChromiumBaseInputConnection { |
| @Override |
| public boolean setComposingText(final CharSequence text, final int newCursorPosition) { |
| if (DEBUG_LOGS) Log.w(TAG, "setComposingText [%s] [%d]", text, newCursorPosition); |
| + return updateComposingText(text, newCursorPosition, false); |
| + } |
| + |
| + /** |
| + * Sends composing update to the InputMethodManager. |
| + */ |
| + @VisibleForTesting |
| + public boolean updateComposingText( |
|
Yaron
2016/03/23 21:21:04
package-protected (no visibility modifier) should
|
| + final CharSequence text, final int newCursorPosition, final boolean isPendingAccent) { |
| + final int accentToSend = |
| + isPendingAccent ? (mPendingAccent | KeyCharacterMap.COMBINING_ACCENT) : 0; |
| assertOnImeThread(); |
| cancelCombiningAccent(); |
| ThreadUtils.postOnUiThread(new Runnable() { |
| @Override |
| public void run() { |
| - mImeAdapter.sendCompositionToNative(text, newCursorPosition, false); |
| + mImeAdapter.sendCompositionToNative(text, newCursorPosition, false, accentToSend); |
| } |
| }); |
| notifyUserAction(); |
| @@ -295,7 +306,7 @@ public class ThreadedInputConnection implements ChromiumBaseInputConnection { |
| ThreadUtils.postOnUiThread(new Runnable() { |
| @Override |
| public void run() { |
| - mImeAdapter.sendCompositionToNative(text, newCursorPosition, text.length() > 0); |
| + mImeAdapter.sendCompositionToNative(text, newCursorPosition, text.length() > 0, 0); |
| } |
| }); |
| notifyUserAction(); |
| @@ -436,8 +447,8 @@ public class ThreadedInputConnection implements ChromiumBaseInputConnection { |
| int pendingAccent = unicodeChar & KeyCharacterMap.COMBINING_ACCENT_MASK; |
| StringBuilder builder = new StringBuilder(); |
| builder.appendCodePoint(pendingAccent); |
| - setComposingText(builder.toString(), 1); |
| - mPendingAccent = pendingAccent; |
| + updateComposingText(builder.toString(), 1, true); |
| + setCombiningAccent(pendingAccent); |
| return true; |
| } else if (mPendingAccent != 0 && unicodeChar != 0) { |
| int combined = KeyEvent.getDeadChar(mPendingAccent, unicodeChar); |
| @@ -454,6 +465,11 @@ public class ThreadedInputConnection implements ChromiumBaseInputConnection { |
| return false; |
| } |
| + @VisibleForTesting |
| + public void setCombiningAccent(int pendingAccent) { |
|
Yaron
2016/03/23 21:21:04
drop "public"
|
| + mPendingAccent = pendingAccent; |
| + } |
| + |
| private void cancelCombiningAccent() { |
| mPendingAccent = 0; |
| } |