ensure all nodes have a intialized layout

This commit is contained in:
Evan Almloff committed 2022-05-01 21:19:11 -05:00
1 parent 84db875101
commit e1120bb644
1 file changed
+6 -2
+6 -2
View File
@@ -36,9 +36,11 @@ pub(crate) struct StretchLayout {
impl ChildDepState for StretchLayout { impl ChildDepState for StretchLayout {
type Ctx = Rc<RefCell<Stretch>>; type Ctx = Rc<RefCell<Stretch>>;
type DepState = Self; type DepState = Self;
// todo: update mask // use tag to force this to be called when a node is built
const NODE_MASK: NodeMask = 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 /// Setup the layout
fn reduce<'a>( fn reduce<'a>(
@@ -73,6 +75,7 @@ impl ChildDepState for StretchLayout {
} else { } else {
self.node = self.node =
PossiblyUninitalized::Initialized(stretch.new_node(style, &[]).unwrap()); PossiblyUninitalized::Initialized(stretch.new_node(style, &[]).unwrap());
changed = true;
} }
} else { } else {
// gather up all the styles from the attribute list // gather up all the styles from the attribute list
@@ -104,6 +107,7 @@ impl ChildDepState for StretchLayout {
self.node = PossiblyUninitalized::Initialized( self.node = PossiblyUninitalized::Initialized(
stretch.new_node(style, &child_layout).unwrap(), stretch.new_node(style, &child_layout).unwrap(),
); );
changed = true;
} }
} }
if self.style != style { if self.style != style {