Index: chrome/browser/cocoa/bookmark_bar_folder_controller.mm |
diff --git a/chrome/browser/cocoa/bookmark_bar_folder_controller.mm b/chrome/browser/cocoa/bookmark_bar_folder_controller.mm |
index b17b19cc593d23b33b03e5b05b0d577a733f6639..3afaa1851ee595d3358be5f79ea06e9a537dabb8 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 |
viettrungluu
2010/03/12 08:11:28
That should've been "*from* the sides". Stupid pre
|
// 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 |
viettrungluu
2010/03/12 08:11:28
Possibly also nil under other strange situations,
|
+ const CGFloat padding = 8; |
+ NSRect screen = [[[self window] screen] frame]; |
viettrungluu
2010/03/12 08:11:28
Did you rename it so that things would still fit o
|
+ 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]; |