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 708bcc7b8bd6a847aa4b1158b1712543d21dc57e..5cce0a859e8a1448daeb88c839e1f5f515a3a8b7 100644 |
--- a/content/browser/renderer_host/input/touch_selection_controller.cc |
+++ b/content/browser/renderer_host/input/touch_selection_controller.cc |
@@ -110,7 +110,7 @@ void TouchSelectionController::OnLongPressEvent() { |
last_input_event_type_ = LONG_PRESS; |
ShowSelectionHandlesAutomatically(); |
ShowInsertionHandleAutomatically(); |
- ResetCachedValues(); |
+ ResetCachedValuesIfInactive(); |
} |
void TouchSelectionController::OnTapEvent() { |
@@ -118,7 +118,7 @@ void TouchSelectionController::OnTapEvent() { |
activate_selection_automatically_ = false; |
DeactivateSelection(); |
ShowInsertionHandleAutomatically(); |
- ResetCachedValues(); |
+ ResetCachedValuesIfInactive(); |
} |
void TouchSelectionController::HideAndDisallowShowingAutomatically() { |
@@ -147,7 +147,7 @@ void TouchSelectionController::OnSelectionEditable(bool editable) { |
if (selection_editable_ == editable) |
return; |
selection_editable_ = editable; |
- ResetCachedValues(); |
+ ResetCachedValuesIfInactive(); |
if (!selection_editable_) |
DeactivateInsertion(); |
} |
@@ -156,7 +156,7 @@ void TouchSelectionController::OnSelectionEmpty(bool empty) { |
if (selection_empty_ == empty) |
return; |
selection_empty_ = empty; |
- ResetCachedValues(); |
+ ResetCachedValuesIfInactive(); |
} |
bool TouchSelectionController::Animate(base::TimeTicks frame_time) { |
@@ -220,16 +220,14 @@ void TouchSelectionController::ShowInsertionHandleAutomatically() { |
if (activate_insertion_automatically_) |
return; |
activate_insertion_automatically_ = true; |
- if (!is_insertion_active_ && !is_selection_active_) |
- ResetCachedValues(); |
+ ResetCachedValuesIfInactive(); |
} |
void TouchSelectionController::ShowSelectionHandlesAutomatically() { |
if (activate_selection_automatically_) |
return; |
activate_selection_automatically_ = true; |
- if (!is_insertion_active_ && !is_selection_active_) |
- ResetCachedValues(); |
+ ResetCachedValuesIfInactive(); |
} |
void TouchSelectionController::OnInsertionChanged() { |
@@ -328,7 +326,10 @@ void TouchSelectionController::DeactivateSelection() { |
client_->OnSelectionEvent(SELECTION_CLEARED, gfx::PointF()); |
} |
-void TouchSelectionController::ResetCachedValues() { |
+void TouchSelectionController::ResetCachedValuesIfInactive() { |
+ if (is_insertion_active_ || is_selection_active_) |
+ return; |
+ |
start_rect_ = gfx::RectF(); |
end_rect_ = gfx::RectF(); |
start_orientation_ = TOUCH_HANDLE_ORIENTATION_UNDEFINED; |