Chromium Code Reviews| 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 c98d485160c4be3aa4e05dc3c1195e0ddbd1b9cd..90c589972cab3a49c78e38893085427804df135e 100644 |
| --- a/ui/touch_selection/touch_selection_controller.cc |
| +++ b/ui/touch_selection/touch_selection_controller.cc |
| @@ -89,6 +89,15 @@ void TouchSelectionController::OnSelectionBoundsChanged( |
| client_->OnSelectionEvent(SELECTION_DISSOLVED); |
| } |
| + // Swap the Handles when the start and end selection points cross each other. |
| + if (active_status_ == SELECTION_ACTIVE && |
|
AKV
2015/10/21 06:19:29
We can break this condition to 2 ifs to add more r
AviD
2015/10/21 06:40:02
Done.
|
| + ((start_selection_handle_->IsActive() && |
| + end_.edge_bottom() == start.edge_bottom()) || |
| + (end_selection_handle_->IsActive() && |
| + end.edge_bottom() == start_.edge_bottom()))) { |
| + start_selection_handle_.swap(end_selection_handle_); |
| + } |
| + |
| start_ = start; |
| end_ = end; |
| start_orientation_ = ToTouchHandleOrientation(start_.type()); |
| @@ -649,6 +658,20 @@ bool TouchSelectionController::GetEndVisible() const { |
| return !temporarily_hidden_ && !longpress_drag_selector_.IsActive(); |
| } |
| +TouchHandleOrientation TouchSelectionController::GetStartHandleOrientation() |
| + const { |
| + if (active_status_ != SELECTION_ACTIVE) |
|
AKV
2015/10/21 06:19:29
May be we can return actual orientation and do thi
AviD
2015/10/21 06:40:02
I think this is better as it will also check for N
|
| + return TouchHandleOrientation::UNDEFINED; |
| + return start_selection_handle_->orientation(); |
| +} |
| + |
| +TouchHandleOrientation TouchSelectionController::GetEndHandleOrientation() |
| + const { |
| + if (active_status_ != SELECTION_ACTIVE) |
|
AKV
2015/10/21 06:19:29
ditto
|
| + return TouchHandleOrientation::UNDEFINED; |
| + return end_selection_handle_->orientation(); |
| +} |
| + |
| TouchHandle::AnimationStyle TouchSelectionController::GetAnimationStyle( |
| bool was_active) const { |
| return was_active && client_->SupportsAnimation() |