mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +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
|
@ -532,11 +532,13 @@ impl HTMLElementMethods<crate::DomTypeHolder> for HTMLElement {
|
|||
if fragment.upcast::<Node>().children_count() == 0 {
|
||||
let text_node = Text::new(DOMString::from("".to_owned()), &document, can_gc);
|
||||
|
||||
fragment.upcast::<Node>().AppendChild(text_node.upcast())?;
|
||||
fragment
|
||||
.upcast::<Node>()
|
||||
.AppendChild(text_node.upcast(), can_gc)?;
|
||||
}
|
||||
|
||||
// Step 6: Replace this with fragment within this's parent.
|
||||
parent.ReplaceChild(fragment.upcast(), node)?;
|
||||
parent.ReplaceChild(fragment.upcast(), node, can_gc)?;
|
||||
|
||||
// Step 7: If next is non-null and next's previous sibling is a Text node, then merge with
|
||||
// the next text node given next's previous sibling.
|
||||
|
@ -670,7 +672,7 @@ fn append_text_node_to_fragment(
|
|||
let text = Text::new(DOMString::from(text), document, can_gc);
|
||||
fragment
|
||||
.upcast::<Node>()
|
||||
.AppendChild(text.upcast())
|
||||
.AppendChild(text.upcast(), can_gc)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
|
@ -1016,7 +1018,10 @@ impl HTMLElement {
|
|||
}
|
||||
|
||||
let br = HTMLBRElement::new(local_name!("br"), None, &document, None, can_gc);
|
||||
fragment.upcast::<Node>().AppendChild(br.upcast()).unwrap();
|
||||
fragment
|
||||
.upcast::<Node>()
|
||||
.AppendChild(br.upcast(), can_gc)
|
||||
.unwrap();
|
||||
},
|
||||
_ => {
|
||||
// Collect a sequence of code points that are not U+000A LF or U+000D CR from
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue