Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm |
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
index 4ebd4f2a15eda94bee4b16e39e47279162c9e686..71d2d9ed1f289902bc14a439ad767e73499b2f64 100644 |
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm |
@@ -198,13 +198,9 @@ willPositionSheet:(NSWindow*)sheet |
CGFloat floatingBarHeight = [self floatingBarHeight]; |
CGFloat yOffset = 0; |
if ([self isInFullscreenWithOmniboxSliding]) { |
- switch (fullscreenStyle_) { |
+ yOffset += [presentationModeController_ menubarOffset]; |
+ switch (presentationModeController_.get().slidingStyle) { |
case fullscreen_mac::OMNIBOX_TABS_PRESENT: |
- // In system fullscreen mode, |yOffset| accounts for the extra offset |
- // needed to dodge the menu bar. |
- yOffset = -std::floor( |
- (floatingBarShownFraction_) * |
- [presentationModeController_ floatingBarVerticalOffset]); |
break; |
case fullscreen_mac::OMNIBOX_PRESENT: { |
// At rest: omnibox showing. yOffset should be tabstrip height |
@@ -213,18 +209,17 @@ willPositionSheet:(NSWindow*)sheet |
CGFloat tabStripHeight = 0; |
if ([self hasTabStrip]) |
tabStripHeight = NSHeight([[self tabStripView] frame]); |
- yOffset = std::floor( |
- (1 - floatingBarShownFraction_) * tabStripHeight - |
- floatingBarShownFraction_ * |
- [presentationModeController_ floatingBarVerticalOffset]); |
+ yOffset += std::floor( |
+ (1 - presentationModeController_.get().toolbarPercentage) * |
+ tabStripHeight); |
break; |
} |
case fullscreen_mac::OMNIBOX_TABS_HIDDEN: |
// In presentation mode, |yOffset| accounts for the sliding position of |
// the floating bar and the extra offset needed to dodge the menu bar. |
- yOffset = |
- std::floor((1 - floatingBarShownFraction_) * floatingBarHeight) - |
- [presentationModeController_ floatingBarVerticalOffset]; |
+ yOffset += std::floor( |
+ (1 - presentationModeController_.get().toolbarPercentage) * |
+ floatingBarHeight); |
break; |
} |
} |
@@ -267,7 +262,7 @@ willPositionSheet:(NSWindow*)sheet |
[fullscreenExitBubbleController_ positionInWindowAtTop:maxY width:width]; |
if ([self isInFullscreenWithOmniboxSliding]) { |
- switch (fullscreenStyle_) { |
+ switch (presentationModeController_.get().slidingStyle) { |
case fullscreen_mac::OMNIBOX_TABS_PRESENT: |
case fullscreen_mac::OMNIBOX_PRESENT: |
// Do nothing in Canonical Fullscreen and Simplified Fullscreen. All |
@@ -718,12 +713,13 @@ willPositionSheet:(NSWindow*)sheet |
} |
- (void)adjustUIForSlidingFullscreenStyle:(fullscreen_mac::SlidingStyle)style { |
- fullscreenStyle_ = style; |
- |
if (!presentationModeController_) { |
presentationModeController_.reset( |
- [[PresentationModeController alloc] initWithBrowserController:self]); |
+ [[PresentationModeController alloc] initWithBrowserController:self |
+ style:style]); |
[self configurePresentationModeController]; |
+ } else { |
+ presentationModeController_.get().slidingStyle = style; |
} |
if (!floatingBarBackingView_.get() && |
@@ -1094,33 +1090,44 @@ willPositionSheet:(NSWindow*)sheet |
// NSThemeFrame. |
// http://crbug.com/407921 |
if (enteringAppKitFullscreen_) { |
- // Disable implicit animations. |
- [CATransaction begin]; |
- [CATransaction setDisableActions:YES]; |
- |
- // Get the current position of the tabStripView. |
- NSView* superview = [[self tabStripView] superview]; |
- NSArray* subviews = [superview subviews]; |
- NSInteger index = [subviews indexOfObject:[self tabStripView]]; |
- NSView* siblingBelow = nil; |
- if (index > 0) |
- siblingBelow = [subviews objectAtIndex:index - 1]; |
- |
- // Remove the tabStripView. |
- [[self tabStripView] removeFromSuperview]; |
- |
- // Add it to the same position. |
- if (siblingBelow) { |
- [superview addSubview:[self tabStripView] |
- positioned:NSWindowAbove |
- relativeTo:siblingBelow]; |
- } else { |
- [superview addSubview:[self tabStripView] |
- positioned:NSWindowBelow |
- relativeTo:nil]; |
- } |
+ // The tabstrip frequently lies outside the bounds of its superview. |
+ // Repeatedly adding/removing the tabstrip from its superview during the |
+ // AppKit Fullscreen transition causes graphical glitches on 10.10. The |
+ // correct solution is to use the AppKit fullscreen transition APIs added |
+ // in 10.7+. |
+ // http://crbug.com/408791 |
+ if (!hasAdjustedTabStripWhileEnteringAppKitFullscreen_) { |
+ // Disable implicit animations. |
+ [CATransaction begin]; |
+ [CATransaction setDisableActions:YES]; |
+ |
+ // Get the current position of the tabStripView. |
+ NSView* superview = [[self tabStripView] superview]; |
+ NSArray* subviews = [superview subviews]; |
+ NSInteger index = [subviews indexOfObject:[self tabStripView]]; |
+ NSView* siblingBelow = nil; |
+ if (index > 0) |
+ siblingBelow = [subviews objectAtIndex:index - 1]; |
+ |
+ // Remove the tabStripView. |
+ [[self tabStripView] removeFromSuperview]; |
+ |
+ // Add it to the same position. |
+ if (siblingBelow) { |
+ [superview addSubview:[self tabStripView] |
+ positioned:NSWindowAbove |
+ relativeTo:siblingBelow]; |
+ } else { |
+ [superview addSubview:[self tabStripView] |
+ positioned:NSWindowBelow |
+ relativeTo:nil]; |
+ } |
- [CATransaction commit]; |
+ [CATransaction commit]; |
+ hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = YES; |
+ } |
+ } else { |
+ hasAdjustedTabStripWhileEnteringAppKitFullscreen_ = NO; |
} |
} |