aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/servohtmlparser.rs
diff options
context:
space:
mode:
authornchinth <nchinth@ncsu.edu>2014-10-17 16:30:01 -0400
committerNikhil Chinthapallee <nchinth@ncsu.edu>2014-10-29 11:31:20 -0400
commit6a736c7f3c9456224aadde71ebbd62e844fd6877 (patch)
tree26105ea56f09373c717d4190cbc7bd34cf3f1945 /components/script/dom/servohtmlparser.rs
parent7ba02bb11d2d9275949cb7522c5fcbc4ebcd23d1 (diff)
downloadservo-6a736c7f3c9456224aadde71ebbd62e844fd6877.tar.gz
servo-6a736c7f3c9456224aadde71ebbd62e844fd6877.zip
Adding initial version of parser trait
Added parse_chunk method declaration to parser Removed unnecessary visibilty for parse_chunk function Implemented parse_chunk function Implemented parse_chunk fn for ServoHTMLParser Moved parser trait to mod.rs and added finish fn added licence header to mod.rs and other review comments Fixed trailing space issue Fixed failed tabular space test
Diffstat (limited to 'components/script/dom/servohtmlparser.rs')
-rw-r--r--components/script/dom/servohtmlparser.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs
index 88f0c9c8275..f88c0777437 100644
--- a/components/script/dom/servohtmlparser.rs
+++ b/components/script/dom/servohtmlparser.rs
@@ -14,6 +14,7 @@ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
use dom::node::TrustedNodeAddress;
use dom::document::{Document, DocumentHelpers};
use parse::html::JSMessage;
+use parse::Parser;
use servo_util::task_state;
@@ -43,6 +44,15 @@ pub struct ServoHTMLParser {
tokenizer: DOMRefCell<Tokenizer>,
}
+impl Parser for ServoHTMLParser{
+ fn parse_chunk(&self, input: String) {
+ self.tokenizer().borrow_mut().feed(input);
+ }
+ fn finish(&self){
+ self.tokenizer().borrow_mut().end();
+ }
+}
+
impl ServoHTMLParser {
#[allow(unrooted_must_root)]
pub fn new(js_chan: Sender<JSMessage>, base_url: Option<Url>, document: JSRef<Document>)