servo: Merge #15210 - Serialize text-decoration-line to none if nothing specified (from upsuper:text-decoration-line); r=Manishearth

Source-Repo: https://github.com/servo/servo
Source-Revision: 2a32cf135262318b58b0738f56cd5f8aa6da8823
This commit is contained in:
Xidorn Quan 2017-01-25 04:09:09 -08:00
parent ecc8909f7e
commit cb25d5d08e

View File

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