Commit 9dd673ff authored by Stephen Sigwart's avatar Stephen Sigwart Committed by Commit Bot

[omnibox] Reset selection on left click

Fixes visible selection change when you left click or hold down the left
mouse button.

Bug: 1101679
Change-Id: Id08534eeabfc9a9a58744d7fa6cb4e7a2ba1a372
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2285873Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786447}
parent edd780b7
......@@ -1289,13 +1289,12 @@ bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
TextChanged();
filter_drag_events_for_unelision_ = true;
} else if (event.GetClickCount() == 1 && event.IsLeftMouseButton()) {
// Select the current word and record it for later. Selection will be
// immediately reset to cursor position, so no need to clean up. This is
// done to handle an edge case where the wrong word is selected on a
// double click when the elided URL is selected prior to the dobule click.
// Unelision happens between the first and second click, causing the
// wrong word to be selected because it's based on the click position in
// the newly unelided URL. See https://crbug.com/1084406.
// Select the current word and record it for later. This is done to handle
// an edge case where the wrong word is selected on a double click when
// the elided URL is selected prior to the dobule click. Unelision happens
// between the first and second click, causing the wrong word to be
// selected because it's based on the click position in the newly unelided
// URL. See https://crbug.com/1084406.
if (IsSelectAll()) {
SelectWordAt(event.location());
base::string16 shown_url = GetText();
......@@ -1307,6 +1306,8 @@ bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
next_double_click_selection_offset_ =
offset + GetCursorPosition() - next_double_click_selection_len_;
}
// Reset selection
SelectAll(false);
}
} else if (event.GetClickCount() == 2 && event.IsLeftMouseButton()) {
// If the user double clicked and we unelided between the first and second
......
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