X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fchrome%2Fbrowser%2Fui%2Fcocoa%2Ftabs%2Ftab_window_controller.mm;h=6cca97080f79e08ab8343926edac80fc25e8f215;hb=ac5c4e12d0a033d1c358a787e329f167d4ded761;hp=c6dfa624f0ef37063166cb708b2cc7b1306d5482;hpb=0a7e0ff458505735434b51cfa564902cdb901fc1;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm b/src/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm index c6dfa62..6cca970 100644 --- a/src/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm +++ b/src/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm @@ -51,6 +51,7 @@ base::scoped_nsobject window( [[FramedBrowserWindow alloc] initWithContentRect:contentRect hasTabStrip:hasTabStrip]); + [self moveContentViewToBack:[window contentView]]; [window setReleasedWhenClosed:YES]; [window setAutorecalculatesKeyViewLoop:YES]; @@ -68,7 +69,7 @@ [tabStripView_ setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin]; if (hasTabStrip) - [self addTabStripToWindow]; + [self insertTabStripView:tabStripView_ intoWindow:[self window]]; } return self; } @@ -81,16 +82,6 @@ return tabContentArea_; } -// Add the top tab strop to the window, above the content box and add it to the -// view hierarchy as a sibling of the content view so it can overlap with the -// window frame. -- (void)addTabStripToWindow { - // The frame doesn't matter. This class relies on subclasses to do tab strip - // layout. - NSView* contentParent = [[self window] cr_windowView]; - [contentParent addSubview:tabStripView_]; -} - - (void)removeOverlay { [self setUseOverlay:NO]; if (closeDeferred_) { @@ -154,7 +145,8 @@ // content view and therefore it should always be added after the content // view is set. [window setContentView:originalContentView_]; - [[window cr_windowView] addSubview:[self tabStripView]]; + [self moveContentViewToBack:originalContentView_]; + [self insertTabStripView:[self tabStripView] intoWindow:window]; [[window cr_windowView] updateTrackingAreas]; [focusBeforeOverlay_ restoreFocusInWindow:window]; @@ -292,6 +284,25 @@ closeDeferred_ = YES; } +- (void)moveContentViewToBack:(NSView*)cv { + base::scoped_nsobject contentView([cv retain]); + NSView* superview = [contentView superview]; + [contentView removeFromSuperview]; + [superview addSubview:contentView positioned:NSWindowBelow relativeTo:nil]; +} + +- (void)insertTabStripView:(NSView*)tabStripView intoWindow:(NSWindow*)window { + NSView* contentParent = [window cr_windowView]; + if (contentParent == [[window contentView] superview]) { + // Add the tab strip directly above the content view, if they are siblings. + [contentParent addSubview:tabStripView + positioned:NSWindowAbove + relativeTo:[window contentView]]; + } else { + [contentParent addSubview:tabStripView]; + } +} + // Called when the size of the window content area has changed. Override to // position specific views. Base class implementation does nothing. - (void)layoutSubviews {