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

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

Issue 258012: [Mac] Insert views into the proper place in the view hierarchy when tearing o... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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/browser/cocoa/tab_window_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/tab_window_controller.mm
===================================================================
--- chrome/browser/cocoa/tab_window_controller.mm (revision 27984)
+++ chrome/browser/cocoa/tab_window_controller.mm (working copy)
@@ -60,20 +60,21 @@
[self setUseOverlay:YES];
}
-- (NSArray*)viewsToMoveToOverlay {
- return [NSArray arrayWithObjects:[self tabStripView],
- [self tabContentArea], nil];
-}
-
// if |useOverlay| is true, we're moving views into the overlay's content
// area. If false, we're moving out of the overlay back into the window's
// content.
- (void)moveViewsBetweenWindowAndOverlay:(BOOL)useOverlay {
- NSView* moveTo = useOverlay ?
- [overlayWindow_ contentView] : [cachedContentView_ superview];
- NSArray* viewsToMove = [self viewsToMoveToOverlay];
- for (NSView* view in viewsToMove)
- [moveTo addSubview:view];
+ if (useOverlay) {
+ [[[overlayWindow_ contentView] superview] addSubview:[self tabStripView]];
+ // Add the original window's content view as a subview of the overlay
+ // window's content view. We cannot simply use setContentView: here because
+ // the overlay window has a different content size (due to it being
+ // borderless).
+ [[overlayWindow_ contentView] addSubview:cachedContentView_];
+ } else {
+ [[[[self window] contentView] superview] addSubview:[self tabStripView]];
+ [[self window] setContentView:cachedContentView_];
+ }
}
// If |useOverlay| is YES, creates a new overlay window and puts the tab strip
@@ -95,8 +96,6 @@
[overlayWindow_ setBackgroundColor:[NSColor clearColor]];
[overlayWindow_ setOpaque:NO];
[overlayWindow_ setDelegate:self];
- NSView *contentView = [overlayWindow_ contentView];
- [contentView addSubview:[self tabStripView]];
cachedContentView_ = [[self window] contentView];
[self moveViewsBetweenWindowAndOverlay:useOverlay];
[[self window] addChildWindow:overlayWindow_ ordered:NSWindowAbove];
« no previous file with comments | « chrome/browser/cocoa/tab_window_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698