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

Side by Side Diff: chrome/browser/cocoa/browser_window_controller.mm

Issue 210011: [Mac] Disable autoresizing of subviews when going into and out of fullscreen... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include <Carbon/Carbon.h> 5 #include <Carbon/Carbon.h>
6 6
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/scoped_nsdisable_screen_updates.h" 8 #include "base/scoped_nsdisable_screen_updates.h"
9 #import "base/scoped_nsobject.h" 9 #import "base/scoped_nsobject.h"
10 #include "base/sys_string_conversions.h" 10 #include "base/sys_string_conversions.h"
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 } 903 }
904 904
905 - (void)setFullscreen:(BOOL)fullscreen { 905 - (void)setFullscreen:(BOOL)fullscreen {
906 if (![self supportsFullscreen]) 906 if (![self supportsFullscreen])
907 return; 907 return;
908 908
909 fullscreen_ = fullscreen; 909 fullscreen_ = fullscreen;
910 if (fullscreen) { 910 if (fullscreen) {
911 // Move content to a new fullscreen window 911 // Move content to a new fullscreen window
912 NSView* content = [[self window] contentView]; 912 NSView* content = [[self window] contentView];
913 // Disable autoresizing of subviews while we move views around. This
914 // prevents spurious renderer resizes.
915 [content setAutoresizesSubviews:NO];
913 fullscreen_window_.reset([[self fullscreenWindow] retain]); 916 fullscreen_window_.reset([[self fullscreenWindow] retain]);
914 [content removeFromSuperview]; 917 [content removeFromSuperview];
915 [fullscreen_window_ setContentView:content]; 918 [fullscreen_window_ setContentView:content];
916 [self setWindow:fullscreen_window_.get()]; 919 [self setWindow:fullscreen_window_.get()];
917 // Minimize our UI. This call triggers a relayout, so it needs to come 920 // Minimize our UI. This call triggers a relayout, so it needs to come
918 // after we move the contentview to the new window. 921 // after we move the contentview to the new window.
919 [self adjustUIForFullscreen:fullscreen]; 922 [self adjustUIForFullscreen:fullscreen];
920 // Show one window, hide the other. 923 // Show one window, hide the other.
921 [fullscreen_window_ makeKeyAndOrderFront:self]; 924 [fullscreen_window_ makeKeyAndOrderFront:self];
925 [content setAutoresizesSubviews:YES];
922 [content setNeedsDisplay:YES]; 926 [content setNeedsDisplay:YES];
923 [window_ orderOut:self]; 927 [window_ orderOut:self];
924 } else { 928 } else {
925 NSView* content = [fullscreen_window_ contentView]; 929 NSView* content = [fullscreen_window_ contentView];
930 // Disable autoresizing of subviews while we move views around. This
931 // prevents spurious renderer resizes.
932 [content setAutoresizesSubviews:NO];
926 [content removeFromSuperview]; 933 [content removeFromSuperview];
927 [window_ setContentView:content]; 934 [window_ setContentView:content];
928 [self setWindow:window_.get()]; 935 [self setWindow:window_.get()];
929 // This call triggers a relayout, so it needs to come after we move the 936 // This call triggers a relayout, so it needs to come after we move the
930 // contentview to the new window. 937 // contentview to the new window.
931 [self adjustUIForFullscreen:fullscreen]; 938 [self adjustUIForFullscreen:fullscreen];
939 [content setAutoresizesSubviews:YES];
932 [content setNeedsDisplay:YES]; 940 [content setNeedsDisplay:YES];
933 941
934 // With this call, valgrind yells at me about "Conditional jump or 942 // With this call, valgrind yells at me about "Conditional jump or
935 // move depends on uninitialised value(s)". The error happens in 943 // move depends on uninitialised value(s)". The error happens in
936 // -[NSThemeFrame drawOverlayRect:]. I'm pretty convinced this is 944 // -[NSThemeFrame drawOverlayRect:]. I'm pretty convinced this is
937 // an Apple bug, but there is no visual impact. I have been 945 // an Apple bug, but there is no visual impact. I have been
938 // unable to tickle it away with other window or view manipulation 946 // unable to tickle it away with other window or view manipulation
939 // Cocoa calls. Stack added to suppressions_mac.txt. 947 // Cocoa calls. Stack added to suppressions_mac.txt.
940 [window_ makeKeyAndOrderFront:self]; 948 [window_ makeKeyAndOrderFront:self];
941 949
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 provider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR); 1422 provider->GetNSColor(BrowserThemeProvider::COLOR_TOOLBAR);
1415 [theme setValue:toolbarBackgroundColor 1423 [theme setValue:toolbarBackgroundColor
1416 forAttribute:@"backgroundColor" 1424 forAttribute:@"backgroundColor"
1417 style:GTMThemeStyleToolBar 1425 style:GTMThemeStyleToolBar
1418 state:GTMThemeStateActiveWindow]; 1426 state:GTMThemeStateActiveWindow];
1419 1427
1420 return theme; 1428 return theme;
1421 } 1429 }
1422 @end 1430 @end
1423 1431
OLDNEW
« 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