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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 836173002: Mac: Fix sheet positioning on popup windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 7fc8ac02ba697fb99a4ea326d8626d4f8d7e40d9..36a9ccd5d0fde2f556e7de584b576f03888fcd0c 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -171,35 +171,26 @@ void RecordFullscreenStyle(FullscreenStyle style) {
- (NSRect)window:(NSWindow*)window
willPositionSheet:(NSWindow*)sheet
- usingRect:(NSRect)defaultSheetRect {
+ usingRect:(NSRect)defaultSheetLocation {
// Position the sheet as follows:
+ // - If the bookmark bar is shown (attached to the normal toolbar), position
+ // the sheet below the bookmark bar.
// - If the bookmark bar is hidden or shown as a bubble (on the NTP when the
// bookmark bar is disabled), position the sheet immediately below the
// normal toolbar.
- // - If the bookmark bar is shown (attached to the normal toolbar), position
- // the sheet below the bookmark bar.
// - If the bookmark bar is currently animating, position the sheet according
// to where the bar will be when the animation ends.
- CGFloat defaultSheetY = defaultSheetRect.origin.y;
- switch ([bookmarkBarController_ currentState]) {
- case BookmarkBar::SHOW: {
- NSRect bookmarkBarFrame = [[bookmarkBarController_ view] frame];
- defaultSheetY = bookmarkBarFrame.origin.y;
- break;
- }
- case BookmarkBar::HIDDEN:
- case BookmarkBar::DETACHED: {
- if ([self hasToolbar]) {
- NSRect toolbarFrame = [[toolbarController_ view] frame];
- defaultSheetY = toolbarFrame.origin.y;
- } else {
- // The toolbar is not shown in application mode. The sheet should be
- // located at the top of the window, under the title of the window.
- defaultSheetY = NSHeight([[window contentView] frame]) -
- defaultSheetRect.size.height;
Andre 2015/01/06 20:55:33 This height has no meaning according to AppKit doc
- }
- break;
- }
+ CGFloat defaultSheetY = defaultSheetLocation.origin.y;
+ if ([self supportsBookmarkBar] &&
Andre 2015/01/06 20:55:33 This was the missing check that caused the sheet t
+ [bookmarkBarController_ currentState] == BookmarkBar::SHOW) {
+ defaultSheetY = NSMinY([[bookmarkBarController_ view] frame]);
+ } else if ([self hasToolbar]) {
+ defaultSheetY = NSMinY([[toolbarController_ view] frame]);
+ } else {
+ // The toolbar is not shown in popup and application modes. The sheet
+ // should be located at the top of the window, under the title of the
+ // window.
+ defaultSheetY = NSMaxY([[window contentView] frame]);
}
// AppKit may shift the window up to fit the sheet on screen, but it will
@@ -217,8 +208,8 @@ willPositionSheet:(NSWindow*)sheet
CGFloat windowHeight = NSHeight([window frame]);
defaultSheetY = std::min(defaultSheetY, windowHeight);
- defaultSheetRect.origin.y = defaultSheetY;
- return defaultSheetRect;
+ defaultSheetLocation.origin.y = defaultSheetY;
+ return defaultSheetLocation;
}
- (void)layoutSubviews {
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_browsertest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698