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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 523723002: mac, fullscreen: Several bug fixes after major refactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@new_fullscreen2
Patch Set: Comments from rsesek. (Includes a rebase against the latest fullscreen refactor) Created 6 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 side-by-side diff with in-line comments
Download patch
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 52a740f3f2fc6b356307144144905b1b47505881..eec4c1ac80acbe68877fe40fe039ee48c1b49ecc 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().toolbarFraction) *
+ 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().toolbarFraction) *
+ 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
@@ -720,12 +715,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() &&
@@ -1096,33 +1092,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;
}
}

Powered by Google App Engine
This is Rietveld 408576698