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

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: Created 6 years, 2 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/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..ee9c7fc899039f8b189db12675439ac20f521b3f 100644
--- a/content/browser/renderer_host/input/touch_selection_controller.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller.cc
@@ -209,13 +209,23 @@ void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) {
return;
}
+ gfx::PointF fixed_handle_position;
if (&handle == start_selection_handle_.get()) {
- fixed_handle_position_ =
+ fixed_handle_position =
end_selection_handle_->position() + GetEndLineOffset();
} else {
- fixed_handle_position_ =
+ fixed_handle_position =
start_selection_handle_->position() + GetStartLineOffset();
}
+
+ // 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.
+ gfx::Vector2dF line_offset = &handle == end_selection_handle_.get()
jdduke (slow) 2014/10/15 15:46:07 This could might be more simply folded into the ab
christiank 2014/10/17 14:33:05 Good idea!
+ ? GetStartLineOffset()
+ : GetEndLineOffset();
+ gfx::PointF handle_position = handle.position() + line_offset;
+ client_->SelectBetweenCoordinates(fixed_handle_position, handle_position);
christiank 2014/10/15 09:55:03 Instead of adding a new code path for swapping the
jdduke (slow) 2014/10/15 15:46:07 Ah, I think what you have is reasonable, maybe we
christiank 2014/10/17 14:33:05 I agree, I'll update the names.
+
client_->OnSelectionEvent(SELECTION_DRAG_STARTED, handle.position());
}
@@ -230,7 +240,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_->MoveSelectionExtent(line_position);
jdduke (slow) 2014/10/15 15:46:07 Could add a test (or update an existing test) in t
christiank 2014/10/17 14:33:05 Sure, will do!
}
}

Powered by Google App Engine
This is Rietveld 408576698