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:
- DOM reconciliation (
compute_node_changesafterreconcile_dom) - CSS restyle (
restyle_on_state_changefor hover/focus/active) - 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: RelayoutScopeMaximum 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
impl ChangeAccumulator
pub fn new() -> Self
Sourcepub fn needs_layout(&self) -> bool
pub fn needs_layout(&self) -> bool
Returns true if layout work is needed (any node has scope > None).
Sourcepub fn needs_paint_only(&self) -> bool
pub fn needs_paint_only(&self) -> bool
Returns true if only paint work is needed (no layout).
Sourcepub fn is_visually_unchanged(&self) -> bool
pub fn is_visually_unchanged(&self) -> bool
Returns true if only non-visual changes occurred (callbacks, dataset, a11y).
Sourcepub 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>,
)
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).
Sourcepub fn add_text_change(
&mut self,
node_id: NodeId,
old_text: String,
new_text: String,
)
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).
Sourcepub fn add_css_change(
&mut self,
node_id: NodeId,
prop_type: CssPropertyType,
scope: RelayoutScope,
)
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).
Sourcepub fn add_image_change(&mut self, node_id: NodeId, scope: RelayoutScope)
pub fn add_image_change(&mut self, node_id: NodeId, scope: RelayoutScope)
Add an image change (from runtime edit or DOM reconciliation).
Sourcepub fn add_unmount(&mut self, node_id: NodeId)
pub fn add_unmount(&mut self, node_id: NodeId)
Add an unmounted (removed) node.
Sourcepub fn merge_restyle_result(&mut self, restyle: &RestyleResult)
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.
Sourcepub fn merge_extended_diff(
&mut self,
extended: &ExtendedDiffResult,
old_node_data: &[NodeData],
new_node_data: &[NodeData],
)
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
impl Clone for ChangeAccumulator
Source§fn clone(&self) -> ChangeAccumulator
fn clone(&self) -> ChangeAccumulator
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more