mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Allow 'decimal' and 'none' in <counter-style-name>
… other than in `@counter-style`.
This commit is contained in:
parent
1146921866
commit
0ff64bdc59
7 changed files with 45 additions and 5 deletions
|
@ -13,6 +13,7 @@ use gecko_bindings::bindings::Gecko_ReleaseAtom;
|
|||
use gecko_bindings::structs::nsIAtom;
|
||||
use nsstring::nsAString;
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::{Cow, Borrow};
|
||||
use std::char::{self, DecodeUtf16};
|
||||
use std::fmt::{self, Write};
|
||||
|
@ -224,6 +225,25 @@ impl Atom {
|
|||
Atom(WeakAtom::new(ptr))
|
||||
}
|
||||
}
|
||||
|
||||
/// Return whether two atoms are ASCII-case-insensitive matches
|
||||
pub fn eq_ignore_ascii_case(&self, other: &Self) -> bool {
|
||||
let a = self.as_slice();
|
||||
let b = other.as_slice();
|
||||
a.len() == b.len() && a.iter().zip(b).all(|(&a16, &b16)| {
|
||||
if a16 <= 0x7F && b16 <= 0x7F {
|
||||
(a16 as u8).eq_ignore_ascii_case(&(b16 as u8))
|
||||
} else {
|
||||
a16 == b16
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// Return whether this atom is an ASCII-case-insensitive match for the given string
|
||||
pub fn eq_str_ignore_ascii_case(&self, other: &str) -> bool {
|
||||
self.chars().map(|r| r.map(|c: char| c.to_ascii_lowercase()))
|
||||
.eq(other.chars().map(|c: char| Ok(c.to_ascii_lowercase())))
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash for Atom {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue