pub trait InvalidationProcessor<'a, 'b, E>
where E: TElement,
{ // Required methods fn check_outer_dependency( &mut self, dependency: &Dependency, element: E, ) -> bool; fn matching_context(&mut self) -> &mut MatchingContext<'b, E::Impl>; fn sibling_traversal_map(&self) -> &SiblingTraversalMap<E>; 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 { ... } fn found_relative_selector_invalidation( &mut self, _element: E, _kind: RelativeDependencyInvalidationKind, _relative_dependency: &'a Dependency, ) { ... } }
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<'b, E::Impl>

The matching context that should be used to process invalidations.

source

fn sibling_traversal_map(&self) -> &SiblingTraversalMap<E>

The traversal map 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…

source

fn found_relative_selector_invalidation( &mut self, _element: E, _kind: RelativeDependencyInvalidationKind, _relative_dependency: &'a Dependency, )

Executes an action when an element in a relative selector is reached. Lets the dependency to be borrowed for further processing out of the invalidation traversal.

Implementors§

source§

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

source§

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

source§

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

source§

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

source§

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