From 8c6af822b052e40019c67c060b658c3ea1e13dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 27 May 2023 16:21:05 +0200 Subject: [PATCH] style: Make anonymous scrollbar caching work on mac by default, and unify scrollbars.css across platforms We make it work on macOS by setting pointer-events: none + opacity: 0 rather than visibility: hidden, and tweaking the caching setup to be Android-like. Now that the scrollbars sheet is the same across platforms, move it to where the rest of the UA sheets are. This way we guarantee that the RDM vs. Android difference is less (just the ifdef at the top of the sheet). Depends on D128084 Differential Revision: https://phabricator.services.mozilla.com/D128085 --- components/style/gecko/media_features.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/components/style/gecko/media_features.rs b/components/style/gecko/media_features.rs index 7e087e3fd0a..93dc085cd69 100644 --- a/components/style/gecko/media_features.rs +++ b/components/style/gecko/media_features.rs @@ -607,6 +607,16 @@ fn eval_moz_windows_non_native_menus( query_value.map_or(use_non_native_menus, |v| v == use_non_native_menus) } +fn eval_moz_overlay_scrollbars( + device: &Device, + query_value: Option, + _: Option, +) -> bool { + let use_overlay = + unsafe { bindings::Gecko_MediaFeatures_UseOverlayScrollbars(device.document()) }; + query_value.map_or(use_overlay, |v| v == use_overlay) +} + fn get_lnf_int(int_id: i32) -> i32 { unsafe { bindings::Gecko_GetLookAndFeelInt(int_id) } } @@ -902,13 +912,18 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 61] = [ Evaluator::BoolInteger(eval_moz_windows_non_native_menus), ParsingRequirements::CHROME_AND_UA_ONLY, ), + feature!( + atom!("-moz-overlay-scrollbars"), + AllowsRanges::No, + Evaluator::BoolInteger(eval_moz_overlay_scrollbars), + ParsingRequirements::CHROME_AND_UA_ONLY, + ), lnf_int_feature!(atom!("-moz-scrollbar-start-backward"), ScrollArrowStyle, get_scrollbar_start_backward), lnf_int_feature!(atom!("-moz-scrollbar-start-forward"), ScrollArrowStyle, get_scrollbar_start_forward), lnf_int_feature!(atom!("-moz-scrollbar-end-backward"), ScrollArrowStyle, get_scrollbar_end_backward), lnf_int_feature!(atom!("-moz-scrollbar-end-forward"), ScrollArrowStyle, get_scrollbar_end_forward), lnf_int_feature!(atom!("-moz-scrollbar-thumb-proportional"), ScrollSliderStyle), - lnf_int_feature!(atom!("-moz-overlay-scrollbars"), UseOverlayScrollbars), lnf_int_feature!(atom!("-moz-menubar-drag"), MenuBarDrag), lnf_int_feature!(atom!("-moz-windows-default-theme"), WindowsDefaultTheme), lnf_int_feature!(atom!("-moz-mac-graphite-theme"), MacGraphiteTheme),