diff --git a/accessible/mac/MOXAccessibleProtocol.h b/accessible/mac/MOXAccessibleProtocol.h index 117bce79e7c8..8d25b745d8c9 100644 --- a/accessible/mac/MOXAccessibleProtocol.h +++ b/accessible/mac/MOXAccessibleProtocol.h @@ -5,8 +5,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "SDKDeclarations.h" - @protocol MOXTextMarkerSupport; @protocol mozAccessible; diff --git a/dom/media/platforms/apple/AppleDecoderModule.cpp b/dom/media/platforms/apple/AppleDecoderModule.cpp index 4e73c87a775a..a1419f013050 100644 --- a/dom/media/platforms/apple/AppleDecoderModule.cpp +++ b/dom/media/platforms/apple/AppleDecoderModule.cpp @@ -221,12 +221,7 @@ bool AppleDecoderModule::CanCreateHWDecoder(media::MediaCodec aCodec) { /* static */ bool AppleDecoderModule::RegisterSupplementalVP9Decoder() { static bool sRegisterIfAvailable = []() { -#if !defined(MAC_OS_VERSION_11_0) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0 - if (nsCocoaFeatures::OnBigSurOrLater()) { -#else if (__builtin_available(macos 11.0, *)) { -#endif VTRegisterSupplementalVideoDecoderIfAvailable(kCMVideoCodecType_VP9); return true; } diff --git a/gfx/layers/NativeLayerCA.mm b/gfx/layers/NativeLayerCA.mm index fb434dc84fc0..ec19fcd36286 100644 --- a/gfx/layers/NativeLayerCA.mm +++ b/gfx/layers/NativeLayerCA.mm @@ -29,7 +29,6 @@ #include "mozilla/Telemetry.h" #include "mozilla/webrender/RenderMacIOSurfaceTextureHost.h" #include "ScopedGLHelpers.h" -#include "SDKDeclarations.h" @interface CALayer (PrivateSetContentsOpaque) - (void)setContentsOpaque:(BOOL)opaque; diff --git a/gfx/thebes/gfxMacUtils.cpp b/gfx/thebes/gfxMacUtils.cpp index f52ca0910f96..0c0b66eb14dc 100644 --- a/gfx/thebes/gfxMacUtils.cpp +++ b/gfx/thebes/gfxMacUtils.cpp @@ -8,15 +8,6 @@ /* static */ CFStringRef gfxMacUtils::CFStringForTransferFunction( mozilla::gfx::TransferFunction aTransferFunction) { -#if !defined(MAC_OS_VERSION_10_13) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_10_13 - CFStringRef kCVImageBufferTransferFunction_sRGB = CFSTR("IEC_sRGB"); - CFStringRef kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ = - CFSTR("SMPTE_ST_2084_PQ"); - CFStringRef kCVImageBufferTransferFunction_ITU_R_2100_HLG = - CFSTR("ITU_R_2100_HLG"); -#endif - switch (aTransferFunction) { case mozilla::gfx::TransferFunction::BT709: return kCVImageBufferTransferFunction_ITU_R_709_2; diff --git a/toolkit/xre/MacApplicationDelegate.mm b/toolkit/xre/MacApplicationDelegate.mm index 804189201a8f..ed13160332ad 100644 --- a/toolkit/xre/MacApplicationDelegate.mm +++ b/toolkit/xre/MacApplicationDelegate.mm @@ -384,13 +384,8 @@ void ProcessPendingGetURLAppleEvents() { - (BOOL)application:(NSApplication*)application continueUserActivity:(NSUserActivity*)userActivity -#if defined(MAC_OS_X_VERSION_10_14) && \ - MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14 restorationHandler: (void (^)(NSArray>*))restorationHandler { -#else - restorationHandler:(void (^)(NSArray*))restorationHandler { -#endif if (![userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { return NO; diff --git a/toolkit/xre/MacRunFromDmgUtils.mm b/toolkit/xre/MacRunFromDmgUtils.mm index 5cc38d6c1b97..78cf14ec6c3d 100644 --- a/toolkit/xre/MacRunFromDmgUtils.mm +++ b/toolkit/xre/MacRunFromDmgUtils.mm @@ -32,7 +32,6 @@ #ifdef MOZ_UPDATER # include "nsUpdateDriver.h" #endif -#include "SDKDeclarations.h" // For IOKit docs, see: // https://developer.apple.com/documentation/iokit diff --git a/widget/cocoa/AppearanceOverride.mm b/widget/cocoa/AppearanceOverride.mm index 36c17fd6cc8b..c3938d6b934f 100644 --- a/widget/cocoa/AppearanceOverride.mm +++ b/widget/cocoa/AppearanceOverride.mm @@ -12,7 +12,6 @@ #include "mozilla/StaticPrefs_widget.h" #include "nsXULAppAPI.h" -#include "SDKDeclarations.h" static void ToolbarThemePrefChanged(const char* aPref, void* aUserInfo); diff --git a/widget/cocoa/MOZMenuOpeningCoordinator.mm b/widget/cocoa/MOZMenuOpeningCoordinator.mm index 41554ab9a92b..6b1787094081 100644 --- a/widget/cocoa/MOZMenuOpeningCoordinator.mm +++ b/widget/cocoa/MOZMenuOpeningCoordinator.mm @@ -17,7 +17,6 @@ #include "nsCocoaUtils.h" #include "nsMenuX.h" #include "nsObjCExceptions.h" -#include "SDKDeclarations.h" static BOOL sNeedToUnwindForMenuClosing = NO; @@ -163,12 +162,7 @@ static BOOL sNeedToUnwindForMenuClosing = NO; // option 5. if (aAppearance) { -#if !defined(MAC_OS_VERSION_11_0) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0 - if (nsCocoaFeatures::OnBigSurOrLater()) { -#else if (@available(macOS 11.0, *)) { -#endif // By default, NSMenu inherits its appearance from the opening NSEvent's // window. If CSS has overridden it, on Big Sur + we can respect it with // -[NSMenu setAppearance]. diff --git a/widget/cocoa/SDKDeclarations.h b/widget/cocoa/SDKDeclarations.h deleted file mode 100644 index b06409358201..000000000000 --- a/widget/cocoa/SDKDeclarations.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef SDKDefines_h -#define SDKDefines_h - -#import - -/** - * This file contains header declarations from SDKs more recent than the minimum macOS SDK which we - * require for building Firefox, which is currently the macOS 10.12 SDK. - */ - -#if !defined(MAC_OS_X_VERSION_10_12_2) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12_2 - -@interface NSView (NSView10_12_2) -- (NSTouchBar*)makeTouchBar; -@end - -#endif - -#if !defined(MAC_OS_X_VERSION_10_13) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13 - -using NSAppearanceName = NSString*; - -@interface NSColor (NSColor10_13) -// "Available in 10.10", but not present in any SDK less than 10.13 -@property(class, strong, readonly) NSColor* systemPurpleColor NS_AVAILABLE_MAC(10_10); -@end - -@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 - -enum : OSType { - kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420', - kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20', -}; - -#endif - -#if !defined(MAC_OS_X_VERSION_10_14) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_14 - -const NSAppearanceName NSAppearanceNameDarkAqua = @"NSAppearanceNameDarkAqua"; - -@interface NSWindow (NSWindow10_14) -@property(weak) NSObject* appearanceSource NS_AVAILABLE_MAC(10_14); -@end - -@interface NSApplication (NSApplication10_14) -@property(strong) NSAppearance* appearance NS_AVAILABLE_MAC(10_14); -@property(readonly, strong) NSAppearance* effectiveAppearance NS_AVAILABLE_MAC(10_14); -@end - -@interface NSAppearance (NSAppearance10_14) -- (NSAppearanceName)bestMatchFromAppearancesWithNames:(NSArray*)appearances - NS_AVAILABLE_MAC(10_14); -@end - -@interface NSColor (NSColor10_14) -// Available in 10.10, but retroactively made public in 10.14. -@property(class, strong, readonly) NSColor* linkColor NS_AVAILABLE_MAC(10_10); -@end - -enum { - NSVisualEffectMaterialToolTip NS_ENUM_AVAILABLE_MAC(10_14) = 17, -}; - -#endif - -#if !defined(MAC_OS_VERSION_11_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0 -// The declarations below do not have NS_AVAILABLE_MAC(11_0) on them because we're building with a -// pre-macOS 11 SDK, so macOS 11 identifies itself as 10.16, and @available(macOS 11.0, *) checks -// won't work. You'll need to use an annoying double-whammy check for these: -// -// #if !defined(MAC_OS_VERSION_11_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0 -// if (nsCocoaFeatures::OnBigSurOrLater()) { -// #else -// if (@available(macOS 11.0, *)) { -// #endif -// ... -// } -// - -typedef NS_ENUM(NSInteger, NSTitlebarSeparatorStyle) { - NSTitlebarSeparatorStyleAutomatic, - NSTitlebarSeparatorStyleNone, - NSTitlebarSeparatorStyleLine, - NSTitlebarSeparatorStyleShadow -}; - -@interface NSWindow (NSWindow11_0) -@property NSTitlebarSeparatorStyle titlebarSeparatorStyle; -@end - -@interface NSMenu (NSMenu11_0) -// In reality, NSMenu implements the NSAppearanceCustomization protocol, and picks up the appearance -// property from that protocol. But we can't tack on protocol implementations, so we just declare -// the property setter here. -- (void)setAppearance:(NSAppearance*)appearance; -@end - -#endif - -#if !defined(MAC_OS_VERSION_12_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0 - -typedef CFTypeRef AXTextMarkerRef; -typedef CFTypeRef AXTextMarkerRangeRef; - -extern "C" { -CFTypeID AXTextMarkerGetTypeID(); -AXTextMarkerRef AXTextMarkerCreate(CFAllocatorRef allocator, const UInt8* bytes, CFIndex length); -const UInt8* AXTextMarkerGetBytePtr(AXTextMarkerRef text_marker); -CFIndex AXTextMarkerGetLength(AXTextMarkerRef text_marker); -CFTypeID AXTextMarkerRangeGetTypeID(); -AXTextMarkerRangeRef AXTextMarkerRangeCreate(CFAllocatorRef allocator, AXTextMarkerRef start_marker, - AXTextMarkerRef end_marker); -AXTextMarkerRef AXTextMarkerRangeCopyStartMarker(AXTextMarkerRangeRef text_marker_range); -AXTextMarkerRef AXTextMarkerRangeCopyEndMarker(AXTextMarkerRangeRef text_marker_range); -} - -@interface NSScreen (NSScreen12_0) -// https://developer.apple.com/documentation/appkit/nsscreen/3882821-safeareainsets?language=objc&changes=latest_major -@property(readonly) NSEdgeInsets safeAreaInsets; -@end - -#endif - -#endif // SDKDefines_h diff --git a/widget/cocoa/VibrancyManager.mm b/widget/cocoa/VibrancyManager.mm index 2fce3f8728cc..392faf2adff7 100644 --- a/widget/cocoa/VibrancyManager.mm +++ b/widget/cocoa/VibrancyManager.mm @@ -9,7 +9,6 @@ #import #include "nsChildView.h" -#include "SDKDeclarations.h" using namespace mozilla; diff --git a/widget/cocoa/moz.build b/widget/cocoa/moz.build index c996e62ad6ac..ebee9439e0fc 100644 --- a/widget/cocoa/moz.build +++ b/widget/cocoa/moz.build @@ -27,7 +27,6 @@ EXPORTS += [ "nsChangeObserver.h", "nsCocoaFeatures.h", "nsCocoaUtils.h", - "SDKDeclarations.h", ] UNIFIED_SOURCES += [ diff --git a/widget/cocoa/nsCocoaUtils.h b/widget/cocoa/nsCocoaUtils.h index 047b35ae8b1b..9e3b76a920e0 100644 --- a/widget/cocoa/nsCocoaUtils.h +++ b/widget/cocoa/nsCocoaUtils.h @@ -115,10 +115,6 @@ struct KeyBindingsCommand { @end // NativeKeyBindingsRecorder -#if !defined(MAC_OS_X_VERSION_10_14) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_14 -typedef NSString* AVMediaType; -#endif - class nsCocoaUtils { typedef mozilla::gfx::SourceSurface SourceSurface; typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint; @@ -130,7 +126,8 @@ class nsCocoaUtils { // Get the backing scale factor from an object that supports this selector // (NSView/Window/Screen, on 10.7 or later), returning 1.0 if not supported static CGFloat GetBackingScaleFactor(id aObject) { - if (HiDPIEnabled() && [aObject respondsToSelector:@selector(backingScaleFactor)]) { + if (HiDPIEnabled() && + [aObject respondsToSelector:@selector(backingScaleFactor)]) { return [aObject backingScaleFactor]; } return 1.0; @@ -142,36 +139,41 @@ class nsCocoaUtils { return NSToIntRound(aPts * aBackingScale); } - static LayoutDeviceIntPoint CocoaPointsToDevPixels(const NSPoint& aPt, CGFloat aBackingScale) { + static LayoutDeviceIntPoint CocoaPointsToDevPixels(const NSPoint& aPt, + CGFloat aBackingScale) { return LayoutDeviceIntPoint(NSToIntRound(aPt.x * aBackingScale), NSToIntRound(aPt.y * aBackingScale)); } - static LayoutDeviceIntPoint CocoaPointsToDevPixelsRoundDown(const NSPoint& aPt, - CGFloat aBackingScale) { + static LayoutDeviceIntPoint CocoaPointsToDevPixelsRoundDown( + const NSPoint& aPt, CGFloat aBackingScale) { return LayoutDeviceIntPoint(NSToIntFloor(aPt.x * aBackingScale), NSToIntFloor(aPt.y * aBackingScale)); } - static LayoutDeviceIntRect CocoaPointsToDevPixels(const NSRect& aRect, CGFloat aBackingScale) { + static LayoutDeviceIntRect CocoaPointsToDevPixels(const NSRect& aRect, + CGFloat aBackingScale) { return LayoutDeviceIntRect(NSToIntRound(aRect.origin.x * aBackingScale), NSToIntRound(aRect.origin.y * aBackingScale), NSToIntRound(aRect.size.width * aBackingScale), NSToIntRound(aRect.size.height * aBackingScale)); } - static CGFloat DevPixelsToCocoaPoints(int32_t aPixels, CGFloat aBackingScale) { + static CGFloat DevPixelsToCocoaPoints(int32_t aPixels, + CGFloat aBackingScale) { return (CGFloat)aPixels / aBackingScale; } - static NSPoint DevPixelsToCocoaPoints(const mozilla::LayoutDeviceIntPoint& aPt, - CGFloat aBackingScale) { - return NSMakePoint((CGFloat)aPt.x / aBackingScale, (CGFloat)aPt.y / aBackingScale); + static NSPoint DevPixelsToCocoaPoints( + const mozilla::LayoutDeviceIntPoint& aPt, CGFloat aBackingScale) { + return NSMakePoint((CGFloat)aPt.x / aBackingScale, + (CGFloat)aPt.y / aBackingScale); } // Implements an NSPoint equivalent of -[NSWindow convertRectFromScreen:]. static NSPoint ConvertPointFromScreen(NSWindow* aWindow, const NSPoint& aPt) { - return [aWindow convertRectFromScreen:NSMakeRect(aPt.x, aPt.y, 0, 0)].origin; + return + [aWindow convertRectFromScreen:NSMakeRect(aPt.x, aPt.y, 0, 0)].origin; } // Implements an NSPoint equivalent of -[NSWindow convertRectToScreen:]. @@ -179,8 +181,10 @@ class nsCocoaUtils { return [aWindow convertRectToScreen:NSMakeRect(aPt.x, aPt.y, 0, 0)].origin; } - static NSRect DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect, CGFloat aBackingScale) { - return NSMakeRect((CGFloat)aRect.X() / aBackingScale, (CGFloat)aRect.Y() / aBackingScale, + static NSRect DevPixelsToCocoaPoints(const LayoutDeviceIntRect& aRect, + CGFloat aBackingScale) { + return NSMakeRect((CGFloat)aRect.X() / aBackingScale, + (CGFloat)aRect.Y() / aBackingScale, (CGFloat)aRect.Width() / aBackingScale, (CGFloat)aRect.Height() / aBackingScale); } @@ -207,14 +211,14 @@ class nsCocoaUtils { static NSPoint GeckoPointToCocoaPoint(const mozilla::DesktopPoint& aPoint); // Converts aGeckoRect in dev pixels to points in Cocoa coordinates - static NSRect GeckoRectToCocoaRectDevPix(const mozilla::LayoutDeviceIntRect& aGeckoRect, - CGFloat aBackingScale); + static NSRect GeckoRectToCocoaRectDevPix( + const mozilla::LayoutDeviceIntRect& aGeckoRect, CGFloat aBackingScale); // See explanation for geckoRectToCocoaRect, guess what this does... static mozilla::DesktopIntRect CocoaRectToGeckoRect(const NSRect& cocoaRect); - static mozilla::LayoutDeviceIntRect CocoaRectToGeckoRectDevPix(const NSRect& aCocoaRect, - CGFloat aBackingScale); + static mozilla::LayoutDeviceIntRect CocoaRectToGeckoRectDevPix( + const NSRect& aCocoaRect, CGFloat aBackingScale); // Gives the location for the event in screen coordinates. Do not call this // unless the window the event was originally targeted at is still alive! @@ -225,10 +229,10 @@ class nsCocoaUtils { // is for the window. Does not take window z-order into account. static BOOL IsEventOverWindow(NSEvent* anEvent, NSWindow* aWindow); - // Events are set up so that their coordinates refer to the window to which they - // were originally sent. If we reroute the event somewhere else, we'll have - // to get the window coordinates this way. Do not call this unless the window - // the event was originally targeted at is still alive! + // Events are set up so that their coordinates refer to the window to which + // they were originally sent. If we reroute the event somewhere else, we'll + // have to get the window coordinates this way. Do not call this unless the + // window the event was originally targeted at is still alive! static NSPoint EventLocationForWindow(NSEvent* anEvent, NSWindow* aWindow); static BOOL IsMomentumScrollEvent(NSEvent* aEvent); @@ -248,12 +252,13 @@ class nsCocoaUtils { static void PrepareForNativeAppModalDialog(); static void CleanUpAfterNativeAppModalDialog(); - // 3 utility functions to go from a frame of imgIContainer to CGImage and then to NSImage - // Convert imgIContainer -> CGImageRef, caller owns result + // 3 utility functions to go from a frame of imgIContainer to CGImage and then + // to NSImage Convert imgIContainer -> CGImageRef, caller owns result - /** Creates a CGImageRef from a frame contained in an imgIContainer. - Copies the pixel data from the indicated frame of the imgIContainer into a new - CGImageRef. The caller owns the CGImageRef. + /** Creates a CGImageRef from a frame contained in an + imgIContainer. Copies the pixel data from the indicated frame + of the imgIContainer into a new CGImageRef. The + caller owns the CGImageRef. @param aFrame the frame to convert @param aResult the resulting CGImageRef @param aIsEntirelyBlack an outparam that, if non-null, will be set to a @@ -261,44 +266,48 @@ class nsCocoaUtils { pixels are zero @return NS_OK if the conversion worked, NS_ERROR_FAILURE otherwise */ - static nsresult CreateCGImageFromSurface(SourceSurface* aSurface, CGImageRef* aResult, + static nsresult CreateCGImageFromSurface(SourceSurface* aSurface, + CGImageRef* aResult, bool* aIsEntirelyBlack = nullptr); /** Creates a Cocoa NSImage from a CGImageRef. - Copies the pixel data from the CGImageRef into a new NSImage. - The caller owns the NSImage. + Copies the pixel data from the CGImageRef into a new + NSImage. The caller owns the NSImage. @param aInputImage the image to convert @param aResult the resulting NSImage @return NS_OK if the conversion worked, NS_ERROR_FAILURE otherwise */ - static nsresult CreateNSImageFromCGImage(CGImageRef aInputImage, NSImage** aResult); + static nsresult CreateNSImageFromCGImage(CGImageRef aInputImage, + NSImage** aResult); - /** Creates a Cocoa NSImage from a frame of an imgIContainer. - Combines the two methods above. The caller owns the NSImage. + /** Creates a Cocoa NSImage from a frame of an + imgIContainer. Combines the two methods above. The caller owns + the NSImage. @param aImage the image to extract a frame from @param aWhichFrame the frame to extract (see imgIContainer FRAME_*) - @param aComputedStyle the ComputedStyle of the element that the image is for, to support SVG - context paint properties, can be null + @param aComputedStyle the ComputedStyle of the element that the image is + for, to support SVG context paint properties, can be null @param aResult the resulting NSImage - @param scaleFactor the desired scale factor of the NSImage (2 for a retina display) + @param scaleFactor the desired scale factor of the NSImage (2 for a retina + display) @param aIsEntirelyBlack an outparam that, if non-null, will be set to a bool that indicates whether the RGB values on all pixels are zero @return NS_OK if the conversion worked, NS_ERROR_FAILURE otherwise */ - static nsresult CreateNSImageFromImageContainer(imgIContainer* aImage, uint32_t aWhichFrame, - const nsPresContext* aPresContext, - const mozilla::ComputedStyle* aComputedStyle, - NSImage** aResult, CGFloat scaleFactor, - bool* aIsEntirelyBlack = nullptr); + static nsresult CreateNSImageFromImageContainer( + imgIContainer* aImage, uint32_t aWhichFrame, + const nsPresContext* aPresContext, + const mozilla::ComputedStyle* aComputedStyle, NSImage** aResult, + CGFloat scaleFactor, bool* aIsEntirelyBlack = nullptr); - /** Creates a Cocoa NSImage from a frame of an imgIContainer. - The new NSImage will have both a regular and HiDPI representation. - The caller owns the NSImage. + /** Creates a Cocoa NSImage from a frame of an + imgIContainer. The new NSImage will have both a + regular and HiDPI representation. The caller owns the NSImage. @param aImage the image to extract a frame from @param aWhichFrame the frame to extract (see imgIContainer FRAME_*) - @param aComputedStyle the ComputedStyle of the element that the image is for, to support SVG - context paint properties, can be null + @param aComputedStyle the ComputedStyle of the element that the image is + for, to support SVG context paint properties, can be null @param aResult the resulting NSImage @param aIsEntirelyBlack an outparam that, if non-null, will be set to a bool that indicates whether the RGB values on all @@ -306,7 +315,8 @@ class nsCocoaUtils { @return NS_OK if the conversion worked, NS_ERROR_FAILURE otherwise */ static nsresult CreateDualRepresentationNSImageFromImageContainer( - imgIContainer* aImage, uint32_t aWhichFrame, const nsPresContext* aPresContext, + imgIContainer* aImage, uint32_t aWhichFrame, + const nsPresContext* aPresContext, const mozilla::ComputedStyle* aComputedStyle, NSImage** aResult, bool* aIsEntirelyBlack = nullptr); @@ -335,31 +345,35 @@ class nsCocoaUtils { * Just copies values between the two types; it does no coordinate-system * conversion, so both rects must have the same coordinate origin/direction. */ - static void GeckoRectToNSRect(const nsIntRect& aGeckoRect, NSRect& aOutCocoaRect); + static void GeckoRectToNSRect(const nsIntRect& aGeckoRect, + NSRect& aOutCocoaRect); /** * Returns Gecko rect for aCocoaRect. * Just copies values between the two types; it does no coordinate-system * conversion, so both rects must have the same coordinate origin/direction. */ - static void NSRectToGeckoRect(const NSRect& aCocoaRect, nsIntRect& aOutGeckoRect); + static void NSRectToGeckoRect(const NSRect& aCocoaRect, + nsIntRect& aOutGeckoRect); /** * Makes NSEvent instance for aEventTytpe and aEvent. */ - static NSEvent* MakeNewCocoaEventWithType(NSEventType aEventType, NSEvent* aEvent); + static NSEvent* MakeNewCocoaEventWithType(NSEventType aEventType, + NSEvent* aEvent); /** * Makes a cocoa event from a widget keyboard event. */ - static NSEvent* MakeNewCococaEventFromWidgetEvent(const mozilla::WidgetKeyboardEvent& aKeyEvent, - NSInteger aWindowNumber, - NSGraphicsContext* aContext); + static NSEvent* MakeNewCococaEventFromWidgetEvent( + const mozilla::WidgetKeyboardEvent& aKeyEvent, NSInteger aWindowNumber, + NSGraphicsContext* aContext); /** * Initializes WidgetInputEvent for aNativeEvent or aModifiers. */ - static void InitInputEvent(mozilla::WidgetInputEvent& aInputEvent, NSEvent* aNativeEvent); + static void InitInputEvent(mozilla::WidgetInputEvent& aInputEvent, + NSEvent* aNativeEvent); /** * Converts the native modifiers from aNativeEvent into WidgetMouseEvent @@ -385,7 +399,8 @@ class nsCocoaUtils { * commands based on selectors. This collects any such commands in the * provided array. */ - static void GetCommandsFromKeyEvent(NSEvent* aEvent, nsTArray& aCommands); + static void GetCommandsFromKeyEvent(NSEvent* aEvent, + nsTArray& aCommands); /** * Converts the string name of a Gecko key (like "VK_HOME") to the @@ -478,20 +493,23 @@ class nsCocoaUtils { static mozilla::PanGestureInput CreatePanGestureEvent( NSEvent* aNativeEvent, mozilla::TimeStamp aTimeStamp, - const mozilla::ScreenPoint& aPanStartPoint, const mozilla::ScreenPoint& aPreciseDelta, - const mozilla::gfx::IntPoint& aLineOrPageDelta, mozilla::Modifiers aModifiers); + const mozilla::ScreenPoint& aPanStartPoint, + const mozilla::ScreenPoint& aPreciseDelta, + const mozilla::gfx::IntPoint& aLineOrPageDelta, + mozilla::Modifiers aModifiers); /** * Return true if aAvailableType is a vaild NSPasteboard type. */ - static bool IsValidPasteboardType(NSString* aAvailableType, bool aAllowFileURL); + static bool IsValidPasteboardType(NSString* aAvailableType, + bool aAllowFileURL); /** * Set data for specific type from NSPasteboardItem to Transferable. */ - static void SetTransferDataForTypeFromPasteboardItem(nsITransferable* aTransferable, - const nsCString& aFlavor, - NSPasteboardItem* aItem); + static void SetTransferDataForTypeFromPasteboardItem( + nsITransferable* aTransferable, const nsCString& aFlavor, + NSPasteboardItem* aItem); private: /** @@ -519,21 +537,23 @@ class nsCocoaUtils { * or ResolveVideoCapturePromises) to be used as * the requestAccessForMediaType callback. */ - static nsresult RequestCapturePermission(NSString* aType, RefPtr& aPromise, + static nsresult RequestCapturePermission(NSString* aType, + RefPtr& aPromise, PromiseArray& aPromiseList, void (^aHandler)(BOOL granted)); /** * Resolves the pending promises that are waiting for a response * to a request video or audio capture permission. */ - static void ResolveMediaCapturePromises(bool aGranted, PromiseArray& aPromiseList); + static void ResolveMediaCapturePromises(bool aGranted, + PromiseArray& aPromiseList); /** * Get string data for a specific type from NSPasteboardItem. */ - static NSString* GetStringForTypeFromPasteboardItem(NSPasteboardItem* aItem, - const NSString* aType, - bool aAllowFileURL = false); + static NSString* GetStringForTypeFromPasteboardItem( + NSPasteboardItem* aItem, const NSString* aType, + bool aAllowFileURL = false); /** * Get the file path from NSPasteboardItem. diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm index b33bab268324..9cc565febd27 100644 --- a/widget/cocoa/nsCocoaWindow.mm +++ b/widget/cocoa/nsCocoaWindow.mm @@ -23,7 +23,6 @@ #include "nsIInterfaceRequestorUtils.h" #include "nsIAppWindow.h" #include "nsToolkit.h" -#include "nsTouchBarNativeAPIDefines.h" #include "nsPIDOMWindow.h" #include "nsThreadUtils.h" #include "nsMenuBarX.h" @@ -35,7 +34,6 @@ #include "nsCocoaFeatures.h" #include "nsIScreenManager.h" #include "nsIWidgetListener.h" -#include "SDKDeclarations.h" #include "VibrancyManager.h" #include "nsPresContext.h" #include "nsDocShell.h" @@ -3948,12 +3946,7 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn"; // NSWindows that this view is used in, including the floating full screen // toolbar window. The drawing bug was filed as FB9056136. See bug 1700211 // for more details. -#if !defined(MAC_OS_VERSION_11_0) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0 - if (nsCocoaFeatures::OnBigSurOrLater()) { -#else if (@available(macOS 11.0, *)) { -#endif aWindow.titlebarSeparatorStyle = NSTitlebarSeparatorStyleNone; } } @@ -4046,12 +4039,7 @@ static const NSString* kStateWantsTitleDrawn = @"wantsTitleDrawn"; mInitialTitlebarHeight = [self titlebarHeight]; [self setTitlebarAppearsTransparent:YES]; -#if !defined(MAC_OS_VERSION_11_0) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0 - if (nsCocoaFeatures::OnBigSurOrLater()) { -#else if (@available(macOS 11.0, *)) { -#endif self.titlebarSeparatorStyle = NSTitlebarSeparatorStyleNone; } [self updateTitlebarView]; diff --git a/widget/cocoa/nsLookAndFeel.mm b/widget/cocoa/nsLookAndFeel.mm index 7c84c8a2371f..ae6224833df8 100644 --- a/widget/cocoa/nsLookAndFeel.mm +++ b/widget/cocoa/nsLookAndFeel.mm @@ -19,7 +19,6 @@ #include "mozilla/StaticPrefs_widget.h" #include "mozilla/Telemetry.h" #include "mozilla/widget/WidgetMessageUtils.h" -#include "SDKDeclarations.h" #import #import diff --git a/widget/cocoa/nsMenuBarX.mm b/widget/cocoa/nsMenuBarX.mm index c91ba1f8fbfa..67e20a1bfce6 100644 --- a/widget/cocoa/nsMenuBarX.mm +++ b/widget/cocoa/nsMenuBarX.mm @@ -17,7 +17,6 @@ #include "nsGkAtoms.h" #include "nsObjCExceptions.h" #include "nsThreadUtils.h" -#include "nsTouchBarNativeAPIDefines.h" #include "nsIContent.h" #include "nsIWidget.h" diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 46999772f780..6550b71bf805 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -39,7 +39,6 @@ #include "mozilla/StaticPrefs_widget.h" #include "nsLookAndFeel.h" #include "MacThemeGeometryType.h" -#include "SDKDeclarations.h" #include "VibrancyManager.h" #include "gfxContext.h" diff --git a/widget/cocoa/nsNativeThemeColors.h b/widget/cocoa/nsNativeThemeColors.h index 2b7750adb1b5..02ec96f51a16 100644 --- a/widget/cocoa/nsNativeThemeColors.h +++ b/widget/cocoa/nsNativeThemeColors.h @@ -8,7 +8,6 @@ #import -#include "SDKDeclarations.h" #include "mozilla/ColorScheme.h" enum ColorName { @@ -41,16 +40,17 @@ inline float NativeGreyColorAsFloat(ColorName name, BOOL isMain) { return NativeGreyColorAsInt(name, isMain) / 255.0f; } -inline void DrawNativeGreyColorInRect(CGContextRef context, ColorName name, CGRect rect, - BOOL isMain) { +inline void DrawNativeGreyColorInRect(CGContextRef context, ColorName name, + CGRect rect, BOOL isMain) { float grey = NativeGreyColorAsFloat(name, isMain); CGContextSetRGBFillColor(context, grey, grey, grey, 1.0f); CGContextFillRect(context, rect); } inline NSAppearance* NSAppearanceForColorScheme(mozilla::ColorScheme aScheme) { - NSAppearanceName appearanceName = - aScheme == mozilla::ColorScheme::Light ? NSAppearanceNameAqua : NSAppearanceNameDarkAqua; + NSAppearanceName appearanceName = aScheme == mozilla::ColorScheme::Light + ? NSAppearanceNameAqua + : NSAppearanceNameDarkAqua; return [NSAppearance appearanceNamed:appearanceName]; } diff --git a/widget/cocoa/nsTouchBar.h b/widget/cocoa/nsTouchBar.h index 4432b05c39dd..4d0aa28d63ee 100644 --- a/widget/cocoa/nsTouchBar.h +++ b/widget/cocoa/nsTouchBar.h @@ -9,9 +9,9 @@ #include "nsITouchBarHelper.h" #include "nsTouchBarInput.h" -#include "nsTouchBarNativeAPIDefines.h" -const NSTouchBarItemIdentifier kTouchBarBaseIdentifier = @"com.mozilla.firefox.touchbar"; +const NSTouchBarItemIdentifier kTouchBarBaseIdentifier = + @"com.mozilla.firefox.touchbar"; /** * Our TouchBar is its own delegate. This is adequate for our purposes, @@ -34,7 +34,8 @@ const NSTouchBarItemIdentifier kTouchBarBaseIdentifier = @"com.mozilla.firefox.t * Contains TouchBarInput representations of the inputs currently in * the Touch Bar. Populated in `init` and updated by nsITouchBarUpdater. */ -@property(strong) NSMutableDictionary* mappedLayoutItems; +@property(strong) NSMutableDictionary* + mappedLayoutItems; /** * Stores buttons displayed in a NSScrollView. They must be stored separately @@ -42,7 +43,8 @@ const NSTouchBarItemIdentifier kTouchBarBaseIdentifier = @"com.mozilla.firefox.t * cannot be retrieved with [NSTouchBar itemForIdentifier]. */ @property(strong) - NSMutableDictionary* scrollViewButtons; + NSMutableDictionary* + scrollViewButtons; /** * Returns an instance of nsTouchBar based on implementation details @@ -104,8 +106,10 @@ const NSTouchBarItemIdentifier kTouchBarBaseIdentifier = @"com.mozilla.firefox.t withIdentifier:(NSTouchBarItemIdentifier)aIdentifier; - (void)updateScrollView:(NSCustomTouchBarItem*)aScrollViewItem withIdentifier:(NSTouchBarItemIdentifier)aIdentifier; -- (void)updateLabel:(NSTextField*)aLabel withIdentifier:(NSTouchBarItemIdentifier)aIdentifier; -- (NSTouchBarItem*)makeShareScrubberForIdentifier:(NSTouchBarItemIdentifier)aIdentifier; +- (void)updateLabel:(NSTextField*)aLabel + withIdentifier:(NSTouchBarItemIdentifier)aIdentifier; +- (NSTouchBarItem*)makeShareScrubberForIdentifier: + (NSTouchBarItemIdentifier)aIdentifier; /** * If aShowing is true, aPopover is shown. Otherwise, it is hidden. @@ -125,9 +129,10 @@ const NSTouchBarItemIdentifier kTouchBarBaseIdentifier = @"com.mozilla.firefox.t - (NSArray*)itemsForSharingServicePickerTouchBarItem: (NSSharingServicePickerTouchBarItem*)aPickerTouchBarItem; -- (NSArray*)sharingServicePicker:(NSSharingServicePicker*)aSharingServicePicker - sharingServicesForItems:(NSArray*)aItems - proposedSharingServices:(NSArray*)aProposedServices; +- (NSArray*) + sharingServicePicker:(NSSharingServicePicker*)aSharingServicePicker + sharingServicesForItems:(NSArray*)aItems + proposedSharingServices:(NSArray*)aProposedServices; - (void)releaseJSObjects; diff --git a/widget/cocoa/nsTouchBarInput.h b/widget/cocoa/nsTouchBarInput.h index 4853660d7908..41ed7979a4fd 100644 --- a/widget/cocoa/nsTouchBarInput.h +++ b/widget/cocoa/nsTouchBarInput.h @@ -8,7 +8,6 @@ #import #include "nsITouchBarInput.h" -#include "nsTouchBarNativeAPIDefines.h" #include "nsCOMPtr.h" using namespace mozilla::dom; @@ -73,8 +72,10 @@ class nsTouchBarInputIcon; * TouchBarInput's nativeIdentifier (e.g. nsTouchBarUpdater looking up a * popover in mappedLayoutItems). */ -+ (NSTouchBarItemIdentifier)nativeIdentifierWithType:(NSString*)aType withKey:(NSString*)aKey; -+ (NSTouchBarItemIdentifier)nativeIdentifierWithXPCOM:(nsCOMPtr)aInput; ++ (NSTouchBarItemIdentifier)nativeIdentifierWithType:(NSString*)aType + withKey:(NSString*)aKey; ++ (NSTouchBarItemIdentifier)nativeIdentifierWithXPCOM: + (nsCOMPtr)aInput; // Non-JS scrubber implemention for the Share Scrubber, // since it is defined by an Apple API. diff --git a/widget/cocoa/nsTouchBarInputIcon.h b/widget/cocoa/nsTouchBarInputIcon.h index 115d7a00752b..d018afb756ef 100644 --- a/widget/cocoa/nsTouchBarInputIcon.h +++ b/widget/cocoa/nsTouchBarInputIcon.h @@ -14,7 +14,6 @@ #include "mozilla/widget/IconLoader.h" #include "nsTouchBarInput.h" -#include "nsTouchBarNativeAPIDefines.h" using namespace mozilla::dom; diff --git a/widget/cocoa/nsTouchBarNativeAPIDefines.h b/widget/cocoa/nsTouchBarNativeAPIDefines.h deleted file mode 100644 index 1317a1bc7975..000000000000 --- a/widget/cocoa/nsTouchBarNativeAPIDefines.h +++ /dev/null @@ -1,67 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef nsTouchBarNativeAPIDefines_h -#define nsTouchBarNativeAPIDefines_h - -#import - -#if !defined(MAC_OS_X_VERSION_10_12_2) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12_2 -@interface NSApplication (TouchBarMenu) -- (IBAction)toggleTouchBarCustomizationPalette:(id)sender; -@end - -typedef NSString* NSTouchBarItemIdentifier; -__attribute__((weak_import)) -@interface NSTouchBarItem : NSObject -@property(readonly) NSView* view; -@property(readonly) NSString* customizationLabel; -- (instancetype)initWithIdentifier:(NSTouchBarItemIdentifier)aIdentifier; -@end - -@protocol NSSharingServicePickerTouchBarItemDelegate -@end - -__attribute__((weak_import)) -@interface NSSharingServicePickerTouchBarItem : NSTouchBarItem -@property(strong) id delegate; -@property(strong) NSImage* buttonImage; -@end - -__attribute__((weak_import)) -@interface NSCustomTouchBarItem : NSTouchBarItem -@property(strong) NSView* view; -@property(strong) NSString* customizationLabel; -@end - -@protocol NSTouchBarDelegate -@end - -typedef NSString* NSTouchBarCustomizationIdentifier; -__attribute__((weak_import)) -@interface NSTouchBar : NSObject -@property(strong) NSArray* defaultItemIdentifiers; -@property(strong) id delegate; -@property(strong) NSTouchBarCustomizationIdentifier customizationIdentifier; -@property(strong) NSArray* customizationAllowedItemIdentifiers; -- (NSTouchBarItem*)itemForIdentifier:(NSTouchBarItemIdentifier)aIdentifier; -@end - -__attribute__((weak_import)) -@interface NSPopoverTouchBarItem : NSTouchBarItem -@property(strong) NSString* customizationLabel; -@property(strong) NSView* collapsedRepresentation; -@property(strong) NSImage* collapsedRepresentationImage; -@property(strong) NSString* collapsedRepresentationLabel; -@property(strong) NSTouchBar* popoverTouchBar; -@property BOOL showsCloseButton; -- (void)showPopover:(id)sender; -- (void)dismissPopover:(id)sender; -@end - -@interface NSButton (TouchBarButton) -@property(strong) NSColor* bezelColor; -@end -#endif // !defined(MAC_OS_X_VERSION_10_12_2) -#endif // nsTouchBarNativeAPIDefines_h diff --git a/widget/cocoa/nsTouchBarUpdater.mm b/widget/cocoa/nsTouchBarUpdater.mm index 0ecea8413bba..ed0b78c6d180 100644 --- a/widget/cocoa/nsTouchBarUpdater.mm +++ b/widget/cocoa/nsTouchBarUpdater.mm @@ -7,7 +7,6 @@ #include "nsTouchBar.h" #include "nsTouchBarInput.h" #include "nsTouchBarUpdater.h" -#include "nsTouchBarNativeAPIDefines.h" #include "nsIBaseWindow.h" #include "nsIWidget.h" @@ -15,13 +14,6 @@ // defined in nsCocoaWindow.mm. extern BOOL sTouchBarIsInitialized; -#if !defined(MAC_OS_X_VERSION_10_12_2) || \ - MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12_2 -@interface BaseWindow (NSTouchBarProvider) -@property(strong) NSTouchBar* touchBar; -@end -#endif - NS_IMPL_ISUPPORTS(nsTouchBarUpdater, nsITouchBarUpdater); NS_IMETHODIMP