Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5191)

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 1319983002: Add a top shadow to material design omnibox dropdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Peter's comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
index b2c8d9443454123b70d159e98a47b36c31dc16ae..dfc47bde45cb7c4c1dafce65a752c23eb3187151 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -69,6 +69,7 @@ OmniboxPopupContentsView::OmniboxPopupContentsView(
set_owned_by_client();
ui::ThemeProvider* theme = location_bar_view_->GetThemeProvider();
+ top_shadow_ = theme->GetImageSkiaNamed(IDR_OMNIBOX_DROPDOWN_SHADOW_TOP);
int bottom_shadow_asset = ui::MaterialDesignController::IsModeMaterial() ?
IDR_OMNIBOX_DROPDOWN_SHADOW_BOTTOM : IDR_BUBBLE_B;
bottom_shadow_ = theme->GetImageSkiaNamed(bottom_shadow_asset);
@@ -194,10 +195,18 @@ void OmniboxPopupContentsView::UpdatePopupAppearance() {
for (size_t i = result_size; i < AutocompleteResult::kMaxMatches; ++i)
child_at(i)->SetVisible(false);
+ // The additional overlap is needed for material design so that the content
+ // separator beneath the toolbar is not visible underneath the transparent
+ // shadow asset.
Peter Kasting 2015/08/29 01:00:23 OK, so if we move the comment in the other file ou
tdanderson 2015/08/31 15:23:19 Done.
+ int top_edge_overlap = views::NonClientFrameView::kClientEdgeThickness;
+ if (ui::MaterialDesignController::IsModeMaterial())
Peter Kasting 2015/08/29 01:00:23 ...Then above this line, I'd add a further comment
tdanderson 2015/08/31 15:23:19 Done.
+ top_edge_overlap += top_shadow_->height();
+
gfx::Point top_left_screen_coord;
int width;
location_bar_view_->GetOmniboxPopupPositioningInfo(
- &top_left_screen_coord, &width, &start_margin_, &end_margin_);
+ &top_left_screen_coord, &width, &start_margin_,
+ &end_margin_, top_edge_overlap);
gfx::Rect new_target_bounds(top_left_screen_coord,
gfx::Size(width, CalculatePopupHeight()));
@@ -431,10 +440,15 @@ const char* OmniboxPopupContentsView::GetClassName() const {
void OmniboxPopupContentsView::OnPaint(gfx::Canvas* canvas) {
// Top border.
- canvas->FillRect(
- gfx::Rect(0, 0, width(), views::NonClientFrameView::kClientEdgeThickness),
- ThemeProperties::GetDefaultColor(
- ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ canvas->TileImageInt(*top_shadow_, 0, 0, width(), top_shadow_->height());
+ } else {
+ canvas->FillRect(
+ gfx::Rect(0, 0, width(),
+ views::NonClientFrameView::kClientEdgeThickness),
+ ThemeProperties::GetDefaultColor(
+ ThemeProperties::COLOR_TOOLBAR_SEPARATOR));
+ }
// Bottom border.
canvas->TileImageInt(*bottom_shadow_, 0, height() - bottom_shadow_->height(),

Powered by Google App Engine
This is Rietveld 408576698