Auto merge of #15210 - upsuper:text-decoration-line, r=Manishearth

Serialize text-decoration-line to none if nothing specified

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15210)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-25 04:09:09 -08:00 committed by GitHub
commit 2a32cf1352

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 {
if self.overline { dest.write_str(" ")?;
if space { }
try!(dest.write_str(" ")); dest.write_str($css)?;
has_any = true;
}
} }
try!(dest.write_str("overline"));
space = true;
} }
if self.line_through { write_value!(underline => "underline");
if space { write_value!(overline => "overline");
try!(dest.write_str(" ")); write_value!(line_through => "line-through");
} write_value!(blink => "blink");
try!(dest.write_str("line-through")); if !has_any {
space = true; dest.write_str("none")?;
}
if self.blink {
if space {
try!(dest.write_str(" "));
}
try!(dest.write_str("blink"));
} }
Ok(()) Ok(())
} }