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

Unified Diff: ui/touch_selection/touch_selection_controller.cc

Issue 1537493006: Allow scrolling a page with selection after long-press on whitespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years, 11 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
Index: ui/touch_selection/touch_selection_controller.cc
diff --git a/ui/touch_selection/touch_selection_controller.cc b/ui/touch_selection/touch_selection_controller.cc
index 90f7c6241580f66532ff678d360f070a8fa82bc3..48fba29af1acc46119e72b55bd1799679f9fc34c 100644
--- a/ui/touch_selection/touch_selection_controller.cc
+++ b/ui/touch_selection/touch_selection_controller.cc
@@ -231,6 +231,24 @@ bool TouchSelectionController::WillHandleLongPressEvent(
return false;
}
+void TouchSelectionController::OnScrollBeginEvent() {
+ // When there is an active selection, if the user performs a long-press that
+ // does not trigger a new selection (e.g. a long-press on an empty area) and
+ // then scrolls, the scroll will move the selection. In this case we will
+ // think incorrectly that the selection change was due to the long-press and
+ // will activate touch selection and start long-press drag gesture (see
+ // ActivateInsertionIfNecessary()). To prevent this, we need to reset the
+ // state of touch selection controller and long-press drag selector.
+ // TODO(mohsen): Remove this workaround when we have enough information about
+ // the cause of a selection change (see https://crbug.com/571897).
+ longpress_drag_selector_.OnScrollBeginEvent();
+ response_pending_input_event_ = INPUT_EVENT_TYPE_NONE;
+ if (active_status_ == INACTIVE) {
+ activate_insertion_automatically_ = false;
+ activate_selection_automatically_ = false;
+ }
+}
+
void TouchSelectionController::AllowShowingFromCurrentSelection() {
if (active_status_ != INACTIVE)
return;
« no previous file with comments | « ui/touch_selection/touch_selection_controller.h ('k') | ui/touch_selection/touch_selection_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698