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

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm

Issue 606593002: Move bookmark's folder menu upwards only when its parent button is moved (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit : additional space Created 6 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698