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

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

Issue 2617443002: Implement ThreadedInputConnection.deleteSurroundingTextInCodePoints() (Closed)
Patch Set: Convert UTF8 to UTF16 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 df58b85a1caa6589cebf562a34cb16f6ee454732..ffe6593417c3466757d3dc1ed5f0ed8f9a2dc386 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