commit 322b5f92161a253db5120f452de1b995f212413d
parent 34f05691876f733b795e9125a12fc631d9fef3f5
Author: Sam Johnson <sam@scj.me>
Date: Tue, 7 Oct 2025 07:27:47 +0000
Bug 1991240 - Add utils for detecting macOS Tahoe. r=firefox-style-system-reviewers,emilio
Added a helper and a media feature that can be used by future patches implementing features that should only be available on macOS Tahoe and newer.
Differential Revision: https://phabricator.services.mozilla.com/D267165
Diffstat:
8 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/layout/style/test/chrome/chrome-only-media-queries.js b/layout/style/test/chrome/chrome-only-media-queries.js
@@ -4,6 +4,7 @@ const CHROME_ONLY_TOGGLES = [
"-moz-print-preview",
"-moz-overlay-scrollbars",
"-moz-mac-big-sur-theme",
+ "-moz-mac-tahoe-theme",
"-moz-menubar-drag",
"-moz-windows-accent-color-in-titlebar",
"-moz-swipe-animation-enabled",
diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs
@@ -645,7 +645,7 @@ macro_rules! lnf_int_feature {
/// to support new types in these entries and (2) ensuring that either
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
/// would be returned by the evaluator function could change.
-pub static MEDIA_FEATURES: [QueryFeatureDescription; 58] = [
+pub static MEDIA_FEATURES: [QueryFeatureDescription; 59] = [
feature!(
atom!("width"),
AllowsRanges::Yes,
@@ -918,6 +918,7 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 58] = [
),
lnf_int_feature!(atom!("-moz-menubar-drag"), MenuBarDrag),
lnf_int_feature!(atom!("-moz-mac-big-sur-theme"), MacBigSurTheme),
+ lnf_int_feature!(atom!("-moz-mac-tahoe-theme"), MacTahoeTheme),
feature!(
atom!("-moz-mac-rtl"),
AllowsRanges::No,
diff --git a/widget/LookAndFeel.h b/widget/LookAndFeel.h
@@ -118,6 +118,12 @@ class LookAndFeel {
MacBigSurTheme,
/*
+ * A Boolean value to determine whether the macOS Tahoe-specific
+ * theming should be used.
+ */
+ MacTahoeTheme,
+
+ /*
* AlertNotificationOrigin indicates from which corner of the
* screen alerts slide in, and from which direction (horizontal/vertical).
* 0, the default, represents bottom right, sliding vertically.
diff --git a/widget/cocoa/nsCocoaFeatures.h b/widget/cocoa/nsCocoaFeatures.h
@@ -22,6 +22,7 @@ class nsCocoaFeatures {
static bool OnMontereyOrLater();
static bool OnVenturaOrLater();
static bool OnSonomaOrLater();
+ static bool OnTahoeOrLater();
static bool IsAtLeastVersion(int32_t aMajor, int32_t aMinor,
int32_t aBugFix = 0);
diff --git a/widget/cocoa/nsCocoaFeatures.mm b/widget/cocoa/nsCocoaFeatures.mm
@@ -27,6 +27,7 @@
#define MACOS_VERSION_12_0_HEX 0x000C0000
#define MACOS_VERSION_13_0_HEX 0x000D0000
#define MACOS_VERSION_14_0_HEX 0x000E0000
+#define MACOS_VERSION_26_0_HEX 0x001A0000
#include "nsCocoaFeatures.h"
#include "nsCocoaUtils.h"
@@ -186,6 +187,11 @@ int32_t nsCocoaFeatures::GetVersion(int32_t aMajor, int32_t aMinor,
return (macOSVersion() >= MACOS_VERSION_14_0_HEX);
}
+/* static */ bool nsCocoaFeatures::OnTahoeOrLater() {
+ // See comments above regarding SYSTEM_VERSION_COMPAT.
+ return (macOSVersion() >= MACOS_VERSION_26_0_HEX);
+}
+
/* static */ bool nsCocoaFeatures::IsAtLeastVersion(int32_t aMajor,
int32_t aMinor,
int32_t aBugFix) {
diff --git a/widget/cocoa/nsLookAndFeel.mm b/widget/cocoa/nsLookAndFeel.mm
@@ -458,6 +458,9 @@ nsresult nsLookAndFeel::NativeGetInt(IntID aID, int32_t& aResult) {
case IntID::MacBigSurTheme:
aResult = nsCocoaFeatures::OnBigSurOrLater();
break;
+ case IntID::MacTahoeTheme:
+ aResult = nsCocoaFeatures::OnTahoeOrLater();
+ break;
case IntID::AlertNotificationOrigin:
aResult = NS_ALERT_TOP;
break;
diff --git a/widget/nsXPLookAndFeel.cpp b/widget/nsXPLookAndFeel.cpp
@@ -121,6 +121,7 @@ static const char sIntPrefs[][45] = {
"ui.windowsMica",
"ui.windowsMicaPopups",
"ui.macBigSurTheme",
+ "ui.macTahoeTheme",
"ui.alertNotificationOrigin",
"ui.scrollToClick",
"ui.IMERawInputUnderlineStyle",
diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py
@@ -2283,6 +2283,7 @@ STATIC_ATOMS = [
Atom("_moz_windows_mica", "-moz-windows-mica"),
Atom("_moz_windows_mica_popups", "-moz-windows-mica-popups"),
Atom("_moz_mac_big_sur_theme", "-moz-mac-big-sur-theme"),
+ Atom("_moz_mac_tahoe_theme", "-moz-mac-tahoe-theme"),
Atom("_moz_mac_rtl", "-moz-mac-rtl"),
Atom("_moz_mac_titlebar_height", "-moz-mac-titlebar-height"),
Atom("_moz_platform", "-moz-platform"),