Commit 7d0d820f authored by Cliff Smolinsky's avatar Cliff Smolinsky Committed by Commit Bot

Omnibox: Fix OnBlur RevertAll behavior for NTP

Recent changes to the handling of user_input_in_progress caused a
regression in OmniboxViewViews::OnBlur() where the edit state is not
reverted when the current text exactly matches the permanent text. This
resulted in page icons such as the bookmarks star from remaining hidden
when they should be shown.

This change adds a check to see whether the text has been edited but
currently is an exact match for the permanent text and does a revert.
This is necessary because users may have no idea that they are
currently in "edit mode" because the text looks unchanged.

Bug: 932782
Change-Id: Ie6d7218daa27a4f59eafaac9c76477925b50e384
Reviewed-on: https://chromium-review.googlesource.com/c/1475947
Commit-Queue: Cliff Smolinsky <cliffsmo@microsoft.com>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633788}
parent 00114095
...@@ -1250,9 +1250,15 @@ void OmniboxViewViews::OnBlur() { ...@@ -1250,9 +1250,15 @@ void OmniboxViewViews::OnBlur() {
// Because merely Alt-Tabbing to another window and back should not change the // Because merely Alt-Tabbing to another window and back should not change the
// Omnibox state, we only revert the text only if the Omnibox is blurred in // Omnibox state, we only revert the text only if the Omnibox is blurred in
// favor of some other View in the same Widget. // favor of some other View in the same Widget.
//
// Also revert if the text has been edited but currently exactly matches
// the permanent text. An example of this scenario is someone typing on the
// new tab page and then deleting everything using backspace/delete.
if (GetWidget() && GetWidget()->IsActive() && if (GetWidget() && GetWidget()->IsActive() &&
!model()->user_input_in_progress() && ((!model()->user_input_in_progress() &&
text() != model()->GetPermanentDisplayText()) { text() != model()->GetPermanentDisplayText()) ||
(model()->user_input_in_progress() &&
text() == model()->GetPermanentDisplayText()))) {
RevertAll(); RevertAll();
} }
......
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