Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 713493003: Clear the selection when hiding the handles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a null check Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698