From d4c4f252a9422a4001e31dc811400382d5a93a93 Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Wed, 1 Sep 2010 19:27:46 +0000 Subject: Adds support for invisible menu items to bookmark menus and wires it up for the wrench menu. BUG=46221, 54017 TEST=see bug Review URL: http://codereview.chromium.org/3289001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58218 0039d316-1c4b-4281-b951-d872f2087c98 --- views/controls/menu/submenu_view.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'views') diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc index a6e48d5..0df12e5 100644 --- a/views/controls/menu/submenu_view.cc +++ b/views/controls/menu/submenu_view.cc @@ -86,9 +86,11 @@ void SubmenuView::Layout() { int menu_item_width = width() - insets.width(); for (int i = 0; i < GetChildViewCount(); ++i) { View* child = GetChildViewAt(i); - gfx::Size child_pref_size = child->GetPreferredSize(); - child->SetBounds(x, y, menu_item_width, child_pref_size.height()); - y += child_pref_size.height(); + if (child->IsVisible()) { + gfx::Size child_pref_size = child->GetPreferredSize(); + child->SetBounds(x, y, menu_item_width, child_pref_size.height()); + y += child_pref_size.height(); + } } } @@ -101,7 +103,8 @@ gfx::Size SubmenuView::GetPreferredSize() { int height = 0; for (int i = 0; i < GetChildViewCount(); ++i) { View* child = GetChildViewAt(i); - gfx::Size child_pref_size = child->GetPreferredSize(); + gfx::Size child_pref_size = child->IsVisible() ? + child->GetPreferredSize() : gfx::Size(); max_width = std::max(max_width, child_pref_size.width()); height += child_pref_size.height(); if (child->GetID() == MenuItemView::kMenuItemViewID) { -- cgit v1.1