mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
style: Remove -moz-toolbar-prefers-color-scheme
By making prefers-color-scheme return the ColorSchemeForChrome(), which accounts for the Firefox theme. Differential Revision: https://phabricator.services.mozilla.com/D128611
This commit is contained in:
parent
8c6af822b0
commit
685b2cd29a
1 changed files with 1 additions and 46 deletions
|
@ -406,45 +406,6 @@ fn eval_prefers_color_scheme(device: &Device, query_value: Option<PrefersColorSc
|
|||
}
|
||||
}
|
||||
|
||||
/// Values for the -moz-toolbar-prefers-color-scheme media feature.
|
||||
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, PartialEq, ToCss)]
|
||||
#[repr(u8)]
|
||||
enum ToolbarPrefersColorScheme {
|
||||
Dark,
|
||||
Light,
|
||||
System,
|
||||
}
|
||||
|
||||
/// The color-scheme of the toolbar in the current Firefox theme. This is based
|
||||
/// on a pref managed by the front-end.
|
||||
fn eval_toolbar_prefers_color_scheme(d: &Device, query_value: Option<ToolbarPrefersColorScheme>) -> bool {
|
||||
let toolbar_value = match static_prefs::pref!("browser.theme.toolbar-theme") {
|
||||
0 => ToolbarPrefersColorScheme::Dark,
|
||||
1 => ToolbarPrefersColorScheme::Light,
|
||||
_ => ToolbarPrefersColorScheme::System,
|
||||
};
|
||||
|
||||
let query_value = match query_value {
|
||||
Some(v) => v,
|
||||
None => return true,
|
||||
};
|
||||
|
||||
if query_value == toolbar_value {
|
||||
return true;
|
||||
}
|
||||
|
||||
if toolbar_value != ToolbarPrefersColorScheme::System {
|
||||
return false;
|
||||
}
|
||||
|
||||
// System might match light and dark as well.
|
||||
match query_value {
|
||||
ToolbarPrefersColorScheme::Dark => eval_prefers_color_scheme(d, Some(PrefersColorScheme::Dark)),
|
||||
ToolbarPrefersColorScheme::Light => eval_prefers_color_scheme(d, Some(PrefersColorScheme::Light)),
|
||||
ToolbarPrefersColorScheme::System => true,
|
||||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
/// https://drafts.csswg.org/mediaqueries-4/#mf-interaction
|
||||
struct PointerCapabilities: u8 {
|
||||
|
@ -690,7 +651,7 @@ macro_rules! bool_pref_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: [MediaFeatureDescription; 61] = [
|
||||
pub static MEDIA_FEATURES: [MediaFeatureDescription; 60] = [
|
||||
feature!(
|
||||
atom!("width"),
|
||||
AllowsRanges::Yes,
|
||||
|
@ -900,12 +861,6 @@ pub static MEDIA_FEATURES: [MediaFeatureDescription; 61] = [
|
|||
Evaluator::BoolInteger(eval_moz_non_native_content_theme),
|
||||
ParsingRequirements::CHROME_AND_UA_ONLY,
|
||||
),
|
||||
feature!(
|
||||
atom!("-moz-toolbar-prefers-color-scheme"),
|
||||
AllowsRanges::No,
|
||||
keyword_evaluator!(eval_toolbar_prefers_color_scheme, ToolbarPrefersColorScheme),
|
||||
ParsingRequirements::CHROME_AND_UA_ONLY,
|
||||
),
|
||||
feature!(
|
||||
atom!("-moz-windows-non-native-menus"),
|
||||
AllowsRanges::No,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue