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

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

Issue 629973002: Adjust bookmark folder menu window if its parent button is partly off-screen to the left. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments 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..c8b63ce74e7a2ad30cbc62835d863f4a9d330972 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,18 @@ 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 goes 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 if (newWindowTopLeft.x < NSMinX(screenFrame)) {
+ // For left side.
+ 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
« 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