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

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

Issue 434583002: Prevent repeated taps from resetting insertion handle position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the patch Created 6 years, 4 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 6fc01c275ef74a204e1e0f1a1535cc079b28d9ce..a7ebb4f429619dc943d55a4e838eed3a90b564a8 100644
--- a/content/browser/renderer_host/input/touch_selection_controller.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller.cc
@@ -120,7 +120,7 @@ void TouchSelectionController::OnLongPressEvent() {
last_input_event_type_ = LONG_PRESS;
ShowSelectionHandlesAutomatically();
ShowInsertionHandleAutomatically();
- ResetCachedValues();
+ ResetCachedValuesIfInactive();
}
void TouchSelectionController::OnTapEvent() {
@@ -128,7 +128,7 @@ void TouchSelectionController::OnTapEvent() {
activate_selection_automatically_ = false;
DeactivateSelection();
ShowInsertionHandleAutomatically();
- ResetCachedValues();
+ ResetCachedValuesIfInactive();
}
void TouchSelectionController::HideAndDisallowShowingAutomatically() {
@@ -157,7 +157,7 @@ void TouchSelectionController::OnSelectionEditable(bool editable) {
if (selection_editable_ == editable)
return;
selection_editable_ = editable;
- ResetCachedValues();
+ ResetCachedValuesIfInactive();
if (!selection_editable_)
DeactivateInsertion();
}
@@ -166,7 +166,7 @@ void TouchSelectionController::OnSelectionEmpty(bool empty) {
if (selection_empty_ == empty)
return;
selection_empty_ = empty;
- ResetCachedValues();
+ ResetCachedValuesIfInactive();
}
bool TouchSelectionController::Animate(base::TimeTicks frame_time) {
@@ -230,16 +230,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() {
@@ -338,7 +336,9 @@ void TouchSelectionController::DeactivateSelection() {
client_->OnSelectionEvent(SELECTION_CLEARED, gfx::PointF());
}
-void TouchSelectionController::ResetCachedValues() {
+void TouchSelectionController::ResetCachedValuesIfInactive() {
+ if (is_selection_active_ || is_insertion_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