Struct style::invalidation::element::invalidation_map::InvalidationMap
[−]
[src]
pub struct InvalidationMap { pub class_to_selector: MaybeCaseInsensitiveHashMap<Atom, SmallVec<[Dependency; 1]>>, pub id_to_selector: MaybeCaseInsensitiveHashMap<Atom, SmallVec<[Dependency; 1]>>, pub state_affecting_selectors: SelectorMap<StateDependency>, pub other_attribute_affecting_selectors: SelectorMap<Dependency>, pub has_class_attribute_selectors: bool, pub has_id_attribute_selectors: bool, }
A map where we store invalidations.
This is slightly different to a SelectorMap, in the sense of that the same selector may appear multiple times.
In particular, we want to lookup as few things as possible to get the fewer selectors the better, so this looks up by id, class, or looks at the list of state/other attribute affecting selectors.
Fields
class_to_selector: MaybeCaseInsensitiveHashMap<Atom, SmallVec<[Dependency; 1]>>
A map from a given class name to all the selectors with that class selector.
id_to_selector: MaybeCaseInsensitiveHashMap<Atom, SmallVec<[Dependency; 1]>>
A map from a given id to all the selectors with that ID in the stylesheets currently applying to the document.
state_affecting_selectors: SelectorMap<StateDependency>
A map of all the state dependencies.
other_attribute_affecting_selectors: SelectorMap<Dependency>
A map of other attribute affecting selectors.
has_class_attribute_selectors: bool
Whether there are attribute rules of the form [class~="foo"]
that may
match. In that case, we need to look at
other_attribute_affecting_selectors
too even if only the class
has
changed.
has_id_attribute_selectors: bool
Whether there are attribute rules of the form [id|="foo"]
that may
match. In that case, we need to look at
other_attribute_affecting_selectors
too even if only the id
has
changed.
Methods
impl InvalidationMap
[src]
pub fn new() -> Self
[src]
Creates an empty InvalidationMap
.
pub fn len(&self) -> usize
[src]
Returns the number of dependencies stored in the invalidation map.
pub fn note_selector(
&mut self,
selector: &Selector<SelectorImpl>,
quirks_mode: QuirksMode
) -> Result<(), FailedAllocationError>
[src]
&mut self,
selector: &Selector<SelectorImpl>,
quirks_mode: QuirksMode
) -> Result<(), FailedAllocationError>
Adds a selector to this InvalidationMap
. Returns Err(..) to
signify OOM.
pub fn clear(&mut self)
[src]
Clears this map, leaving it empty.
Trait Implementations
impl Debug for InvalidationMap
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl MallocSizeOf for InvalidationMap
[src]
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
[src]
Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. Read more