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

Unified Diff: chrome/browser/tab_contents/tab_contents_view_mac.mm

Issue 8491062: Fixes GetContainerBounds in tab_contents_view_mac.mm (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes as requested Created 9 years, 1 month 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/tab_contents/tab_contents_view_mac.mm
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index 6f71e3a9bb9a3b2161020757ed37b461effe759d..b566e6df1c17f4f5aba41199d90e3f78718f3a75 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -149,7 +149,21 @@ gfx::NativeWindow TabContentsViewMac::GetTopLevelNativeWindow() const {
}
void TabContentsViewMac::GetContainerBounds(gfx::Rect* out) const {
- *out = [cocoa_view_.get() flipNSRectToRect:[cocoa_view_.get() bounds]];
+ // Convert bounds to window coordinate space.
+ NSRect bounds =
+ [cocoa_view_.get() convertRect:[cocoa_view_.get() bounds] toView:nil];
+
+ // Convert bounds to screen coordinate space.
+ NSWindow* window = [cocoa_view_.get() window];
+ NSPoint origin = [window convertBaseToScreen:bounds.origin];
+ bounds = NSMakeRect(origin.x, origin.y, bounds.size.width,
+ bounds.size.height);
Avi (use Gerrit) 2011/11/14 21:27:14 alternatively: bounds.origin = [window convertBas
+
+ // Flip y to account for screen flip.
+ NSScreen* screen = [[NSScreen screens] objectAtIndex:0];
+ bounds.origin.y = [screen frame].size.height - bounds.origin.y
+ - bounds.size.height;
+ *out = gfx::Rect(NSRectToCGRect(bounds));
}
void TabContentsViewMac::StartDragging(
« no previous file with comments | « no previous file | content/browser/tab_contents/tab_contents_view.h » ('j') | content/browser/tab_contents/tab_contents_view.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698