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

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

Issue 2617443002: Implement ThreadedInputConnection.deleteSurroundingTextInCodePoints() (Closed)
Patch Set: Add more comments Created 3 years, 11 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 9b34ac91c4e39ef9cb1bfd349358421fb3da7bdd..fc2a8489d497fa0caee5d5c5970e0a214775f232 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
@@ -635,6 +635,26 @@ public class ImeAdapter {
}
/**
+ * Send a request to the native counterpart to delete a given range of characters.
+ * @param beforeLength Number of code points to extend the selection by before the existing
+ * selection.
+ * @param afterLength Number of code points to extend the selection by after the existing
+ * selection.
+ * @return Whether the native counterpart of ImeAdapter received the call.
+ */
+ boolean deleteSurroundingTextInCodePoints(int beforeLength, int afterLength) {
+ mViewEmbedder.onImeEvent();
+ if (mNativeImeAdapterAndroid == 0) return false;
+ nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.RawKeyDown, 0,
+ SystemClock.uptimeMillis(), COMPOSITION_KEY_CODE, 0, false, 0);
+ nativeDeleteSurroundingTextInCodePoints(
+ mNativeImeAdapterAndroid, beforeLength, afterLength);
+ nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.KeyUp, 0,
+ SystemClock.uptimeMillis(), COMPOSITION_KEY_CODE, 0, false, 0);
+ return true;
+ }
+
+ /**
* Send a request to the native counterpart to set the selection to given range.
* @param start Selection start index.
* @param end Selection end index.
@@ -785,6 +805,8 @@ public class ImeAdapter {
private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, int start, int end);
private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid,
int before, int after);
+ private native void nativeDeleteSurroundingTextInCodePoints(
+ long nativeImeAdapterAndroid, int before, int after);
private native void nativeResetImeAdapter(long nativeImeAdapterAndroid);
private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapterAndroid);
private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid,

Powered by Google App Engine
This is Rietveld 408576698