pub trait InvalidationProcessor<'a, E>where
    E: TElement,{
    // Required methods
    fn check_outer_dependency(
        &mut self,
        dependency: &Dependency,
        element: E
    ) -> bool;
    fn matching_context(&mut self) -> &mut MatchingContext<'a, E::Impl>;
    fn collect_invalidations(
        &mut self,
        element: E,
        self_invalidations: &mut InvalidationVector<'a>,
        descendant_invalidations: &mut DescendantInvalidationLists<'a>,
        sibling_invalidations: &mut InvalidationVector<'a>
    ) -> bool;
    fn should_process_descendants(&mut self, element: E) -> bool;
    fn recursion_limit_exceeded(&mut self, element: E);
    fn invalidated_self(&mut self, element: E);
    fn invalidated_sibling(&mut self, sibling: E, of: E);
    fn invalidated_descendants(&mut self, element: E, child: E);

    // Provided methods
    fn invalidates_on_pseudo_element(&self) -> bool { ... }
    fn light_tree_only(&self) -> bool { ... }
}
Expand description

A trait to abstract the collection of invalidations for a given pass.

Required Methods§

source

fn check_outer_dependency( &mut self, dependency: &Dependency, element: E ) -> bool

When a dependency from a :where or :is selector matches, it may still be the case that we don’t need to invalidate the full style. Consider the case of:

div .foo:where(.bar *, .baz) .qux

We can get to the * part after a .bar class change, but you only need to restyle the element if it also matches .foo.

Similarly, you only need to restyle .baz if the whole result of matching the selector changes.

This function is called to check the result of matching the “outer” dependency that we generate for the parent of the :where selector, that is, in the case above it should match div .foo:where(.bar *, .baz).

Returning true unconditionally here is over-optimistic and may over-invalidate.

source

fn matching_context(&mut self) -> &mut MatchingContext<'a, E::Impl>

The matching context that should be used to process invalidations.

source

fn collect_invalidations( &mut self, element: E, self_invalidations: &mut InvalidationVector<'a>, descendant_invalidations: &mut DescendantInvalidationLists<'a>, sibling_invalidations: &mut InvalidationVector<'a> ) -> bool

Collect invalidations for a given element’s descendants and siblings.

Returns whether the element itself was invalidated.

source

fn should_process_descendants(&mut self, element: E) -> bool

Returns whether the invalidation process should process the descendants of the given element.

source

fn recursion_limit_exceeded(&mut self, element: E)

Executes an arbitrary action when the recursion limit is exceded (if any).

source

fn invalidated_self(&mut self, element: E)

Executes an action when Self is invalidated.

source

fn invalidated_sibling(&mut self, sibling: E, of: E)

Executes an action when sibling is invalidated as a sibling of of.

source

fn invalidated_descendants(&mut self, element: E, child: E)

Executes an action when any descendant of Self is invalidated.

Provided Methods§

source

fn invalidates_on_pseudo_element(&self) -> bool

Whether an invalidation that contains only a pseudo-element selector like ::before or ::after triggers invalidation of the element that would originate it.

source

fn light_tree_only(&self) -> bool

Whether the invalidation processor only cares about light-tree descendants of a given element, that is, doesn’t invalidate pseudo-elements, NAC, shadow dom…

Implementors§

source§

impl<'a, 'b: 'a, E> InvalidationProcessor<'a, E> for StateAndAttrInvalidationProcessor<'a, 'b, E>where E: TElement + 'a,

source§

impl<'a, E, I> InvalidationProcessor<'a, E> for DocumentStateInvalidationProcessor<'a, E, I>where E: TElement, I: Iterator<Item = &'a CascadeData>,

source§

impl<'a, E, Q> InvalidationProcessor<'a, E> for QuerySelectorProcessor<'a, E, Q>where E: TElement + 'a, Q: SelectorQuery<E>, Q::Output: 'a,