Commit f4621371 authored by amaralp's avatar amaralp Committed by Commit bot

Removing SelectionPopupController.updateActionModeVisibility()

SelectionPopupController.updateActionModeVisibility() is confusing and unnecessary.
This patch refactors code to remove it.

This shouldn't have any behavior changes because
|ContentViewCore.setTouchScrollInProgress()| can't be called if the selection is
being dragged. Likewise when the selection handle dragging stops there shouldn't be
a touch scroll in progress.

Review-Url: https://codereview.chromium.org/2581863002
Cr-Commit-Position: refs/heads/master@{#439062}
parent 186c7dbb
......@@ -1110,7 +1110,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Displa
private void setTouchScrollInProgress(boolean inProgress) {
if (mTouchScrollInProgress == inProgress) return;
mTouchScrollInProgress = inProgress;
mSelectionPopupController.updateActionModeVisibility(inProgress);
mSelectionPopupController.hideActionMode(inProgress);
}
@SuppressWarnings("unused")
......
......@@ -87,7 +87,6 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
private View mView;
private ActionMode mActionMode;
private boolean mDraggingSelection;
// Bit field for mappings from menu item to a flag indicating it is allowed.
private int mAllowedMenuItems;
......@@ -361,7 +360,7 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
* side-effects if the underlying ActionMode supports hiding.
* @param hide whether to hide or show the ActionMode.
*/
private void hideActionMode(boolean hide) {
void hideActionMode(boolean hide) {
if (!canHideActionMode()) return;
if (mHidden == hide) return;
mHidden = hide;
......@@ -789,17 +788,14 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
mUnselectAllOnDismiss = false;
mSelectionRect.setEmpty();
finishActionMode();
mDraggingSelection = false;
break;
case SelectionEventType.SELECTION_HANDLE_DRAG_STARTED:
mDraggingSelection = true;
updateActionModeVisibility(touchScrollInProgress);
hideActionMode(true);
break;
case SelectionEventType.SELECTION_HANDLE_DRAG_STOPPED:
mDraggingSelection = false;
updateActionModeVisibility(touchScrollInProgress);
hideActionMode(false);
break;
case SelectionEventType.INSERTION_HANDLE_SHOWN:
......@@ -919,13 +915,6 @@ public class SelectionPopupController extends ActionModeCallbackHelper {
return mHasSelection;
}
void updateActionModeVisibility(boolean touchScrollInProgress) {
// The active fling count isn't reliable with WebView, so only use the
// active touch scroll signal for hiding. The fling animation movement
// will naturally hide the ActionMode by invalidating its content rect.
hideActionMode(mDraggingSelection || touchScrollInProgress);
}
@Override
public String getSelectedText() {
return mHasSelection ? mLastSelectedText : "";
......
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