Chromium Code Reviews| 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 f9aac0a605a8bc1c51c65f28c3bce22e55c81e27..26a44e9cb877753a26effee0e5845ddae9624b40 100644 |
| --- a/ui/views/controls/menu/menu_controller.cc |
| +++ b/ui/views/controls/menu/menu_controller.cc |
| @@ -1950,15 +1950,19 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item, |
| if (menu_config.offset_context_menus && state_.context_menu) |
| x -= 1; |
| } else if (state_.anchor == MENU_ANCHOR_BOTTOMCENTER) { |
| - x = x - (pref.width() - state_.initial_bounds.width()) / 2; |
| + x += (state_.initial_bounds.width() - pref.width()) / 2; |
| + // Place the menu below if it does not fit above. |
|
minch1
2017/05/09 16:25:20
Wrong position of the comment. Will update it in n
|
| if (pref.height() > |
| state_.initial_bounds.y() + kCenteredContextMenuYOffset) { |
| - // Menu does not fit above the anchor. We move it to below. |
| y = state_.initial_bounds.y() - kCenteredContextMenuYOffset; |
| } else { |
| y = std::max(0, state_.initial_bounds.y() - pref.height()) + |
| kCenteredContextMenuYOffset; |
| } |
| + } else if (state_.anchor == MENU_ANCHOR_FIXED_BOTTOMCENTER) { |
| + x += (state_.initial_bounds.width() - pref.width()) / 2; |
| + } else if (state_.anchor == MENU_ANCHOR_SIDECENTER) { |
| + y += (state_.initial_bounds.height() - pref.height()) / 2; |
| } |
| if (!state_.monitor_bounds.IsEmpty() && |