Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion float-pigment-layout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ pub trait LayoutTreeVisitor<T: LayoutTreeNode> {

/// Get the specified child.
fn child_at(&self, index: usize) -> Option<&T>;

/// A notifier that the node has been marked dirty.
///
/// When `LayoutNode::mark_dirty` is called, some related nodes (e.g. the ancestors) are also marked dirty automatically.
/// These calls tells which nodes are marked dirty.
fn dirty_marked(&self) {
}
}

/// The styles of a tree node.
Expand Down Expand Up @@ -284,7 +291,9 @@ impl<T: LayoutTreeNode> LayoutNode<T> {
/// Informs the node styles been changed.
#[inline]
pub fn mark_dirty(&self, node: &T::TreeVisitor) -> bool {
self.unit.borrow_mut().mark_dirty(node)
let ret = self.unit.borrow_mut().mark_dirty(node);
node.dirty_marked();
ret
}

/// Get the size and position results (border rect).
Expand Down
1 change: 1 addition & 0 deletions float-pigment-layout/src/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ impl<T: LayoutTreeNode> LayoutUnit<T> {
}
let mut cur = node_tree_visitor;
while let Some(parent) = cur.parent() {
parent.tree_visitor().dirty_marked();
if !parent.layout_node().unit().mark_self_dirty() {
break;
}
Expand Down