pub struct StylesheetInvalidationSet {
    classes: MaybeCaseInsensitiveHashMap<Atom, InvalidationKind>,
    ids: MaybeCaseInsensitiveHashMap<Atom, InvalidationKind>,
    local_names: PrecomputedHashMap<LocalName, InvalidationKind>,
    fully_invalid: bool,
}
Expand description

A set of invalidations due to stylesheet additions.

TODO(emilio): We might be able to do the same analysis for media query changes too (or even selector changes?).

Fields§

§classes: MaybeCaseInsensitiveHashMap<Atom, InvalidationKind>§ids: MaybeCaseInsensitiveHashMap<Atom, InvalidationKind>§local_names: PrecomputedHashMap<LocalName, InvalidationKind>§fully_invalid: bool

Implementations§

source§

impl StylesheetInvalidationSet

source

pub fn new() -> Self

Create an empty StylesheetInvalidationSet.

source

pub fn invalidate_fully(&mut self)

Mark the DOM tree styles’ as fully invalid.

source

fn shrink_if_needed(&mut self)

source

pub fn collect_invalidations_for<S>( &mut self, device: &Device, stylesheet: &S, guard: &SharedRwLockReadGuard<'_> )

Analyze the given stylesheet, and collect invalidations from their rules, in order to avoid doing a full restyle when we style the document next time.

source

pub fn flush<E>( &mut self, document_element: Option<E>, snapshots: Option<&SnapshotMap> ) -> bool
where E: TElement,

Clears the invalidation set, invalidating elements as needed if document_element is provided.

Returns true if any invalidations ocurred.

source

pub fn is_empty(&self) -> bool

Returns whether there’s no invalidation to process.

source

fn invalidation_kind_for<E>( &self, element: E, snapshot: Option<&Snapshot>, quirks_mode: QuirksMode ) -> InvalidationKind
where E: TElement,

source

pub fn clear(&mut self)

Clears the invalidation set without processing.

source

fn process_invalidations<E>( &self, element: E, snapshots: Option<&SnapshotMap> ) -> bool
where E: TElement,

source

fn process_invalidations_in_subtree<E>( &self, element: E, snapshots: Option<&SnapshotMap>, quirks_mode: QuirksMode ) -> bool
where E: TElement,

Process style invalidations in a given subtree. This traverses the subtree looking for elements that match the invalidations in our hash map members.

Returns whether it invalidated at least one element’s style.

source

fn scan_component( component: &Component<SelectorImpl>, invalidation: &mut Option<Invalidation> )

TODO(emilio): Reuse the bucket stuff from selectormap? That handles :is() / :where() etc.

source

fn collect_invalidations( &mut self, selector: &Selector<SelectorImpl>, quirks_mode: QuirksMode )

Collect invalidations for a given selector.

We look at the outermost local name, class, or ID selector to the left of an ancestor combinator, in order to restyle only a given subtree.

If the selector has no ancestor combinator, then we do the same for the only sequence it has, but record it as an element invalidation instead of a subtree invalidation.

We prefer IDs to classs, and classes to local names, on the basis that the former should be more specific than the latter. We also prefer to generate subtree invalidations for the outermost part of the selector, to reduce the amount of traversal we need to do when flushing invalidations.

source

fn insert_invalidation( &mut self, invalidation: Invalidation, kind: InvalidationKind, quirks_mode: QuirksMode ) -> bool

source

pub fn rule_changed<S>( &mut self, stylesheet: &S, rule: &CssRule, guard: &SharedRwLockReadGuard<'_>, device: &Device, quirks_mode: QuirksMode, change_kind: RuleChangeKind )

Collects invalidations for a given CSS rule, if not fully invalid already.

TODO(emilio): we can’t check whether the rule is inside a non-effective subtree, we potentially could do that.

source

fn collect_invalidations_for_rule( &mut self, rule: &CssRule, guard: &SharedRwLockReadGuard<'_>, device: &Device, quirks_mode: QuirksMode, is_generic_change: bool )

Collects invalidations for a given CSS rule.

Trait Implementations§

source§

impl Debug for StylesheetInvalidationSet

source§

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

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

impl Default for StylesheetInvalidationSet

source§

fn default() -> StylesheetInvalidationSet

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

impl MallocSizeOf for StylesheetInvalidationSet

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.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> MaybeBoxed<Box<T>> for T

source§

fn maybe_boxed(self) -> Box<T>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T