Skip to main content

ChangeAccumulator

Struct ChangeAccumulator 

Source
pub struct ChangeAccumulator {
    pub per_node: BTreeMap<NodeId, NodeChangeReport>,
    pub max_scope: RelayoutScope,
    pub mounted_nodes: Vec<NodeId>,
    pub unmounted_nodes: Vec<NodeId>,
}
Expand description

Unified change report that merges information from all three change paths:

  1. DOM reconciliation (compute_node_changes after reconcile_dom)
  2. CSS restyle (restyle_on_state_change for hover/focus/active)
  3. Runtime edits (words_changed, css_properties_changed, images_changed)

This is the single source of truth for “what work needs to happen this frame”.

Fields§

§per_node: BTreeMap<NodeId, NodeChangeReport>

Per-node change info. Key is the new-DOM NodeId.

§max_scope: RelayoutScope

Maximum RelayoutScope across all changed nodes. Quick check: if this is None, we can skip layout entirely.

§mounted_nodes: Vec<NodeId>

Nodes that are newly mounted (no old counterpart). These always need full layout.

§unmounted_nodes: Vec<NodeId>

Nodes that were unmounted (no new counterpart). Used for cleanup (remove from scroll/focus/cursor managers).

Implementations§

Source§

impl ChangeAccumulator

Source

pub fn new() -> Self

Source

pub fn is_empty(&self) -> bool

Returns true if no changes were detected at all.

Source

pub fn needs_layout(&self) -> bool

Returns true if layout work is needed (any node has scope > None).

Source

pub fn needs_paint_only(&self) -> bool

Returns true if only paint work is needed (no layout).

Source

pub fn is_visually_unchanged(&self) -> bool

Returns true if only non-visual changes occurred (callbacks, dataset, a11y).

Source

pub fn add_dom_change( &mut self, new_node_id: NodeId, change_set: NodeChangeSet, relayout_scope: RelayoutScope, text_change: Option<TextChange>, changed_css_properties: Vec<CssPropertyType>, )

Add a node change from DOM reconciliation (Path A).

Source

pub fn add_text_change( &mut self, node_id: NodeId, old_text: String, new_text: String, )

Add a text change (from runtime edit or DOM reconciliation).

Source

pub fn add_css_change( &mut self, node_id: NodeId, prop_type: CssPropertyType, scope: RelayoutScope, )

Add a CSS property change (from runtime edit or restyle).

Source

pub fn add_image_change(&mut self, node_id: NodeId, scope: RelayoutScope)

Add an image change (from runtime edit or DOM reconciliation).

Source

pub fn add_mount(&mut self, node_id: NodeId)

Add a mounted (new) node.

Source

pub fn add_unmount(&mut self, node_id: NodeId)

Add an unmounted (removed) node.

Source

pub fn merge_restyle_result(&mut self, restyle: &RestyleResult)

Merge a RestyleResult (from restyle_on_state_change()) into this accumulator.

This is the bridge between Path B (restyle) and the unified change pipeline. Each ChangedCssProperty is classified via relayout_scope() to determine whether it affects layout or only paint.

Source

pub fn merge_extended_diff( &mut self, extended: &ExtendedDiffResult, old_node_data: &[NodeData], new_node_data: &[NodeData], )

Populate this accumulator from an ExtendedDiffResult + the old/new DOM data.

This converts per-node NodeChangeSet flags into full NodeChangeReports with RelayoutScope classification.

Trait Implementations§

Source§

impl Clone for ChangeAccumulator

Source§

fn clone(&self) -> ChangeAccumulator

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChangeAccumulator

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ChangeAccumulator

Source§

fn default() -> ChangeAccumulator

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.