pub struct StyleRecalcChange { /* private fields */ }Expand description
Tracks what kind of style recalculation is needed.
This is passed down through the style tree during recalc, allowing parent changes to inform child recalculation decisions.
§Examples
// When parent's font-size changes:
let change = StyleRecalcChange::new(Propagate::InheritedOnly);
// When a class is applied:
let change = StyleRecalcChange::new(Propagate::RecalcChildren)
.with_flags(RecalcFlags::CLASS_CHANGED);
// When dark mode toggles:
let change = StyleRecalcChange::new(Propagate::RecalcDescendants)
.with_flags(RecalcFlags::DARK_MODE_CHANGED);Implementations§
Source§impl StyleRecalcChange
impl StyleRecalcChange
Sourcepub fn new(propagate: Propagate) -> Self
pub fn new(propagate: Propagate) -> Self
Create a new change with the specified propagation level.
Sourcepub fn with_flags(self, flags: RecalcFlags) -> Self
pub fn with_flags(self, flags: RecalcFlags) -> Self
Add flags to this change.
Sourcepub fn flags(&self) -> RecalcFlags
pub fn flags(&self) -> RecalcFlags
Returns the flags.
Sourcepub fn for_children(&self) -> Self
pub fn for_children(&self) -> Self
Compute the change for processing children.
When moving from parent to child, we adjust the propagation level:
- RecalcDescendants stays the same (all descendants need recalc)
- RecalcChildren becomes None (only immediate children were marked)
- InheritedOnly stays the same (inherited props propagate)
- Other levels become None
Sourcepub fn combine(&self, other: &Self) -> Self
pub fn combine(&self, other: &Self) -> Self
Combine two changes, taking the more intensive propagation.
When multiple sources contribute to a style change (e.g., both a class change and a hover state change), we need the union of their requirements.
Sourcepub fn ensure_at_least(&self, propagate: Propagate) -> Self
pub fn ensure_at_least(&self, propagate: Propagate) -> Self
Upgrade to at least the given propagation level.
Sourcepub fn force_recalc_descendants(&self) -> Self
pub fn force_recalc_descendants(&self) -> Self
Force full descendant recalculation.
Sourcepub fn force_recalc_children(&self) -> Self
pub fn force_recalc_children(&self) -> Self
Force children to recalculate.
Sourcepub fn force_reattach(&self) -> Self
pub fn force_reattach(&self) -> Self
Mark as reattach needed.
Sourcepub fn should_recalc(&self, view_is_dirty: bool) -> bool
pub fn should_recalc(&self, view_is_dirty: bool) -> bool
Should this view’s style be recalculated?
Returns true if either:
- The view itself is marked dirty
- The parent change requires recalculating children
Sourcepub fn can_use_inherited_fast_path(&self, view_has_selectors: bool) -> bool
pub fn can_use_inherited_fast_path(&self, view_has_selectors: bool) -> bool
Can we use the “inherited only” fast path?
Returns true if we only need to propagate inherited properties and can skip full selector resolution.
Sourcepub fn needs_reattach(&self) -> bool
pub fn needs_reattach(&self) -> bool
Check if reattach is needed.
Sourcepub fn font_units_may_have_changed(&self) -> bool
pub fn font_units_may_have_changed(&self) -> bool
Check if font-relative units may have changed.
Trait Implementations§
Source§impl Clone for StyleRecalcChange
impl Clone for StyleRecalcChange
Source§fn clone(&self) -> StyleRecalcChange
fn clone(&self) -> StyleRecalcChange
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StyleRecalcChange
impl Debug for StyleRecalcChange
Source§impl Default for StyleRecalcChange
impl Default for StyleRecalcChange
Source§fn default() -> StyleRecalcChange
fn default() -> StyleRecalcChange
impl Copy for StyleRecalcChange
Auto Trait Implementations§
impl Freeze for StyleRecalcChange
impl RefUnwindSafe for StyleRecalcChange
impl Send for StyleRecalcChange
impl Sync for StyleRecalcChange
impl Unpin for StyleRecalcChange
impl UnwindSafe for StyleRecalcChange
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more