Serialize text-decoration-line to none if nothing specified

This commit is contained in:
Xidorn Quan 2017-01-25 17:51:04 +11:00
parent 6fc0d2f927
commit b0f5f20290

View file

@ -122,30 +122,24 @@ ${helpers.single_keyword("unicode-bidi",
impl ToCss for SpecifiedValue { impl ToCss for SpecifiedValue {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
let mut space = false; let mut has_any = false;
if self.underline { macro_rules! write_value {
try!(dest.write_str("underline")); ($line:ident => $css:expr) => {
space = true; if self.$line {
if has_any {
dest.write_str(" ")?;
} }
if self.overline { dest.write_str($css)?;
if space { has_any = true;
try!(dest.write_str(" "));
} }
try!(dest.write_str("overline"));
space = true;
} }
if self.line_through {
if space {
try!(dest.write_str(" "));
} }
try!(dest.write_str("line-through")); write_value!(underline => "underline");
space = true; write_value!(overline => "overline");
} write_value!(line_through => "line-through");
if self.blink { write_value!(blink => "blink");
if space { if !has_any {
try!(dest.write_str(" ")); dest.write_str("none")?;
}
try!(dest.write_str("blink"));
} }
Ok(()) Ok(())
} }