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

Unified Diff: views/controls/menu/submenu_view.cc

Issue 3289001: Adds support for invisible menu items to bookmark menus and wires it (Closed)
Patch Set: Created 10 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
« no previous file with comments | « chrome/browser/views/wrench_menu.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/submenu_view.cc
diff --git a/views/controls/menu/submenu_view.cc b/views/controls/menu/submenu_view.cc
index a6e48d50736d5003df448f18f9beacbadf1c4f79..0df12e589c0852a703a68f7020b56a2d4ed0110d 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) {
« no previous file with comments | « chrome/browser/views/wrench_menu.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698