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

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

Issue 10829176: Update drop down menu look & feel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up includes 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
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 d5747bd35ed2aebb197151f817d80d76819bf797..3a9c7ae00bfd365f9ae56c4240013bb9e43422ba 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -50,6 +50,10 @@ static const int kShowDelay = 400;
// Amount of time from when the drop exits the menu and the menu is hidden.
static const int kCloseOnExitTime = 1200;
+// Border width of the menu shadow (used to align drop down position/bounds)
+static const int kMenuBorderOffsetY = 2;
+static const int kMenuBorderOffsetX = 1;
+
namespace views {
namespace {
@@ -1554,6 +1558,8 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item,
gfx::Size pref = submenu->GetScrollViewContainer()->GetPreferredSize();
+ pref.set_width(pref.width() - (2 * kMenuBorderOffsetX));
+
// Don't let the menu go too wide.
if (item->actual_menu_position() != MenuItemView::POSITION_OVER_BOUNDS)
pref.set_width(std::min(pref.width(),
@@ -1568,11 +1574,11 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item,
if (!item->GetParentMenuItem()) {
// First item, position relative to initial location.
- x = state_.initial_bounds.x();
+ x = state_.initial_bounds.x() + kMenuBorderOffsetX;
if (item->actual_menu_position() == MenuItemView::POSITION_OVER_BOUNDS)
y = state_.initial_bounds.y();
else
- y = state_.initial_bounds.bottom();
+ y = state_.initial_bounds.bottom() + kMenuBorderOffsetY;
if (state_.anchor == MenuItemView::TOPRIGHT)
x = x + state_.initial_bounds.width() - pref.width();

Powered by Google App Engine
This is Rietveld 408576698