From ad99753465c038c59de69604ce82342bb0b3c15e Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Mon, 14 Aug 2023 23:58:31 +0200 Subject: [PATCH] style: Change order of container shorthand Since the initial value of container-type is an open issue [1], I'm leaving that as-is for now. [1] https://github.com/w3c/csswg-drafts/issues/7202 Differential Revision: https://phabricator.services.mozilla.com/D147338 --- .../style/properties/shorthands/box.mako.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/components/style/properties/shorthands/box.mako.rs b/components/style/properties/shorthands/box.mako.rs index df0d6f76abee2..a05f7fd461cbf 100644 --- a/components/style/properties/shorthands/box.mako.rs +++ b/components/style/properties/shorthands/box.mako.rs @@ -36,7 +36,7 @@ ${helpers.two_properties_shorthand( <%helpers:shorthand engines="gecko" name="container" - sub_properties="container-type container-name" + sub_properties="container-name container-type" gecko_pref="layout.css.container-queries.enabled", spec="https://drafts.csswg.org/css-contain-3/#container-shorthand" > @@ -48,24 +48,24 @@ ${helpers.two_properties_shorthand( use crate::values::specified::box_::{ContainerName, ContainerType}; // See https://github.com/w3c/csswg-drafts/issues/7180 for why we don't // match the spec. - let container_type = ContainerType::parse(context, input)?; - let container_name = if input.try_parse(|input| input.expect_delim('/')).is_ok() { - ContainerName::parse(context, input)? + let container_name = ContainerName::parse(context, input)?; + let container_type = if input.try_parse(|input| input.expect_delim('/')).is_ok() { + ContainerType::parse(context, input)? } else { - ContainerName::none() + ContainerType::NONE }; Ok(expanded! { - container_type: container_type, container_name: container_name, + container_type: container_type, }) } impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { - self.container_type.to_css(dest)?; - if !self.container_name.is_none() { + self.container_name.to_css(dest)?; + if !self.container_type.is_empty() { dest.write_str(" / ")?; - self.container_name.to_css(dest)?; + self.container_type.to_css(dest)?; } Ok(()) }