Do not root ServoHTMLParser::document

This commit is contained in:
Anthony Ramine 2015-10-17 16:00:51 +02:00
parent 7c47a6b78e
commit da06341578

View file

@ -152,8 +152,7 @@ impl AsyncResponseListener for ParserContext {
Some(parser) => parser.root(),
None => return,
};
let doc = parser.r().document.root();
doc.r().finish_load(LoadType::PageSource(self.url.clone()));
parser.document.finish_load(LoadType::PageSource(self.url.clone()));
if let Err(err) = status {
debug!("Failed to load page URL {}, error: {}", self.url.serialize(), err);
@ -188,7 +187,7 @@ pub struct ServoHTMLParser {
impl<'a> Parser for &'a ServoHTMLParser {
fn parse_chunk(self, input: String) {
self.document.root().r().set_current_parser(Some(self));
self.document.set_current_parser(Some(self));
self.pending_input.borrow_mut().push(input);
self.parse_sync();
}
@ -200,8 +199,7 @@ impl<'a> Parser for &'a ServoHTMLParser {
self.tokenizer().borrow_mut().end();
debug!("finished parsing");
let document = self.document.root();
document.r().set_current_parser(None);
self.document.set_current_parser(None);
if let Some(pipeline) = self.pipeline {
ScriptTask::parsing_complete(pipeline);
@ -298,8 +296,7 @@ impl ServoHTMLParser {
break;
}
let document = self.document.root();
document.r().reflow_if_reflow_timer_expired();
self.document.reflow_if_reflow_timer_expired();
let mut pending_input = self.pending_input.borrow_mut();
if !pending_input.is_empty() {
@ -318,8 +315,7 @@ impl ServoHTMLParser {
}
fn window(&self) -> Root<Window> {
let doc = self.document.root();
window_from_node(doc.r())
window_from_node(&*self.document)
}
}