Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm |
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm |
index 2eb0880c5f79ed46df5d53ad068412a2a6691471..f894eb6ac76fd2263b9eb0aec5e139342dbdb9d5 100644 |
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm |
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm |
@@ -1935,11 +1935,16 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { |
NSInteger buttonCount = [buttons_ count]; |
if (buttonCount) { |
BookmarkButton* subButton = [folderController_ parentButton]; |
+ NSInteger targetIndex = 0; |
for (NSButton* aButton in buttons_.get()) { |
- // If this button is showing its menu then we need to move the menu, too. |
- if (aButton == subButton) |
- [folderController_ |
- offsetFolderMenuWindow:NSMakeSize(0.0, chrome::kBookmarkBarHeight)]; |
+ targetIndex++; |
+ // If this button is showing its menu and is below the removed button, |
+ // i.e its index is greater, then we need to move the menu too. |
+ if (aButton == subButton && targetIndex > buttonIndex) { |
+ [folderController_ offsetFolderMenuWindow:NSMakeSize(0.0, |
+ bookmarks::kBookmarkFolderButtonHeight)]; |
+ break; |
Gaja
2014/10/07 04:39:12
Is it okay to break the loop once we found the but
|
+ } |
} |
} else if (parentButton_ != [barController_ otherBookmarksButton]) { |
// If all nodes have been removed from this folder then add in the |