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

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 1310903004: Use a ui::MenuModel in views::Combobox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +curlies Created 5 years, 3 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/views/controls/menu/menu_config_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_controller.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index bba8a191e214b971aa7a417dc5c423a946f4a6e2..53fa52c30564458e8089bf446a099a51cb69e7eb 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -1646,6 +1646,10 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item,
gfx::Size pref = submenu->GetScrollViewContainer()->GetPreferredSize();
+ // For comboboxes, ensure the menu is at least as wide as the anchor.
+ if (is_combobox_)
+ pref.set_width(std::max(pref.width(), state_.initial_bounds.width()));
+
// Don't let the menu go too wide.
pref.set_width(std::min(pref.width(),
item->GetDelegate()->GetMaxWidthForMenu(item)));
« no previous file with comments | « ui/views/controls/menu/menu_config_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698