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_
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
{
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
,
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
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
);
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
53 bool Gecko_OnSierraExactly();
56 #endif // nsCocoaFeatures_h_