Bug 1773752: Remove more workarounds for old macOS SDKs. r=mstange,media-playback-reviewers,padenot

Differential Revision: https://phabricator.services.mozilla.com/D151532
This commit is contained in:
Stephen A Pohl 2022-07-18 17:08:59 +00:00
parent 8559c5bb57
commit a945096f93
9 changed files with 8 additions and 78 deletions

View File

@ -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

View File

@ -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

View File

@ -146,14 +146,6 @@ already_AddRefed<MacIOSurface> 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<mozilla::gfx::DrawTarget> 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();

View File

@ -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);

View File

@ -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 )

View File

@ -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 )

View File

@ -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<NSString*>* arguments;
- (BOOL)launchAndReturnError:(NSError**)error NS_AVAILABLE_MAC(10_13);
@end
#endif
/**
* Helper to launch macOS tasks via NSTask.
*/

View File

@ -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
```

View File

@ -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];