diff --git a/style/values/computed/length.rs b/style/values/computed/length.rs index b7e78183e7..7c41b07025 100644 --- a/style/values/computed/length.rs +++ b/style/values/computed/length.rs @@ -176,77 +176,6 @@ impl NonNegativeLengthPercentageOrAuto { computed_length_percentage_or_auto!(NonNegativeLengthPercentage); } -#[cfg(feature = "servo")] -impl MaxSize { - /// Convert the computed value into used value. - #[inline] - pub fn to_used_value(&self, percentage_basis: Au) -> Option { - match *self { - Self::None | Self::MinContent | Self::MaxContent | Self::FitContent | Self::Stretch => { - None - }, - Self::LengthPercentage(ref lp) => Some(lp.to_used_value(percentage_basis)), - Self::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"), - } - } - - /// Convert the computed value into used value if there is enough information. - #[inline] - pub fn maybe_to_used_value(&self, percentage_basis: Option) -> Option { - match *self { - Self::None | Self::MinContent | Self::MaxContent | Self::FitContent | Self::Stretch => { - None - }, - Self::LengthPercentage(ref lp) => lp.maybe_to_used_value(percentage_basis), - Self::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"), - } - } -} - -impl Size { - /// Convert the computed value into used value. - #[inline] - #[cfg(feature = "servo")] - pub fn to_used_value(&self, percentage_basis: Au) -> Option { - match *self { - Self::Auto | Self::MinContent | Self::MaxContent | Self::FitContent | Self::Stretch => { - None - }, - Self::LengthPercentage(ref lp) => Some(lp.to_used_value(percentage_basis)), - Self::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"), - } - } - - /// Convert the computed value into used value if there is enough information. - #[inline] - #[cfg(feature = "servo")] - pub fn maybe_to_used_value(&self, percentage_basis: Option) -> Option { - match *self { - Self::Auto | Self::MinContent | Self::MaxContent | Self::FitContent | Self::Stretch => { - None - }, - Self::LengthPercentage(ref lp) => lp.maybe_to_used_value(percentage_basis), - Self::AnchorSizeFunction(_) => unreachable!("anchor-size() should be disabled"), - } - } - - /// Returns true if the computed value is absolute 0 or 0%. - #[inline] - pub fn is_definitely_zero(&self) -> bool { - match *self { - Self::Auto => false, - Self::LengthPercentage(ref lp) => lp.is_definitely_zero(), - Self::MinContent | - Self::MaxContent | - Self::FitContent | - Self::Stretch | - Self::AnchorSizeFunction(_) => false, - #[cfg(feature = "gecko")] - Self::MozAvailable | Self::WebkitFillAvailable | Self::FitContentFunction(_) => false, - } - } -} - /// The computed `` value. #[derive( Animate, diff --git a/style/values/generics/length.rs b/style/values/generics/length.rs index ecfb278619..2000bb84c1 100644 --- a/style/values/generics/length.rs +++ b/style/values/generics/length.rs @@ -169,7 +169,6 @@ pub enum GenericSize { WebkitFillAvailable, #[animation(error)] Stretch, - #[cfg(feature = "gecko")] #[animation(error)] #[css(function = "fit-content")] FitContentFunction(LengthPercent), @@ -246,7 +245,6 @@ pub enum GenericMaxSize { WebkitFillAvailable, #[animation(error)] Stretch, - #[cfg(feature = "gecko")] #[animation(error)] #[css(function = "fit-content")] FitContentFunction(LengthPercent), diff --git a/style/values/specified/length.rs b/style/values/specified/length.rs index ddbc6dca22..a77cb943f1 100644 --- a/style/values/specified/length.rs +++ b/style/values/specified/length.rs @@ -2050,12 +2050,10 @@ fn is_stretch_enabled() -> bool { static_prefs::pref!("layout.css.stretch-size-keyword.enabled") } -#[cfg(feature = "gecko")] fn is_fit_content_function_enabled() -> bool { static_prefs::pref!("layout.css.fit-content-function.enabled") } -#[cfg(feature = "gecko")] macro_rules! parse_fit_content_function { ($size:ident, $input:expr, $context:expr, $allow_quirks:expr) => { if is_fit_content_function_enabled() { @@ -2079,7 +2077,6 @@ impl Size { allow_quirks: AllowQuirks, ) -> Result> { parse_size_non_length!(Size, input, "auto" => Auto); - #[cfg(feature = "gecko")] parse_fit_content_function!(Size, input, context, allow_quirks); if let Ok(length) = @@ -2119,7 +2116,6 @@ impl MaxSize { allow_quirks: AllowQuirks, ) -> Result> { parse_size_non_length!(MaxSize, input, "none" => None); - #[cfg(feature = "gecko")] parse_fit_content_function!(MaxSize, input, context, allow_quirks); if let Ok(length) = diff --git a/stylo_static_prefs/src/lib.rs b/stylo_static_prefs/src/lib.rs index 97c27c3ac9..1e622d2cf9 100644 --- a/stylo_static_prefs/src/lib.rs +++ b/stylo_static_prefs/src/lib.rs @@ -24,6 +24,9 @@ macro_rules! pref { ("layout.css.basic-shape-xywh.enabled") => { true }; + ("layout.css.fit-content-function.enabled") => { + true + }; ("layout.css.relative-color-syntax.enabled") => { true };