diff options
author | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-26 04:29:15 +0000 |
---|---|---|
committer | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-26 04:29:15 +0000 |
commit | c5a323f5fc9ebeb1eab39c039799a51b987c33e4 (patch) | |
tree | 765adb57564ade2b79a7e585a21b10c68e6ba56c /ui | |
parent | c3160cf3b5c50129c62cca03422ebd6ca4d1e96d (diff) | |
download | chromium_src-c5a323f5fc9ebeb1eab39c039799a51b987c33e4.zip chromium_src-c5a323f5fc9ebeb1eab39c039799a51b987c33e4.tar.gz chromium_src-c5a323f5fc9ebeb1eab39c039799a51b987c33e4.tar.bz2 |
Fixing too large menu case for suppressing scrollable menus
BUG=128815
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10444033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/views/controls/menu/menu_controller.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 2e571e3..ce1adc2 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -1555,21 +1555,23 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item, state_.monitor_bounds.bottom() - y)); } else if (item->actual_menu_position() == MenuItemView::POSITION_BEST_FIT) { + MenuItemView::MenuPosition orientation = + MenuItemView::POSITION_BELOW_BOUNDS; if (state_.monitor_bounds.height() < pref.height()) { // Handle very tall menus. pref.set_height(state_.monitor_bounds.height()); - y = state_.monitor_bounds.bottom(); - item->set_actual_menu_position(MenuItemView::POSITION_BELOW_BOUNDS); + y = state_.monitor_bounds.y(); } else if (state_.monitor_bounds.y() + pref.height() < state_.initial_bounds.y()) { // Flipping upwards if there is enough space. y = state_.initial_bounds.y() - pref.height(); - item->set_actual_menu_position(MenuItemView::POSITION_ABOVE_BOUNDS); + orientation = MenuItemView::POSITION_ABOVE_BOUNDS; } else { - // The user prefers to move the menu a bit around in order to get the + // It is allowed to move the menu a bit around in order to get the // best fit and to avoid showing scroll elements. y = state_.monitor_bounds.bottom() - pref.height(); - item->set_actual_menu_position(MenuItemView::POSITION_BELOW_BOUNDS); + } + if (orientation == MenuItemView::POSITION_BELOW_BOUNDS) { // The menu should never overlap the owning button. So move it. // We use the anchor view style to determine the preferred position // relative to the owning button. @@ -1590,6 +1592,7 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item, x = state_.initial_bounds.x() - pref.width(); // Move left. } } + item->set_actual_menu_position(orientation); } else { pref.set_height(std::min(pref.height(), state_.initial_bounds.y() - state_.monitor_bounds.y())); |