Add CanGc as arguments in methods in Attr and Node (#36371)

Add CanGc as argument to methods in `Attr` and `Node`.

Addressed part of https://github.com/servo/servo/issues/34573.

---

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because they are a refactor.

Signed-off-by: Yerkebulan Tulibergenov <yerkebulan@gmail.com>
This commit is contained in:
Yerkebulan Tulibergenov 2025-04-05 23:27:59 -07:00 committed by GitHub
parent bd43b78735
commit 6898eae61e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 137 additions and 111 deletions

View file

@ -138,12 +138,12 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
// Step 4.
if let Some(doc_type) = maybe_doctype {
doc_node.AppendChild(doc_type.upcast()).unwrap();
doc_node.AppendChild(doc_type.upcast(), can_gc).unwrap();
}
// Step 5.
if let Some(ref elem) = maybe_elem {
doc_node.AppendChild(elem.upcast()).unwrap();
doc_node.AppendChild(elem.upcast(), can_gc).unwrap();
}
}
@ -185,7 +185,7 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
// Step 3.
let doc_node = doc.upcast::<Node>();
let doc_type = DocumentType::new(DOMString::from("html"), None, None, &doc, can_gc);
doc_node.AppendChild(doc_type.upcast()).unwrap();
doc_node.AppendChild(doc_type.upcast(), can_gc).unwrap();
}
{
@ -198,7 +198,9 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
None,
can_gc,
));
doc_node.AppendChild(&doc_html).expect("Appending failed");
doc_node
.AppendChild(&doc_html, can_gc)
.expect("Appending failed");
{
// Step 5.
@ -209,7 +211,7 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
None,
can_gc,
));
doc_html.AppendChild(&doc_head).unwrap();
doc_html.AppendChild(&doc_head, can_gc).unwrap();
// Step 6.
if let Some(title_str) = title {
@ -221,17 +223,17 @@ impl DOMImplementationMethods<crate::DomTypeHolder> for DOMImplementation {
None,
can_gc,
));
doc_head.AppendChild(&doc_title).unwrap();
doc_head.AppendChild(&doc_title, can_gc).unwrap();
// Step 6.2.
let title_text = Text::new(title_str, &doc, can_gc);
doc_title.AppendChild(title_text.upcast()).unwrap();
doc_title.AppendChild(title_text.upcast(), can_gc).unwrap();
}
}
// Step 7.
let doc_body = HTMLBodyElement::new(local_name!("body"), None, &doc, None, can_gc);
doc_html.AppendChild(doc_body.upcast()).unwrap();
doc_html.AppendChild(doc_body.upcast(), can_gc).unwrap();
}
// Step 8.