| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| index 16ccc5948c83bfda876a1e262af632db398f45fc..a3e4b086aaa726ce7fe8914223888c809c066347 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
|
| @@ -1315,6 +1315,10 @@ public class ContentViewCore
|
| private void hidePopupsAndClearSelection() {
|
| mUnselectAllOnActionModeDismiss = true;
|
| hidePopups();
|
| + // Clear the selection. The selection is cleared on destroying IME
|
| + // and also here since we may receive destroy first, for example
|
| + // when focus is lost in webview.
|
| + clearUserSelection();
|
| }
|
|
|
| private void hidePopupsAndPreserveSelection() {
|
| @@ -1322,6 +1326,17 @@ public class ContentViewCore
|
| hidePopups();
|
| }
|
|
|
| + private void clearUserSelection() {
|
| + if (isSelectionEditable()) {
|
| + if (mInputConnection != null) {
|
| + int selectionEnd = Selection.getSelectionEnd(mEditable);
|
| + mInputConnection.setSelection(selectionEnd, selectionEnd);
|
| + }
|
| + } else if (mImeAdapter != null) {
|
| + mImeAdapter.unselect();
|
| + }
|
| + }
|
| +
|
| private void hidePopups() {
|
| hideSelectActionBar();
|
| hidePastePopup();
|
| @@ -1927,12 +1942,7 @@ public class ContentViewCore
|
| mActionMode = null;
|
| if (mUnselectAllOnActionModeDismiss) {
|
| hideTextHandles();
|
| - if (isSelectionEditable()) {
|
| - int selectionEnd = Selection.getSelectionEnd(mEditable);
|
| - mInputConnection.setSelection(selectionEnd, selectionEnd);
|
| - } else {
|
| - mImeAdapter.unselect();
|
| - }
|
| + clearUserSelection();
|
| }
|
| getContentViewClient().onContextualActionBarHidden();
|
| }
|
|
|