diff --git a/components/style/values/resolved/counters.rs b/components/style/values/resolved/counters.rs index 3bb439a104d..c00e63fda22 100644 --- a/components/style/values/resolved/counters.rs +++ b/components/style/values/resolved/counters.rs @@ -23,20 +23,19 @@ impl ToResolvedValue for computed::Content { #[inline] fn to_resolved_value(self, context: &Context) -> Self { - let is_before_or_after = context - .style - .pseudo() - .map_or(false, |p| p.is_before_or_after()); - let is_marker = context - .style - .pseudo() - .map_or(false, |p| p.is_marker()); - + let (is_pseudo, is_before_or_after, is_marker) = + match context.style.pseudo() { + Some(ref pseudo) => (true, pseudo.is_before_or_after(), pseudo.is_marker()), + None => (false, false, false) + }; match self { Self::Normal if is_before_or_after => Self::None, - // For now, make `content: none` compute to `normal` for elements + // For now, make `content: none` compute to `normal` for pseudos // other than ::before, ::after and ::marker, as we don't respect it. - Self::None if !is_before_or_after && !is_marker => Self::Normal, + // https://github.com/w3c/csswg-drafts/issues/6124 + // Ditto for non-pseudo elements if the pref is disabled. + Self::None if (is_pseudo && !is_before_or_after && !is_marker) || + (!is_pseudo && !static_prefs::pref!("layout.css.element-content-none.enabled")) => Self::Normal, other => other, } }