From a5df51ea56dd7116b5fb95acd9c88f123bdebbfc Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Thu, 8 Aug 2024 03:20:26 -0400 Subject: [PATCH] Refine crown annotations for HTML parser. (#32956) * Refine crown annotations for HTML parser. Signed-off-by: Josh Matthews * Add missing annotation. Signed-off-by: Josh Matthews --------- Signed-off-by: Josh Matthews --- components/script/dom/servoparser/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 33e2948d375..7169cba5e13 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -1083,19 +1083,21 @@ impl Sink { } } -#[allow(crown::unrooted_must_root)] // FIXME: really? impl TreeSink for Sink { type Output = Self; + #[allow(crown::unrooted_must_root)] fn finish(self) -> Self { self } type Handle = Dom; + #[allow(crown::unrooted_must_root)] fn get_document(&mut self) -> Dom { Dom::from_ref(self.document.upcast()) } + #[allow(crown::unrooted_must_root)] fn get_template_contents(&mut self, target: &Dom) -> Dom { let template = target .downcast::() @@ -1117,6 +1119,7 @@ impl TreeSink for Sink { } } + #[allow(crown::unrooted_must_root)] fn create_element( &mut self, name: QualName, @@ -1137,11 +1140,13 @@ impl TreeSink for Sink { Dom::from_ref(element.upcast()) } + #[allow(crown::unrooted_must_root)] fn create_comment(&mut self, text: StrTendril) -> Dom { let comment = Comment::new(DOMString::from(String::from(text)), &self.document, None); Dom::from_ref(comment.upcast()) } + #[allow(crown::unrooted_must_root)] fn create_pi(&mut self, target: StrTendril, data: StrTendril) -> Dom { let doc = &*self.document; let pi = ProcessingInstruction::new( @@ -1182,6 +1187,7 @@ impl TreeSink for Sink { } } + #[allow(crown::unrooted_must_root)] fn append_before_sibling(&mut self, sibling: &Dom, new_node: NodeOrText>) { let parent = sibling .GetParentNode() @@ -1203,10 +1209,12 @@ impl TreeSink for Sink { self.document.set_quirks_mode(mode); } + #[allow(crown::unrooted_must_root)] fn append(&mut self, parent: &Dom, child: NodeOrText>) { insert(parent, None, child, self.parsing_algorithm); } + #[allow(crown::unrooted_must_root)] fn append_based_on_parent_node( &mut self, elem: &Dom,