Commit f28b7fc7 authored by manuk's avatar manuk Committed by Commit Bot

[omnibox] [rich-autocompletion] Unelide omnibox before setting focus.

With the 1-line UI, rich autocompletion adds a label adjacent to the
omnibox and then resizes the two as the autocompletion length changes.

On location bar focus, the omnibox is unelided; e.g. google.com is
unelided to https://www.google.com.

Before this CL, unelision occurs *after* the location bar is given focus
and its layout computed.

With this CL, unelision occurs *before* the location bar is given focus
so that it can reserve sufficient width for the unelided URL when
updating its layout.

Bug: 1062446
Change-Id: Id78d635255de69d9af97a5589a9e001eee3d0feb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2304666
Commit-Queue: manuk hovanesian <manukh@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#789698}
parent d9d7a737
...@@ -375,16 +375,16 @@ void LocationBarView::SelectAll() { ...@@ -375,16 +375,16 @@ void LocationBarView::SelectAll() {
void LocationBarView::FocusLocation(bool is_user_initiated) { void LocationBarView::FocusLocation(bool is_user_initiated) {
const bool omnibox_already_focused = omnibox_view_->HasFocus(); const bool omnibox_already_focused = omnibox_view_->HasFocus();
if (is_user_initiated)
omnibox_view()->model()->Unelide();
omnibox_view_->SetFocus(is_user_initiated); omnibox_view_->SetFocus(is_user_initiated);
if (omnibox_already_focused) if (omnibox_already_focused)
omnibox_view()->model()->ClearKeyword(); omnibox_view()->model()->ClearKeyword();
if (!is_user_initiated) if (is_user_initiated)
return; omnibox_view_->SelectAll(true);
omnibox_view_->SelectAll(true);
omnibox_view()->model()->Unelide();
} }
void LocationBarView::Revert() { void LocationBarView::Revert() {
......
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