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

Side by Side 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: Added a comment Created 4 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/touch_selection/touch_selection_controller.h" 5 #include "ui/touch_selection/touch_selection_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 10
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return true; 224 return true;
225 225
226 longpress_drag_selector_.OnLongPressEvent(event_time, location); 226 longpress_drag_selector_.OnLongPressEvent(event_time, location);
227 response_pending_input_event_ = LONG_PRESS; 227 response_pending_input_event_ = LONG_PRESS;
228 ShowSelectionHandlesAutomatically(); 228 ShowSelectionHandlesAutomatically();
229 ShowInsertionHandleAutomatically(); 229 ShowInsertionHandleAutomatically();
230 ForceNextUpdateIfInactive(); 230 ForceNextUpdateIfInactive();
231 return false; 231 return false;
232 } 232 }
233 233
234 void TouchSelectionController::OnScrollBeginEvent() {
235 longpress_drag_selector_.OnScrollBeginEvent();
236 response_pending_input_event_ = INPUT_EVENT_TYPE_NONE;
237 if (active_status_ == INACTIVE) {
238 activate_insertion_automatically_ = false;
239 activate_selection_automatically_ = false;
240 }
241 }
242
234 void TouchSelectionController::AllowShowingFromCurrentSelection() { 243 void TouchSelectionController::AllowShowingFromCurrentSelection() {
235 if (active_status_ != INACTIVE) 244 if (active_status_ != INACTIVE)
236 return; 245 return;
237 246
238 activate_selection_automatically_ = true; 247 activate_selection_automatically_ = true;
239 activate_insertion_automatically_ = true; 248 activate_insertion_automatically_ = true;
240 if (GetStartPosition() != GetEndPosition()) { 249 if (GetStartPosition() != GetEndPosition()) {
241 OnSelectionChanged(); 250 OnSelectionChanged();
242 } else if (start_orientation_ == TouchHandleOrientation::CENTER && 251 } else if (start_orientation_ == TouchHandleOrientation::CENTER &&
243 selection_editable_) { 252 selection_editable_) {
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_; 670 base::TimeDelta duration = base::TimeTicks::Now() - selection_start_time_;
662 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration", 671 UMA_HISTOGRAM_CUSTOM_TIMES("Event.TouchSelection.WasDraggedDuration",
663 duration, 672 duration,
664 base::TimeDelta::FromMilliseconds(500), 673 base::TimeDelta::FromMilliseconds(500),
665 base::TimeDelta::FromSeconds(60), 674 base::TimeDelta::FromSeconds(60),
666 60); 675 60);
667 } 676 }
668 } 677 }
669 678
670 } // namespace ui 679 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698