OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.annotation.TargetApi; |
| 8 import android.os.Build; |
7 import android.os.SystemClock; | 9 import android.os.SystemClock; |
8 import android.text.Editable; | 10 import android.text.Editable; |
9 import android.text.InputType; | 11 import android.text.InputType; |
10 import android.text.Selection; | 12 import android.text.Selection; |
11 import android.text.TextUtils; | 13 import android.text.TextUtils; |
12 import android.util.Log; | 14 import android.util.Log; |
13 import android.view.KeyCharacterMap; | 15 import android.view.KeyCharacterMap; |
14 import android.view.KeyEvent; | 16 import android.view.KeyEvent; |
15 import android.view.View; | 17 import android.view.View; |
16 import android.view.inputmethod.BaseInputConnection; | 18 import android.view.inputmethod.BaseInputConnection; |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 } | 561 } |
560 updateSelectionIfRequired(); | 562 updateSelectionIfRequired(); |
561 | 563 |
562 CharSequence regionText = null; | 564 CharSequence regionText = null; |
563 if (b > a) { | 565 if (b > a) { |
564 regionText = mEditable.subSequence(a, b); | 566 regionText = mEditable.subSequence(a, b); |
565 } | 567 } |
566 return mImeAdapter.setComposingRegion(regionText, a, b); | 568 return mImeAdapter.setComposingRegion(regionText, a, b); |
567 } | 569 } |
568 | 570 |
| 571 /** |
| 572 * @see BaseInputConnection#requestCursorUpdates(int) |
| 573 */ |
| 574 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
| 575 @Override |
| 576 public boolean requestCursorUpdates(int cursorUpdateMode) { |
| 577 return mImeAdapter.onRequestCursorUpdates(cursorUpdateMode); |
| 578 } |
| 579 |
569 boolean isActive() { | 580 boolean isActive() { |
570 return getInputMethodManagerWrapper().isActive(mInternalView); | 581 return getInputMethodManagerWrapper().isActive(mInternalView); |
571 } | 582 } |
572 | 583 |
573 private InputMethodManagerWrapper getInputMethodManagerWrapper() { | 584 private InputMethodManagerWrapper getInputMethodManagerWrapper() { |
574 return mImeAdapter.getInputMethodManagerWrapper(); | 585 return mImeAdapter.getInputMethodManagerWrapper(); |
575 } | 586 } |
576 | 587 |
577 /** | 588 /** |
578 * This method works around the issue crbug.com/373934 where Blink does not
cancel | 589 * This method works around the issue crbug.com/373934 where Blink does not
cancel |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 @VisibleForTesting | 633 @VisibleForTesting |
623 ImeState getImeStateForTesting() { | 634 ImeState getImeStateForTesting() { |
624 String text = mEditable.toString(); | 635 String text = mEditable.toString(); |
625 int selectionStart = Selection.getSelectionStart(mEditable); | 636 int selectionStart = Selection.getSelectionStart(mEditable); |
626 int selectionEnd = Selection.getSelectionEnd(mEditable); | 637 int selectionEnd = Selection.getSelectionEnd(mEditable); |
627 int compositionStart = getComposingSpanStart(mEditable); | 638 int compositionStart = getComposingSpanStart(mEditable); |
628 int compositionEnd = getComposingSpanEnd(mEditable); | 639 int compositionEnd = getComposingSpanEnd(mEditable); |
629 return new ImeState(text, selectionStart, selectionEnd, compositionStart
, compositionEnd); | 640 return new ImeState(text, selectionStart, selectionEnd, compositionStart
, compositionEnd); |
630 } | 641 } |
631 } | 642 } |
OLD | NEW |