File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,7 @@ impl Node {
275275 }
276276 self . node_type . replace ( node_type) ;
277277 }
278- if node_type == NodeType :: Text {
278+ if node_type == NodeType :: Text && node_type != prev_type {
279279 * self . measure_cache . get ( ) = Some ( Box :: new ( LruCache :: new ( CACHE_SIZE ) ) ) ;
280280 * self . baseline_cache . get ( ) = Some ( Box :: new ( LruCache :: new ( CACHE_SIZE ) ) ) ;
281281 }
@@ -548,16 +548,21 @@ impl ChildOperation for Node {
548548 if self . children_len ( ) == 0 {
549549 return ;
550550 }
551- if let Some ( ( idx , node ) ) = self
551+ let child_idx_opt = self
552552 . children
553553 . borrow ( )
554554 . iter ( )
555- . enumerate ( )
556- . find ( |( _, node) | std:: ptr:: eq ( * * node, child) )
557- {
558- ( * * node) . set_parent ( None ) ;
559- ( * self . children . as_ptr ( ) ) . remove ( idx) ;
555+ . position ( |node| std:: ptr:: eq ( * node, child) ) ;
556+ if let Some ( child_idx) = child_idx_opt {
557+ let node = {
558+ let mut children = self . children . borrow_mut ( ) ;
559+ let node = children[ child_idx] ;
560+ children. remove ( child_idx) ;
561+ node
562+ } ;
563+ ( * node) . set_parent ( None ) ;
560564 }
565+
561566 self . mark_dirty_propagate ( ) ;
562567 }
563568 unsafe fn remove_child_at ( & self , idx : usize ) {
You can’t perform that action at this time.
0 commit comments