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

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

Issue 2884026: Initial bookmark bar folder window tries harder to be on-screen.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 5 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 | chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/bookmark_bar_folder_controller.mm
===================================================================
--- chrome/browser/cocoa/bookmark_bar_folder_controller.mm (revision 52574)
+++ chrome/browser/cocoa/bookmark_bar_folder_controller.mm (working copy)
@@ -340,6 +340,15 @@
convertPoint:NSZeroPoint toView:nil]];
newWindowTopLeft = NSMakePoint(buttonBottomLeftInScreen.x,
bookmarkBarBottomLeftInScreen.y);
+ // Make sure the window is on-screen; if not, push left. It is
+ // intentional that top level folders "push left" slightly
+ // different than subfolders.
+ NSRect screenFrame = [[[parentButton_ window] screen] frame];
+ CGFloat spillOff = (newWindowTopLeft.x + windowWidth) - NSMaxX(screenFrame);
+ if (spillOff > 0.0) {
+ newWindowTopLeft.x = std::max(newWindowTopLeft.x - spillOff,
+ NSMinX(screenFrame));
+ }
} else {
// Parent is a folder; grow right/left.
newWindowTopLeft.x = [self childFolderWindowLeftForWidth:windowWidth];
« no previous file with comments | « no previous file | chrome/browser/cocoa/bookmark_bar_folder_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698