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..06f6d9d206e8643312b480b1f2625b3307d3a975 100644 |
| --- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm |
| +++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm |
| @@ -526,14 +526,19 @@ NSRect GetFirstButtonFrameForHeight(CGFloat height) { |
| newWindowTopLeft = NSMakePoint( |
| buttonBottomLeftInScreen.x + bookmarks::kBookmarkBarButtonOffset, |
| bookmarkBarBottomLeftInScreen.y + bookmarks::kBookmarkBarMenuOffset); |
| - // Make sure the window is on-screen; if not, push left. It is |
| - // intentional that top level folders "push left" slightly |
| + // Make sure the window is on-screen; if not, push left or right. It is |
| + // intentional that top level folders "push left" or "push right" slightly |
| // different than subfolders. |
| NSRect screenFrame = [screen_ visibleFrame]; |
| + // Test if window is off-screen on the right side. |
| CGFloat spillOff = (newWindowTopLeft.x + windowWidth) - NSMaxX(screenFrame); |
| if (spillOff > 0.0) { |
| newWindowTopLeft.x = std::max(newWindowTopLeft.x - spillOff, |
| NSMinX(screenFrame)); |
| + } else { // For left side. |
|
Alexei Svitkine (slow)
2014/10/07 18:26:13
Nit: Two spaces before start of // comment.
Gaja
2014/10/08 03:08:03
Moved to else if block.
|
| + spillOff = NSMinX(screenFrame) - newWindowTopLeft.x; |
| + if (spillOff > 0.0) |
|
Alexei Svitkine (slow)
2014/10/07 18:26:13
Just check "if (newWindowTopLeft.x < NSMinX(screen
Gaja
2014/10/08 03:08:03
Done.
|
| + newWindowTopLeft.x = 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 |