Don't serialize parens when tree pseudo don't have argument.
draft
Don't serialize parens when tree pseudo don't have argument.
MozReview-Commit-ID: 8xLfb141n60
--- a/servo/components/style/gecko/generated/pseudo_element_definition.rs
+++ b/servo/components/style/gecko/generated/pseudo_element_definition.rs
@@ -1873,36 +1873,25 @@ impl ToCss for PseudoElement {
PseudoElement::MozTreeCheckbox(..) => dest.write_str(":-moz-tree-checkbox")?,
PseudoElement::MozTreeProgressmeter(..) => dest.write_str(":-moz-tree-progressmeter")?,
PseudoElement::MozTreeDropFeedback(..) => dest.write_str(":-moz-tree-drop-feedback")?,
PseudoElement::MozSVGMarkerAnonChild => dest.write_str(":-moz-svg-marker-anon-child")?,
PseudoElement::MozSVGOuterSVGAnonChild => dest.write_str(":-moz-svg-outer-svg-anon-child")?,
PseudoElement::MozSVGForeignContent => dest.write_str(":-moz-svg-foreign-content")?,
PseudoElement::MozSVGText => dest.write_str(":-moz-svg-text")?,
}
- match *self {
- PseudoElement::MozTreeColumn(ref args) |
- PseudoElement::MozTreeRow(ref args) |
- PseudoElement::MozTreeSeparator(ref args) |
- PseudoElement::MozTreeCell(ref args) |
- PseudoElement::MozTreeIndentation(ref args) |
- PseudoElement::MozTreeLine(ref args) |
- PseudoElement::MozTreeTwisty(ref args) |
- PseudoElement::MozTreeImage(ref args) |
- PseudoElement::MozTreeCellText(ref args) |
- PseudoElement::MozTreeCheckbox(ref args) |
- PseudoElement::MozTreeProgressmeter(ref args) |
- PseudoElement::MozTreeDropFeedback(ref args) => {
+ if let Some(args) = self.tree_pseudo_args() {
+ if !args.is_empty() {
dest.write_char('(')?;
let mut iter = args.iter();
if let Some(first) = iter.next() {
serialize_identifier(&first.to_string(), dest)?;
for item in iter {
dest.write_str(", ")?;
serialize_identifier(&item.to_string(), dest)?;
}
}
- dest.write_char(')')
+ dest.write_char(')')?;
}
- _ => Ok(()),
}
+ Ok(())
}
}
--- a/servo/components/style/gecko/pseudo_element_definition.mako.rs
+++ b/servo/components/style/gecko/pseudo_element_definition.mako.rs
@@ -262,26 +262,25 @@ impl PseudoElement {
impl ToCss for PseudoElement {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
dest.write_char(':')?;
match *self {
% for pseudo in PSEUDOS:
${pseudo_element_variant(pseudo)} => dest.write_str("${pseudo.value}")?,
% endfor
}
- match *self {
- ${" |\n ".join("PseudoElement::{}(ref args)".format(pseudo.capitalized())
- for pseudo in TREE_PSEUDOS)} => {
+ if let Some(args) = self.tree_pseudo_args() {
+ if !args.is_empty() {
dest.write_char('(')?;
let mut iter = args.iter();
if let Some(first) = iter.next() {
serialize_identifier(&first.to_string(), dest)?;
for item in iter {
dest.write_str(", ")?;
serialize_identifier(&item.to_string(), dest)?;
}
}
- dest.write_char(')')
+ dest.write_char(')')?;
}
- _ => Ok(()),
}
+ Ok(())
}
}