mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Optimise Node.childNodes
We use the virtual method children_changed() to propagate changes in the children list to the NodeList tied to Node.childNodes.
This commit is contained in:
parent
a49eb14615
commit
4e8922a53a
3 changed files with 207 additions and 15 deletions
|
@ -40,7 +40,7 @@ use dom::element::{AttributeHandlers, Element, ElementCreator, ElementTypeId};
|
|||
use dom::element::ElementHelpers;
|
||||
use dom::eventtarget::{EventTarget, EventTargetTypeId};
|
||||
use dom::htmlelement::HTMLElementTypeId;
|
||||
use dom::nodelist::NodeList;
|
||||
use dom::nodelist::{NodeList, NodeListHelpers};
|
||||
use dom::processinginstruction::{ProcessingInstruction, ProcessingInstructionHelpers};
|
||||
use dom::text::Text;
|
||||
use dom::virtualmethods::{VirtualMethods, vtable_for};
|
||||
|
@ -2582,6 +2582,9 @@ impl<'a> VirtualMethods for &'a Node {
|
|||
self.children_count.set(added.len() as u32);
|
||||
},
|
||||
}
|
||||
if let Some(list) = self.child_list.get().map(|list| list.root()) {
|
||||
list.as_children_list().children_changed(mutation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue