pub type TSStateDependencyMap = SelectorMap<TSStateDependency>;
Expand description

Dependency mapping for tree-structural pseudo-class states.

Aliased Type§

struct TSStateDependencyMap {
    pub root: SmallVec<[TSStateDependency; 1]>,
    pub id_hash: MaybeCaseInsensitiveHashMap<Atom<AtomStaticSet>, SmallVec<[TSStateDependency; 1]>>,
    pub class_hash: MaybeCaseInsensitiveHashMap<Atom<AtomStaticSet>, SmallVec<[TSStateDependency; 1]>>,
    pub local_name_hash: HashMap<GenericAtomIdent<LocalNameStaticSet>, SmallVec<[TSStateDependency; 1]>, BuildHasherDefault<PrecomputedHasher>>,
    pub attribute_hash: HashMap<GenericAtomIdent<LocalNameStaticSet>, SmallVec<[TSStateDependency; 1]>, BuildHasherDefault<PrecomputedHasher>>,
    pub namespace_hash: HashMap<GenericAtomIdent<NamespaceStaticSet>, SmallVec<[TSStateDependency; 1]>, BuildHasherDefault<PrecomputedHasher>>,
    pub rare_pseudo_classes: SmallVec<[TSStateDependency; 1]>,
    pub other: SmallVec<[TSStateDependency; 1]>,
    pub count: usize,
}

Fields§

§root: SmallVec<[TSStateDependency; 1]>

Rules that have :root selectors.

§id_hash: MaybeCaseInsensitiveHashMap<Atom<AtomStaticSet>, SmallVec<[TSStateDependency; 1]>>

A hash from an ID to rules which contain that ID selector.

§class_hash: MaybeCaseInsensitiveHashMap<Atom<AtomStaticSet>, SmallVec<[TSStateDependency; 1]>>

A hash from a class name to rules which contain that class selector.

§local_name_hash: HashMap<GenericAtomIdent<LocalNameStaticSet>, SmallVec<[TSStateDependency; 1]>, BuildHasherDefault<PrecomputedHasher>>

A hash from local name to rules which contain that local name selector.

§attribute_hash: HashMap<GenericAtomIdent<LocalNameStaticSet>, SmallVec<[TSStateDependency; 1]>, BuildHasherDefault<PrecomputedHasher>>

A hash from attributes to rules which contain that attribute selector.

§namespace_hash: HashMap<GenericAtomIdent<NamespaceStaticSet>, SmallVec<[TSStateDependency; 1]>, BuildHasherDefault<PrecomputedHasher>>

A hash from namespace to rules which contain that namespace selector.

§rare_pseudo_classes: SmallVec<[TSStateDependency; 1]>

Rules for pseudo-states that are rare but have global selectors.

§other: SmallVec<[TSStateDependency; 1]>

All other rules.

§count: usize

The number of entries in this map.

Implementations§

source§

impl<T> SelectorMap<T>

source

pub fn new() -> Self

Trivially constructs an empty SelectorMap.

source

pub fn shrink_if_needed(&mut self)

Shrink the capacity of the map if needed.

source

pub fn clear(&mut self)

Clears the hashmap retaining storage.

source

pub fn is_empty(&self) -> bool

Returns whether there are any entries in the map.

source

pub fn len(&self) -> usize

Returns the number of entries.

source§

impl<T: SelectorMapEntry> SelectorMap<T>

source

pub fn insert( &mut self, entry: T, quirks_mode: QuirksMode ) -> Result<(), AllocErr>

Inserts an entry into the correct bucket(s).

source

pub fn lookup<'a, E, F>( &'a self, element: E, quirks_mode: QuirksMode, relevant_attributes: Option<&mut RelevantAttributes>, f: F ) -> boolwhere E: TElement, F: FnMut(&'a T) -> bool,

Looks up entries by id, class, local name, namespace, and other (in order).

Each entry is passed to the callback, which returns true to continue iterating entries, or false to terminate the lookup.

Returns false if the callback ever returns false.

FIXME(bholley) This overlaps with SelectorMap::get_all_matching_rules, but that function is extremely hot and I’d rather not rearrange it.

source

fn lookup_with_state<'a, E, F>( &'a self, element: E, element_state: ElementState, quirks_mode: QuirksMode, relevant_attributes: Option<&mut RelevantAttributes>, f: F ) -> boolwhere E: TElement, F: FnMut(&'a T) -> bool,

source

pub fn lookup_with_additional<'a, E, F>( &'a self, element: E, quirks_mode: QuirksMode, additional_id: Option<&WeakAtom>, additional_classes: &[Atom], additional_states: ElementState, f: F ) -> boolwhere E: TElement, F: FnMut(&'a T) -> bool,

Performs a normal lookup, and also looks up entries for the passed-in id and classes.

Each entry is passed to the callback, which returns true to continue iterating entries, or false to terminate the lookup.

Returns false if the callback ever returns false.

Trait Implementations§

source§

impl<T: Clone + 'static> Clone for SelectorMap<T>

source§

fn clone(&self) -> SelectorMap<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug + 'static> Debug for SelectorMap<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: 'static> Default for SelectorMap<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T> MallocSizeOf for SelectorMap<T>where T: MallocSizeOf + 'static,

source§

fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself.