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

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: Created 6 years, 3 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 | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h ('k') | 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..b0f830ce51690b40fc682a70d19ffc31f44be743 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
@@ -350,15 +350,6 @@ NSRect GetFirstButtonFrameForHeight(CGFloat height) {
return parentButton_.get();
}
-- (void)offsetFolderMenuWindow:(NSSize)offset {
- NSWindow* window = [self window];
- NSRect windowFrame = [window frame];
- windowFrame.origin.x -= offset.width;
- windowFrame.origin.y += offset.height; // Yes, in the opposite direction!
- [window setFrame:windowFrame display:YES];
- [folderController_ offsetFolderMenuWindow:offset];
-}
-
- (void)reconfigureMenu {
[NSObject cancelPreviousPerformRequestsWithTarget:self];
for (BookmarkButton* button in buttons_.get()) {
@@ -1931,35 +1922,28 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
buttonFrame.origin.y -= bookmarks::kBookmarkFolderButtonHeight;
[button setFrame:buttonFrame];
}
- // Search for and adjust submenus, if necessary.
+
NSInteger buttonCount = [buttons_ count];
- if (buttonCount) {
- 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.
Alexei Svitkine (slow) 2014/09/26 15:14:37 Are you sure we never need to do this? What if yo
Gaja 2014/09/27 05:56:33 Oh, I did not test this case, I will check the beh
- if (aButton == subButton)
- [folderController_
- offsetFolderMenuWindow:NSMakeSize(0.0, chrome::kBookmarkBarHeight)];
Gaja 2014/09/25 09:00:39 @asvitkine, This CL is to remove only the above 'i
- }
- } else if (parentButton_ != [barController_ otherBookmarksButton]) {
- // If all nodes have been removed from this folder then add in the
- // 'empty' placeholder button except for "Other bookmarks" folder
- // as we are going to hide it.
- NSRect buttonFrame =
- GetFirstButtonFrameForHeight([self menuHeightForButtonCount:1]);
- BookmarkButton* button = [self makeButtonForNode:nil
+ if (buttonCount == 0) {
+ if (parentButton_ != [barController_ otherBookmarksButton]) {
+ // If all nodes have been removed from this folder then add in the
+ // 'empty' placeholder button except for "Other bookmarks" folder
+ // as we are going to hide it.
+ NSRect buttonFrame =
+ GetFirstButtonFrameForHeight([self menuHeightForButtonCount:1]);
+ BookmarkButton* button = [self makeButtonForNode:nil
frame:buttonFrame];
Alexei Svitkine (slow) 2014/09/26 15:14:37 Nit: Align :'s or wrap after =.
Gaja 2014/09/27 05:56:33 Acknowledged.
- [buttons_ addObject:button];
- [folderView_ addSubview:button];
- buttonCount = 1;
- }
-
- // buttonCount will be 0 if "Other bookmarks" folder is empty, so close
- // the folder before hiding it.
- if (buttonCount == 0)
- [barController_ closeBookmarkFolder:nil];
- else if (buttonCount > 0)
- [self adjustWindowForButtonCount:buttonCount];
+ [buttons_ addObject:button];
+ [folderView_ addSubview:button];
+ buttonCount = 1;
Alexei Svitkine (slow) 2014/09/26 15:14:37 Shouldn't this block call [self adjustWindowForBut
Gaja 2014/09/27 05:56:33 I think we don't need this line. Here is my analys
+ }
+ else {
Alexei Svitkine (slow) 2014/09/26 15:14:37 Nit: Put on previous line.
Gaja 2014/09/27 05:56:33 Acknowledged.
+ // buttonCount will be 0 if "Other bookmarks" folder is empty, so close
+ // the folder before hiding it.
+ [barController_ closeBookmarkFolder:nil];
+ }
+ } else if (buttonCount > 0)
Alexei Svitkine (slow) 2014/09/26 15:14:37 Nit: {}'s
Gaja 2014/09/27 05:56:33 Acknowledged.
+ [self adjustWindowForButtonCount:buttonCount];
if (animate && !ignoreAnimations_)
NSShowAnimationEffect(NSAnimationEffectDisappearingItemDefault, poofPoint,
« no previous file with comments | « chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698