Commit fe55ead6 authored by Tommy C. Li's avatar Tommy C. Li Committed by Commit Bot

Revert "Omnibox UI Refresh: Align Omnibox text to new Suggestion text"

This reverts commit 0830cdf0.

Reason for revert: UX direction change.

Original change's description:
> Omnibox UI Refresh: Align Omnibox text to new Suggestion text
> 
> The goal of the CL is to re-align the Omnibox text to match the new
> Refresh spec.
> 
> In the new Refresh spec, the text has a different indentation depending
> on whether or not the popup is open, so this CL resets the insets
> of the OmniboxViewViews whenever the popup opens or closes.
> 
> It also updates LocationBarView to no longer ignore the left-inset
> value of the OmniboxViewViews. We used to also ignore the right-inset
> value, but we stopped doing that recently [1].
> 
> After no longer ignoring the left-inset value, we update the
> non-Refresh value to the correct value of 0 (to keep things looking
> the same), and update the Refresh value to 2, which matches mocks.
> 
> We are updating the inset of the OmniboxViewViews textfield instead of
> the bounds of the textfield because we want the whole area to remain a
> clickable I-beam, even if we indent the text a bit.
> 
> [1] https://codereview.chromium.org/2642893002/diff/100001/chrome/browser/ui/views/location_bar/location_bar_view.cc
> 
> Bug: 849779, 823535
> Change-Id: I8c2a9e4934a78efec0d3d6cd60c63181be2d92c4
> Reviewed-on: https://chromium-review.googlesource.com/1096491
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Justin Donnelly <jdonnelly@chromium.org>
> Commit-Queue: Tommy Li <tommycli@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#566834}

TBR=sky@chromium.org,tommycli@chromium.org,jdonnelly@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 849779, 823535
Change-Id: Icf9e2f004042be6f25b9a86d23f269f5ebf0fd90
Reviewed-on: https://chromium-review.googlesource.com/1117218
Commit-Queue: Tommy Li <tommycli@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570847}
parent a0a4bf6a
......@@ -47,10 +47,8 @@ ChromeLayoutProvider::CreateLayoutProvider() {
gfx::Insets ChromeLayoutProvider::GetInsetsMetric(int metric) const {
switch (metric) {
case ChromeInsetsMetric::INSETS_OMNIBOX: {
int left_inset = ui::MaterialDesignController::IsRefreshUi() ? 2 : 0;
return gfx::Insets(3, left_inset, 3, 3);
}
case ChromeInsetsMetric::INSETS_OMNIBOX:
return gfx::Insets(3);
case ChromeInsetsMetric::INSETS_TOAST:
return gfx::Insets(0, 8);
case INSETS_BOOKMARKS_BAR_BUTTON:
......
......@@ -476,8 +476,10 @@ void LocationBarView::Layout() {
keyword_hint_view_->SetVisible(false);
const int item_padding = GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING);
LocationBarLayout leading_decorations(LocationBarLayout::LEFT_EDGE,
item_padding, item_padding);
LocationBarLayout leading_decorations(
LocationBarLayout::LEFT_EDGE, item_padding,
item_padding - omnibox_view_->GetInsets().left());
LocationBarLayout trailing_decorations(LocationBarLayout::RIGHT_EDGE,
item_padding, item_padding);
......@@ -1240,9 +1242,6 @@ void LocationBarView::OnPopupVisibilityChanged() {
// The focus ring may be hidden or shown when the popup visibility changes.
if (focus_ring_)
focus_ring_->SchedulePaint();
if (ui::MaterialDesignController::IsRefreshUi())
omnibox_view_->UpdateTextIndent();
}
const ToolbarModel* LocationBarView::GetToolbarModel() const {
......
......@@ -239,20 +239,6 @@ void OmniboxViewViews::InstallPlaceholderText() {
}
}
void OmniboxViewViews::UpdateTextIndent() {
DCHECK(ui::MaterialDesignController::IsRefreshUi());
gfx::Insets insets =
ChromeLayoutProvider::Get()->GetInsetsMetric(INSETS_OMNIBOX);
if (model()->popup_model()->IsOpen())
insets += gfx::Insets(0, 8 /* left */, 0, 0);
SetBorder(views::CreateEmptyBorder(insets));
// This is necessary to reposition the internal RenderText.
OnBoundsChanged(gfx::Rect());
}
bool OmniboxViewViews::IsHovered() const {
return hovered_;
}
......
......@@ -91,10 +91,6 @@ class OmniboxViewViews : public OmniboxView,
// "Search Google or type a URL" when the Omnibox is empty and unfocused.
void InstallPlaceholderText();
// If the Omnibox popup is open, updates the text indent to match the popup.
// Otherwise, resets the text indent to default.
void UpdateTextIndent();
// Returns true if the omnibox is currently hovered.
bool IsHovered() const;
......
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