style: Make the serialization of the mask shorthand more compact.

This helps to preserve the old longhand form when possible (mask used to be a
longhand), which will be relevant when we serialize this for the computed
value.

Differential Revision: https://phabricator.services.mozilla.com/D11943
This commit is contained in:
Emilio Cobos Álvarez 2018-11-15 08:22:31 +00:00
parent 0e7adcf18a
commit 60331f01d0
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C

View file

@ -148,21 +148,32 @@
% endfor % endfor
image.to_css(dest)?; image.to_css(dest)?;
dest.write_str(" ")?;
mode.to_css(dest)?;
dest.write_str(" ")?;
Position { if *mode != mask_mode::single_value::get_initial_specified_value() {
horizontal: position_x.clone(), dest.write_str(" ")?;
vertical: position_y.clone() mode.to_css(dest)?;
}.to_css(dest)?; }
if *size != mask_size::single_value::get_initial_specified_value() { if *position_x != PositionComponent::zero() ||
dest.write_str(" / ")?; *position_y != PositionComponent::zero() ||
size.to_css(dest)?; *size != mask_size::single_value::get_initial_specified_value()
{
dest.write_str(" ")?;
Position {
horizontal: position_x.clone(),
vertical: position_y.clone()
}.to_css(dest)?;
if *size != mask_size::single_value::get_initial_specified_value() {
dest.write_str(" / ")?;
size.to_css(dest)?;
}
}
if *repeat != mask_repeat::single_value::get_initial_specified_value() {
dest.write_str(" ")?;
repeat.to_css(dest)?;
} }
dest.write_str(" ")?;
repeat.to_css(dest)?;
if *origin != Origin::BorderBox || *clip != Clip::BorderBox { if *origin != Origin::BorderBox || *clip != Clip::BorderBox {
dest.write_str(" ")?; dest.write_str(" ")?;
@ -173,8 +184,10 @@
} }
} }
dest.write_str(" ")?; if *composite != mask_composite::single_value::get_initial_specified_value() {
composite.to_css(dest)?; dest.write_str(" ")?;
composite.to_css(dest)?;
}
} }
Ok(()) Ok(())