Commit 5d597643 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Remove 1px separator from rounded omnibox results

Rounded omnibox results apply to touchable and Material refresh. This is
not in spec for refresh and touchable doesn't need to diverge here.

Bug: chromium:826606
Change-Id: If9ea12ae3912b50fce92c9368452bf342b395e6c
Reviewed-on: https://chromium-review.googlesource.com/1007898Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550209}
parent 0cfdea89
...@@ -100,7 +100,6 @@ ui::NativeTheme::ColorId GetLegacyColorId(ui::NativeTheme* native_theme, ...@@ -100,7 +100,6 @@ ui::NativeTheme::ColorId GetLegacyColorId(ui::NativeTheme* native_theme,
case OmniboxPart::LOCATION_BAR_TEXT_DIMMED: case OmniboxPart::LOCATION_BAR_TEXT_DIMMED:
case OmniboxPart::RESULTS_ICON: case OmniboxPart::RESULTS_ICON:
case OmniboxPart::RESULTS_TEXT_INVISIBLE: case OmniboxPart::RESULTS_TEXT_INVISIBLE:
case OmniboxPart::RESULTS_SEPARATOR:
NOTREACHED(); NOTREACHED();
break; break;
} }
...@@ -237,10 +236,6 @@ SkColor GetOmniboxColor(OmniboxPart part, ...@@ -237,10 +236,6 @@ SkColor GetOmniboxColor(OmniboxPart part,
return color_utils::BlendTowardOppositeLuma( return color_utils::BlendTowardOppositeLuma(
dark ? gfx::kGoogleGrey800 : SK_ColorWHITE, dark ? gfx::kGoogleGrey800 : SK_ColorWHITE,
NormalHoveredSelectedOrBoth<SkAlpha>(state, 0x00, 0x0F, 0x14, 0x24)); NormalHoveredSelectedOrBoth<SkAlpha>(state, 0x00, 0x0F, 0x14, 0x24));
case OmniboxPart::RESULTS_SEPARATOR:
// The dark base color doesn't appear in the Material spec, just Chrome's.
return dark ? SkColorSetARGB(0x6E, 0x16, 0x17, 0x1A) // 43% alpha.
: SkColorSetA(gfx::kGoogleGrey900, 0x24); // 14% alpha.
case OmniboxPart::LOCATION_BAR_TEXT_DEFAULT: case OmniboxPart::LOCATION_BAR_TEXT_DEFAULT:
case OmniboxPart::RESULTS_TEXT_DEFAULT: case OmniboxPart::RESULTS_TEXT_DEFAULT:
......
...@@ -20,7 +20,6 @@ enum class OmniboxPart { ...@@ -20,7 +20,6 @@ enum class OmniboxPart {
RESULTS_BACKGROUND, // Background of the results dropdown. RESULTS_BACKGROUND, // Background of the results dropdown.
RESULTS_ICON, RESULTS_ICON,
RESULTS_SEPARATOR, // Separator between the input row and the results rows.
RESULTS_TEXT_DEFAULT, RESULTS_TEXT_DEFAULT,
RESULTS_TEXT_DIMMED, RESULTS_TEXT_DIMMED,
RESULTS_TEXT_INVISIBLE, RESULTS_TEXT_INVISIBLE,
......
...@@ -342,15 +342,6 @@ gfx::Point LocationBarView::GetOmniboxViewOrigin() const { ...@@ -342,15 +342,6 @@ gfx::Point LocationBarView::GetOmniboxViewOrigin() const {
return origin; return origin;
} }
int LocationBarView::GetTextInsetForNormalInputStart() const {
// Note that this does not need to account for the internal Textfield border,
// since that's subtracted during layout.
return GetHorizontalEdgeThickness() +
GetLayoutConstant(LOCATION_BAR_ICON_SIZE) +
2 * GetLayoutConstant(LOCATION_BAR_ICON_INTERIOR_PADDING) +
GetLayoutConstant(LOCATION_BAR_ELEMENT_PADDING);
}
void LocationBarView::SetImeInlineAutocompletion(const base::string16& text) { void LocationBarView::SetImeInlineAutocompletion(const base::string16& text) {
ime_inline_autocomplete_view_->SetText(text); ime_inline_autocomplete_view_->SetText(text);
ime_inline_autocomplete_view_->SetVisible(!text.empty()); ime_inline_autocomplete_view_->SetVisible(!text.empty());
......
...@@ -166,10 +166,6 @@ class LocationBarView : public LocationBar, ...@@ -166,10 +166,6 @@ class LocationBarView : public LocationBar,
// not where the icons are shown). // not where the icons are shown).
gfx::Point GetOmniboxViewOrigin() const; gfx::Point GetOmniboxViewOrigin() const;
// Returns the inset from the edge of the location bar where text begins when
// only a location icon is showing (no security chip or keyword bubble).
int GetTextInsetForNormalInputStart() const;
// Shows |text| as an inline autocompletion. This is useful for IMEs, where // Shows |text| as an inline autocompletion. This is useful for IMEs, where
// we can't show the autocompletion inside the actual OmniboxView. See // we can't show the autocompletion inside the actual OmniboxView. See
// comments on |ime_inline_autocomplete_view_|. // comments on |ime_inline_autocomplete_view_|.
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/ui/layout_constants.h" #include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/omnibox/omnibox_theme.h" #include "chrome/browser/ui/omnibox/omnibox_theme.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "ui/compositor/layer.h" #include "ui/compositor/layer.h"
...@@ -23,10 +22,6 @@ namespace { ...@@ -23,10 +22,6 @@ namespace {
// Value from the spec controlling appearance of the shadow. // Value from the spec controlling appearance of the shadow.
constexpr int kElevation = 16; constexpr int kElevation = 16;
// The layout height (in DIPs) of the view drawing the separator above results.
// The top of this view aligns with the bottom edge of the location bar.
constexpr int kSeparatorViewHeightDIP = 1;
// View at the top of the frame which paints transparent pixels to make a hole // View at the top of the frame which paints transparent pixels to make a hole
// so that the location bar shows through. // so that the location bar shows through.
class TopBackgroundView : public views::View { class TopBackgroundView : public views::View {
...@@ -39,25 +34,12 @@ class TopBackgroundView : public views::View { ...@@ -39,25 +34,12 @@ class TopBackgroundView : public views::View {
} }
}; };
class SeparatorView : public views::View {
public:
explicit SeparatorView(SkColor color) : color_(color) {}
// Views:View:
void OnPaint(gfx::Canvas* canvas) override {
BrowserView::Paint1pxHorizontalLine(canvas, color_, GetLocalBounds(), true);
}
private:
const SkColor color_;
};
// Insets used to position |contents_| within |contents_host_|. // Insets used to position |contents_| within |contents_host_|.
gfx::Insets GetContentInsets(views::View* location_bar) { gfx::Insets GetContentInsets(views::View* location_bar) {
return gfx::Insets( return gfx::Insets(
RoundedOmniboxResultsFrame::kLocationBarAlignmentInsets.top(), 0, RoundedOmniboxResultsFrame::kLocationBarAlignmentInsets.top(), 0,
0, 0) + 0, 0) +
gfx::Insets(location_bar->height() + kSeparatorViewHeightDIP, 0, 0, 0); gfx::Insets(location_bar->height(), 0, 0, 0);
} }
} // namespace } // namespace
...@@ -69,7 +51,6 @@ RoundedOmniboxResultsFrame::RoundedOmniboxResultsFrame( ...@@ -69,7 +51,6 @@ RoundedOmniboxResultsFrame::RoundedOmniboxResultsFrame(
LocationBarView* location_bar) LocationBarView* location_bar)
: content_insets_(GetContentInsets(location_bar)), : content_insets_(GetContentInsets(location_bar)),
location_bar_height_(location_bar->height()), location_bar_height_(location_bar->height()),
separator_inset_(location_bar->GetTextInsetForNormalInputStart()),
contents_(contents) { contents_(contents) {
// Host the contents in its own View to simplify layout and clipping. // Host the contents in its own View to simplify layout and clipping.
contents_host_ = new views::View(); contents_host_ = new views::View();
...@@ -93,10 +74,7 @@ RoundedOmniboxResultsFrame::RoundedOmniboxResultsFrame( ...@@ -93,10 +74,7 @@ RoundedOmniboxResultsFrame::RoundedOmniboxResultsFrame(
contents_host_->layer()->SetMaskLayer(contents_mask_->layer()); contents_host_->layer()->SetMaskLayer(contents_mask_->layer());
top_background_ = new TopBackgroundView(background_color); top_background_ = new TopBackgroundView(background_color);
separator_ = new SeparatorView(
GetOmniboxColor(OmniboxPart::RESULTS_SEPARATOR, location_bar->tint()));
contents_host_->AddChildView(top_background_); contents_host_->AddChildView(top_background_);
contents_host_->AddChildView(separator_);
contents_host_->AddChildView(contents_); contents_host_->AddChildView(contents_);
AddChildView(contents_host_); AddChildView(contents_host_);
...@@ -141,11 +119,6 @@ void RoundedOmniboxResultsFrame::Layout() { ...@@ -141,11 +119,6 @@ void RoundedOmniboxResultsFrame::Layout() {
top_bounds.set_height(location_bar_height_); top_bounds.set_height(location_bar_height_);
top_background_->SetBoundsRect(top_bounds); top_background_->SetBoundsRect(top_bounds);
top_bounds.set_y(top_bounds.bottom()); // Shift down.
top_bounds.Inset(separator_inset_, 0); // Inset the width further.
top_bounds.set_height(kSeparatorViewHeightDIP);
separator_->SetBoundsRect(top_bounds);
gfx::Rect results_bounds = gfx::Rect(bounds.size()); gfx::Rect results_bounds = gfx::Rect(bounds.size());
results_bounds.Inset(content_insets_); results_bounds.Inset(content_insets_);
contents_->SetBoundsRect(results_bounds); contents_->SetBoundsRect(results_bounds);
......
...@@ -40,12 +40,10 @@ class RoundedOmniboxResultsFrame : public views::View { ...@@ -40,12 +40,10 @@ class RoundedOmniboxResultsFrame : public views::View {
// Fixed layout constants. // Fixed layout constants.
const gfx::Insets content_insets_; const gfx::Insets content_insets_;
const int location_bar_height_; const int location_bar_height_;
const int separator_inset_;
std::unique_ptr<ui::LayerOwner> contents_mask_; std::unique_ptr<ui::LayerOwner> contents_mask_;
views::View* top_background_ = nullptr; views::View* top_background_ = nullptr;
views::View* separator_ = nullptr;
views::View* contents_ = nullptr; views::View* contents_ = nullptr;
views::View* contents_host_ = nullptr; views::View* contents_host_ = nullptr;
......
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