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

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

Issue 11088037: Revert 160886 - Added MenuConfig setter to MenuItemView, updated rest of the code to use set MenuCo… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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_win.cc ('k') | ui/views/controls/menu/menu_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_controller.cc
===================================================================
--- ui/views/controls/menu/menu_controller.cc (revision 160892)
+++ ui/views/controls/menu/menu_controller.cc (working copy)
@@ -1556,21 +1556,19 @@
int x, y;
- const MenuConfig& menu_config = item->GetMenuConfig();
-
if (!item->GetParentMenuItem()) {
// First item, position relative to initial location.
x = state_.initial_bounds.x();
// Offsets for context menu prevent menu items being selected by
// simply opening the menu (bug 142992).
- if (menu_config.offset_context_menus && state_.context_menu)
+ if (MenuConfig::instance().offset_context_menus && state_.context_menu)
x += 1;
y = state_.initial_bounds.bottom();
if (state_.anchor == MenuItemView::TOPRIGHT) {
x = x + state_.initial_bounds.width() - pref.width();
- if (menu_config.offset_context_menus && state_.context_menu)
+ if (MenuConfig::instance().offset_context_menus && state_.context_menu)
x -= 1;
} else if (state_.anchor == MenuItemView::BOTTOMCENTER) {
x = x - (pref.width() - state_.initial_bounds.width()) / 2;
@@ -1647,7 +1645,7 @@
item->set_actual_menu_position(MenuItemView::POSITION_BELOW_BOUNDS);
}
if (state_.monitor_bounds.width() != 0 &&
- menu_config.offset_context_menus && state_.context_menu) {
+ MenuConfig::instance().offset_context_menus && state_.context_menu) {
if (x + pref.width() > state_.monitor_bounds.right())
x = state_.initial_bounds.x() - pref.width() - 1;
if (x < state_.monitor_bounds.x())
@@ -1665,7 +1663,8 @@
bool layout_is_rtl = base::i18n::IsRTL();
bool create_on_the_right = (prefer_leading && !layout_is_rtl) ||
(!prefer_leading && layout_is_rtl);
- int submenu_horizontal_inset = menu_config.submenu_horizontal_inset;
+ int submenu_horizontal_inset =
+ MenuConfig::instance().submenu_horizontal_inset;
if (create_on_the_right) {
x = item_loc.x() + item->width() - submenu_horizontal_inset;
@@ -1687,7 +1686,7 @@
x = item_loc.x() + item->width() - submenu_horizontal_inset;
}
}
- y = item_loc.y() - menu_config.submenu_vertical_margin_size;
+ y = item_loc.y() - MenuConfig::instance().submenu_vertical_margin_size;
if (state_.monitor_bounds.width() != 0) {
pref.set_height(std::min(pref.height(), state_.monitor_bounds.height()));
if (y + pref.height() > state_.monitor_bounds.bottom())
« no previous file with comments | « ui/views/controls/menu/menu_config_win.cc ('k') | ui/views/controls/menu/menu_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698