Index: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java |
index d3f14cf6423be7e60d96f9548fce08b54ecd930e..6015060aa930e99d43012bdab9e92c7a6f7b0f53 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java |
@@ -16,7 +16,10 @@ import android.text.style.UnderlineSpan; |
import android.view.KeyCharacterMap; |
import android.view.KeyEvent; |
import android.view.View; |
+import android.view.inputmethod.CursorAnchorInfo; |
import android.view.inputmethod.EditorInfo; |
+import android.view.inputmethod.InputConnection; |
+import android.view.inputmethod.InputMethodManager; |
import org.chromium.base.CalledByNative; |
import org.chromium.base.JNINamespace; |
@@ -566,6 +569,17 @@ public class ImeAdapter { |
} |
/** |
+ * Send a request to the native counterpart to call back |
+ * {@link InputMethodManager#updateCursorAnchorInfo(View, CursorAnchorInfo)} when necessary. |
+ * @param cursorUpdateMode The flag passed to {@link InputConnection#requestCursorUpdates(int)}. |
+ * @return Whether the native counterpart of ImeAdapter received the call. |
+ */ |
+ boolean requestCursorUpdates(int cursorUpdateMode) { |
+ if (mNativeImeAdapterAndroid == 0) return false; |
+ return nativeRequestCursorUpdates(mNativeImeAdapterAndroid, cursorUpdateMode); |
+ } |
+ |
+ /** |
* Send a request to the native counterpart to unselect text. |
* @return Whether the native counterpart of ImeAdapter received the call. |
*/ |
@@ -623,6 +637,14 @@ public class ImeAdapter { |
} |
@CalledByNative |
+ private void updateCursorAnchorInfo(Object cursorAnchorInfo) { |
+ if (cursorAnchorInfo instanceof CursorAnchorInfo) { |
+ mInputMethodManagerWrapper.updateCursorAnchorInfo(mViewEmbedder.getAttachedView(), |
+ (CursorAnchorInfo) cursorAnchorInfo); |
+ } |
+ } |
+ |
+ @CalledByNative |
private void populateUnderlinesFromSpans(CharSequence text, long underlines) { |
if (!(text instanceof SpannableString)) return; |
@@ -686,6 +708,9 @@ public class ImeAdapter { |
private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid, |
int before, int after); |
+ private native boolean nativeRequestCursorUpdates(long nativeImeAdapterAndroid, |
+ int cursorUpdateMode); |
+ |
private native void nativeUnselect(long nativeImeAdapterAndroid); |
private native void nativeSelectAll(long nativeImeAdapterAndroid); |
private native void nativeCut(long nativeImeAdapterAndroid); |