Commit 4938c0c4 authored by jdduke's avatar jdduke Committed by Commit bot

Prevent selection handles from showing after a tap

Tap-triggered selections should not trigger the selection handles.
If a longpress occurs before a tap-triggered selection, suppress
activation of the selection handles.

BUG=471280

Review URL: https://codereview.chromium.org/1113653002

Cr-Commit-Position: refs/heads/master@{#327419}
parent d47c029d
......@@ -173,6 +173,7 @@ void TouchSelectionController::AllowShowingFromCurrentSelection() {
void TouchSelectionController::OnTapEvent() {
response_pending_input_event_ = TAP;
activate_selection_automatically_ = false;
ShowInsertionHandleAutomatically();
if (selection_empty_ && !show_on_tap_for_empty_editable_)
DeactivateInsertion();
......
......@@ -909,6 +909,23 @@ TEST_F(TouchSelectionControllerTest, SelectionClearOnTap) {
EXPECT_EQ(gfx::PointF(), GetLastEventStart());
}
TEST_F(TouchSelectionControllerTest, NoSelectionAfterLongpressThenTap) {
gfx::RectF start_rect(5, 5, 0, 10);
gfx::RectF end_rect(50, 5, 0, 10);
bool visible = true;
// Tap-triggered selections should not be allowed.
controller().OnLongPressEvent();
controller().OnTapEvent();
ChangeSelection(start_rect, visible, end_rect, visible);
EXPECT_THAT(GetAndResetEvents(), IsEmpty());
// Subsequent longpress selections will be allowed.
controller().OnLongPressEvent();
ChangeSelection(start_rect, visible, end_rect, visible);
EXPECT_THAT(GetAndResetEvents(), ElementsAre(SELECTION_SHOWN));
}
TEST_F(TouchSelectionControllerTest, AllowShowingFromCurrentSelection) {
gfx::RectF start_rect(5, 5, 0, 10);
gfx::RectF end_rect(50, 5, 0, 10);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment