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