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

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

Issue 884003: Fix mac unit tests (Closed)
Patch Set: Created 10 years, 9 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/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];
« 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