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

Side by Side Diff: chrome/browser/ui/cocoa/full_size_content_window.mm

Issue 2738623002: [Mac] Turn on Auto Layout for browser windows. (Closed)
Patch Set: Add a test. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/full_size_content_window.h" 5 #import "chrome/browser/ui/cocoa/full_size_content_window.h"
6 6
7 #include <crt_externs.h> 7 #include <crt_externs.h>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 14 matching lines...) Expand all
25 BOOL forceFrameFlag_; 25 BOOL forceFrameFlag_;
26 } 26 }
27 27
28 // This method allows us to set the content view size since setFrameSize is 28 // This method allows us to set the content view size since setFrameSize is
29 // overridden to prevent the view from shrinking. 29 // overridden to prevent the view from shrinking.
30 - (void)forceFrame:(NSRect)frame; 30 - (void)forceFrame:(NSRect)frame;
31 31
32 @end 32 @end
33 33
34 @implementation FullSizeContentView 34 @implementation FullSizeContentView
35 35
tapted 2017/03/21 02:16:51 nit: Maybe we want #pragma mark - NSView Override
Sidney San Martín 2017/03/22 21:40:22 Done.
36 // Since Auto Layout and frame-based layout behave differently in small but
37 // important ways (e.g. Auto Layout can restrict window resizing, frame-based
38 // layout doesn't log a warning when a view's autoresizing mask can't be
39 // maintained), ensure that it's on instead of letting it depend on content.
40 + (BOOL)requiresConstraintBasedLayout {
41 return YES;
42 }
43
36 // This method is directly called by AppKit during a live window resize. 44 // This method is directly called by AppKit during a live window resize.
37 // Override it to prevent the content view from shrinking. 45 // Override it to prevent the content view from shrinking.
38 - (void)setFrameSize:(NSSize)size { 46 - (void)setFrameSize:(NSSize)size {
39 if ([self superview] && !forceFrameFlag_) 47 if ([self superview] && !forceFrameFlag_)
40 size = [[self superview] bounds].size; 48 size = [[self superview] bounds].size;
41 [super setFrameSize:size]; 49 [super setFrameSize:size];
42 } 50 }
43 51
44 - (void)forceFrame:(NSRect)frame { 52 - (void)forceFrame:(NSRect)frame {
45 forceFrameFlag_ = YES; 53 forceFrameFlag_ = YES;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 return [super contentRectForFrameRect:fRect styleMask:aStyle]; 208 return [super contentRectForFrameRect:fRect styleMask:aStyle];
201 } 209 }
202 210
203 - (NSRect)contentRectForFrameRect:(NSRect)frameRect { 211 - (NSRect)contentRectForFrameRect:(NSRect)frameRect {
204 if (chromeWindowView_) 212 if (chromeWindowView_)
205 return frameRect; 213 return frameRect;
206 return [super contentRectForFrameRect:frameRect]; 214 return [super contentRectForFrameRect:frameRect];
207 } 215 }
208 216
209 @end 217 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698