From befb40705762fffba9182178d3fe175179e09330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 3 Aug 2022 20:33:09 +0000 Subject: [PATCH] style: Make color-scheme affect Windows' non-native menus This matches what Linux and macOS do, and that allows the fix for bug 1782623 to work on Windows for unstyled selects. This also simplifies the CSS (though it adds a new system color which is a bit more annoying). I filed https://github.com/w3c/csswg-drafts/issues/7561 to propose adding a more generic way to do this in the future (not just for Firefox). Differential Revision: https://phabricator.services.mozilla.com/D153549 --- components/style/gecko/media_features.rs | 14 ++------------ components/style/values/specified/color.rs | 3 +++ 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index 8c93dfa24ce..c939dea3577 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -496,18 +496,8 @@ fn eval_moz_platform(_: &Context, query_value: Option) -> bool { unsafe { bindings::Gecko_MediaFeatures_MatchesPlatform(query_value) } } -fn eval_moz_windows_non_native_menus(context: &Context) -> bool { - let use_non_native_menus = match static_prefs::pref!("browser.display.windows.non_native_menus") - { - 0 => false, - 1 => true, - _ => { - eval_moz_platform(context, Some(Platform::WindowsWin10)) && - get_lnf_int_as_bool(bindings::LookAndFeel_IntID::WindowsDefaultTheme as i32) - }, - }; - - use_non_native_menus +fn eval_moz_windows_non_native_menus(_: &Context) -> bool { + unsafe { bindings::Gecko_MediaFeatures_WindowsNonNativeMenus() } } fn eval_moz_overlay_scrollbars(context: &Context) -> bool { diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index 84d1382582d..aba43f4f25b 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -198,6 +198,9 @@ pub enum SystemColor { MozButtonhovertext, /// Used for menu item backgrounds when hovered. MozMenuhover, + /// Used for menu item backgrounds when hovered and disabled. + #[parse(condition = "ParserContext::in_ua_or_chrome_sheet")] + MozMenuhoverdisabled, /// Used for menu item text when hovered. MozMenuhovertext, /// Used for menubar item text.