Commit b112e866 authored by Orin Jaworski's avatar Orin Jaworski Committed by Commit Bot

[omnibox] Reset line state to normal for non-keyword-mode clicks

This CL fixes a bug where clicking the omnibox would reset the line
state to normal but not clear keyword mode. The expected behavior
when clicking with keyword mode active is to not reset line state.

Bug: 1127291
Change-Id: I4c081add27ead2058189a89940b980f8281841e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2406352Reviewed-by: default avatarAngela Yoeurng <yoangela@chromium.org>
Commit-Queue: Orin Jaworski <orinj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806303}
parent 018fbce3
...@@ -1480,11 +1480,13 @@ const char* OmniboxViewViews::GetClassName() const { ...@@ -1480,11 +1480,13 @@ const char* OmniboxViewViews::GetClassName() const {
} }
bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) { bool OmniboxViewViews::OnMousePressed(const ui::MouseEvent& event) {
if (model()->popup_model()) { // Can be null in tests. // Clear focus of buttons, but do not clear keyword mode.
if (model()->popup_model() && model()->popup_model()->selected_line_state() !=
OmniboxPopupModel::KEYWORD_MODE) {
model()->popup_model()->SetSelectedLineState(OmniboxPopupModel::NORMAL); model()->popup_model()->SetSelectedLineState(OmniboxPopupModel::NORMAL);
} }
is_mouse_pressed_ = true;
is_mouse_pressed_ = true;
select_all_on_mouse_release_ = select_all_on_mouse_release_ =
(event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) && (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton()) &&
(!HasFocus() || (model()->focus_state() == OMNIBOX_FOCUS_INVISIBLE)); (!HasFocus() || (model()->focus_state() == OMNIBOX_FOCUS_INVISIBLE));
......
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