Cherry-pick some parts of the cssparser update.

This commit is contained in:
Emilio Cobos Álvarez 2019-12-16 14:23:24 +01:00
parent f7c5df5703
commit 7513bc293e
3 changed files with 8 additions and 8 deletions

View file

@ -193,18 +193,18 @@ impl PseudoElement {
% for pseudo in SIMPLE_PSEUDOS:
"${pseudo.value[1:]}" => {
return Some(${pseudo_element_variant(pseudo)})
}
},
% endfor
// Alias some legacy prefixed pseudos to their standardized name at parse time:
"-moz-selection" => {
return Some(PseudoElement::Selection);
}
},
"-moz-placeholder" => {
return Some(PseudoElement::Placeholder);
}
},
"-moz-list-bullet" | "-moz-list-number" => {
return Some(PseudoElement::Marker);
}
},
_ => {
if starts_with_ignore_ascii_case(name, "-moz-tree-") {
return PseudoElement::tree_pseudo_element(name, Box::new([]))

View file

@ -396,7 +396,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
parser,
)?.into()
)
}
},
_ => return Err(parser.new_custom_error(
SelectorParseErrorKind::UnsupportedPseudoClassOrElement(name.clone())
))

View file

@ -691,11 +691,11 @@ fn parse_baseline<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, Pars
"first" => {
input.expect_ident_matching("baseline")?;
Ok(AlignFlags::BASELINE)
}
},
"last" => {
input.expect_ident_matching("baseline")?;
Ok(AlignFlags::LAST_BASELINE)
}
},
}
}
@ -794,7 +794,7 @@ fn parse_legacy<'i, 't>(input: &mut Parser<'i, 't>) -> Result<AlignFlags, ParseE
.unwrap_or(AlignFlags::empty());
return Ok(AlignFlags::LEGACY | flags)
}
},
"left" => AlignFlags::LEFT,
"right" => AlignFlags::RIGHT,
"center" => AlignFlags::CENTER,