pub trait MatchMethods: TElement {
    fn layout_parent(&self) -> Self { ... }
    fn finish_restyle(
        context: &mut StyleContext<'_, Self>,
        data: &mut ElementData,
        new_styles: ResolvedElementStyles,
        important_rules_changed: bool
    ) -> ChildCascadeRequirement { ... } fn apply_selector_flags(
        map: &mut SelectorFlagsMap<Self>,
        element: &Self,
        flags: ElementSelectorFlags
    ) { ... } fn replace_rules(
        replacements: RestyleHint,
        context: &mut StyleContext<'_, Self>,
        cascade_inputs: &mut ElementCascadeInputs
    ) -> bool { ... } fn compute_style_difference(
        old_values: &ComputedValues,
        new_values: &ComputedValues,
        pseudo: Option<&PseudoElement>
    ) -> StyleDifference { ... } }
Expand description

The public API that elements expose for selector matching.

Provided methods

Returns the closest parent element that doesn’t have a display: contents style (and thus generates a box).

This is needed to correctly handle blockification of flex and grid items.

Returns itself if the element has no parent. In practice this doesn’t happen because the root element is blockified per spec, but it could happen if we decide to not blockify for roots of disconnected subtrees, which is a kind of dubious behavior.

Updates the styles with the new ones, diffs them, and stores the restyle damage.

Applies selector flags to an element, deferring mutations of the parent until after the traversal.

TODO(emilio): This is somewhat inefficient, because it doesn’t take advantage of us knowing that the traversal is sequential.

Updates the rule nodes without re-running selector matching, using just the rule tree.

Returns true if an !important rule was replaced.

Given the old and new style of this element, and whether it’s a pseudo-element, compute the restyle damage used to determine which kind of layout or painting operations we’ll need.