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.content.res.Configuration; | 7 import android.content.res.Configuration; |
8 import android.os.Build; | 8 import android.os.Build; |
9 import android.os.ResultReceiver; | 9 import android.os.ResultReceiver; |
10 import android.os.SystemClock; | 10 import android.os.SystemClock; |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 if (mNativeImeAdapterAndroid == 0) return false; | 624 if (mNativeImeAdapterAndroid == 0) return false; |
625 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Raw
KeyDown, 0, | 625 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Raw
KeyDown, 0, |
626 SystemClock.uptimeMillis(), COMPOSITION_KEY_CODE, 0, false, 0); | 626 SystemClock.uptimeMillis(), COMPOSITION_KEY_CODE, 0, false, 0); |
627 nativeDeleteSurroundingText(mNativeImeAdapterAndroid, beforeLength, afte
rLength); | 627 nativeDeleteSurroundingText(mNativeImeAdapterAndroid, beforeLength, afte
rLength); |
628 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Key
Up, 0, | 628 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Key
Up, 0, |
629 SystemClock.uptimeMillis(), COMPOSITION_KEY_CODE, 0, false, 0); | 629 SystemClock.uptimeMillis(), COMPOSITION_KEY_CODE, 0, false, 0); |
630 return true; | 630 return true; |
631 } | 631 } |
632 | 632 |
633 /** | 633 /** |
| 634 * Send a request to the native counterpart to delete a given range of chara
cters. |
| 635 * @param beforeLength Number of code points to extend the selection by befo
re the existing |
| 636 * selection. |
| 637 * @param afterLength Number of code points to extend the selection by after
the existing |
| 638 * selection. |
| 639 * @return Whether the native counterpart of ImeAdapter received the call. |
| 640 */ |
| 641 boolean deleteSurroundingTextInCodePoints(int beforeLength, int afterLength)
{ |
| 642 mViewEmbedder.onImeEvent(); |
| 643 if (mNativeImeAdapterAndroid == 0) return false; |
| 644 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Raw
KeyDown, 0, |
| 645 SystemClock.uptimeMillis(), COMPOSITION_KEY_CODE, 0, false, 0); |
| 646 nativeDeleteSurroundingTextInCodePoints( |
| 647 mNativeImeAdapterAndroid, beforeLength, afterLength); |
| 648 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Key
Up, 0, |
| 649 SystemClock.uptimeMillis(), COMPOSITION_KEY_CODE, 0, false, 0); |
| 650 return true; |
| 651 } |
| 652 |
| 653 /** |
634 * Send a request to the native counterpart to set the selection to given ra
nge. | 654 * Send a request to the native counterpart to set the selection to given ra
nge. |
635 * @param start Selection start index. | 655 * @param start Selection start index. |
636 * @param end Selection end index. | 656 * @param end Selection end index. |
637 * @return Whether the native counterpart of ImeAdapter received the call. | 657 * @return Whether the native counterpart of ImeAdapter received the call. |
638 */ | 658 */ |
639 boolean setEditableSelectionOffsets(int start, int end) { | 659 boolean setEditableSelectionOffsets(int start, int end) { |
640 if (mNativeImeAdapterAndroid == 0) return false; | 660 if (mNativeImeAdapterAndroid == 0) return false; |
641 nativeSetEditableSelectionOffsets(mNativeImeAdapterAndroid, start, end); | 661 nativeSetEditableSelectionOffsets(mNativeImeAdapterAndroid, start, end); |
642 return true; | 662 return true; |
643 } | 663 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
774 String textStr, int newCursorPosition); | 794 String textStr, int newCursorPosition); |
775 private native void nativeCommitText( | 795 private native void nativeCommitText( |
776 long nativeImeAdapterAndroid, CharSequence text, String textStr, int
newCursorPosition); | 796 long nativeImeAdapterAndroid, CharSequence text, String textStr, int
newCursorPosition); |
777 private native void nativeFinishComposingText(long nativeImeAdapterAndroid); | 797 private native void nativeFinishComposingText(long nativeImeAdapterAndroid); |
778 private native void nativeAttachImeAdapter(long nativeImeAdapterAndroid); | 798 private native void nativeAttachImeAdapter(long nativeImeAdapterAndroid); |
779 private native void nativeSetEditableSelectionOffsets(long nativeImeAdapterA
ndroid, | 799 private native void nativeSetEditableSelectionOffsets(long nativeImeAdapterA
ndroid, |
780 int start, int end); | 800 int start, int end); |
781 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i
nt start, int end); | 801 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i
nt start, int end); |
782 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, | 802 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, |
783 int before, int after); | 803 int before, int after); |
| 804 private native void nativeDeleteSurroundingTextInCodePoints( |
| 805 long nativeImeAdapterAndroid, int before, int after); |
784 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 806 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
785 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt
erAndroid); | 807 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt
erAndroid); |
786 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, | 808 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, |
787 boolean immediateRequest, boolean monitorRequest); | 809 boolean immediateRequest, boolean monitorRequest); |
788 } | 810 } |
OLD | NEW |