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> {
199199
200200 /// Get the specified child.
201201 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+ }
202209}
203210
204211/// The styles of a tree node.
@@ -284,7 +291,9 @@ impl<T: LayoutTreeNode> LayoutNode<T> {
284291 /// Informs the node styles been changed.
285292 #[ inline]
286293 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
288297 }
289298
290299 /// 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> {
2727 }
2828 let mut cur = node_tree_visitor;
2929 while let Some ( parent) = cur. parent ( ) {
30+ parent. tree_visitor ( ) . dirty_marked ( ) ;
3031 if !parent. layout_node ( ) . unit ( ) . mark_self_dirty ( ) {
3132 break ;
3233 }
You can’t perform that action at this time.
0 commit comments