summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelim Gurun <sgurun@google.com>2014-11-13 22:04:38 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-13 22:04:38 +0000
commit3eaa0a6864d789c352be4a8216f2797a475e01e0 (patch)
tree4a0465b8f3e5f224860a644b7081373aa62352e7
parent66b65590bbb54dab9b24d1973ea44deaee01a95d (diff)
parent5154ef920639c9c98a8ae94355a7247c2fd82dc4 (diff)
downloadchromium_org-3eaa0a6864d789c352be4a8216f2797a475e01e0.tar.gz
Merge "Clear the selection when hiding the handles" into m39
-rw-r--r--content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java22
1 files changed, 16 insertions, 6 deletions
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 001238487c..234bc47654 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
@@ -1289,6 +1289,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() {
@@ -1296,6 +1300,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();
@@ -1909,12 +1924,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();
}