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

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

Issue 1300843003: Change width of rows in material design omnibox dropdown (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change left/right to start/end 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 d716b57767e858e0bc7b5d107f630642efcd3ba8..b2c8d9443454123b70d159e98a47b36c31dc16ae 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc
@@ -63,8 +63,8 @@ OmniboxPopupContentsView::OmniboxPopupContentsView(
font_list_(font_list),
ignore_mouse_drag_(false),
size_animation_(this),
- left_margin_(0),
- right_margin_(0) {
+ start_margin_(0),
+ end_margin_(0) {
// The contents is owned by the LocationBarView.
set_owned_by_client();
@@ -116,12 +116,17 @@ void OmniboxPopupContentsView::LayoutChildren() {
ThemeProperties::PROPERTY_OMNIBOX_DROPDOWN_MIN_TEXT_VERTICAL_PADDING);
gfx::Rect contents_rect = GetContentsBounds();
-
contents_rect.Inset(
- left_margin_,
- views::NonClientFrameView::kClientEdgeThickness + min_vertical_padding,
- right_margin_,
- min_vertical_padding);
+ 0, views::NonClientFrameView::kClientEdgeThickness + min_vertical_padding,
+ 0, min_vertical_padding);
+
+ // In the non-material dropdown, the colored/clickable regions within the
+ // dropdown are only as wide as the location bar. In the material version,
+ // these are full width, and OmniboxResultView instead insets the icons/text
+ // inside to be aligned with the location bar.
+ if (!ui::MaterialDesignController::IsModeMaterial())
+ contents_rect.Inset(start_margin_, 0, end_margin_, 0);
+
int top = contents_rect.y();
for (size_t i = 0; i < AutocompleteResult::kMaxMatches; ++i) {
View* v = child_at(i);
@@ -192,7 +197,7 @@ void OmniboxPopupContentsView::UpdatePopupAppearance() {
gfx::Point top_left_screen_coord;
int width;
location_bar_view_->GetOmniboxPopupPositioningInfo(
- &top_left_screen_coord, &width, &left_margin_, &right_margin_);
+ &top_left_screen_coord, &width, &start_margin_, &end_margin_);
gfx::Rect new_target_bounds(top_left_screen_coord,
gfx::Size(width, CalculatePopupHeight()));
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h ('k') | chrome/browser/ui/views/omnibox/omnibox_result_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698