Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

TL13a: under RAEA_FINE_RESTYLE the snapshot names the attribute that changed. blitz-dom's snapshot listed as changed only the attributes the element had when it was taken, so an attribute being added (data-state appearing) or a second one changed before the flush was never among them, and the trial's invalidation, which reads only what changed, left [data-state=open]'s elements unstyled: ui-parity 266/271 with the trial on against 269/271 off (p14-forms/select-keys, p18-dom/lib-basecoat, p18-dom/lib-radix). The mutator adds each set or cleared attribute's name to the snapshot under the trial; unset, nothing changes

shinyobjectz2b9f1ad862d9
diff --git a/vendor/blitz-dom/src/document.rs b/vendor/blitz-dom/src/document.rs
index 93ac21ba..ece36e85 100644
--- a/vendor/blitz-dom/src/document.rs
+++ b/vendor/blitz-dom/src/document.rs
@@ -1665,6 +1665,23 @@ impl BaseDocument {
}
}
+ /// raea: `name`, about to be set or cleared on `node_id`, among its snapshot's changed attributes. The snapshot
+ /// lists the attributes the element had when it was taken, so an attribute being added (`data-state` appearing)
+ /// or a second one changed before the flush was missing, and an invalidation that reads only what the snapshot
+ /// says changed (RAEA_FINE_RESTYLE) never restyled `[data-state=open]`'s elements (ui-parity's radix, basecoat and
+ /// select-keys cases).
+ pub(crate) fn snapshot_changed_attr(&mut self, node_id: NodeId, name: &crate::QualName) {
+ let Some(node) = self.nodes.get(node_id) else { return };
+ let id = TNode::opaque(&node);
+ if let Some(s) = self.snapshots.get_mut(&id) {
+ let name = GenericAtomIdent(name.local.clone());
+ if !s.changed_attrs.contains(&name) {
+ s.changed_attrs.push(name);
+ }
+ s.other_attributes_changed = true;
+ }
+ }
+
/// Returns whether any style rule depends on any of the given [`ElementState`] bits.
/// If not, changing those bits cannot affect styling and snapshotting can be skipped.
pub fn style_depends_on_state(&self, state: ElementState) -> bool {
diff --git a/vendor/blitz-dom/src/mutator.rs b/vendor/blitz-dom/src/mutator.rs
index edd9811f..19e90aff 100644
--- a/vendor/blitz-dom/src/mutator.rs
+++ b/vendor/blitz-dom/src/mutator.rs
@@ -280,6 +280,9 @@ impl DocumentMutator<'_> {
self.doc.snapshot_node(node_id);
let fine = fine_restyle();
+ if fine {
+ self.doc.snapshot_changed_attr(node_id, &name);
+ }
let node = &mut self.doc.nodes[node_id];
if let Some(mut data) = node.try_stylo_element_data_mut().and_then(|s| s.get_mut()) {
if !fine {
@@ -417,6 +420,9 @@ impl DocumentMutator<'_> {
self.doc.snapshot_node(node_id);
let fine = fine_restyle();
+ if fine {
+ self.doc.snapshot_changed_attr(node_id, &name);
+ }
let node = &mut self.doc.nodes[node_id];
if let Some(mut data) = node.try_stylo_element_data_mut().and_then(|s| s.get_mut()) {