Index: views/controls/menu/menu_controller.cc |
diff --git a/views/controls/menu/menu_controller.cc b/views/controls/menu/menu_controller.cc |
index 1af598fe0c22da3941cd7acfd42d184078e3cc57..16f3690a8f676745217f38a1c53a5ccab6b69478 100644 |
--- a/views/controls/menu/menu_controller.cc |
+++ b/views/controls/menu/menu_controller.cc |
@@ -1344,16 +1344,15 @@ void MenuController::MenuChildrenChanged(MenuItemView* item) { |
DCHECK(item); |
DCHECK(item->GetSubmenu()->IsShowing()); |
- // Currently this only supports adjusting the bounds of the last menu. |
- DCHECK(item == state_.item->GetParentMenuItem()); |
- |
- // Make sure the submenu isn't showing for the current item (the position may |
- // have changed or the menu removed). This also moves the selection back to |
- // the parent, which handles the case where the selected item was removed. |
- SetSelection(state_.item->GetParentMenuItem(), |
- SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); |
- |
- OpenMenuImpl(item, false); |
+ // If the current item is a descendant of the item that changed, |
+ // move the selection back to the changed item. |
+ const MenuItemView* ancestor = state_.item; |
sky
2011/05/11 14:26:10
You should update if either state_.item or pending
rhashimoto
2011/05/11 19:41:07
Done.
|
+ while (ancestor && ancestor != item) |
+ ancestor = ancestor->GetParentMenuItem(); |
+ if (ancestor) { |
+ SetSelection(item, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY); |
+ OpenMenuImpl(item, false); |
sky
2011/05/11 14:26:10
You should only invoke OpenMenuItem if item has a
rhashimoto
2011/05/11 19:41:07
Done, though I think we only get here if the item
|
+ } |
} |
void MenuController::BuildPathsAndCalculateDiff( |