Trait style::matching::MatchMethods
[−]
[src]
pub trait MatchMethods: TElement { fn layout_parent(&self) -> Self { ... } fn finish_restyle(
&self,
context: &mut StyleContext<Self>,
data: &mut ElementData,
new_styles: ResolvedElementStyles,
important_rules_changed: bool
) -> ChildCascadeRequirement { ... } fn apply_selector_flags(
&self,
map: &mut SelectorFlagsMap<Self>,
element: &Self,
flags: ElementSelectorFlags
) { ... } fn replace_rules(
&self,
replacements: RestyleHint,
context: &mut StyleContext<Self>,
cascade_inputs: &mut ElementCascadeInputs
) -> bool { ... } fn replace_rules_internal(
&self,
replacements: RestyleHint,
context: &mut StyleContext<Self>,
cascade_visited: CascadeVisitedMode,
cascade_inputs: &mut ElementCascadeInputs
) -> bool { ... } fn compute_style_difference(
&self,
old_values: &ComputedValues,
new_values: &ComputedValues,
pseudo: Option<&PseudoElement>
) -> StyleDifference { ... } }
The public API that elements expose for selector matching.
Provided Methods
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 beahavior.
fn finish_restyle(
&self,
context: &mut StyleContext<Self>,
data: &mut ElementData,
new_styles: ResolvedElementStyles,
important_rules_changed: bool
) -> ChildCascadeRequirement
&self,
context: &mut StyleContext<Self>,
data: &mut ElementData,
new_styles: ResolvedElementStyles,
important_rules_changed: bool
) -> ChildCascadeRequirement
Updates the styles with the new ones, diffs them, and stores the restyle damage.
fn apply_selector_flags(
&self,
map: &mut SelectorFlagsMap<Self>,
element: &Self,
flags: ElementSelectorFlags
)
&self,
map: &mut SelectorFlagsMap<Self>,
element: &Self,
flags: ElementSelectorFlags
)
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.
fn replace_rules(
&self,
replacements: RestyleHint,
context: &mut StyleContext<Self>,
cascade_inputs: &mut ElementCascadeInputs
) -> bool
&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.
fn replace_rules_internal(
&self,
replacements: RestyleHint,
context: &mut StyleContext<Self>,
cascade_visited: CascadeVisitedMode,
cascade_inputs: &mut ElementCascadeInputs
) -> bool
&self,
replacements: RestyleHint,
context: &mut StyleContext<Self>,
cascade_visited: CascadeVisitedMode,
cascade_inputs: &mut ElementCascadeInputs
) -> bool
Updates the rule nodes without re-running selector matching, using just the rule tree, for a specific visited mode.
Returns true if an !important rule was replaced.
fn compute_style_difference(
&self,
old_values: &ComputedValues,
new_values: &ComputedValues,
pseudo: Option<&PseudoElement>
) -> StyleDifference
&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
impl<E: TElement> MatchMethods for E