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,10 +148,17 @@
% endfor % endfor
image.to_css(dest)?; image.to_css(dest)?;
if *mode != mask_mode::single_value::get_initial_specified_value() {
dest.write_str(" ")?; dest.write_str(" ")?;
mode.to_css(dest)?; mode.to_css(dest)?;
dest.write_str(" ")?; }
if *position_x != PositionComponent::zero() ||
*position_y != PositionComponent::zero() ||
*size != mask_size::single_value::get_initial_specified_value()
{
dest.write_str(" ")?;
Position { Position {
horizontal: position_x.clone(), horizontal: position_x.clone(),
vertical: position_y.clone() vertical: position_y.clone()
@ -161,8 +168,12 @@
dest.write_str(" / ")?; dest.write_str(" / ")?;
size.to_css(dest)?; size.to_css(dest)?;
} }
}
if *repeat != mask_repeat::single_value::get_initial_specified_value() {
dest.write_str(" ")?; dest.write_str(" ")?;
repeat.to_css(dest)?; 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,9 +184,11 @@
} }
} }
if *composite != mask_composite::single_value::get_initial_specified_value() {
dest.write_str(" ")?; dest.write_str(" ")?;
composite.to_css(dest)?; composite.to_css(dest)?;
} }
}
Ok(()) Ok(())
} }