summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 20:28:26 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-15 20:28:26 +0000
commit1de476696d65c188b3d661316cc2a0dc11e2adcc (patch)
treeda1aed1fd8dda05ec89fe0269369c917a0dce4a5 /chrome
parent2a781cbf1f4a307dfec7f810ae3363ea1e1a3e69 (diff)
downloadchromium_src-1de476696d65c188b3d661316cc2a0dc11e2adcc.zip
chromium_src-1de476696d65c188b3d661316cc2a0dc11e2adcc.tar.gz
chromium_src-1de476696d65c188b3d661316cc2a0dc11e2adcc.tar.bz2
Fixes GetContainerBounds in tab_contents_view_mac.mm to return the position of the view in screen coordinates.
Currently GetContainerBounds would return origin of (0,0) which is inconsistent with GTK and Windows implementation. BUG=104178 Review URL: http://codereview.chromium.org/8491062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/tab_contents/tab_contents_view_mac.mm14
1 files changed, 13 insertions, 1 deletions
diff --git a/chrome/browser/tab_contents/tab_contents_view_mac.mm b/chrome/browser/tab_contents/tab_contents_view_mac.mm
index ba507b4..3c61009 100644
--- a/chrome/browser/tab_contents/tab_contents_view_mac.mm
+++ b/chrome/browser/tab_contents/tab_contents_view_mac.mm
@@ -145,7 +145,19 @@ 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];
+ bounds.origin = [window convertBaseToScreen:bounds.origin];
+
+ // 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(