| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 } | 546 } |
| 545 updateSelectionIfRequired(); | 547 updateSelectionIfRequired(); |
| 546 | 548 |
| 547 CharSequence regionText = null; | 549 CharSequence regionText = null; |
| 548 if (b > a) { | 550 if (b > a) { |
| 549 regionText = mEditable.subSequence(a, b); | 551 regionText = mEditable.subSequence(a, b); |
| 550 } | 552 } |
| 551 return mImeAdapter.setComposingRegion(regionText, a, b); | 553 return mImeAdapter.setComposingRegion(regionText, a, b); |
| 552 } | 554 } |
| 553 | 555 |
| 556 /** |
| 557 * @see BaseInputConnection#requestCursorUpdates(int) |
| 558 */ |
| 559 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
| 560 @Override |
| 561 public boolean requestCursorUpdates(int cursorUpdateMode) { |
| 562 return mImeAdapter.requestCursorUpdates(cursorUpdateMode); |
| 563 } |
| 564 |
| 554 boolean isActive() { | 565 boolean isActive() { |
| 555 return getInputMethodManagerWrapper().isActive(mInternalView); | 566 return getInputMethodManagerWrapper().isActive(mInternalView); |
| 556 } | 567 } |
| 557 | 568 |
| 558 private InputMethodManagerWrapper getInputMethodManagerWrapper() { | 569 private InputMethodManagerWrapper getInputMethodManagerWrapper() { |
| 559 return mImeAdapter.getInputMethodManagerWrapper(); | 570 return mImeAdapter.getInputMethodManagerWrapper(); |
| 560 } | 571 } |
| 561 | 572 |
| 562 /** | 573 /** |
| 563 * This method works around the issue crbug.com/373934 where Blink does not
cancel | 574 * 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... |
| 607 @VisibleForTesting | 618 @VisibleForTesting |
| 608 ImeState getImeStateForTesting() { | 619 ImeState getImeStateForTesting() { |
| 609 String text = mEditable.toString(); | 620 String text = mEditable.toString(); |
| 610 int selectionStart = Selection.getSelectionStart(mEditable); | 621 int selectionStart = Selection.getSelectionStart(mEditable); |
| 611 int selectionEnd = Selection.getSelectionEnd(mEditable); | 622 int selectionEnd = Selection.getSelectionEnd(mEditable); |
| 612 int compositionStart = getComposingSpanStart(mEditable); | 623 int compositionStart = getComposingSpanStart(mEditable); |
| 613 int compositionEnd = getComposingSpanEnd(mEditable); | 624 int compositionEnd = getComposingSpanEnd(mEditable); |
| 614 return new ImeState(text, selectionStart, selectionEnd, compositionStart
, compositionEnd); | 625 return new ImeState(text, selectionStart, selectionEnd, compositionStart
, compositionEnd); |
| 615 } | 626 } |
| 616 } | 627 } |
| OLD | NEW |