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

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

Issue 2838023002: Only do Smart Select if one word is selected. (Closed)
Patch Set: timav nit Created 3 years, 8 months 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/SelectionPopupController.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
index 0012b5b1b0150d4da1713f251df91ffd5c2177a9..8a8cc8ef08cfe4ae922c58bfafc8fa0cb91751fa 100644
--- a/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
+++ b/content/public/android/java/src/org/chromium/content/browser/SelectionPopupController.java
@@ -844,7 +844,15 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
mSelectionRect.set(left, top, right, bottom);
mHasSelection = true;
mUnselectAllOnDismiss = true;
- if (mSelectionClient == null || !mSelectionClient.sendsSelectionPopupUpdates()) {
+ // When this event comes as the result of SelectAll, SelectionClient should not
+ // change the selection range (http://crbug.com/714106). We assume that two or
+ // more selected words means SelectAll.
+ // TODO(amaralp): Find a better way to know that SELECTION_HANDLES_SHOWN was
+ // caused by SelectAll.
+ boolean oneWordSelected =
+ !getSelectedText().isEmpty() && !getSelectedText().matches(".*\\s+.*");
+ if (!oneWordSelected || mSelectionClient == null
+ || !mSelectionClient.sendsSelectionPopupUpdates()) {
showActionModeOrClearOnFailure();
} else {
// Rely on |mSelectionClient| sending a classification request and the request
« 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