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

Unified Diff: content/browser/web_contents/web_contents_view_mac.mm

Issue 2654413002: Stretching NativeViewHost, and misc tab capture fixes.
Patch Set: Gettin' it all working on ui/cocoa and MacViews too. Created 3 years, 10 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 | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | ui/aura/window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_view_mac.mm
diff --git a/content/browser/web_contents/web_contents_view_mac.mm b/content/browser/web_contents/web_contents_view_mac.mm
index 1d01ac835dbe810121a24de1a4014f1bd4de4307..96b76b72252b9aaa5c257ac7b0983e8123632b87 100644
--- a/content/browser/web_contents/web_contents_view_mac.mm
+++ b/content/browser/web_contents/web_contents_view_mac.mm
@@ -154,17 +154,22 @@ - (void)viewDidBecomeFirstResponder:(NSNotification*)notification;
}
void WebContentsViewMac::GetContainerBounds(gfx::Rect* out) const {
- NSWindow* window = [cocoa_view_.get() window];
- NSRect bounds = [cocoa_view_.get() bounds];
- if (window) {
- // Convert bounds to window coordinate space.
- bounds = [cocoa_view_.get() convertRect:bounds toView:nil];
-
- // Convert bounds to screen coordinate space.
- bounds = [window convertRectToScreen:bounds];
+ // Note: This implementation should pretty much do the exact same thing that
+ // is found in RenderWidgetHostViewMac::GetViewBounds().
+
+ const NSRect bounds = [cocoa_view_.get() bounds];
+ const gfx::Size size(NSWidth(bounds), NSHeight(bounds));
+ NSWindow* const window = [cocoa_view_.get() window];
+ if (!window) {
+ *out = gfx::Rect(size);
+ return;
}
- *out = gfx::ScreenRectFromNSRect(bounds);
+ NSRect boundsInScreen = [cocoa_view_.get() convertRect:bounds toView:nil];
+ boundsInScreen = [window convertRectToScreen:boundsInScreen];
+ const gfx::Point origin = gfx::ScreenRectFromNSRect(boundsInScreen).origin();
+
+ *out = gfx::Rect(origin, size);
}
void WebContentsViewMac::StartDragging(
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | ui/aura/window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698