diff options
Diffstat (limited to 'chrome/browser/ui/cocoa/browser_window_controller_private.mm')
-rw-r--r-- | chrome/browser/ui/cocoa/browser_window_controller_private.mm | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index a28c8b0..3874f20 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -358,13 +358,10 @@ willPositionSheet:(NSWindow*)sheet [tabStripView removeFromSuperview]; } - // Ditto for the content view. - base::scoped_nsobject<NSView> contentView( - [[sourceWindow contentView] retain]); // Disable autoresizing of subviews while we move views around. This prevents // spurious renderer resizes. - [contentView setAutoresizesSubviews:NO]; - [contentView removeFromSuperview]; + [self.chromeContentView setAutoresizesSubviews:NO]; + [self.chromeContentView removeFromSuperview]; // Have to do this here, otherwise later calls can crash because the window // has no delegate. @@ -376,9 +373,11 @@ willPositionSheet:(NSWindow*)sheet // drawOverlayRect:]. I'm pretty convinced this is an Apple bug, but there is // no visual impact. I have been unable to tickle it away with other window // or view manipulation Cocoa calls. Stack added to suppressions_mac.txt. - [contentView setAutoresizesSubviews:YES]; - [destWindow setContentView:contentView]; - [self moveContentViewToBack:contentView]; + [self.chromeContentView setAutoresizesSubviews:YES]; + [[destWindow contentView] addSubview:self.chromeContentView + positioned:NSWindowBelow + relativeTo:nil]; + [self.chromeContentView setFrame:[[destWindow contentView] bounds]]; // Move the incognito badge if present. if ([self shouldShowAvatar]) { @@ -392,7 +391,7 @@ willPositionSheet:(NSWindow*)sheet // Add the tab strip after setting the content view and moving the incognito // badge (if any), so that the tab strip will be on top (in the z-order). if ([self hasTabStrip]) - [self insertTabStripView:tabStripView intoWindow:[self window]]; + [self insertTabStripView:tabStripView intoWindow:destWindow]; [sourceWindow setWindowController:nil]; [self setWindow:destWindow]; @@ -700,7 +699,7 @@ willPositionSheet:(NSWindow*)sheet for (NSWindow* window in [[NSApplication sharedApplication] windows]) { if ([window isKindOfClass:NSClassFromString(@"NSToolbarFullScreenWindow")]) { - [window.contentView setHidden:YES]; + [[window contentView] setHidden:YES]; } } } @@ -986,18 +985,18 @@ willPositionSheet:(NSWindow*)sheet - (void)setContentViewSubviews:(NSArray*)subviews { // Subviews already match. - if ([[self.window.contentView subviews] isEqual:subviews]) + if ([[self.chromeContentView subviews] isEqual:subviews]) return; // The tabContentArea isn't a subview, so just set all the subviews. NSView* tabContentArea = [self tabContentArea]; - if (![[self.window.contentView subviews] containsObject:tabContentArea]) { - [self.window.contentView setSubviews:subviews]; + if (![[self.chromeContentView subviews] containsObject:tabContentArea]) { + [self.chromeContentView setSubviews:subviews]; return; } // Remove all subviews that aren't the tabContentArea. - for (NSView* view in [[self.window.contentView subviews] copy]) { + for (NSView* view in [[self.chromeContentView subviews] copy]) { if (view != tabContentArea) [view removeFromSuperview]; } @@ -1006,17 +1005,17 @@ willPositionSheet:(NSWindow*)sheet NSInteger index = [subviews indexOfObject:tabContentArea]; for (int i = index - 1; i >= 0; --i) { NSView* view = [subviews objectAtIndex:i]; - [self.window.contentView addSubview:view - positioned:NSWindowBelow - relativeTo:nil]; + [self.chromeContentView addSubview:view + positioned:NSWindowBelow + relativeTo:nil]; } // Add in the subviews above the tabContentArea. for (NSUInteger i = index + 1; i < [subviews count]; ++i) { NSView* view = [subviews objectAtIndex:i]; - [self.window.contentView addSubview:view - positioned:NSWindowAbove - relativeTo:nil]; + [self.chromeContentView addSubview:view + positioned:NSWindowAbove + relativeTo:nil]; } } |