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

Unified Diff: content/browser/renderer_host/input/gesture_text_selector.cc

Issue 590483002: Check if Button is pressed for changing selection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check only for Secondary Button Created 6 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: content/browser/renderer_host/input/gesture_text_selector.cc
diff --git a/content/browser/renderer_host/input/gesture_text_selector.cc b/content/browser/renderer_host/input/gesture_text_selector.cc
index 59f28cf3245f0288b397ddb2a47117f88531086d..6387c1bbec096f0710272f0130cfb430ed291ea6 100644
--- a/content/browser/renderer_host/input/gesture_text_selector.cc
+++ b/content/browser/renderer_host/input/gesture_text_selector.cc
@@ -13,6 +13,7 @@ namespace content {
GestureTextSelector::GestureTextSelector(GestureTextSelectorClient* client)
: client_(client),
text_selection_triggered_(false),
+ secondary_button_pressed_(false),
anchor_x_(0.0f),
anchor_y_(0.0f) {
}
@@ -26,6 +27,11 @@ bool GestureTextSelector::OnTouchEvent(const ui::MotionEvent& event) {
// sequences from being forwarded.
text_selection_triggered_ = ShouldStartTextSelection(event);
}
+ if (text_selection_triggered_ &&
+ event.GetAction() == ui::MotionEvent::ACTION_MOVE) {
+ secondary_button_pressed_ =
+ event.GetButtonState() == ui::MotionEvent::BUTTON_SECONDARY;
+ }
return text_selection_triggered_;
}
@@ -48,8 +54,10 @@ bool GestureTextSelector::OnGestureEvent(const ui::GestureEventData& gesture) {
// TODO(changwan): check if we can show handles on ET_GESTURE_SCROLL_END
// instead. Currently it is not possible as ShowSelectionHandles should
// be called before we change the selection.
- client_->ShowSelectionHandlesAutomatically();
- client_->SelectRange(anchor_x_, anchor_y_, gesture.x, gesture.y);
+ if (secondary_button_pressed_) {
jdduke (slow) 2014/09/23 15:10:48 So, what happens when the user repeatedly presses/
AviD 2014/09/23 16:01:04 Yes, you are right. Triggering a new selection in
+ client_->ShowSelectionHandlesAutomatically();
+ client_->SelectRange(anchor_x_, anchor_y_, gesture.x, gesture.y);
+ }
break;
}
default:

Powered by Google App Engine
This is Rietveld 408576698