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

Unified Diff: ui/touch_selection/touch_selection_controller.cc

Issue 1358263002: [Android] Support double-tap selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix contextual search Created 5 years, 3 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 a991f94f713c20ba7b7ff4f16f9a3d0120f43cab..28ddbe1743d77ba2524a1bfe73d2f649bb7f64a5 100644
--- a/ui/touch_selection/touch_selection_controller.cc
+++ b/ui/touch_selection/touch_selection_controller.cc
@@ -174,13 +174,19 @@ bool TouchSelectionController::WillHandleTouchEvent(const MotionEvent& event) {
return false;
}
-bool TouchSelectionController::WillHandleTapEvent(const gfx::PointF& location) {
+bool TouchSelectionController::WillHandleTapEvent(const gfx::PointF& location,
+ int tap_count) {
if (WillHandleTapOrLongPress(location))
return true;
- response_pending_input_event_ = TAP;
- if (active_status_ != SELECTION_ACTIVE)
- activate_selection_automatically_ = false;
+ if (tap_count > 1) {
+ response_pending_input_event_ = REPEATED_TAP;
+ ShowSelectionHandlesAutomatically();
+ } else {
+ response_pending_input_event_ = TAP;
+ if (active_status_ != SELECTION_ACTIVE)
+ activate_selection_automatically_ = false;
+ }
ShowInsertionHandleAutomatically();
if (selection_empty_ && !config_.show_on_tap_for_empty_editable)
DeactivateInsertion();
@@ -428,8 +434,9 @@ bool TouchSelectionController::WillHandleTapOrLongPress(
void TouchSelectionController::OnInsertionChanged() {
DeactivateSelection();
- if (response_pending_input_event_ == TAP && selection_empty_ &&
- !config_.show_on_tap_for_empty_editable) {
+ if ((response_pending_input_event_ == TAP ||
+ response_pending_input_event_ == REPEATED_TAP) &&
+ selection_empty_ && !config_.show_on_tap_for_empty_editable) {
HideAndDisallowShowingAutomatically();
return;
}
@@ -512,7 +519,8 @@ bool TouchSelectionController::ActivateSelectionIfNecessary() {
// intervening SELECTION_HANDLES_CLEARED update to avoid unnecessary state
// changes.
if (active_status_ == INACTIVE ||
- response_pending_input_event_ == LONG_PRESS) {
+ response_pending_input_event_ == LONG_PRESS ||
+ response_pending_input_event_ == REPEATED_TAP) {
if (active_status_ == SELECTION_ACTIVE) {
// The active selection session finishes with the start of the new one.
LogSelectionEnd();
« 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