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

Unified Diff: ui/views/cocoa/bridged_content_view.mm

Issue 987323002: [MacViews] Frameless app windows: make content view cover title bar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 5 years, 9 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 | « chrome/chrome_browser_ui.gypi ('k') | ui/views/widget/native_widget_mac.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « chrome/chrome_browser_ui.gypi ('k') | ui/views/widget/native_widget_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698