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

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

Issue 10545050: mac: Use NSWidth() and friends in a few more places. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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
Index: chrome/browser/ui/cocoa/browser_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index 9f75da34ab49ac6d57178845024f1ea10f20e232..55451384ac63f484df19f59a596721d8ab5c5c00 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -146,7 +146,7 @@ void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) {
// Flip coordinates based on the primary screen.
NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
cocoa_bounds.origin.y =
- [screen frame].size.height - real_bounds.height() - real_bounds.y();
+ NSHeight([screen frame]) - real_bounds.height() - real_bounds.y();
[window() setFrame:cocoa_bounds display:YES];
}
@@ -268,8 +268,8 @@ gfx::Rect BrowserWindowCocoa::GetRestoredBounds() const {
// Flip coordinates based on the primary screen.
NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
NSRect frame = [controller_ regularWindowFrame];
- gfx::Rect bounds(frame.origin.x, 0, frame.size.width, frame.size.height);
- bounds.set_y([screen frame].size.height - frame.origin.y - frame.size.height);
+ gfx::Rect bounds(frame.origin.x, 0, NSWidth(frame), NSHeight(frame));
+ bounds.set_y(NSHeight([screen frame]) - NSMaxY(frame));
Robert Sesek 2012/06/07 16:52:38 Is NSMaxY correct here? (that's origin.y + size.he
Nico 2012/06/07 17:40:23 - frame.origin.y - frame.size.height == - (frame.o
Robert Sesek 2012/06/07 18:37:20 You're right. Lost track of the negative when goin
return bounds;
}

Powered by Google App Engine
This is Rietveld 408576698