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

Unified Diff: chrome/browser/ui/cocoa/tabs/tab_window_controller.mm

Issue 2738623002: [Mac] Turn on Auto Layout for browser windows. (Closed)
Patch Set: Trigger Auto Layout from chromeContentView, which covers all browser windows. Created 3 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
Index: chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
index cd5a115b3e2e659be0e41cbee73634072d5a7d60..409f556963022a6f36a79665c2a549fe81197740 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm
@@ -63,6 +63,23 @@
@end
+@interface ChromeContentView : NSView
tapted 2017/03/22 22:40:00 comment like // Subview of the NSWindow's content
Sidney San Martín 2017/03/22 23:29:59 Done.
+@end
+
+@implementation ChromeContentView
+
+#pragma mark - NSView Overrides
tapted 2017/03/22 22:40:00 optional: a comment here like // NSView overrides
Sidney San Martín 2017/03/22 23:29:59 Done. Xcode likes `#pragma mark -` (there's a popu
+
+// Since Auto Layout and frame-based layout behave differently in small but
+// important ways (e.g. Auto Layout can restrict window resizing, frame-based
+// layout doesn't log a warning when a view's autoresizing mask can't be
+// maintained), ensure that it's on instead of letting it depend on content.
++ (BOOL)requiresConstraintBasedLayout {
+ return YES;
+}
+
+@end
+
@implementation TabWindowController
- (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip
@@ -80,7 +97,7 @@
if ((self = [super initWithWindow:window])) {
[[self window] setDelegate:self];
- chromeContentView_.reset([[NSView alloc]
+ chromeContentView_.reset([[ChromeContentView alloc]
tapted 2017/03/22 22:40:00 I think this will capture popups, but not packaged
Sidney San Martín 2017/03/22 23:29:59 Oh, good to know. I may be working on that change
initWithFrame:NSMakeRect(0, 0, kDefaultWidth, kDefaultHeight)]);
[chromeContentView_
setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];

Powered by Google App Engine
This is Rietveld 408576698