File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,13 @@ pub trait LayoutTreeVisitor<T: LayoutTreeNode> {
199
199
200
200
/// Get the specified child.
201
201
fn child_at ( & self , index : usize ) -> Option < & T > ;
202
+
203
+ /// A notifier that the node has been marked dirty.
204
+ ///
205
+ /// When `LayoutNode::mark_dirty` is called, some related nodes (e.g. the ancestors) are also marked dirty automatically.
206
+ /// These calls tells which nodes are marked dirty.
207
+ fn dirty_marked ( & self ) {
208
+ }
202
209
}
203
210
204
211
/// The styles of a tree node.
@@ -284,7 +291,9 @@ impl<T: LayoutTreeNode> LayoutNode<T> {
284
291
/// Informs the node styles been changed.
285
292
#[ inline]
286
293
pub fn mark_dirty ( & self , node : & T :: TreeVisitor ) -> bool {
287
- self . unit . borrow_mut ( ) . mark_dirty ( node)
294
+ let ret = self . unit . borrow_mut ( ) . mark_dirty ( node) ;
295
+ node. dirty_marked ( ) ;
296
+ ret
288
297
}
289
298
290
299
/// Get the size and position results (border rect).
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ impl<T: LayoutTreeNode> LayoutUnit<T> {
27
27
}
28
28
let mut cur = node_tree_visitor;
29
29
while let Some ( parent) = cur. parent ( ) {
30
+ parent. tree_visitor ( ) . dirty_marked ( ) ;
30
31
if !parent. layout_node ( ) . unit ( ) . mark_self_dirty ( ) {
31
32
break ;
32
33
}
You can’t perform that action at this time.
0 commit comments