mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Refine crown annotations for HTML parser. (#32956)
* Refine crown annotations for HTML parser. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Add missing annotation. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
1379cd5779
commit
a5df51ea56
1 changed files with 9 additions and 1 deletions
|
@ -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<Node>;
|
||||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
fn get_document(&mut self) -> Dom<Node> {
|
||||
Dom::from_ref(self.document.upcast())
|
||||
}
|
||||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
fn get_template_contents(&mut self, target: &Dom<Node>) -> Dom<Node> {
|
||||
let template = target
|
||||
.downcast::<HTMLTemplateElement>()
|
||||
|
@ -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<Node> {
|
||||
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<Node> {
|
||||
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<Node>, new_node: NodeOrText<Dom<Node>>) {
|
||||
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<Node>, child: NodeOrText<Dom<Node>>) {
|
||||
insert(parent, None, child, self.parsing_algorithm);
|
||||
}
|
||||
|
||||
#[allow(crown::unrooted_must_root)]
|
||||
fn append_based_on_parent_node(
|
||||
&mut self,
|
||||
elem: &Dom<Node>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue