diff options
author | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-03 18:47:23 +0000 |
---|---|---|
committer | varunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-03 18:47:23 +0000 |
commit | cdd70c6519a15b2799168fbc9dc96952ef67cba4 (patch) | |
tree | d1f01dee0fedd96a8d4db805e710bce63e3d1d32 /views | |
parent | 5ecd2db362890bd093d6049fda44a9f50aeec279 (diff) | |
download | chromium_src-cdd70c6519a15b2799168fbc9dc96952ef67cba4.zip chromium_src-cdd70c6519a15b2799168fbc9dc96952ef67cba4.tar.gz chromium_src-cdd70c6519a15b2799168fbc9dc96952ef67cba4.tar.bz2 |
Add proper drag position to TouchSelectionController::SelectionHandleDragged.
This is necessary for updating selection on multiline text such as on a
webpage.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7508018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95279 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r-- | views/touchui/touch_selection_controller_impl.cc | 9 | ||||
-rw-r--r-- | views/touchui/touch_selection_controller_impl.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/views/touchui/touch_selection_controller_impl.cc b/views/touchui/touch_selection_controller_impl.cc index 0e965d2..2a28014 100644 --- a/views/touchui/touch_selection_controller_impl.cc +++ b/views/touchui/touch_selection_controller_impl.cc @@ -95,7 +95,7 @@ class TouchSelectionControllerImpl::SelectionHandleView : public View { } virtual bool OnMouseDragged(const MouseEvent& event) OVERRIDE { - controller_->SelectionHandleDragged(event.x()); + controller_->SelectionHandleDragged(event.location()); return true; } @@ -202,7 +202,8 @@ void TouchSelectionControllerImpl::ClientViewLostFocus() { selection_handle_2_->SetVisible(false); } -void TouchSelectionControllerImpl::SelectionHandleDragged(int x) { +void TouchSelectionControllerImpl::SelectionHandleDragged( + const gfx::Point& drag_pos) { if (client_view_->GetWidget()) { DCHECK(dragging_handle_); // Find the stationary selection handle. @@ -211,10 +212,10 @@ void TouchSelectionControllerImpl::SelectionHandleDragged(int x) { fixed_handle = selection_handle_2_.get(); // Find selection end points in client_view's coordinate system. - gfx::Point p1(x + kSelectionHandleRadius, -1); + gfx::Point p1(drag_pos.x() + kSelectionHandleRadius, drag_pos.y()); ConvertPointToClientView(dragging_handle_, &p1); - gfx::Point p2(kSelectionHandleRadius, -1); + gfx::Point p2(kSelectionHandleRadius, 0); ConvertPointToClientView(fixed_handle, &p2); // Instruct client_view to select the region between p1 and p2. The position diff --git a/views/touchui/touch_selection_controller_impl.h b/views/touchui/touch_selection_controller_impl.h index f5d83f4..6ae33e3 100644 --- a/views/touchui/touch_selection_controller_impl.h +++ b/views/touchui/touch_selection_controller_impl.h @@ -32,7 +32,7 @@ class TouchSelectionControllerImpl : public TouchSelectionController { // Callback to inform the client view that the selection handle has been // dragged, hence selection may need to be updated. - void SelectionHandleDragged(int x); + void SelectionHandleDragged(const gfx::Point& drag_pos); // Convenience method to convert a point from a selection handle's coordinate // system to that of the client view. |