summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdduke <jdduke@chromium.org>2015-05-08 11:44:41 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-08 18:45:05 +0000
commit11d7eac006b4198aaae83711f710df2fca3819cf (patch)
tree9441d46d1b6b72480d4d6b6cbd2746d84964cda1
parentb3dadfc6ba396a3711833f778541da4ce9850caf (diff)
downloadchromium_src-11d7eac006b4198aaae83711f710df2fca3819cf.zip
chromium_src-11d7eac006b4198aaae83711f710df2fca3819cf.tar.gz
chromium_src-11d7eac006b4198aaae83711f710df2fca3819cf.tar.bz2
Prevent taps from suppressing selection handle updates
A recent change made selection handle activation more strict, preventing tap gestures from showing the handles. This inadvertently caused an issue where tapping during a selection would prevent subsequent selection handle updates. Fix this by only suppressing selection handle activation after a tap if there's no active selection. BUG=486045 Review URL: https://codereview.chromium.org/1135813002 Cr-Commit-Position: refs/heads/master@{#328995}
-rw-r--r--ui/touch_selection/touch_selection_controller.cc5
-rw-r--r--ui/touch_selection/touch_selection_controller_unittest.cc8
2 files changed, 12 insertions, 1 deletions
diff --git a/ui/touch_selection/touch_selection_controller.cc b/ui/touch_selection/touch_selection_controller.cc
index 2906879..540dfee 100644
--- a/ui/touch_selection/touch_selection_controller.cc
+++ b/ui/touch_selection/touch_selection_controller.cc
@@ -79,6 +79,8 @@ void TouchSelectionController::OnSelectionBoundsChanged(
if (!activate_selection_automatically_ &&
!activate_insertion_automatically_) {
+ DCHECK(!is_insertion_active_);
+ DCHECK(!is_selection_active_);
DCHECK_EQ(INPUT_EVENT_TYPE_NONE, response_pending_input_event_);
return;
}
@@ -173,7 +175,8 @@ void TouchSelectionController::AllowShowingFromCurrentSelection() {
void TouchSelectionController::OnTapEvent() {
response_pending_input_event_ = TAP;
- activate_selection_automatically_ = false;
+ if (!is_selection_active_)
+ activate_selection_automatically_ = false;
ShowInsertionHandleAutomatically();
if (selection_empty_ && !show_on_tap_for_empty_editable_)
DeactivateInsertion();
diff --git a/ui/touch_selection/touch_selection_controller_unittest.cc b/ui/touch_selection/touch_selection_controller_unittest.cc
index 2205958..247ed97 100644
--- a/ui/touch_selection/touch_selection_controller_unittest.cc
+++ b/ui/touch_selection/touch_selection_controller_unittest.cc
@@ -924,6 +924,14 @@ TEST_F(TouchSelectionControllerTest, NoSelectionAfterLongpressThenTap) {
controller().OnLongPressEvent();
ChangeSelection(start_rect, visible, end_rect, visible);
EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_SHOWN));
+
+ // Tapping again shouldn't have any effect on subsequent selection events.
+ controller().OnTapEvent();
+ end_rect.Offset(10, 10);
+ ChangeSelection(start_rect, visible, end_rect, visible);
+ EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_MOVED));
+ ClearSelection();
+ EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_CLEARED));
}
TEST_F(TouchSelectionControllerTest, AllowShowingFromCurrentSelection) {