mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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:
parent
bd43b78735
commit
6898eae61e
20 changed files with 137 additions and 111 deletions
|
@ -913,7 +913,7 @@ impl FetchResponseListener for ParserContext {
|
|||
let img = HTMLImageElement::new(local_name!("img"), None, doc, None, CanGc::note());
|
||||
img.SetSrc(USVString(self.url.to_string()));
|
||||
doc_body
|
||||
.AppendChild(&DomRoot::upcast::<Node>(img))
|
||||
.AppendChild(&DomRoot::upcast::<Node>(img), CanGc::note())
|
||||
.expect("Appending failed");
|
||||
},
|
||||
(mime::TEXT, mime::PLAIN, _) => {
|
||||
|
@ -1095,7 +1095,7 @@ fn insert(
|
|||
if element_in_non_fragment {
|
||||
ScriptThread::push_new_element_queue();
|
||||
}
|
||||
parent.InsertBefore(&n, reference_child).unwrap();
|
||||
parent.InsertBefore(&n, reference_child, can_gc).unwrap();
|
||||
if element_in_non_fragment {
|
||||
ScriptThread::pop_current_element_queue(can_gc);
|
||||
}
|
||||
|
@ -1111,7 +1111,9 @@ fn insert(
|
|||
text.upcast::<CharacterData>().append_data(&t);
|
||||
} else {
|
||||
let text = Text::new(String::from(t).into(), &parent.owner_doc(), can_gc);
|
||||
parent.InsertBefore(text.upcast(), reference_child).unwrap();
|
||||
parent
|
||||
.InsertBefore(text.upcast(), reference_child, can_gc)
|
||||
.unwrap();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -1323,7 +1325,7 @@ impl TreeSink for Sink {
|
|||
CanGc::note(),
|
||||
);
|
||||
doc.upcast::<Node>()
|
||||
.AppendChild(doctype.upcast())
|
||||
.AppendChild(doctype.upcast(), CanGc::note())
|
||||
.expect("Appending failed");
|
||||
}
|
||||
|
||||
|
@ -1343,7 +1345,7 @@ impl TreeSink for Sink {
|
|||
|
||||
fn remove_from_parent(&self, target: &Dom<Node>) {
|
||||
if let Some(ref parent) = target.GetParentNode() {
|
||||
parent.RemoveChild(target).unwrap();
|
||||
parent.RemoveChild(target, CanGc::note()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1367,7 @@ impl TreeSink for Sink {
|
|||
|
||||
fn reparent_children(&self, node: &Dom<Node>, new_parent: &Dom<Node>) {
|
||||
while let Some(ref child) = node.GetFirstChild() {
|
||||
new_parent.AppendChild(child).unwrap();
|
||||
new_parent.AppendChild(child, CanGc::note()).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue