Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(767)

Unified Diff: content/browser/renderer_host/input/touch_selection_controller.cc

Issue 432833002: Prevent repeated taps from resetting insertion handle position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698