diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 08:04:29 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-12 08:04:29 +0000 |
commit | 7960f4b649ef499ddd48a0cfe1daf6cd7a838cc1 (patch) | |
tree | d562c4fc683fac08b03d612f67b3f6db0a0b4d2a /chrome/browser/cocoa/bookmark_bar_folder_controller.mm | |
parent | 6f0eedd9df913b156c22e24a855f65589b12c24a (diff) | |
download | chromium_src-7960f4b649ef499ddd48a0cfe1daf6cd7a838cc1.zip chromium_src-7960f4b649ef499ddd48a0cfe1daf6cd7a838cc1.tar.gz chromium_src-7960f4b649ef499ddd48a0cfe1daf6cd7a838cc1.tar.bz2 |
Fix mac unit tests
Review URL: http://codereview.chromium.org/884003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41419 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/bookmark_bar_folder_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_folder_controller.mm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm index b17b19c..3afaa18 100644 --- a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm @@ -261,12 +261,14 @@ // Make the window fit on screen, with a distance of at least |padding| to // the sides. - const CGFloat padding = 8; - NSRect screenFrame = [[[self window] screen] frame]; - if (NSMaxX(windowFrame) + padding > NSMaxX(screenFrame)) - windowFrame.origin.x -= NSMaxX(windowFrame) + padding - NSMaxX(screenFrame); - else if (NSMinX(windowFrame) - padding < NSMinX(screenFrame)) - windowFrame.origin.x += NSMinX(screenFrame) - NSMinX(windowFrame) + padding; + if ([[self window] screen]) { // nil in unit tests + const CGFloat padding = 8; + NSRect screen = [[[self window] screen] frame]; + if (NSMaxX(windowFrame) + padding > NSMaxX(screen)) + windowFrame.origin.x -= NSMaxX(windowFrame) + padding - NSMaxX(screen); + else if (NSMinX(windowFrame) - padding < NSMinX(screen)) + windowFrame.origin.x += NSMinX(screen) - NSMinX(windowFrame) + padding; + } [[self window] setFrame:windowFrame display:YES]; |