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

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

Issue 2309983002: Allow selection change update before beginBatchEdit (Closed)
Patch Set: fixed a test failure Created 4 years, 3 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 12a42b6ce29084078dbba6232de6697496314c32..c8447b0e7cf88b35d5e2948a92549eaaabaf3231 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
@@ -306,9 +306,10 @@ public class ImeAdapter {
* @param compositionEnd The character offset of the composition end, or -1 if there is no
* selection.
* @param isNonImeChange True when the update was caused by non-IME (e.g. Javascript).
+ * @param inBatchEditMode True when in batch edit mode.
*/
public void updateState(String text, int selectionStart, int selectionEnd, int compositionStart,
- int compositionEnd, boolean isNonImeChange) {
+ int compositionEnd, boolean isNonImeChange, boolean inBatchEditMode) {
if (mCursorAnchorInfoController != null && (!TextUtils.equals(mLastText, text)
|| mLastSelectionStart != selectionStart || mLastSelectionEnd != selectionEnd
|| mLastCompositionStart != compositionStart
@@ -325,7 +326,7 @@ public class ImeAdapter {
boolean singleLine = mTextInputType != TextInputType.TEXT_AREA
&& mTextInputType != TextInputType.CONTENT_EDITABLE;
mInputConnection.updateStateOnUiThread(text, selectionStart, selectionEnd, compositionStart,
- compositionEnd, singleLine, isNonImeChange);
+ compositionEnd, singleLine, isNonImeChange, inBatchEditMode);
}
/**
@@ -679,6 +680,25 @@ public class ImeAdapter {
}
/**
+ * Send a request to the native counterpart to begin batch edit.
+ */
+ boolean beginBatchEdit() {
+ if (mNativeImeAdapterAndroid == 0) return false;
+ if (mInputConnection == null) return false;
+ return nativeBeginBatchEdit(mNativeImeAdapterAndroid);
+ }
+
+ /**
+ * Send a request to the native counterpart to end batch edit.
+ */
+ boolean endBatchEdit() {
+ if (mNativeImeAdapterAndroid == 0) return false;
+ // You won't get state update anyways.
+ if (mInputConnection == null) return false;
+ return nativeEndBatchEdit(mNativeImeAdapterAndroid);
+ }
+
+ /**
* Notified when IME requested Chrome to change the cursor update mode.
*/
public boolean onRequestCursorUpdates(int cursorUpdateMode) {
@@ -778,7 +798,10 @@ public class ImeAdapter {
private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid,
int before, int after);
private native void nativeResetImeAdapter(long nativeImeAdapterAndroid);
- private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapterAndroid);
+ private native boolean nativeRequestTextInputStateUpdate(
+ long nativeImeAdapterAndroid);
+ private native boolean nativeBeginBatchEdit(long nativeImeAdapterAndroid);
+ private native boolean nativeEndBatchEdit(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