mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Make predefined counter style names ASCII-lowercase.
This commit is contained in:
parent
e7a2a98d8a
commit
82c04113d0
3 changed files with 117 additions and 1 deletions
|
@ -22,7 +22,28 @@ use values::CustomIdent;
|
|||
|
||||
/// Parse the prelude of an @counter-style rule
|
||||
pub fn parse_counter_style_name(input: &mut Parser) -> Result<CustomIdent, ()> {
|
||||
CustomIdent::from_ident(input.expect_ident()?, &["decimal", "none"])
|
||||
macro_rules! predefined {
|
||||
($($name: expr,)+) => {
|
||||
{
|
||||
ascii_case_insensitive_phf_map! {
|
||||
// FIXME: use static atoms https://github.com/rust-lang/rust/issues/33156
|
||||
predefined -> &'static str = {
|
||||
$(
|
||||
$name => $name,
|
||||
)+
|
||||
}
|
||||
}
|
||||
|
||||
let ident = input.expect_ident()?;
|
||||
if let Some(&lower_cased) = predefined(&ident) {
|
||||
Ok(CustomIdent(Atom::from(lower_cased)))
|
||||
} else {
|
||||
CustomIdent::from_ident(ident, &["decimal", "none"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
include!("predefined.rs")
|
||||
}
|
||||
|
||||
/// Parse the body (inside `{}`) of an @counter-style rule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue