Chromium Code Reviews| 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..63df38a2cfedcf05fb71060e64915d1814ddc963 100644 |
| --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm |
| +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm |
| @@ -1937,9 +1937,13 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { |
| BookmarkButton* subButton = [folderController_ parentButton]; |
| 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)]; |
| + if (aButton == subButton) { |
| + NSInteger targetIndex = [buttons_ indexOfObject:aButton]; |
|
Alexei Svitkine (slow)
2014/10/06 15:37:30
This results in O(n^2) behavior, since -indexOfObj
Gaja
2014/10/07 04:39:12
Done. Making use of an index variable by increment
|
| + if ((targetIndex + 1) > buttonIndex) { |
|
Alexei Svitkine (slow)
2014/10/06 15:37:30
Can you add a comment explaining this?
Maybe if y
Gaja
2014/10/07 04:39:12
Done. I have added it to existing comment above.
|
| + [folderController_ offsetFolderMenuWindow:NSMakeSize(0.0, |
| + bookmarks::kBookmarkFolderButtonHeight)]; |
| + } |
| + } |
| } |
| } else if (parentButton_ != [barController_ otherBookmarksButton]) { |
| // If all nodes have been removed from this folder then add in the |