2011-08-05 18:36:51 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
2011-08-05 18:36:51 +00:00
|
|
|
|
|
|
|
#ifndef nsCocoaFeatures_h_
|
|
|
|
#define nsCocoaFeatures_h_
|
|
|
|
|
2013-07-30 14:25:31 +00:00
|
|
|
#include <stdint.h>
|
2011-08-05 18:36:51 +00:00
|
|
|
|
2014-11-28 22:28:59 +00:00
|
|
|
/// 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.
|
2011-08-05 18:36:51 +00:00
|
|
|
class nsCocoaFeatures {
|
|
|
|
public:
|
2012-08-22 15:56:38 +00:00
|
|
|
static int32_t OSXVersion();
|
2013-12-19 16:42:19 +00:00
|
|
|
static int32_t OSXVersionMajor();
|
|
|
|
static int32_t OSXVersionMinor();
|
|
|
|
static int32_t OSXVersionBugFix();
|
2014-06-05 22:02:46 +00:00
|
|
|
static bool OnYosemiteOrLater();
|
2015-09-09 23:08:25 +00:00
|
|
|
static bool OnElCapitanOrLater();
|
2018-06-29 01:18:25 +00:00
|
|
|
static bool OnSierraExactly();
|
2016-07-04 21:25:25 +00:00
|
|
|
static bool OnSierraOrLater();
|
2017-09-28 14:21:10 +00:00
|
|
|
static bool OnHighSierraOrLater();
|
2018-06-29 01:18:25 +00:00
|
|
|
static bool OnMojaveOrLater();
|
2012-05-17 07:53:20 +00:00
|
|
|
|
2014-11-11 03:15:22 +00:00
|
|
|
static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor, int32_t aBugFix=0);
|
|
|
|
|
2014-11-28 22:28:59 +00:00
|
|
|
// These are utilities that do not change or depend on the value of mOSXVersion
|
|
|
|
// 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);
|
|
|
|
|
2011-08-05 18:36:51 +00:00
|
|
|
private:
|
2013-12-19 16:42:19 +00:00
|
|
|
static void InitializeVersionNumbers();
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
static int32_t mOSXVersion;
|
2011-08-05 18:36:51 +00:00
|
|
|
};
|
2017-02-09 21:37:24 +00:00
|
|
|
|
2018-04-18 21:08:41 +00:00
|
|
|
// C-callable helper for cairo-quartz-font.c and SkFontHost_mac.cpp
|
2017-02-09 21:37:24 +00:00
|
|
|
extern "C" {
|
2018-04-18 21:08:41 +00:00
|
|
|
bool Gecko_OnSierraExactly();
|
2018-04-20 16:18:03 +00:00
|
|
|
bool Gecko_OnHighSierraOrLater();
|
2017-02-09 21:37:24 +00:00
|
|
|
}
|
|
|
|
|
2011-08-05 18:36:51 +00:00
|
|
|
#endif // nsCocoaFeatures_h_
|