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

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: Address comments Created 4 years, 5 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 c52b32457b7907883dd501925ab411e3f2c5b903..28b82393258ca3653568fe5cb0c2dd27ddecae12 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;
@@ -57,6 +58,8 @@ public class ImeAdapter {
private static final int COMPOSITION_KEY_CODE = 229;
+ private static final int DISABLE_CURSOR_UPDATE = 0;
+
/**
* Interface for the delegate that needs to be notified of IME changes.
*/
@@ -193,7 +196,7 @@ public class ImeAdapter {
mLastSelectionStart, mLastSelectionEnd, outAttrs));
if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection: " + mInputConnection);
if (mCursorAnchorInfoController != null) {
- mCursorAnchorInfoController.resetMonitoringState();
+ onRequestCursorUpdates(DISABLE_CURSOR_UPDATE);
Changwan Ryu 2016/07/07 01:05:36 How about just calling mCursorAnchorInfoController
Seigo Nonaka 2016/07/07 13:38:26 Sure fixed.
}
return mInputConnection;
}
@@ -661,8 +664,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 +729,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 +762,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