Commit 4bceb980 authored by aelias's avatar aelias Committed by Commit bot

Revert of Only do Smart Select if one word is selected. (patchset #4 id:60001...

Revert of Only do Smart Select if one word is selected. (patchset #4 id:60001 of https://codereview.chromium.org/2838023002/ )

Reason for revert:
Null pointer crash http://crbug.com/715526

BUG=715526

Original issue's description:
> Only do Smart Select if one word is selected.
>
> There is a bug where after "Select All" Smart Select will suggest a different
> (smaller) selection. This CL checks if the selection only has one word. Since
> longpress/double tap only selects one word, if we have multiple words we can assume
> it comes from "Select All" and not do Smart Select.
>
> BUG=714106
>
> Review-Url: https://codereview.chromium.org/2838023002
> Cr-Commit-Position: refs/heads/master@{#466856}
> Committed: https://chromium.googlesource.com/chromium/src/+/03f5058e764e8b2b01d571f29426075a83f6049b

TBR=timav@chromium.org,amaralp@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=714106

Review-Url: https://codereview.chromium.org/2848793002
Cr-Commit-Position: refs/heads/master@{#467870}
parent 2e7fbc6d
...@@ -859,15 +859,7 @@ public class SelectionPopupController extends ActionModeCallbackHelper { ...@@ -859,15 +859,7 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
mSelectionRect.set(left, top, right, bottom); mSelectionRect.set(left, top, right, bottom);
mHasSelection = true; mHasSelection = true;
mUnselectAllOnDismiss = true; mUnselectAllOnDismiss = true;
// When this event comes as the result of SelectAll, SelectionClient should not if (mSelectionClient == null || !mSelectionClient.sendsSelectionPopupUpdates()) {
// 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(); showActionModeOrClearOnFailure();
} else { } else {
// Rely on |mSelectionClient| sending a classification request and the request // Rely on |mSelectionClient| sending a classification request and the request
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment