Commit 9fd60e10 authored by Kevin Bailey's avatar Kevin Bailey Committed by Commit Bot

[omnibox] Remove answer from suggestion if keyword suggestion

When a suggestion has a keyword hint, we draw a lazy chevron to its
right, and offer the tab key hint. But if the suggestion is an
Answer, we replace this icon with the appropriate Answer icon.

When both of these occur within the same suggestion, it looks strange.
First, the suggestion looks like an answer, not a keyword suggestion.
Second, when the user hits tab, the Answer icon slides over as the
keyword chevron would do.

To fix this, we remove the answer from suggestions with a keyword
hint, reverting it to a normal search.

Bug: 1011876
Change-Id: I1f8cddd1fb1d3bd9e5c59d77edcaf92f776a94a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847851
Commit-Queue: Kevin Bailey <krb@chromium.org>
Reviewed-by: default avatarmanuk hovanesian <manukh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704159}
parent 2717e4a9
......@@ -669,6 +669,10 @@ void AutocompleteController::UpdateAssociatedKeywords(
// available.
if (!exact_keyword.empty() && !keywords.count(exact_keyword)) {
keywords.insert(exact_keyword);
// If the match has an answer, it will look strange to try to display
// it along with a keyword hint. Prefer the keyword hint, and revert
// to a typical search.
match->answer.reset();
match->associated_keyword.reset(new AutocompleteMatch(
keyword_provider_->CreateVerbatimMatch(exact_keyword,
exact_keyword, input_)));
......
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