From a945096f93db9c5165e074b4acf670b49f999933 Mon Sep 17 00:00:00 2001 From: Stephen A Pohl Date: Mon, 18 Jul 2022 17:08:59 +0000 Subject: [PATCH] Bug 1773752: Remove more workarounds for old macOS SDKs. r=mstange,media-playback-reviewers,padenot Differential Revision: https://phabricator.services.mozilla.com/D151532 --- .../platforms/apple/AppleDecoderModule.cpp | 4 --- dom/media/platforms/apple/AppleVTDecoder.cpp | 7 ---- gfx/2d/MacIOSurface.cpp | 32 ------------------- gfx/2d/MacIOSurface.h | 6 ---- modules/freetype2/builds/mac/ftmac.c | 8 ++--- modules/freetype2/src/base/ftmac.c | 8 ++--- .../mozapps/update/updater/launchchild_osx.mm | 8 ----- widget/cocoa/docs/macos-apis.md | 7 ++-- widget/cocoa/nsNativeThemeColors.h | 6 ---- 9 files changed, 8 insertions(+), 78 deletions(-) diff --git a/dom/media/platforms/apple/AppleDecoderModule.cpp b/dom/media/platforms/apple/AppleDecoderModule.cpp index d6fd930f492c..3dadd6ab685d 100644 --- a/dom/media/platforms/apple/AppleDecoderModule.cpp +++ b/dom/media/platforms/apple/AppleDecoderModule.cpp @@ -15,10 +15,6 @@ #include "mozilla/DebugOnly.h" #include "mozilla/Logging.h" #include "mozilla/StaticPrefs_media.h" -#if !defined(MAC_OS_VERSION_11_0) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0 -# include "nsCocoaFeatures.h" -#endif extern "C" { // Only exists from MacOS 11 diff --git a/dom/media/platforms/apple/AppleVTDecoder.cpp b/dom/media/platforms/apple/AppleVTDecoder.cpp index 455c93aeb0c7..b095d628b53f 100644 --- a/dom/media/platforms/apple/AppleVTDecoder.cpp +++ b/dom/media/platforms/apple/AppleVTDecoder.cpp @@ -637,13 +637,6 @@ CFDictionaryRef AppleVTDecoder::CreateOutputConfiguration() { #ifndef MOZ_WIDGET_UIKIT // Output format type: -# if !defined(MAC_OS_VERSION_10_13) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_10_13 - enum : OSType { - kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420', - kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20', - }; -# endif bool is10Bit = (gfx::BitDepthForColorDepth(mColorDepth) == 10); SInt32 PixelFormatTypeValue = mColorRange == gfx::ColorRange::FULL diff --git a/gfx/2d/MacIOSurface.cpp b/gfx/2d/MacIOSurface.cpp index e37436026ecb..a90d7dfd506c 100644 --- a/gfx/2d/MacIOSurface.cpp +++ b/gfx/2d/MacIOSurface.cpp @@ -146,14 +146,6 @@ already_AddRefed MacIOSurface::CreateNV12OrP010Surface( AddDictionaryInt(props, kIOSurfaceHeight, aYSize.height); ::CFDictionaryAddValue(props.get(), kIOSurfaceIsGlobal, kCFBooleanTrue); -#if !defined(MAC_OS_VERSION_10_13) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_10_13 - enum : OSType { - kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420', - kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20', - }; -#endif - if (aColorRange == ColorRange::LIMITED) { if (aColorDepth == ColorDepth::COLOR_8) { AddDictionaryInt( @@ -454,14 +446,6 @@ already_AddRefed MacIOSurface::GetAsDrawTargetLocked( } SurfaceFormat MacIOSurface::GetFormat() const { -#if !defined(MAC_OS_VERSION_10_13) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_10_13 - enum : OSType { - kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420', - kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20', - }; -#endif - switch (GetPixelFormat()) { case kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange: case kCVPixelFormatType_420YpCbCr8BiPlanarFullRange: @@ -489,14 +473,6 @@ SurfaceFormat MacIOSurface::GetReadFormat() const { } ColorDepth MacIOSurface::GetColorDepth() const { -#if !defined(MAC_OS_VERSION_10_13) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_10_13 - enum : OSType { - kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420', - kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20', - }; -#endif - switch (GetPixelFormat()) { case kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange: case kCVPixelFormatType_420YpCbCr10BiPlanarFullRange: @@ -518,14 +494,6 @@ CGLError MacIOSurface::CGLTexImageIOSurface2D(CGLContextObj ctx, GLenum target, CGLError MacIOSurface::CGLTexImageIOSurface2D( mozilla::gl::GLContext* aGL, CGLContextObj ctx, size_t plane, mozilla::gfx::SurfaceFormat* aOutReadFormat) { -#if !defined(MAC_OS_VERSION_10_13) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_10_13 - enum : OSType { - kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420', - kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20', - }; -#endif - MOZ_ASSERT(plane >= 0); bool isCompatibilityProfile = aGL->IsCompatibilityProfile(); OSType pixelFormat = GetPixelFormat(); diff --git a/gfx/2d/MacIOSurface.h b/gfx/2d/MacIOSurface.h index dc11a6f49a56..ab4aeade2a70 100644 --- a/gfx/2d/MacIOSurface.h +++ b/gfx/2d/MacIOSurface.h @@ -113,12 +113,6 @@ class MacIOSurface final } YUVColorSpace GetYUVColorSpace() const { return mColorSpace; } bool IsFullRange() const { -# if !defined(MAC_OS_VERSION_10_13) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_10_13 - enum : OSType{ - kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20', - }; -# endif OSType format = GetPixelFormat(); return (format == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange || format == kCVPixelFormatType_420YpCbCr10BiPlanarFullRange); diff --git a/modules/freetype2/builds/mac/ftmac.c b/modules/freetype2/builds/mac/ftmac.c index f30ffc7d17ad..3234ac4229c9 100644 --- a/modules/freetype2/builds/mac/ftmac.c +++ b/modules/freetype2/builds/mac/ftmac.c @@ -149,14 +149,10 @@ /* `configure' checks the availability of `ResourceIndex' strictly */ /* and sets HAVE_TYPE_RESOURCE_INDEX to 1 or 0 always. If it is */ /* not set (e.g., a build without `configure'), the availability */ - /* is guessed from the SDK version. */ + /* is guessed from the SDK version. Starting with the 10.6 SDK, */ + /* `ResourceIndex` is always 1. */ #ifndef HAVE_TYPE_RESOURCE_INDEX -#if !defined( MAC_OS_X_VERSION_10_5 ) || \ - ( MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 ) -#define HAVE_TYPE_RESOURCE_INDEX 0 -#else #define HAVE_TYPE_RESOURCE_INDEX 1 -#endif #endif /* !HAVE_TYPE_RESOURCE_INDEX */ #if ( HAVE_TYPE_RESOURCE_INDEX == 0 ) diff --git a/modules/freetype2/src/base/ftmac.c b/modules/freetype2/src/base/ftmac.c index 21f1894ad380..eaedbe36ace3 100644 --- a/modules/freetype2/src/base/ftmac.c +++ b/modules/freetype2/src/base/ftmac.c @@ -84,14 +84,10 @@ /* `configure' checks the availability of `ResourceIndex' strictly */ /* and sets HAVE_TYPE_RESOURCE_INDEX 1 or 0 always. If it is */ /* not set (e.g., a build without `configure'), the availability */ - /* is guessed from the SDK version. */ + /* is guessed from the SDK version. Starting with the 10.6 SDK, */ + /* `ResourceIndex` is always 1. */ #ifndef HAVE_TYPE_RESOURCE_INDEX -#if !defined( MAC_OS_X_VERSION_10_5 ) || \ - ( MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 ) -#define HAVE_TYPE_RESOURCE_INDEX 0 -#else #define HAVE_TYPE_RESOURCE_INDEX 1 -#endif #endif /* !HAVE_TYPE_RESOURCE_INDEX */ #if ( HAVE_TYPE_RESOURCE_INDEX == 0 ) diff --git a/toolkit/mozapps/update/updater/launchchild_osx.mm b/toolkit/mozapps/update/updater/launchchild_osx.mm index 7721da8e5976..3d28a064c72e 100644 --- a/toolkit/mozapps/update/updater/launchchild_osx.mm +++ b/toolkit/mozapps/update/updater/launchchild_osx.mm @@ -451,14 +451,6 @@ void SetGroupOwnershipAndPermissions(const char* aAppBundle) { } } -#if !defined(MAC_OS_X_VERSION_10_13) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 -@interface NSTask (NSTask10_13) -@property(copy) NSURL* executableURL NS_AVAILABLE_MAC(10_13); -@property(copy) NSArray* arguments; -- (BOOL)launchAndReturnError:(NSError**)error NS_AVAILABLE_MAC(10_13); -@end -#endif - /** * Helper to launch macOS tasks via NSTask. */ diff --git a/widget/cocoa/docs/macos-apis.md b/widget/cocoa/docs/macos-apis.md index f5f349064830..8e54a2c1bfd5 100644 --- a/widget/cocoa/docs/macos-apis.md +++ b/widget/cocoa/docs/macos-apis.md @@ -74,9 +74,10 @@ The exact procedure varies based on the type of API (enum, objc class, method, e but the general approach looks like this: ```objc++ -#if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12 -@interface NSWindow (AutomaticWindowTabbing) -@property (class) BOOL allowsAutomaticWindowTabbing API_AVAILABLE(macos(10.12)); +#if !defined(MAC_OS_VERSION_12_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0 +@interface NSScreen (NSScreen12_0) +// https://developer.apple.com/documentation/appkit/nsscreen/3882821-safeareainsets?language=objc&changes=latest_major +@property(readonly) NSEdgeInsets safeAreaInsets; @end #endif ``` diff --git a/widget/cocoa/nsNativeThemeColors.h b/widget/cocoa/nsNativeThemeColors.h index b21c0fb56e44..ba51943aefa0 100644 --- a/widget/cocoa/nsNativeThemeColors.h +++ b/widget/cocoa/nsNativeThemeColors.h @@ -49,12 +49,6 @@ inline void DrawNativeGreyColorInRect(CGContextRef context, ColorName name, CGRe CGContextFillRect(context, rect); } -#if !defined(MAC_OS_X_VERSION_10_14) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_14 -@interface NSColor (NSColorControlAccentColor) -@property(class, strong, readonly) NSColor* controlAccentColor NS_AVAILABLE_MAC(10_14); -@end -#endif - inline NSColor* ControlAccentColor() { if (@available(macOS 10.14, *)) { return [NSColor controlAccentColor];