servo: Merge #17522 - Replace ParseNodeID with ParseNodeId (from streichgeorg:master); r=emilio
authorstreichgeorg <georg.streich@bluewin.ch>
Mon, 26 Jun 2017 22:46:27 -0700
changeset 366108 4b9a7375ccb6f6f21678cfdc117edf7faf0d727a
parent 366107 3358bef7a047d347e576bbb83d1461b3776fc5fb
child 366109 44331317cfac2e07754a26ab84b460787258c4b4
push id45501
push userservo-vcs-sync@mozilla.com
push dateTue, 27 Jun 2017 06:47:20 +0000
treeherderautoland@4b9a7375ccb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
servo: Merge #17522 - Replace ParseNodeID with ParseNodeId (from streichgeorg:master); r=emilio <!-- Please describe your changes on the following line: --> --- Not really much to this... <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #17519 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 8d9b995b344a01cf9e8fa2149afb99c4d0ad3c25
servo/components/script/dom/servoparser/async_html.rs
--- a/servo/components/script/dom/servoparser/async_html.rs
+++ b/servo/components/script/dom/servoparser/async_html.rs
@@ -123,21 +123,21 @@ unsafe impl JSTraceable for HtmlTokenize
         }
 
         let tree_builder = &self.sink;
         tree_builder.trace_handles(&tracer);
         tree_builder.sink.trace(trc);
     }
 }
 
-type ParseNodeID = usize;
+type ParseNodeId = usize;
 
 #[derive(JSTraceable, Clone, HeapSizeOf)]
 pub struct ParseNode {
-    id: ParseNodeID,
+    id: ParseNodeId,
     qual_name: Option<QualName>,
 }
 
 #[derive(JSTraceable, HeapSizeOf)]
 struct ParseNodeData {
     contents: Option<ParseNode>,
     is_integration_point: bool,
 }
@@ -147,43 +147,43 @@ impl Default for ParseNodeData {
         ParseNodeData {
             contents: None,
             is_integration_point: false,
         }
     }
 }
 
 enum ParseOperation {
-    GetTemplateContents(ParseNodeID, ParseNodeID),
-    CreateElement(ParseNodeID, QualName, Vec<Attribute>),
-    CreateComment(StrTendril, ParseNodeID),
+    GetTemplateContents(ParseNodeId, ParseNodeId),
+    CreateElement(ParseNodeId, QualName, Vec<Attribute>),
+    CreateComment(StrTendril, ParseNodeId),
     // sibling, node to be inserted
-    AppendBeforeSibling(ParseNodeID, NodeOrText<ParseNode>),
+    AppendBeforeSibling(ParseNodeId, NodeOrText<ParseNode>),
     // parent, node to be inserted
-    Append(ParseNodeID, NodeOrText<ParseNode>),
+    Append(ParseNodeId, NodeOrText<ParseNode>),
     AppendDoctypeToDocument(StrTendril, StrTendril, StrTendril),
-    AddAttrsIfMissing(ParseNodeID, Vec<Attribute>),
-    RemoveFromParent(ParseNodeID),
-    MarkScriptAlreadyStarted(ParseNodeID),
-    ReparentChildren(ParseNodeID, ParseNodeID),
-    AssociateWithForm(ParseNodeID, ParseNodeID),
-    CreatePI(ParseNodeID, StrTendril, StrTendril),
-    Pop(ParseNodeID),
+    AddAttrsIfMissing(ParseNodeId, Vec<Attribute>),
+    RemoveFromParent(ParseNodeId),
+    MarkScriptAlreadyStarted(ParseNodeId),
+    ReparentChildren(ParseNodeId, ParseNodeId),
+    AssociateWithForm(ParseNodeId, ParseNodeId),
+    CreatePI(ParseNodeId, StrTendril, StrTendril),
+    Pop(ParseNodeId),
 }
 
 #[derive(JSTraceable, HeapSizeOf)]
 #[must_root]
 pub struct Sink {
     base_url: ServoUrl,
     document: JS<Document>,
     current_line: u64,
     script: MutNullableJS<HTMLScriptElement>,
-    parse_node_data: HashMap<ParseNodeID, ParseNodeData>,
-    next_parse_node_id: Cell<ParseNodeID>,
-    nodes: HashMap<ParseNodeID, JS<Node>>,
+    parse_node_data: HashMap<ParseNodeId, ParseNodeData>,
+    next_parse_node_id: Cell<ParseNodeId>,
+    nodes: HashMap<ParseNodeId, JS<Node>>,
     document_node: ParseNode,
 }
 
 impl Sink {
     fn new(base_url: ServoUrl, document: &Document) -> Sink {
         let mut sink = Sink {
             base_url: base_url,
             document: JS::from_ref(document),
@@ -209,33 +209,33 @@ impl Sink {
         self.insert_parse_node_data(id, data);
         self.next_parse_node_id.set(id + 1);
         ParseNode {
             id: id,
             qual_name: None,
         }
     }
 
-    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());
     }
 
-    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!")
     }
 
-    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());
     }
 
-    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!")
     }
 
-    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!")
     }
 
     fn process_operation(&mut self, op: ParseOperation) {
         let document = Root::from_ref(&**self.get_node(&0));
         let document = document.downcast::<Document>().expect("Document node should be downcasted!");
         match op {
             ParseOperation::GetTemplateContents(target, contents) => {