diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-06-22 09:09:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-22 09:09:07 -0700 |
commit | 0fce761bb31f26f147054104c734d02d8aeb027f (patch) | |
tree | acb12831c6078587dd35d410290ba59e3c2dbcde /components/script/dom | |
parent | 813eed222e14735cc6c83c341c2bff46600458f7 (diff) | |
parent | 48e04d8d8fdfd8219bc34987e73a1e8f7705d5ff (diff) | |
download | servo-0fce761bb31f26f147054104c734d02d8aeb027f.tar.gz servo-0fce761bb31f26f147054104c734d02d8aeb027f.zip |
Auto merge of #17457 - cynicaldevil:trim-parse-node-data, r=nox
Remove target and data fields from parse_node_data
<!-- Please describe your changes on the following line: -->
`parse_node_data` does not need to store `data` and `target`, they can automatically be passed as parameters to the parser operation (`ParseOperation::CreatePI`) that we already create to be processed.
Also, this frees up `process_op` from depending on the sink's `parse_node_data` field, which will later allow for the sink to exist on the parser thread separately.
---
<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] 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. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17457)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/servoparser/async_html.rs | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index e13f8169faa..e1632ffaf3c 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -138,8 +138,6 @@ pub struct ParseNode { #[derive(JSTraceable, HeapSizeOf)] struct ParseNodeData { - target: Option<String>, - data: Option<String>, contents: Option<ParseNode>, is_integration_point: bool, } @@ -147,8 +145,6 @@ struct ParseNodeData { impl Default for ParseNodeData { fn default() -> ParseNodeData { ParseNodeData { - target: None, - data: None, contents: None, is_integration_point: false, } @@ -169,7 +165,7 @@ enum ParseOperation { MarkScriptAlreadyStarted(ParseNodeID), ReparentChildren(ParseNodeID, ParseNodeID), AssociateWithForm(ParseNodeID, ParseNodeID), - CreatePI(ParseNodeID), + CreatePI(ParseNodeID, StrTendril, StrTendril), Pop(ParseNodeID), } @@ -329,15 +325,11 @@ impl Sink { ParseOperation::Pop(node) => { vtable_for(self.get_node(&node)).pop(); } - ParseOperation::CreatePI(node) => { - let pi; - { - let data = self.get_parse_node_data(&node); - pi = ProcessingInstruction::new( - DOMString::from(data.target.clone().unwrap()), - DOMString::from(data.data.clone().unwrap()), + ParseOperation::CreatePI(node, target, data) => { + let pi = ProcessingInstruction::new( + DOMString::from(String::from(target)), + DOMString::from(String::from(data)), document); - } self.insert_node(node, JS::from_ref(pi.upcast())); } } @@ -411,12 +403,7 @@ impl TreeSink for Sink { fn create_pi(&mut self, target: StrTendril, data: StrTendril) -> ParseNode { let node = self.new_parse_node(); - { - let mut node_data = self.get_parse_node_data_mut(&node.id); - node_data.target = Some(String::from(target)); - node_data.data = Some(String::from(data)); - } - self.process_operation(ParseOperation::CreatePI(node.id)); + self.process_operation(ParseOperation::CreatePI(node.id, target, data)); node } |