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

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

Issue 842493004: [Clank IME] Make keyCode detection sensitive to autocomplete=on|off. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing heuristic for English composition to work. Created 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser.input; 5 package org.chromium.content.browser.input;
6 6
7 import android.os.Handler; 7 import android.os.Handler;
8 import android.os.ResultReceiver; 8 import android.os.ResultReceiver;
9 import android.os.SystemClock; 9 import android.os.SystemClock;
10 import android.text.Editable; 10 import android.text.Editable;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 return androidKeyEventForCharacter(newtext.charAt(0)); 374 return androidKeyEventForCharacter(newtext.charAt(0));
375 } else { 375 } else {
376 return null; 376 return null;
377 } 377 }
378 } 378 }
379 379
380 // The content has grown in length: assume the last character is the key that caused it. 380 // The content has grown in length: assume the last character is the key that caused it.
381 if (newtext.length() > oldtext.length() && newtext.startsWith(oldtext)) 381 if (newtext.length() > oldtext.length() && newtext.startsWith(oldtext))
382 return androidKeyEventForCharacter(newtext.charAt(newtext.length() - 1)); 382 return androidKeyEventForCharacter(newtext.charAt(newtext.length() - 1));
383 383
384 // The content has shrunk in length: assume that backspace was pressed. 384 // The content has shrunk in length: assume that backspace was pressed, unless a deleted
385 if (oldtext.length() > newtext.length() && oldtext.startsWith(newtext)) 385 // character (last element of |oldtext|) has no corresponding key event. This prevents
386 // Japanese IME compositions from being cleared on backspace (see crbug. com/422685).
387 if (oldtext.length() > newtext.length() && oldtext.startsWith(newtext)
388 && androidKeyEventForCharacter(oldtext.charAt(oldtext.length() - 1)) != null)
bcwhite 2015/01/09 22:52:44 Have you tested this as working? A potential prob
386 return new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL); 389 return new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DEL);
387 390
388 // The content is unchanged or has undergone a complex change (i.e. not a simple tail 391 // The content is unchanged or has undergone a complex change (i.e. not a simple tail
389 // modification) so return an unknown key-code. 392 // modification) so return an unknown key-code.
390 return null; 393 return null;
391 } 394 }
392 395
393 void sendKeyEventWithKeyCode(int keyCode, int flags) { 396 void sendKeyEventWithKeyCode(int keyCode, int flags) {
394 long eventTime = SystemClock.uptimeMillis(); 397 long eventTime = SystemClock.uptimeMillis();
395 mLastSyntheticKeyCode = keyCode; 398 mLastSyntheticKeyCode = keyCode;
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , 713 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid ,
711 int before, int after); 714 int before, int after);
712 715
713 private native void nativeUnselect(long nativeImeAdapterAndroid); 716 private native void nativeUnselect(long nativeImeAdapterAndroid);
714 private native void nativeSelectAll(long nativeImeAdapterAndroid); 717 private native void nativeSelectAll(long nativeImeAdapterAndroid);
715 private native void nativeCut(long nativeImeAdapterAndroid); 718 private native void nativeCut(long nativeImeAdapterAndroid);
716 private native void nativeCopy(long nativeImeAdapterAndroid); 719 private native void nativeCopy(long nativeImeAdapterAndroid);
717 private native void nativePaste(long nativeImeAdapterAndroid); 720 private native void nativePaste(long nativeImeAdapterAndroid);
718 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); 721 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid);
719 } 722 }
OLDNEW
« 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