mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
replaced ParseNodeID with ParseNodeId
This commit is contained in:
parent
3f2d747689
commit
fa6fc141c8
1 changed files with 22 additions and 22 deletions
|
@ -128,11 +128,11 @@ unsafe impl JSTraceable for HtmlTokenizer<TreeBuilder<ParseNode, Sink>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type ParseNodeID = usize;
|
type ParseNodeId = usize;
|
||||||
|
|
||||||
#[derive(JSTraceable, Clone, HeapSizeOf)]
|
#[derive(JSTraceable, Clone, HeapSizeOf)]
|
||||||
pub struct ParseNode {
|
pub struct ParseNode {
|
||||||
id: ParseNodeID,
|
id: ParseNodeId,
|
||||||
qual_name: Option<QualName>,
|
qual_name: Option<QualName>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,21 +152,21 @@ impl Default for ParseNodeData {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ParseOperation {
|
enum ParseOperation {
|
||||||
GetTemplateContents(ParseNodeID, ParseNodeID),
|
GetTemplateContents(ParseNodeId, ParseNodeId),
|
||||||
CreateElement(ParseNodeID, QualName, Vec<Attribute>),
|
CreateElement(ParseNodeId, QualName, Vec<Attribute>),
|
||||||
CreateComment(StrTendril, ParseNodeID),
|
CreateComment(StrTendril, ParseNodeId),
|
||||||
// sibling, node to be inserted
|
// sibling, node to be inserted
|
||||||
AppendBeforeSibling(ParseNodeID, NodeOrText<ParseNode>),
|
AppendBeforeSibling(ParseNodeId, NodeOrText<ParseNode>),
|
||||||
// parent, node to be inserted
|
// parent, node to be inserted
|
||||||
Append(ParseNodeID, NodeOrText<ParseNode>),
|
Append(ParseNodeId, NodeOrText<ParseNode>),
|
||||||
AppendDoctypeToDocument(StrTendril, StrTendril, StrTendril),
|
AppendDoctypeToDocument(StrTendril, StrTendril, StrTendril),
|
||||||
AddAttrsIfMissing(ParseNodeID, Vec<Attribute>),
|
AddAttrsIfMissing(ParseNodeId, Vec<Attribute>),
|
||||||
RemoveFromParent(ParseNodeID),
|
RemoveFromParent(ParseNodeId),
|
||||||
MarkScriptAlreadyStarted(ParseNodeID),
|
MarkScriptAlreadyStarted(ParseNodeId),
|
||||||
ReparentChildren(ParseNodeID, ParseNodeID),
|
ReparentChildren(ParseNodeId, ParseNodeId),
|
||||||
AssociateWithForm(ParseNodeID, ParseNodeID),
|
AssociateWithForm(ParseNodeId, ParseNodeId),
|
||||||
CreatePI(ParseNodeID, StrTendril, StrTendril),
|
CreatePI(ParseNodeId, StrTendril, StrTendril),
|
||||||
Pop(ParseNodeID),
|
Pop(ParseNodeId),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(JSTraceable, HeapSizeOf)]
|
#[derive(JSTraceable, HeapSizeOf)]
|
||||||
|
@ -176,9 +176,9 @@ pub struct Sink {
|
||||||
document: JS<Document>,
|
document: JS<Document>,
|
||||||
current_line: u64,
|
current_line: u64,
|
||||||
script: MutNullableJS<HTMLScriptElement>,
|
script: MutNullableJS<HTMLScriptElement>,
|
||||||
parse_node_data: HashMap<ParseNodeID, ParseNodeData>,
|
parse_node_data: HashMap<ParseNodeId, ParseNodeData>,
|
||||||
next_parse_node_id: Cell<ParseNodeID>,
|
next_parse_node_id: Cell<ParseNodeId>,
|
||||||
nodes: HashMap<ParseNodeID, JS<Node>>,
|
nodes: HashMap<ParseNodeId, JS<Node>>,
|
||||||
document_node: ParseNode,
|
document_node: ParseNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,23 +214,23 @@ impl Sink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert_node(&mut self, id: ParseNodeID, node: JS<Node>) {
|
fn insert_node(&mut self, id: ParseNodeId, node: JS<Node>) {
|
||||||
assert!(self.nodes.insert(id, node).is_none());
|
assert!(self.nodes.insert(id, node).is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_node<'a>(&'a self, id: &ParseNodeID) -> &'a JS<Node> {
|
fn get_node<'a>(&'a self, id: &ParseNodeId) -> &'a JS<Node> {
|
||||||
self.nodes.get(id).expect("Node not found!")
|
self.nodes.get(id).expect("Node not found!")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert_parse_node_data(&mut self, id: ParseNodeID, data: ParseNodeData) {
|
fn insert_parse_node_data(&mut self, id: ParseNodeId, data: ParseNodeData) {
|
||||||
assert!(self.parse_node_data.insert(id, data).is_none());
|
assert!(self.parse_node_data.insert(id, data).is_none());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_parse_node_data<'a>(&'a self, id: &'a ParseNodeID) -> &'a ParseNodeData {
|
fn get_parse_node_data<'a>(&'a self, id: &'a ParseNodeId) -> &'a ParseNodeData {
|
||||||
self.parse_node_data.get(id).expect("Parse Node data not found!")
|
self.parse_node_data.get(id).expect("Parse Node data not found!")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_parse_node_data_mut<'a>(&'a mut self, id: &'a ParseNodeID) -> &'a mut ParseNodeData {
|
fn get_parse_node_data_mut<'a>(&'a mut self, id: &'a ParseNodeId) -> &'a mut ParseNodeData {
|
||||||
self.parse_node_data.get_mut(id).expect("Parse Node data not found!")
|
self.parse_node_data.get_mut(id).expect("Parse Node data not found!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue