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

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

Issue 348413003: Generate key event for deleteSurroundingText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do no send the keycode Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1126a8040b0798b581ada643248e9ef4208629d0..d85273be9f59e92ddf388eeab157d6da9d7be89a 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
@@ -407,7 +407,15 @@ public class ImeAdapter {
*/
boolean deleteSurroundingText(int beforeLength, int afterLength) {
if (mNativeImeAdapterAndroid == 0) return false;
+ // Can't send the deletion key code yet because it will delete an extra char at the end.
+ // Also the deleteSurroundingText message is not always ordered properly with key event
+ // messages yet.
+ // TODO(guohui): fix the ordering and send the deletion key code for single-char deletion.
+ sendSyntheticKeyEvent(
+ sEventTypeRawKeyDown, SystemClock.uptimeMillis(), KeyEvent.KEYCODE_UNKNOWN, 0);
nativeDeleteSurroundingText(mNativeImeAdapterAndroid, beforeLength, afterLength);
+ sendSyntheticKeyEvent(
+ sEventTypeKeyUp, SystemClock.uptimeMillis(), KeyEvent.KEYCODE_UNKNOWN, 0);
return true;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698