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

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: Moved inset code 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.h » ('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 e0032c30986a737c102b6d88815f6ef45f1ba760..62b5a94c0bf9596c3aed4ad9063f8eef8c01ac0f 100644
--- a/ui/views/controls/combobox/native_combobox_views.cc
+++ b/ui/views/controls/combobox/native_combobox_views.cc
@@ -18,6 +18,7 @@
#include "ui/views/border.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/focusable_border.h"
+#include "ui/views/controls/menu/menu_config.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/menu/submenu_view.h"
#include "ui/views/widget/root_view.h"
@@ -57,7 +58,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),
@@ -326,13 +327,18 @@ void NativeComboboxViews::ShowDropDownMenu() {
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
-
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() +
+ MenuConfig::instance().menu_border_width_left);
sky 2012/08/07 20:50:01 Now that this code is entirely here it doesn't mak
Harry McCleave 2012/08/07 22:08:08 Done.
+ menu_position.set_y(menu_position.y() +
+ MenuConfig::instance().menu_border_width_top);
+ lb.set_width(lb.width() - (MenuConfig::instance().menu_border_width_left +
+ MenuConfig::instance().menu_border_width_right));
+
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.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698