diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /widget/cocoa/nsCocoaFeatures.h | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/cocoa/nsCocoaFeatures.h')
-rw-r--r-- | widget/cocoa/nsCocoaFeatures.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h new file mode 100644 index 0000000000..9ab9d5927c --- /dev/null +++ b/widget/cocoa/nsCocoaFeatures.h @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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 nsCocoaFeatures_h_ +#define nsCocoaFeatures_h_ + +#include <stdint.h> + +/// Note that this class assumes we support the platform we are running on. +/// For better or worse, if the version is unknown or less than what we +/// support, we set it to the minimum supported version. GetSystemVersion +/// is the only call that returns the unadjusted values. +class nsCocoaFeatures { + public: + static int32_t macOSVersion(); + static int32_t macOSVersionMajor(); + static int32_t macOSVersionMinor(); + static int32_t macOSVersionBugFix(); + static bool OnSierraExactly(); + static bool OnHighSierraOrLater(); + static bool OnMojaveOrLater(); + static bool OnCatalinaOrLater(); + static bool OnBigSurOrLater(); + + static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, + int32_t aBugFix = 0); + + static bool ProcessIsRosettaTranslated(); + + // These are utilities that do not change or depend on the value of + // mOSVersion and instead just encapsulate the encoding algorithm. Note that + // GetVersion actually adjusts to the lowest supported OS, so it will always + // return a "supported" version. GetSystemVersion does not make any + // modifications. + static void GetSystemVersion(int& aMajor, int& aMinor, int& aBugFix); + static int32_t GetVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix); + static int32_t ExtractMajorVersion(int32_t aVersion); + static int32_t ExtractMinorVersion(int32_t aVersion); + static int32_t ExtractBugFixVersion(int32_t aVersion); + + private: + nsCocoaFeatures() = delete; // Prevent instantiation. + static void InitializeVersionNumbers(); + + static int32_t mOSVersion; +}; + +// C-callable helper for cairo-quartz-font.c and SkFontHost_mac.cpp +extern "C" { +bool Gecko_OnSierraExactly(); +} + +#endif // nsCocoaFeatures_h_ |