diff options
Diffstat (limited to 'components/style/gecko/selector_parser.rs')
-rw-r--r-- | components/style/gecko/selector_parser.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 6f8ac010e11..c63bc81c95b 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -11,7 +11,7 @@ use crate::invalidation::element::document_state::InvalidationMatchingData; use crate::selector_parser::{Direction, SelectorParser}; use crate::str::starts_with_ignore_ascii_case; use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; -use crate::values::serialize_atom_identifier; +use crate::values::{AtomIdent, AtomString}; use cssparser::{BasicParseError, BasicParseErrorKind, Parser}; use cssparser::{CowRcStr, SourceLocation, ToCss, Token}; use selectors::parser::{SelectorParseErrorKind, ParseErrorRecovery}; @@ -39,7 +39,7 @@ bitflags! { } /// The type used to store the language argument to the `:lang` pseudo-class. -pub type Lang = Atom; +pub type Lang = AtomIdent; macro_rules! pseudo_class_name { ([$(($css:expr, $name:ident, $state:tt, $flags:tt),)*]) => { @@ -77,7 +77,7 @@ impl ToCss for NonTSPseudoClass { $(NonTSPseudoClass::$name => concat!(":", $css),)* NonTSPseudoClass::Lang(ref s) => { dest.write_str(":lang(")?; - serialize_atom_identifier(s, dest)?; + s.to_css(dest)?; return dest.write_char(')'); }, NonTSPseudoClass::MozLocaleDir(ref dir) => { @@ -270,12 +270,10 @@ pub struct SelectorImpl; impl ::selectors::SelectorImpl for SelectorImpl { type ExtraMatchingData = InvalidationMatchingData; - type AttrValue = Atom; - type Identifier = Atom; - type ClassName = Atom; - type PartName = Atom; - type LocalName = Atom; - type NamespacePrefix = Atom; + type AttrValue = AtomString; + type Identifier = AtomIdent; + type LocalName = AtomIdent; + type NamespacePrefix = AtomIdent; type NamespaceUrl = Namespace; type BorrowedNamespaceUrl = WeakNamespace; type BorrowedLocalName = WeakAtom; @@ -386,7 +384,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { let pseudo_class = match_ignore_ascii_case! { &name, "lang" => { let name = parser.expect_ident_or_string()?; - NonTSPseudoClass::Lang(Atom::from(name.as_ref())) + NonTSPseudoClass::Lang(Lang::from(name.as_ref())) }, "-moz-locale-dir" => { NonTSPseudoClass::MozLocaleDir(Direction::parse(parser)?) @@ -475,7 +473,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { self.namespaces.default.clone() } - fn namespace_for_prefix(&self, prefix: &Atom) -> Option<Namespace> { + fn namespace_for_prefix(&self, prefix: &AtomIdent) -> Option<Namespace> { self.namespaces.prefixes.get(prefix).cloned() } } |