diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-18 02:04:47 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-18 02:04:47 +0000 |
commit | 69e4d83c82077807a3c915d8eb6404140d9a8051 (patch) | |
tree | 0287915478992a1ec697024d1558997dc78e01d5 /chrome | |
parent | 4fac253191cd739920649d67d164847569a250a4 (diff) | |
download | chromium_src-69e4d83c82077807a3c915d8eb6404140d9a8051.zip chromium_src-69e4d83c82077807a3c915d8eb6404140d9a8051.tar.gz chromium_src-69e4d83c82077807a3c915d8eb6404140d9a8051.tar.bz2 |
Revert 75342 - The bookmark folder menus look bad when squeezed up against the bottom of a screen.
Detect this case and automatically switch to showing the menu above the button in this case.
BUG=69996
TEST=NONE
Review URL: http://codereview.chromium.org/6531019
TBR=maf@chromium.org
Review URL: http://codereview.chromium.org/6544010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm | 21 |
1 files changed, 3 insertions, 18 deletions
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 3362886..53bb97d 100644 --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm @@ -458,8 +458,7 @@ struct LayoutMetrics { // coordinates). The top left is positioned in a manner similar to // cascading menus. Windows may grow to either the right or left of // their parent (if a sub-folder) so we need to know |windowWidth|. -- (NSPoint)windowTopLeftForWidth:(int)windowWidth height:(int)windowHeight { - CGFloat kMinSqueezedMenuHeight = bookmarks::kBookmarkFolderButtonHeight * 2.0; +- (NSPoint)windowTopLeftForWidth:(int)windowWidth { NSPoint newWindowTopLeft; if (![parentController_ isKindOfClass:[self class]]) { // If we're not popping up from one of ourselves, we must be @@ -486,18 +485,6 @@ struct LayoutMetrics { newWindowTopLeft.x = std::max(newWindowTopLeft.x - spillOff, NSMinX(screenFrame)); } - // The menu looks bad when it is squeezed up against the bottom of the - // screen and ends up being only a few pixels tall. If it meets the - // threshold for this case, instead show the menu above the button. - NSRect visFrame = [[[parentButton_ window] screen] visibleFrame]; - CGFloat availableVerticalSpace = newWindowTopLeft.y - - (NSMinY(visFrame) + bookmarks::kScrollWindowVerticalMargin); - if ((availableVerticalSpace < kMinSqueezedMenuHeight) && - (windowHeight > availableVerticalSpace)) { - newWindowTopLeft.y = std::min( - newWindowTopLeft.y + windowHeight + NSHeight([parentButton_ frame]), - NSMaxY(visFrame)); - } } else { // Parent is a folder: expose as much as we can vertically; grow right/left. newWindowTopLeft.x = [self childFolderWindowLeftForWidth:windowWidth]; @@ -715,8 +702,7 @@ struct LayoutMetrics { folderFrame.size.height += deltaMenuHeight; [folderView_ setFrameSize:folderFrame.size]; CGFloat windowWidth = [self adjustButtonWidths] + padding_; - NSPoint newWindowTopLeft = [self windowTopLeftForWidth:windowWidth - height:deltaMenuHeight]; + NSPoint newWindowTopLeft = [self windowTopLeftForWidth:windowWidth]; CGFloat left = newWindowTopLeft.x; NSSize newSize = NSMakeSize(windowWidth, deltaMenuHeight); [self adjustWindowLeft:left size:newSize scrollingBy:0.0]; @@ -776,8 +762,7 @@ struct LayoutMetrics { // base the window width on this ideal button width. CGFloat buttonWidth = [self adjustButtonWidths]; CGFloat windowWidth = buttonWidth + padding_; - NSPoint newWindowTopLeft = [self windowTopLeftForWidth:windowWidth - height:height]; + NSPoint newWindowTopLeft = [self windowTopLeftForWidth:windowWidth]; // Make sure as much of a submenu is exposed (which otherwise would be a // problem if the parent button is close to the bottom of the screen). if ([parentController_ isKindOfClass:[self class]]) { |