Chromium Code Reviews| 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 8193fb180668397e589d451edf2f107e782af49a..352bf364c964b7c76fe864089b77589351364569 100644 |
| --- a/content/browser/renderer_host/input/touch_selection_controller.cc |
| +++ b/content/browser/renderer_host/input/touch_selection_controller.cc |
| @@ -183,6 +183,8 @@ bool TouchSelectionController::Animate(base::TimeTicks frame_time) { |
| } |
| void TouchSelectionController::OnHandleDragBegin(const TouchHandle& handle) { |
| + last_input_event_type_ = INPUT_EVENT_TYPE_NONE; |
| + |
| if (&handle == insertion_handle_.get()) { |
| client_->OnSelectionEvent(INSERTION_DRAG_STARTED, handle.position()); |
| return; |
| @@ -324,8 +326,12 @@ void TouchSelectionController::ActivateSelection() { |
| end_selection_handle_->SetOrientation(end_orientation_); |
| } |
| - if (!is_selection_active_) { |
| + // As a long press received while a selection is already active may trigger |
| + // an entirely new selection, notify the client but avoid sending an |
| + // intervening SELECTION_CLEARED update to avoid unnecessary state changes. |
| + if (!is_selection_active_ || last_input_event_type_ == LONG_PRESS) { |
|
cjhopman
2014/08/14 00:12:28
Maybe there's a better name for last_input_event_t
jdduke (slow)
2014/08/14 17:57:19
Yeah, I'll tweak it.
|
| is_selection_active_ = true; |
| + last_input_event_type_ = INPUT_EVENT_TYPE_NONE; |
| client_->OnSelectionEvent(SELECTION_SHOWN, GetStartPosition()); |
| } |
| } |