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

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

Issue 2121953002: Do not calculate composition bounds until IME requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test failures Created 4 years, 4 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
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 8c1ae7a6652c3371c7a374969838f42c4d5f1805..ade6398bbb375e7330f2b6b55340e0d7d0b206f2 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;
}
@@ -674,8 +682,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());
}
@@ -731,7 +747,8 @@ public class ImeAdapter {
@CalledByNative
private void setCharacterBounds(float[] characterBounds) {
if (mCursorAnchorInfoController == null) return;
- mCursorAnchorInfoController.setCompositionCharacterBounds(characterBounds);
+ mCursorAnchorInfoController.setCompositionCharacterBounds(characterBounds,
+ mViewEmbedder.getAttachedView());
}
@CalledByNative
@@ -763,5 +780,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);
}

Powered by Google App Engine
This is Rietveld 408576698