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

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

Issue 657803002: Update touch selection to only modify one selection point at a time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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/touch_selection_controller.cc
diff --git a/content/browser/renderer_host/input/touch_selection_controller.cc b/content/browser/renderer_host/input/touch_selection_controller.cc
index e904e283ee0716401cea8556353b8eba048032d1..4c8807d0fccb149a08ab403fd83e3863cc8b521f 100644
--- a/content/browser/renderer_host/input/touch_selection_controller.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller.cc
@@ -209,13 +209,19 @@ void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) {
return;
}
+ gfx::PointF base, extent;
if (&handle == start_selection_handle_.get()) {
- fixed_handle_position_ =
- end_selection_handle_->position() + GetEndLineOffset();
+ base = end_selection_handle_->position() + GetEndLineOffset();
+ extent = start_selection_handle_->position() + GetStartLineOffset();
} else {
- fixed_handle_position_ =
- start_selection_handle_->position() + GetStartLineOffset();
+ base = start_selection_handle_->position() + GetStartLineOffset();
+ extent = end_selection_handle_->position() + GetEndLineOffset();
}
+
+ // When moving the handle we want to move only the extent point. Before doing
+ // so we must make sure that the base point is set correctly.
+ client_->SelectBetweenCoordinates(base, extent);
+
client_->OnSelectionEvent(SELECTION_DRAG_STARTED, handle.position());
}
@@ -230,7 +236,7 @@ void TouchSelectionController::OnHandleDragUpdate(const TouchHandle& handle,
if (&handle == insertion_handle_.get()) {
client_->MoveCaret(line_position);
} else {
- client_->SelectBetweenCoordinates(fixed_handle_position_, line_position);
+ client_->MoveRangeSelectionExtent(line_position);
}
}

Powered by Google App Engine
This is Rietveld 408576698