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

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

Issue 337019: Mac: Fix (window modal) sheet placement when bookmark bar is present. (Closed)
Patch Set: Updated comments per jrg's review. Created 11 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/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 54f96198a78e9fcab822a75e5583f2da33891f6b..b6cc9150f3b7a2c982ce99719ca87339f2f925a3 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -1225,10 +1225,24 @@ willPositionSheet:(NSWindow*)sheet
- (NSRect)window:(NSWindow*)window
willPositionSheet:(NSWindow*)sheet
usingRect:(NSRect)defaultSheetRect {
- // Any sheet should come from right above the visible content area.
+ // Any sheet should come from right above the apparent content area, or
+ // equivalently right below the apparent toolbar.
NSRect toolbarFrame = [[toolbarController_ view] frame];
- NSRect infobarFrame = [[infoBarContainerController_ view] frame];
- defaultSheetRect.origin.y = toolbarFrame.origin.y - infobarFrame.size.height;
+ defaultSheetRect.origin.y = toolbarFrame.origin.y;
+
+ // Position as follows:
+ // - On a normal (non-NTP) page, position the sheet under the bookmark bar if
+ // it's visible. Else put it immediately below the normal toolbar.
+ // - On the NTP, if the bookmark bar is enabled ("always visible"), then it
+ // looks like a normal bookmark bar, so position the sheet under it; if it
+ // isn't enabled, the bookmark bar will look as if it's a part of the
+ // content area, so just put it immediately below the toolbar.
+ if ([bookmarkBarController_ isVisible] &&
+ (![bookmarkBarController_ isNewTabPage] ||
+ [bookmarkBarController_ isAlwaysVisible])) {
+ NSRect bookmarkBarFrame = [[bookmarkBarController_ view] frame];
+ defaultSheetRect.origin.y -= bookmarkBarFrame.size.height;
Scott Hess - ex-Googler 2009/10/26 17:04:07 What is wrong with bookmarkBarFrame.origin.y, here
+ }
return defaultSheetRect;
}
« 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