diff --git a/components/style/properties/shorthand/position.mako.rs b/components/style/properties/shorthand/position.mako.rs index 94c3bee9ddc..b1d40e52a19 100644 --- a/components/style/properties/shorthand/position.mako.rs +++ b/components/style/properties/shorthand/position.mako.rs @@ -144,28 +144,6 @@ use properties::longhands::align_content; use properties::longhands::justify_content; -% if product == "servo": - impl From for justify_content::SpecifiedValue { - fn from(align: align_content::SpecifiedValue) -> - justify_content::SpecifiedValue { - match align { - align_content::SpecifiedValue::stretch => - justify_content::SpecifiedValue::stretch, - align_content::SpecifiedValue::flex_start => - justify_content::SpecifiedValue::flex_start, - align_content::SpecifiedValue::flex_end => - justify_content::SpecifiedValue::flex_end, - align_content::SpecifiedValue::center => - justify_content::SpecifiedValue::center, - align_content::SpecifiedValue::space_between => - justify_content::SpecifiedValue::space_between, - align_content::SpecifiedValue::space_around => - justify_content::SpecifiedValue::space_around, - } - } - } -% endif - pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result { let align = align_content::parse(context, input)?; let justify = input.try(|input| justify_content::parse(context, input)) @@ -179,9 +157,13 @@ impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - self.align_content.to_css(dest)?; - dest.write_str(" ")?; - self.justify_content.to_css(dest) + if self.align_content == self.justify_content { + self.align_content.to_css(dest) + } else { + self.justify_content.to_css(dest)?; + dest.write_str(" ")?; + self.justify_content.to_css(dest) + } } } @@ -204,9 +186,13 @@ impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - self.align_self.to_css(dest)?; - dest.write_str(" ")?; - self.justify_self.to_css(dest) + if self.align_self == self.justify_self { + self.align_self.to_css(dest) + } else { + self.align_self.to_css(dest)?; + dest.write_str(" ")?; + self.justify_self.to_css(dest) + } } } @@ -236,9 +222,13 @@ impl<'a> ToCss for LonghandsToSerialize<'a> { fn to_css(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { - self.align_items.to_css(dest)?; - dest.write_str(" ")?; - self.justify_items.to_css(dest) + if self.align_items.0 == self.justify_items.0 { + self.align_items.to_css(dest) + } else { + self.align_items.to_css(dest)?; + dest.write_str(" ")?; + self.justify_items.to_css(dest) + } } }