OLD | NEW |
---|---|
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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 // If this is a commit with no previous composition, then treat it a s a native | 433 // If this is a commit with no previous composition, then treat it a s a native |
434 // KeyDown/KeyUp pair with no composition rather than a synthetic pa ir with | 434 // KeyDown/KeyUp pair with no composition rather than a synthetic pa ir with |
435 // composition below. | 435 // composition below. |
436 if (keyCode > 0 && isCommit && mLastComposeText == null) { | 436 if (keyCode > 0 && isCommit && mLastComposeText == null) { |
437 mLastSyntheticKeyCode = keyCode; | 437 mLastSyntheticKeyCode = keyCode; |
438 return translateAndSendNativeEvents(keyEvent, 0) | 438 return translateAndSendNativeEvents(keyEvent, 0) |
439 && translateAndSendNativeEvents( | 439 && translateAndSendNativeEvents( |
440 KeyEvent.changeAction(keyEvent, KeyEvent.ACTION_ UP), 0); | 440 KeyEvent.changeAction(keyEvent, KeyEvent.ACTION_ UP), 0); |
441 } | 441 } |
442 | 442 |
443 // If autocomplete=off then use heuristic to compute keyEvent. | |
bcwhite
2015/01/12 20:56:04
Add link to the related issue.
| |
444 if ((mTextInputFlags & sTextInputFlagAutocompleteOff) == 0) { | |
445 keyCode = COMPOSITION_KEY_CODE; | |
446 modifiers = 0; | |
447 } | |
448 | |
443 // When typing, there is no issue sending KeyDown and KeyUp events a round the | 449 // When typing, there is no issue sending KeyDown and KeyUp events a round the |
444 // composition event because those key events do nothing (other than call JS | 450 // composition event because those key events do nothing (other than call JS |
445 // handlers). Typing does not cause changes outside of a KeyPress e vent which | 451 // handlers). Typing does not cause changes outside of a KeyPress e vent which |
446 // we don't call here. However, if the key-code is a control key su ch as | 452 // we don't call here. However, if the key-code is a control key su ch as |
447 // KEYCODE_DEL then there never is an associated KeyPress event and the KeyDown | 453 // KEYCODE_DEL then there never is an associated KeyPress event and the KeyDown |
448 // event itself causes the action. The net result below is that the Renderer calls | 454 // event itself causes the action. The net result below is that the Renderer calls |
449 // cancelComposition() and then Android starts anew with setComposin gRegion(). | 455 // cancelComposition() and then Android starts anew with setComposin gRegion(). |
450 // This stopping and restarting of composition could be a source of problems | 456 // This stopping and restarting of composition could be a source of problems |
451 // with 3rd party keyboards. | 457 // with 3rd party keyboards. |
452 // | 458 // |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
710 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , | 716 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , |
711 int before, int after); | 717 int before, int after); |
712 | 718 |
713 private native void nativeUnselect(long nativeImeAdapterAndroid); | 719 private native void nativeUnselect(long nativeImeAdapterAndroid); |
714 private native void nativeSelectAll(long nativeImeAdapterAndroid); | 720 private native void nativeSelectAll(long nativeImeAdapterAndroid); |
715 private native void nativeCut(long nativeImeAdapterAndroid); | 721 private native void nativeCut(long nativeImeAdapterAndroid); |
716 private native void nativeCopy(long nativeImeAdapterAndroid); | 722 private native void nativeCopy(long nativeImeAdapterAndroid); |
717 private native void nativePaste(long nativeImeAdapterAndroid); | 723 private native void nativePaste(long nativeImeAdapterAndroid); |
718 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 724 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
719 } | 725 } |
OLD | NEW |