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

The public API that elements expose for selector matching.

Provided Methods§

source

fn layout_parent(&self) -> Self

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.

source

fn finish_restyle( &self, context: &mut StyleContext<'_, Self>, data: &mut ElementData, new_styles: ResolvedElementStyles, important_rules_changed: bool ) -> ChildRestyleRequirement

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

source

fn replace_rules( &self, replacements: RestyleHint, context: &mut StyleContext<'_, Self>, cascade_inputs: &mut ElementCascadeInputs ) -> bool

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

Returns true if an !important rule was replaced.

source

fn compute_style_difference( &self, old_values: &ComputedValues, new_values: &ComputedValues, pseudo: Option<&PseudoElement> ) -> StyleDifference

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.

Implementors§