Bug 1776444 [wpt PR 34582] - Revert "Add TimedHTMLParserBudget to fieldtrial_testing_...
[gecko.git] / widget / cocoa / SDKDeclarations.h
blobb0640935820163f15bee1e191b694f1f4c1a709c
1 /* -*- Mode: c++; tab-width: 2; indent-tabs-mode: nil; -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef SDKDefines_h
7 #define SDKDefines_h
9 #import <Cocoa/Cocoa.h>
11 /**
12 * This file contains header declarations from SDKs more recent than the minimum macOS SDK which we
13 * require for building Firefox, which is currently the macOS 10.12 SDK.
16 #if !defined(MAC_OS_X_VERSION_10_12_2) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12_2
18 @interface NSView (NSView10_12_2)
19 - (NSTouchBar*)makeTouchBar;
20 @end
22 #endif
24 #if !defined(MAC_OS_X_VERSION_10_13) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_13
26 using NSAppearanceName = NSString*;
28 @interface NSColor (NSColor10_13)
29 // "Available in 10.10", but not present in any SDK less than 10.13
30 @property(class, strong, readonly) NSColor* systemPurpleColor NS_AVAILABLE_MAC(10_10);
31 @end
33 @interface NSTask (NSTask10_13)
34 @property(copy) NSURL* executableURL NS_AVAILABLE_MAC(10_13);
35 @property(copy) NSArray<NSString*>* arguments;
36 - (BOOL)launchAndReturnError:(NSError**)error NS_AVAILABLE_MAC(10_13);
37 @end
39 enum : OSType {
40 kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420',
41 kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20',
44 #endif
46 #if !defined(MAC_OS_X_VERSION_10_14) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_14
48 const NSAppearanceName NSAppearanceNameDarkAqua = @"NSAppearanceNameDarkAqua";
50 @interface NSWindow (NSWindow10_14)
51 @property(weak) NSObject<NSAppearanceCustomization>* appearanceSource NS_AVAILABLE_MAC(10_14);
52 @end
54 @interface NSApplication (NSApplication10_14)
55 @property(strong) NSAppearance* appearance NS_AVAILABLE_MAC(10_14);
56 @property(readonly, strong) NSAppearance* effectiveAppearance NS_AVAILABLE_MAC(10_14);
57 @end
59 @interface NSAppearance (NSAppearance10_14)
60 - (NSAppearanceName)bestMatchFromAppearancesWithNames:(NSArray<NSAppearanceName>*)appearances
61 NS_AVAILABLE_MAC(10_14);
62 @end
64 @interface NSColor (NSColor10_14)
65 // Available in 10.10, but retroactively made public in 10.14.
66 @property(class, strong, readonly) NSColor* linkColor NS_AVAILABLE_MAC(10_10);
67 @end
69 enum {
70 NSVisualEffectMaterialToolTip NS_ENUM_AVAILABLE_MAC(10_14) = 17,
73 #endif
75 #if !defined(MAC_OS_VERSION_11_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0
76 // The declarations below do not have NS_AVAILABLE_MAC(11_0) on them because we're building with a
77 // pre-macOS 11 SDK, so macOS 11 identifies itself as 10.16, and @available(macOS 11.0, *) checks
78 // won't work. You'll need to use an annoying double-whammy check for these:
80 // #if !defined(MAC_OS_VERSION_11_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_11_0
81 // if (nsCocoaFeatures::OnBigSurOrLater()) {
82 // #else
83 // if (@available(macOS 11.0, *)) {
84 // #endif
85 // ...
86 // }
89 typedef NS_ENUM(NSInteger, NSTitlebarSeparatorStyle) {
90 NSTitlebarSeparatorStyleAutomatic,
91 NSTitlebarSeparatorStyleNone,
92 NSTitlebarSeparatorStyleLine,
93 NSTitlebarSeparatorStyleShadow
96 @interface NSWindow (NSWindow11_0)
97 @property NSTitlebarSeparatorStyle titlebarSeparatorStyle;
98 @end
100 @interface NSMenu (NSMenu11_0)
101 // In reality, NSMenu implements the NSAppearanceCustomization protocol, and picks up the appearance
102 // property from that protocol. But we can't tack on protocol implementations, so we just declare
103 // the property setter here.
104 - (void)setAppearance:(NSAppearance*)appearance;
105 @end
107 #endif
109 #if !defined(MAC_OS_VERSION_12_0) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0
111 typedef CFTypeRef AXTextMarkerRef;
112 typedef CFTypeRef AXTextMarkerRangeRef;
114 extern "C" {
115 CFTypeID AXTextMarkerGetTypeID();
116 AXTextMarkerRef AXTextMarkerCreate(CFAllocatorRef allocator, const UInt8* bytes, CFIndex length);
117 const UInt8* AXTextMarkerGetBytePtr(AXTextMarkerRef text_marker);
118 CFIndex AXTextMarkerGetLength(AXTextMarkerRef text_marker);
119 CFTypeID AXTextMarkerRangeGetTypeID();
120 AXTextMarkerRangeRef AXTextMarkerRangeCreate(CFAllocatorRef allocator, AXTextMarkerRef start_marker,
121 AXTextMarkerRef end_marker);
122 AXTextMarkerRef AXTextMarkerRangeCopyStartMarker(AXTextMarkerRangeRef text_marker_range);
123 AXTextMarkerRef AXTextMarkerRangeCopyEndMarker(AXTextMarkerRangeRef text_marker_range);
126 @interface NSScreen (NSScreen12_0)
127 // https://developer.apple.com/documentation/appkit/nsscreen/3882821-safeareainsets?language=objc&changes=latest_major
128 @property(readonly) NSEdgeInsets safeAreaInsets;
129 @end
131 #endif
133 #endif // SDKDefines_h