aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2015-12-02 02:45:52 -0500
committerJosh Matthews <josh@joshmatthews.net>2015-12-04 16:32:54 -0500
commit9d3b915cace62d1e6aaa22572a992316894edf76 (patch)
tree131e1df17cd0ebbd2306a93c9caf49fd45920441 /components/script/dom/document.rs
parenta840a23990fbca4ce9572e729d9f390f3d991390 (diff)
downloadservo-9d3b915cace62d1e6aaa22572a992316894edf76.tar.gz
servo-9d3b915cace62d1e6aaa22572a992316894edf76.zip
Introduce abstraction over HTML and XML parsers for parser network listener.
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 4c1a7f12791..35a668ca196 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -65,7 +65,7 @@ use dom::nodeiterator::NodeIterator;
use dom::nodelist::NodeList;
use dom::processinginstruction::ProcessingInstruction;
use dom::range::Range;
-use dom::servohtmlparser::ServoHTMLParser;
+use dom::servohtmlparser::{ParserRoot, ParserRef, MutNullableParserField};
use dom::text::Text;
use dom::touch::Touch;
use dom::touchevent::TouchEvent;
@@ -184,7 +184,7 @@ pub struct Document {
/// Tracks all outstanding loads related to this document.
loader: DOMRefCell<DocumentLoader>,
/// The current active HTML parser, to allow resuming after interruptions.
- current_parser: MutNullableHeap<JS<ServoHTMLParser>>,
+ current_parser: MutNullableParserField,
/// When we should kick off a reflow. This happens during parsing.
reflow_timeout: Cell<Option<u64>>,
/// The cached first `base` element with an `href` attribute.
@@ -1224,9 +1224,9 @@ impl Document {
// A finished resource load can potentially unblock parsing. In that case, resume the
// parser so its loop can find out.
- if let Some(parser) = self.current_parser.get() {
- if parser.is_suspended() {
- parser.resume();
+ if let Some(parser) = self.get_current_parser() {
+ if parser.r().is_suspended() {
+ parser.r().resume();
}
} else if self.reflow_timeout.get().is_none() {
// If we don't have a parser, and the reflow timer has been reset, explicitly
@@ -1347,11 +1347,11 @@ impl Document {
}
- pub fn set_current_parser(&self, script: Option<&ServoHTMLParser>) {
+ pub fn set_current_parser(&self, script: Option<ParserRef>) {
self.current_parser.set(script);
}
- pub fn get_current_parser(&self) -> Option<Root<ServoHTMLParser>> {
+ pub fn get_current_parser(&self) -> Option<ParserRoot> {
self.current_parser.get()
}