diff --git a/layout/style/GeckoBindings.cpp b/layout/style/GeckoBindings.cpp index 0c837a81f996..92aaca36766d 100644 --- a/layout/style/GeckoBindings.cpp +++ b/layout/style/GeckoBindings.cpp @@ -688,21 +688,10 @@ bool Gecko_IsDocumentBody(const Element* aElement) { } nscolor Gecko_GetLookAndFeelSystemColor(int32_t aId, const Document* aDoc, - StyleSystemColorScheme aColorScheme, const StyleColorScheme* aStyle) { auto colorId = static_cast(aId); auto useStandins = LookAndFeel::ShouldUseStandins(*aDoc, colorId); - auto colorScheme = [&] { - switch (aColorScheme) { - case StyleSystemColorScheme::Default: - break; - case StyleSystemColorScheme::Light: - return LookAndFeel::ColorScheme::Light; - case StyleSystemColorScheme::Dark: - return LookAndFeel::ColorScheme::Dark; - } - return LookAndFeel::ColorSchemeForStyle(*aDoc, aStyle->bits); - }(); + auto colorScheme = LookAndFeel::ColorSchemeForStyle(*aDoc, aStyle->bits); AutoWriteLock guard(*sServoFFILock); return LookAndFeel::Color(colorId, colorScheme, useStandins); diff --git a/layout/style/GeckoBindings.h b/layout/style/GeckoBindings.h index 54f4dc98e2a5..f5e9377ccdc6 100644 --- a/layout/style/GeckoBindings.h +++ b/layout/style/GeckoBindings.h @@ -506,7 +506,6 @@ bool Gecko_IsDocumentBody(const mozilla::dom::Element* element); // because forward-declaring a nested enum/struct is impossible nscolor Gecko_GetLookAndFeelSystemColor(int32_t color_id, const mozilla::dom::Document*, - mozilla::StyleSystemColorScheme, const mozilla::StyleColorScheme*); int32_t Gecko_GetLookAndFeelInt(int32_t int_id); diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml index 7ce304324fda..915f42de8229 100644 --- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -508,7 +508,6 @@ cbindgen-types = [ { gecko = "StyleFontFamilyNameSyntax", servo = "crate::values::computed::font::FontFamilyNameSyntax" }, { gecko = "StyleGenericColor", servo = "crate::values::generics::color::Color" }, { gecko = "StyleSystemColor", servo = "crate::values::specified::color::SystemColor" }, - { gecko = "StyleSystemColorScheme", servo = "crate::values::specified::color::SystemColorScheme" }, { gecko = "StyleSystemFont", servo = "crate::values::specified::font::SystemFont" }, { gecko = "StyleGenericColorOrAuto", servo = "crate::values::generics::color::ColorOrAuto" }, { gecko = "StyleGenericScrollbarColor", servo = "crate::values::generics::ui::ScrollbarColor" }, diff --git a/layout/style/test/test_non_content_accessible_values.html b/layout/style/test/test_non_content_accessible_values.html index 4ac357d457b2..7f4ca653f069 100644 --- a/layout/style/test/test_non_content_accessible_values.html +++ b/layout/style/test/test_non_content_accessible_values.html @@ -12,8 +12,6 @@ const NON_CONTENT_ACCESSIBLE_VALUES = { "-moz-disabledfield", "-moz-colheaderhovertext", "-moz-colheadertext", - "-moz-system-color(highlight, light)", - "-moz-system-color(highlight, dark)", "-moz-nativevisitedhyperlinktext", "text-select-foreground", "text-select-background", diff --git a/servo/components/style/values/specified/color.rs b/servo/components/style/values/specified/color.rs index a44eae5025c4..42065ed50acb 100644 --- a/servo/components/style/values/specified/color.rs +++ b/servo/components/style/values/specified/color.rs @@ -178,20 +178,6 @@ impl ToCss for ColorMix { } } -/// The color scheme for a specific system color. -#[cfg(feature = "gecko")] -#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, ToCss, ToShmem)] -#[repr(u8)] -pub enum SystemColorScheme { - /// The default color-scheme for the document. - #[css(skip)] - Default, - /// A light color scheme. - Light, - /// A dark color scheme. - Dark, -} - /// Specified color value #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToShmem)] pub enum Color { @@ -206,10 +192,9 @@ pub enum Color { }, /// A complex color value from computed value Complex(ComputedColor), - /// Either a system color, or a `-moz-system-color(, light|dark)` - /// function which allows chrome code to choose between color schemes. + /// A system color. #[cfg(feature = "gecko")] - System(SystemColor, SystemColorScheme), + System(SystemColor), /// A color mix. ColorMix(Box), /// Quirksmode-only rule for inheriting color from the body @@ -464,7 +449,7 @@ pub enum SystemColor { #[cfg(feature = "gecko")] impl SystemColor { #[inline] - fn compute(&self, cx: &Context, scheme: SystemColorScheme) -> ComputedColor { + fn compute(&self, cx: &Context) -> ComputedColor { use crate::gecko_bindings::bindings; let colors = &cx.device().pref_sheet_prefs().mColors; @@ -481,7 +466,7 @@ impl SystemColor { _ => { let color = unsafe { - bindings::Gecko_GetLookAndFeelSystemColor(*self as i32, cx.device().document(), scheme, &style_color_scheme) + bindings::Gecko_GetLookAndFeelSystemColor(*self as i32, cx.device().document(), &style_color_scheme) }; if color == bindings::NS_SAME_AS_FOREGROUND_COLOR { return ComputedColor::currentcolor(); @@ -562,20 +547,6 @@ impl<'a, 'b: 'a, 'i: 'a> ::cssparser::ColorComponentParser<'i> for ColorComponen } } -fn parse_moz_system_color<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, -) -> Result<(SystemColor, SystemColorScheme), ParseError<'i>> { - debug_assert!(context.chrome_rules_enabled()); - input.expect_function_matching("-moz-system-color")?; - input.parse_nested_block(|input| { - let color = SystemColor::parse(context, input)?; - input.expect_comma()?; - let scheme = SystemColorScheme::parse(input)?; - Ok((color, scheme)) - }) -} - impl Parse for Color { fn parse<'i, 't>( context: &ParserContext, @@ -601,15 +572,7 @@ impl Parse for Color { #[cfg(feature = "gecko")] { if let Ok(system) = input.try_parse(|i| SystemColor::parse(context, i)) { - return Ok(Color::System(system, SystemColorScheme::Default)); - } - - if context.chrome_rules_enabled() { - if let Ok((color, scheme)) = - input.try_parse(|i| parse_moz_system_color(context, i)) - { - return Ok(Color::System(color, scheme)); - } + return Ok(Color::System(system)); } } @@ -648,17 +611,7 @@ impl ToCss for Color { Color::Complex(_) => Ok(()), Color::ColorMix(ref mix) => mix.to_css(dest), #[cfg(feature = "gecko")] - Color::System(system, scheme) => { - if scheme == SystemColorScheme::Default { - system.to_css(dest) - } else { - dest.write_str("-moz-system-color(")?; - system.to_css(dest)?; - dest.write_str(", ")?; - scheme.to_css(dest)?; - dest.write_char(')') - } - }, + Color::System(system) => system.to_css(dest), #[cfg(feature = "gecko")] Color::InheritFromBodyQuirk => Ok(()), } @@ -819,7 +772,7 @@ impl Color { )) }, #[cfg(feature = "gecko")] - Color::System(system, scheme) => system.compute(context?, scheme), + Color::System(system) => system.compute(context?), #[cfg(feature = "gecko")] Color::InheritFromBodyQuirk => ComputedColor::rgba(context?.device().body_text_color()), })