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 47ecf5a36413e4ffc1557c681b15fa6c8955a7c8..1c8ceae98b5fe1d7d6508e5a3c254ddf82ba4b9a 100644 |
--- a/ui/touch_selection/touch_selection_controller.cc |
+++ b/ui/touch_selection/touch_selection_controller.cc |
@@ -68,14 +68,13 @@ |
void TouchSelectionController::OnSelectionBoundsChanged( |
const SelectionBound& start, |
const SelectionBound& end) { |
- if (!force_next_update_ && start == start_ && end_ == end) |
+ if (start == start_ && end_ == end) |
return; |
start_ = start; |
end_ = end; |
start_orientation_ = ToTouchHandleOrientation(start_.type()); |
end_orientation_ = ToTouchHandleOrientation(end_.type()); |
- force_next_update_ = false; |
if (!activate_selection_automatically_ && |
!activate_insertion_automatically_) { |
@@ -156,7 +155,7 @@ |
response_pending_input_event_ = LONG_PRESS; |
ShowSelectionHandlesAutomatically(); |
ShowInsertionHandleAutomatically(); |
- ForceNextUpdateIfInactive(); |
+ ResetCachedValuesIfInactive(); |
} |
void TouchSelectionController::AllowShowingFromCurrentSelection() { |
@@ -180,7 +179,7 @@ |
ShowInsertionHandleAutomatically(); |
if (selection_empty_ && !show_on_tap_for_empty_editable_) |
DeactivateInsertion(); |
- ForceNextUpdateIfInactive(); |
+ ResetCachedValuesIfInactive(); |
} |
void TouchSelectionController::HideAndDisallowShowingAutomatically() { |
@@ -209,7 +208,7 @@ |
if (selection_editable_ == editable) |
return; |
selection_editable_ = editable; |
- ForceNextUpdateIfInactive(); |
+ ResetCachedValuesIfInactive(); |
if (!selection_editable_) |
DeactivateInsertion(); |
} |
@@ -218,7 +217,7 @@ |
if (selection_empty_ == empty) |
return; |
selection_empty_ = empty; |
- ForceNextUpdateIfInactive(); |
+ ResetCachedValuesIfInactive(); |
} |
bool TouchSelectionController::Animate(base::TimeTicks frame_time) { |
@@ -341,14 +340,14 @@ |
if (activate_insertion_automatically_) |
return; |
activate_insertion_automatically_ = true; |
- ForceNextUpdateIfInactive(); |
+ ResetCachedValuesIfInactive(); |
} |
void TouchSelectionController::ShowSelectionHandlesAutomatically() { |
if (activate_selection_automatically_) |
return; |
activate_selection_automatically_ = true; |
- ForceNextUpdateIfInactive(); |
+ ResetCachedValuesIfInactive(); |
} |
void TouchSelectionController::OnInsertionChanged() { |
@@ -464,9 +463,13 @@ |
client_->OnSelectionEvent(SELECTION_CLEARED); |
} |
-void TouchSelectionController::ForceNextUpdateIfInactive() { |
- if (active_status_ == INACTIVE) |
- force_next_update_ = true; |
+void TouchSelectionController::ResetCachedValuesIfInactive() { |
+ if (active_status_ != INACTIVE) |
+ return; |
+ start_ = SelectionBound(); |
+ end_ = SelectionBound(); |
+ start_orientation_ = TouchHandleOrientation::UNDEFINED; |
+ end_orientation_ = TouchHandleOrientation::UNDEFINED; |
} |
gfx::Vector2dF TouchSelectionController::GetStartLineOffset() const { |