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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 155694: Implement SetSize for valid size requests.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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/renderer_host/render_widget_host_view_mac.mm
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 20947)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -117,12 +117,25 @@
return;
// TODO(avi): the TabContents object uses this method to size the newly
- // created widget to the correct size. At the time of this call, we're not yet
- // in the view hierarchy so |size| ends up being 0x0. However, this works for
- // us because we're using the Cocoa view struture and resizer flags to fix
- // things up as soon as the view gets added to the hierarchy. Figure out if we
- // want to keep this flow or switch back to the flow Windows uses which sets
- // the size upon creation. http://crbug.com/8285.
+ // created widget to the correct size. For that instance, we're not yet in the
+ // view hierarchy so |size| ends up being 0x0. However, this works for us
+ // because we're using the Cocoa view struture and resizer flags to fix things
+ // up as soon as the view gets added to the hierarchy. Figure out if we want
+ // to keep this flow or switch back to the flow Windows uses which sets the
+ // size upon creation. <http://crbug.com/8285>. However, if the size is not
+ // 0x0, this is a valid request.
+ if (size.IsEmpty())
+ return;
+
+ // Do conversions to upper-left origin, as "set size" means keep the
+ // upper-left corner pinned. If the new size is valid, this is a popup whose
+ // superview is another RenderWidgetHostViewCocoa, but even if it's directly
+ // in a TabContentsViewCocoa, they're both BaseViews.
+ gfx::Rect rect =
+ [(BaseView*)[cocoa_view_ superview] NSRectToRect:[cocoa_view_ frame]];
+ rect.set_width(size.width());
+ rect.set_height(size.height());
+ [cocoa_view_ setFrame:[(BaseView*)[cocoa_view_ superview] RectToNSRect:rect]];
}
gfx::NativeView RenderWidgetHostViewMac::GetNativeView() {
« 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