Index: ui/views/cocoa/bridged_content_view.mm |
diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm |
index 58d2972393fb4a50bdef72df2e69a4326d8cf4ca..c9562dbf7f394401da3d727d5ced05fdc54524b6 100644 |
--- a/ui/views/cocoa/bridged_content_view.mm |
+++ b/ui/views/cocoa/bridged_content_view.mm |
@@ -248,7 +248,24 @@ bool DispatchEventToMenu(views::Widget* widget, ui::KeyboardCode key_code) { |
return YES; |
} |
+- (void)viewDidMoveToWindow { |
+ // When this view is added to a window, AppKit calls setFrameSize before it is |
+ // added to the window, so the behavior in setFrameSize is not triggered. |
+ NSWindow* window = [self window]; |
+ if (window) |
+ [self setFrameSize:NSZeroSize]; |
+} |
+ |
- (void)setFrameSize:(NSSize)newSize { |
+ // The size passed in here does not always use |
+ // -[NSWindow contentRectForFrameRect]. The following ensures that the |
+ // contentView for a frameless window can extend over the titlebar of the new |
+ // window containing it, since AppKit requires a titlebar to give frameless |
+ // windows correct shadows and rounded corners. |
+ NSWindow* window = [self window]; |
+ if (window) |
+ newSize = [window contentRectForFrameRect:[window frame]].size; |
+ |
[super setFrameSize:newSize]; |
if (!hostedView_) |
return; |