dom: Move child_list to rare data (#35592)

This is only created when calling the ChildNodes method. Gecko also stores it in their similar
data structure at https://searchfox.org/mozilla-central/rev/155d514d72473453492a822e97dc1c68cf49d110/dom/base/nsINode.h#1464

Signed-off-by: webbeef <me@webbeef.org>
This commit is contained in:
webbeef 2025-02-21 17:32:37 -08:00 committed by GitHub
parent 6a182c345c
commit f7c1cd4635
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 15 deletions

View file

@ -7,7 +7,7 @@ use std::rc::Rc;
use euclid::default::Rect;
use servo_atoms::Atom;
use crate::dom::bindings::root::Dom;
use crate::dom::bindings::root::{Dom, MutNullableDom};
use crate::dom::customelementregistry::{
CustomElementDefinition, CustomElementReaction, CustomElementState,
};
@ -16,6 +16,7 @@ use crate::dom::htmlslotelement::SlottableData;
use crate::dom::intersectionobserver::IntersectionObserverRegistration;
use crate::dom::mutationobserver::RegisteredObserver;
use crate::dom::node::UniqueId;
use crate::dom::nodelist::NodeList;
use crate::dom::range::WeakRangeVec;
use crate::dom::shadowroot::ShadowRoot;
use crate::dom::window::LayoutValue;
@ -42,6 +43,9 @@ pub(crate) struct NodeRareData {
/// twice in this vector, even if both the start and end containers
/// are this node.
pub(crate) ranges: WeakRangeVec,
/// The live list of children return by .childNodes.
pub(crate) child_list: MutNullableDom<NodeList>,
}
#[derive(Default, JSTraceable, MallocSizeOf)]