From e38d2369c5b8d8e04c07e677d0e345e38da85bd9 Mon Sep 17 00:00:00 2001 From: Ziran Sun Date: Mon, 9 Jan 2023 10:17:25 +0000 Subject: [PATCH] style: Serialization differences with "columns" with one or more `auto` value Differential Revision: https://phabricator.services.mozilla.com/D166087 --- .../style/properties/shorthands/column.mako.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/components/style/properties/shorthands/column.mako.rs b/components/style/properties/shorthands/column.mako.rs index 40c5e44855c..4cf9a8d7866 100644 --- a/components/style/properties/shorthands/column.mako.rs +++ b/components/style/properties/shorthands/column.mako.rs @@ -8,7 +8,6 @@ engines="gecko servo" sub_properties="column-width column-count" servo_pref="layout.columns.enabled" - derive_serialize="True" spec="https://drafts.csswg.org/css-multicol/#propdef-columns"> use crate::properties::longhands::{column_count, column_width}; @@ -54,6 +53,20 @@ }) } } + + impl<'a> ToCss for LonghandsToSerialize<'a> { + fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: fmt::Write { + if self.column_width.is_auto() { + return self.column_count.to_css(dest) + } + self.column_width.to_css(dest)?; + if !self.column_count.is_auto() { + dest.write_char(' ')?; + self.column_count.to_css(dest)?; + } + Ok(()) + } + } <%helpers:shorthand