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 3d52b4c3e423f276b65541c1491b0e260411fb86..87f09e142bb6bb3508420bb99e67cfe2dd6a3dcd 100644 |
--- a/ui/touch_selection/touch_selection_controller.cc |
+++ b/ui/touch_selection/touch_selection_controller.cc |
@@ -66,11 +66,11 @@ TouchSelectionController::TouchSelectionController( |
TouchSelectionController::~TouchSelectionController() { |
} |
-void TouchSelectionController::OnSelectionBoundsChanged( |
+bool TouchSelectionController::OnSelectionBoundsUpdated( |
const SelectionBound& start, |
const SelectionBound& end) { |
if (start == start_ && end_ == end) |
- return; |
+ return false; |
start_ = start; |
end_ = end; |
@@ -80,7 +80,7 @@ void TouchSelectionController::OnSelectionBoundsChanged( |
if (!activate_selection_automatically_ && |
!activate_insertion_automatically_) { |
DCHECK_EQ(INPUT_EVENT_TYPE_NONE, response_pending_input_event_); |
- return; |
+ return false; |
} |
// Ensure that |response_pending_input_event_| is cleared after the method |
@@ -113,16 +113,17 @@ void TouchSelectionController::OnSelectionBoundsChanged( |
start_orientation_ != TouchHandleOrientation::UNDEFINED && |
end_orientation_ != TouchHandleOrientation::UNDEFINED)) { |
OnSelectionChanged(); |
- return; |
+ return true; |
} |
if (start_orientation_ == TouchHandleOrientation::CENTER && |
selection_editable_) { |
OnInsertionChanged(); |
- return; |
+ return true; |
} |
HideAndDisallowShowingAutomatically(); |
+ return true; |
} |
bool TouchSelectionController::WillHandleTouchEvent(const MotionEvent& event) { |
@@ -217,6 +218,13 @@ void TouchSelectionController::OnSelectionEmpty(bool empty) { |
ResetCachedValuesIfInactive(); |
} |
+void TouchSelectionController::OnNativeViewMoved() { |
+ if (is_selection_active_) |
+ client_->OnSelectionEvent(SELECTION_MOVED); |
+ else if (is_insertion_active_) |
+ client_->OnSelectionEvent(INSERTION_MOVED); |
+} |
+ |
bool TouchSelectionController::Animate(base::TimeTicks frame_time) { |
if (is_insertion_active_) |
return insertion_handle_->Animate(frame_time); |
@@ -299,11 +307,10 @@ void TouchSelectionController::OnHandleDragUpdate(const TouchHandle& handle, |
? GetStartLineOffset() |
: GetEndLineOffset(); |
gfx::PointF line_position = position + line_offset; |
- if (&handle == insertion_handle_.get()) { |
+ if (&handle == insertion_handle_.get()) |
client_->MoveCaret(line_position); |
- } else { |
+ else |
client_->MoveRangeSelectionExtent(line_position); |
- } |
} |
void TouchSelectionController::OnHandleDragEnd(const TouchHandle& handle) { |