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

Unified Diff: ui/views/controls/combobox/native_combobox_views.cc

Issue 10829176: Update drop down menu look & feel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: png crush Created 8 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
« no previous file with comments | « ui/resources/ui_resources.grd ('k') | ui/views/controls/menu/menu_config_views.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/combobox/native_combobox_views.cc
diff --git a/ui/views/controls/combobox/native_combobox_views.cc b/ui/views/controls/combobox/native_combobox_views.cc
index f791d4f965b39b374114a0fee02750d2b0abd31f..40e9821b9546ec5e89c81e81fc10ea3f16397d27 100644
--- a/ui/views/controls/combobox/native_combobox_views.cc
+++ b/ui/views/controls/combobox/native_combobox_views.cc
@@ -32,6 +32,12 @@ const int kLeftInsetSize = 4;
const int kBottomInsetSize = 4;
const int kRightInsetSize = 4;
+// Menu border widths
+const int kMenuBorderWidthLeft = 1;
+const int kMenuBorderWidthTop = 1;
+const int kMenuBorderWidthRight = 1;
+const int kMenuBorderWidthBottom = 2;
+
// Limit how small a combobox can be.
const int kMinComboboxWidth = 148;
@@ -58,7 +64,7 @@ NativeComboboxViews::NativeComboboxViews(Combobox* combobox)
: combobox_(combobox),
text_border_(new FocusableBorder()),
disclosure_arrow_(ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_DISCLOSURE_ARROW).ToImageSkia()),
+ IDR_MENU_DROPARROW).ToImageSkia()),
dropdown_open_(false),
selected_index_(-1),
content_width_(0),
@@ -325,15 +331,18 @@ void NativeComboboxViews::ShowDropDownMenu() {
// Extend the menu to the width of the combobox.
MenuItemView* menu = dropdown_list_menu_runner_->GetMenu();
SubmenuView* submenu = menu->CreateSubmenu();
- submenu->set_minimum_preferred_width(size().width());
-
-#if defined(USE_AURA)
- // Aura style is to have the menu over the bounds. Below bounds is default.
- menu->set_menu_position(views::MenuItemView::POSITION_OVER_BOUNDS);
-#endif
+ submenu->set_minimum_preferred_width(size().width() -
+ (kMenuBorderWidthLeft + kMenuBorderWidthRight));
gfx::Rect lb = GetLocalBounds();
gfx::Point menu_position(lb.origin());
+
+ // Inset the menu's requested position so the border of the menu lines up
+ // with the border of the combobox.
+ menu_position.set_x(menu_position.x() + kMenuBorderWidthLeft);
+ menu_position.set_y(menu_position.y() + kMenuBorderWidthTop);
+ lb.set_width(lb.width() - (kMenuBorderWidthLeft + kMenuBorderWidthRight));
+
View::ConvertPointToScreen(this, &menu_position);
if (menu_position.x() < 0)
menu_position.set_x(0);
« no previous file with comments | « ui/resources/ui_resources.grd ('k') | ui/views/controls/menu/menu_config_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698