mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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
|
@ -2249,13 +2249,13 @@ impl Document {
|
|||
for node in nodes {
|
||||
match node {
|
||||
NodeOrString::Node(node) => {
|
||||
fragment.AppendChild(&node)?;
|
||||
fragment.AppendChild(&node, can_gc)?;
|
||||
},
|
||||
NodeOrString::String(string) => {
|
||||
let node = DomRoot::upcast::<Node>(self.CreateTextNode(string, can_gc));
|
||||
// No try!() here because appending a text node
|
||||
// should not fail.
|
||||
fragment.AppendChild(&node).unwrap();
|
||||
fragment.AppendChild(&node, can_gc).unwrap();
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -5404,7 +5404,7 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
let parent = root.upcast::<Node>();
|
||||
let child = elem.upcast::<Node>();
|
||||
parent
|
||||
.InsertBefore(child, parent.GetFirstChild().as_deref())
|
||||
.InsertBefore(child, parent.GetFirstChild().as_deref(), can_gc)
|
||||
.unwrap()
|
||||
},
|
||||
}
|
||||
|
@ -5427,7 +5427,9 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
None,
|
||||
can_gc,
|
||||
);
|
||||
head.upcast::<Node>().AppendChild(elem.upcast()).unwrap()
|
||||
head.upcast::<Node>()
|
||||
.AppendChild(elem.upcast(), can_gc)
|
||||
.unwrap()
|
||||
},
|
||||
None => return,
|
||||
},
|
||||
|
@ -5500,7 +5502,7 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
// Step 3.
|
||||
(Some(ref root), Some(child)) => {
|
||||
let root = root.upcast::<Node>();
|
||||
root.ReplaceChild(new_body.upcast(), child.upcast())
|
||||
root.ReplaceChild(new_body.upcast(), child.upcast(), CanGc::note())
|
||||
.unwrap();
|
||||
},
|
||||
|
||||
|
@ -5510,7 +5512,7 @@ impl DocumentMethods<crate::DomTypeHolder> for Document {
|
|||
// Step 5.
|
||||
(Some(ref root), &None) => {
|
||||
let root = root.upcast::<Node>();
|
||||
root.AppendChild(new_body.upcast()).unwrap();
|
||||
root.AppendChild(new_body.upcast(), CanGc::note()).unwrap();
|
||||
},
|
||||
}
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue