style: Serialization differences with "columns" with one or more auto value

Differential Revision: https://phabricator.services.mozilla.com/D166087
This commit is contained in:
Ziran Sun 2023-01-09 10:17:25 +00:00 committed by Martin Robinson
parent 2edc1139b6
commit e38d2369c5

View file

@ -8,7 +8,6 @@
engines="gecko servo" engines="gecko servo"
sub_properties="column-width column-count" sub_properties="column-width column-count"
servo_pref="layout.columns.enabled" servo_pref="layout.columns.enabled"
derive_serialize="True"
spec="https://drafts.csswg.org/css-multicol/#propdef-columns"> spec="https://drafts.csswg.org/css-multicol/#propdef-columns">
use crate::properties::longhands::{column_count, column_width}; use crate::properties::longhands::{column_count, column_width};
@ -54,6 +53,20 @@
}) })
} }
} }
impl<'a> ToCss for LonghandsToSerialize<'a> {
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> 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> </%helpers:shorthand>
<%helpers:shorthand <%helpers:shorthand