Index: views/controls/menu/menu_controller.cc |
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc |
index a59caacc9ca35f20ff51b2d2618fb68650837243..022f1767dc722f22069c054c01c1157f82b52ab9 100644 |
--- a/views/controls/menu/menu_controller.cc |
+++ b/views/controls/menu/menu_controller.cc |
@@ -1325,8 +1325,14 @@ void MenuController::OpenMenu(MenuItemView* item) { |
} |
void MenuController::OpenMenuImpl(MenuItemView* item, bool show) { |
- if (show) |
+ if (show) { |
+ int old_count = item->GetSubmenu()->child_count(); |
item->GetDelegate()->WillShowMenu(item); |
+ if (old_count != item->GetSubmenu()->child_count()) { |
+ // If the number of children changed then we may need to add empty items. |
+ item->AddEmptyMenus(); |
+ } |
+ } |
bool prefer_leading = |
state_.open_leading.empty() ? true : state_.open_leading.back(); |
bool resulting_direction; |