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
This commit is contained in:
nchinth 2014-10-17 16:30:01 -04:00 committed by Nikhil Chinthapallee
parent 7ba02bb11d
commit 6a736c7f3c
4 changed files with 26 additions and 7 deletions

View file

@ -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>)