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 c52b32457b7907883dd501925ab411e3f2c5b903..e066eac062325a014e371c5a1d0a3b8890cce330 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 |
@@ -18,6 +18,7 @@ import android.view.KeyEvent; |
import android.view.View; |
import android.view.inputmethod.BaseInputConnection; |
import android.view.inputmethod.EditorInfo; |
+import android.view.inputmethod.InputConnection; |
import org.chromium.base.Log; |
import org.chromium.base.VisibleForTesting; |
@@ -192,8 +193,15 @@ public class ImeAdapter { |
mViewEmbedder.getAttachedView(), this, mTextInputType, mTextInputFlags, |
mLastSelectionStart, mLastSelectionEnd, outAttrs)); |
if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection: " + mInputConnection); |
+ |
if (mCursorAnchorInfoController != null) { |
- mCursorAnchorInfoController.resetMonitoringState(); |
+ mCursorAnchorInfoController.onRequestCursorUpdates( |
+ false /* not an immediate request */, false /* disable monitoring */, |
+ mViewEmbedder.getAttachedView()); |
+ } |
+ if (mNativeImeAdapterAndroid != 0) { |
+ nativeRequestCursorUpdate(mNativeImeAdapterAndroid, |
+ false /* not an immediate request */, false /* disable monitoring */); |
} |
return mInputConnection; |
} |
@@ -661,8 +669,16 @@ public class ImeAdapter { |
* Notified when IME requested Chrome to change the cursor update mode. |
*/ |
public boolean onRequestCursorUpdates(int cursorUpdateMode) { |
+ final boolean immediateRequest = |
+ (cursorUpdateMode & InputConnection.CURSOR_UPDATE_IMMEDIATE) != 0; |
+ final boolean monitorRequest = |
+ (cursorUpdateMode & InputConnection.CURSOR_UPDATE_MONITOR) != 0; |
+ |
+ if (mNativeImeAdapterAndroid != 0) { |
+ nativeRequestCursorUpdate(mNativeImeAdapterAndroid, immediateRequest, monitorRequest); |
+ } |
if (mCursorAnchorInfoController == null) return false; |
- return mCursorAnchorInfoController.onRequestCursorUpdates(cursorUpdateMode, |
+ return mCursorAnchorInfoController.onRequestCursorUpdates(immediateRequest, monitorRequest, |
mViewEmbedder.getAttachedView()); |
} |
@@ -718,7 +734,8 @@ public class ImeAdapter { |
@CalledByNative |
private void setCharacterBounds(float[] characterBounds) { |
if (mCursorAnchorInfoController == null) return; |
- mCursorAnchorInfoController.setCompositionCharacterBounds(characterBounds); |
+ mCursorAnchorInfoController.setCompositionCharacterBounds(characterBounds, |
+ mViewEmbedder.getAttachedView()); |
} |
@CalledByNative |
@@ -750,5 +767,7 @@ public class ImeAdapter { |
int before, int after); |
private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapterAndroid); |
+ private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, |
+ boolean immediateRequest, boolean monitorRequest); |
private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid); |
} |