Commit 5856fd65 authored by spqchan's avatar spqchan Committed by Commit Bot

[Mac] Remove Mac OSX 10.9 code in BrowserWindowController

Bug: 840453
Change-Id: I76e819cd53b3f834eb6252808e1323080aa69525
Reviewed-on: https://chromium-review.googlesource.com/1048122Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Sarah Chan <spqchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556576}
parent fc6cbcd4
......@@ -141,16 +141,6 @@ enum class FullscreenSource {
// to prevent redraws.
- (void)setContentViewSubviews:(NSArray*)subviews;
// There is a bug in Mavericks for applications linked against OSX 10.8 and
// earlier. The bug requires Screens Have Separate Spaces to be enabled, and
// for the window to be on a secondary screen. When AppKit Fullscreen is
// invoked on the window, its final frame is 22pt too short. These methods
// detect when the relevant conditions have been met so that a hack can be
// applied to fix the size of the window.
// http://crbug.com/396980
+ (BOOL)systemSettingsRequireMavericksAppKitFullscreenHack;
- (BOOL)shouldUseMavericksAppKitFullscreenHack;
// Whether the instance should use a custom transition when animating into and
// out of AppKit Fullscreen.
- (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen;
......
......@@ -616,32 +616,6 @@ willPositionSheet:(NSWindow*)sheet
}
}
if ([self shouldUseMavericksAppKitFullscreenHack]) {
// Apply a hack to fix the size of the window. This is the last run of the
// MessageLoop where the hack will not work, so dispatch the hack to the
// top of the MessageLoop.
base::Callback<void(void)> callback = base::BindBlock(^{
if (![self isInAppKitFullscreen])
return;
// The window's frame should be exactly 22 points too short.
CGFloat kExpectedHeightDifference = 22;
NSRect currentFrame = [[self window] frame];
NSRect expectedFrame = [[[self window] screen] frame];
if (!NSEqualPoints(currentFrame.origin, expectedFrame.origin))
return;
if (currentFrame.size.width != expectedFrame.size.width)
return;
CGFloat heightDelta =
expectedFrame.size.height - currentFrame.size.height;
if (fabs(heightDelta - kExpectedHeightDifference) > 0.01)
return;
[[self window] setFrame:expectedFrame display:YES];
});
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, callback);
}
if (notification) // For System Fullscreen when non-nil.
[self deregisterForContentViewResizeNotifications];
......@@ -1083,24 +1057,6 @@ willPositionSheet:(NSWindow*)sheet
}
}
+ (BOOL)systemSettingsRequireMavericksAppKitFullscreenHack {
if (!base::mac::IsOS10_9())
return NO;
return [NSScreen respondsToSelector:@selector(screensHaveSeparateSpaces)] &&
[NSScreen screensHaveSeparateSpaces];
}
- (BOOL)shouldUseMavericksAppKitFullscreenHack {
if (![[self class] systemSettingsRequireMavericksAppKitFullscreenHack])
return NO;
if (!enteringAppKitFullscreen_)
return NO;
if (enteringAppKitFullscreenOnPrimaryScreen_)
return NO;
return YES;
}
- (BOOL)shouldUseCustomAppKitFullscreenTransition:(BOOL)enterFullScreen {
// Use the native transition on 10.13+: https://crbug.com/741478.
if (base::mac::IsAtLeastOS10_13())
......@@ -1114,15 +1070,6 @@ willPositionSheet:(NSWindow*)sheet
if (!root.layer)
return NO;
// AppKit on OSX 10.9 has a bug for applications linked against OSX 10.8 SDK
// and earlier. Under specific circumstances, it prevents the custom AppKit
// transition from working well. See http://crbug.com/396980 for more
// details.
if ([[self class] systemSettingsRequireMavericksAppKitFullscreenHack] &&
![[[self window] screen] isEqual:[[NSScreen screens] firstObject]]) {
return NO;
}
return YES;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment