Skip to content

Commit

Permalink
style: Make color-scheme affect Windows' non-native menus
Browse files Browse the repository at this point in the history
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 w3c/csswg-drafts#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
  • Loading branch information
emilio authored and Loirooriol committed Sep 25, 2023
1 parent d51921e commit 81350d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
14 changes: 2 additions & 12 deletions components/style/gecko/media_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,18 +496,8 @@ fn eval_moz_platform(_: &Context, query_value: Option<Platform>) -> 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 {
Expand Down
3 changes: 3 additions & 0 deletions components/style/values/specified/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 81350d0

Please sign in to comment.