ensure all nodes have a intialized layout

This commit is contained in:
Evan Almloff 2022-05-01 21:19:11 -05:00
parent 84db875101
commit e1120bb644

View file

@ -36,9 +36,11 @@ pub(crate) struct StretchLayout {
impl ChildDepState for StretchLayout {
type Ctx = Rc<RefCell<Stretch>>;
type DepState = Self;
// todo: update mask
// use tag to force this to be called when a node is built
const NODE_MASK: NodeMask =
NodeMask::new_with_attrs(AttributeMask::Static(SORTED_LAYOUT_ATTRS)).with_text();
NodeMask::new_with_attrs(AttributeMask::Static(SORTED_LAYOUT_ATTRS))
.with_text()
.with_tag();
/// Setup the layout
fn reduce<'a>(
@ -73,6 +75,7 @@ impl ChildDepState for StretchLayout {
} else {
self.node =
PossiblyUninitalized::Initialized(stretch.new_node(style, &[]).unwrap());
changed = true;
}
} else {
// gather up all the styles from the attribute list
@ -104,6 +107,7 @@ impl ChildDepState for StretchLayout {
self.node = PossiblyUninitalized::Initialized(
stretch.new_node(style, &child_layout).unwrap(),
);
changed = true;
}
}
if self.style != style {