refactor: propagate CanGc arguments through callers (#35591)

Signed-off-by: Auguste Baum <auguste.apple@gmail.com>
This commit is contained in:
Auguste Baum 2025-02-23 01:34:51 +01:00 committed by GitHub
parent 02199520f2
commit b0b0289014
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
74 changed files with 403 additions and 275 deletions

View file

@ -54,38 +54,46 @@ impl NodeList {
reflect_dom_object(Box::new(NodeList::new_inherited(list_type)), window, can_gc)
}
pub(crate) fn new_simple_list<T>(window: &Window, iter: T) -> DomRoot<NodeList>
pub(crate) fn new_simple_list<T>(window: &Window, iter: T, can_gc: CanGc) -> DomRoot<NodeList>
where
T: Iterator<Item = DomRoot<Node>>,
{
NodeList::new(
window,
NodeListType::Simple(iter.map(|r| Dom::from_ref(&*r)).collect()),
CanGc::note(),
can_gc,
)
}
pub(crate) fn new_simple_list_slice(window: &Window, slice: &[&Node]) -> DomRoot<NodeList> {
pub(crate) fn new_simple_list_slice(
window: &Window,
slice: &[&Node],
can_gc: CanGc,
) -> DomRoot<NodeList> {
NodeList::new(
window,
NodeListType::Simple(slice.iter().map(|r| Dom::from_ref(*r)).collect()),
CanGc::note(),
can_gc,
)
}
pub(crate) fn new_child_list(window: &Window, node: &Node) -> DomRoot<NodeList> {
pub(crate) fn new_child_list(window: &Window, node: &Node, can_gc: CanGc) -> DomRoot<NodeList> {
NodeList::new(
window,
NodeListType::Children(ChildrenList::new(node)),
CanGc::note(),
can_gc,
)
}
pub(crate) fn new_labels_list(window: &Window, element: &HTMLElement) -> DomRoot<NodeList> {
pub(crate) fn new_labels_list(
window: &Window,
element: &HTMLElement,
can_gc: CanGc,
) -> DomRoot<NodeList> {
NodeList::new(
window,
NodeListType::Labels(LabelsList::new(element)),
CanGc::note(),
can_gc,
)
}
@ -93,16 +101,17 @@ impl NodeList {
window: &Window,
document: &Document,
name: DOMString,
can_gc: CanGc,
) -> DomRoot<NodeList> {
NodeList::new(
window,
NodeListType::ElementsByName(ElementsByNameList::new(document, name)),
CanGc::note(),
can_gc,
)
}
pub(crate) fn empty(window: &Window) -> DomRoot<NodeList> {
NodeList::new(window, NodeListType::Simple(vec![]), CanGc::note())
pub(crate) fn empty(window: &Window, can_gc: CanGc) -> DomRoot<NodeList> {
NodeList::new(window, NodeListType::Simple(vec![]), can_gc)
}
}