Bug 1761357 [wpt PR 33355] - Fix #33204: Move Safari stable runs to Big Sur, a=testonly
[gecko.git] / widget / cocoa / nsCocoaFeatures.h
blobfdd1d1cd4d49374b197e3567bf6f0036baa0f13f
1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 nsCocoaFeatures_h_
7 #define nsCocoaFeatures_h_
9 #include <stdint.h>
11 /// Note that this class assumes we support the platform we are running on.
12 /// For better or worse, if the version is unknown or less than what we
13 /// support, we set it to the minimum supported version. GetSystemVersion
14 /// is the only call that returns the unadjusted values.
15 class nsCocoaFeatures {
16 public:
17 static int32_t macOSVersion();
18 static int32_t macOSVersionMajor();
19 static int32_t macOSVersionMinor();
20 static int32_t macOSVersionBugFix();
21 static bool OnSierraExactly();
22 static bool OnHighSierraOrLater();
23 static bool OnMojaveOrLater();
24 static bool OnCatalinaOrLater();
25 static bool OnBigSurOrLater();
26 static bool OnMontereyOrLater();
28 static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
29 int32_t aBugFix = 0);
31 static bool ProcessIsRosettaTranslated();
33 // These are utilities that do not change or depend on the value of
34 // mOSVersion and instead just encapsulate the encoding algorithm. Note that
35 // GetVersion actually adjusts to the lowest supported OS, so it will always
36 // return a "supported" version. GetSystemVersion does not make any
37 // modifications.
38 static void GetSystemVersion(int& aMajor, int& aMinor, int& aBugFix);
39 static int32_t GetVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix);
40 static int32_t ExtractMajorVersion(int32_t aVersion);
41 static int32_t ExtractMinorVersion(int32_t aVersion);
42 static int32_t ExtractBugFixVersion(int32_t aVersion);
44 private:
45 nsCocoaFeatures() = delete; // Prevent instantiation.
46 static void InitializeVersionNumbers();
48 static int32_t mOSVersion;
51 // C-callable helper for cairo-quartz-font.c and SkFontHost_mac.cpp
52 extern "C" {
53 bool Gecko_OnSierraExactly();
56 #endif // nsCocoaFeatures_h_