mirror of
https://github.com/servo/servo.git
synced 2025-08-01 03:30:33 +01:00
Introduce ServoParser::document
This commit is contained in:
parent
ea27f9d5ec
commit
27f245e6ae
4 changed files with 36 additions and 39 deletions
|
@ -3,10 +3,11 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::cell::DOMRefCell;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::js::{JS, Root};
|
||||
use dom::bindings::refcounted::Trusted;
|
||||
use dom::document::Document;
|
||||
use dom::servohtmlparser::ServoHTMLParser;
|
||||
use dom::servoparser::ServoParser;
|
||||
use dom::servoxmlparser::ServoXMLParser;
|
||||
use dom::window::Window;
|
||||
use std::cell::Cell;
|
||||
|
@ -104,6 +105,13 @@ pub enum ParserRef<'a> {
|
|||
}
|
||||
|
||||
impl<'a> ParserRef<'a> {
|
||||
pub fn as_servo_parser(&self) -> &ServoParser {
|
||||
match *self {
|
||||
ParserRef::HTML(parser) => parser.upcast(),
|
||||
ParserRef::XML(parser) => parser.upcast(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_chunk(&self, input: String) {
|
||||
match *self {
|
||||
ParserRef::HTML(parser) => parser.parse_chunk(input),
|
||||
|
@ -160,13 +168,6 @@ impl<'a> ParserRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn document(&self) -> &Document {
|
||||
match *self {
|
||||
ParserRef::HTML(parser) => parser.document(),
|
||||
ParserRef::XML(parser) => parser.document(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn last_chunk_received(&self) -> &Cell<bool> {
|
||||
match *self {
|
||||
ParserRef::HTML(parser) => parser.last_chunk_received(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue