servo: Merge #8278 - M1503: Integrate XML5 parser (from Ronak6892:master); r=eefriedman

Hi,

This is for NCSU fall 15 project for Mozilla.

We have included changes for initial steps in this pull request.
https://github.com/servo/servo/wiki/Integrate-xml5ever

Kindly review !

Source-Repo: https://github.com/servo/servo
Source-Revision: 65a1a28860ac8858a02be6d26b262a61d040beb1

--HG--
rename : servo/components/script/dom/webidls/ServoHTMLParser.webidl => servo/components/script/dom/webidls/ServoXMLParser.webidl
This commit is contained in:
jsharda 2015-11-05 08:43:44 +05:01
Родитель e0c7e3eb45
Коммит a3a32430d4
8 изменённых файлов: 81 добавлений и 6 удалений

Просмотреть файл

@ -70,6 +70,10 @@ git = "https://github.com/pcwalton/ipc-channel"
version = "0.6"
features = [ "serde-serialization" ]
[dependencies.xml5ever]
git = "https://github.com/Ygg01/xml5ever"
features = ["unstable"]
[dependencies]
app_units = {version = "0.1", features = ["plugins"]}
log = "0.3"

Просмотреть файл

@ -16,6 +16,7 @@ use dom::document::DocumentSource;
use dom::document::{Document, IsHTMLDocument};
use dom::window::Window;
use parse::html::{ParseContext, parse_html};
use parse::xml::{self, parse_xml};
use std::borrow::ToOwned;
use util::str::DOMString;
@ -68,12 +69,14 @@ impl DOMParserMethods for DOMParser {
}
Text_xml => {
//FIXME: this should probably be FromParser when we actually parse the string (#3756).
Ok(Document::new(&self.window, Some(url.clone()),
IsHTMLDocument::NonHTMLDocument,
Some(content_type),
None,
DocumentSource::NotFromParser,
loader))
let document = Document::new(&self.window, Some(url.clone()),
IsHTMLDocument::NonHTMLDocument,
Some(content_type),
None,
DocumentSource::NotFromParser,
loader);
parse_xml(document.r(), s, url, xml::ParseContext::Owner(None));
Ok(document)
}
}
}

Просмотреть файл

@ -338,6 +338,7 @@ pub mod progressevent;
pub mod range;
pub mod screen;
pub mod servohtmlparser;
pub mod servoxmlparser;
pub mod storage;
pub mod storageevent;
pub mod testbinding;

Просмотреть файл

@ -0,0 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::reflector::Reflector;
#[must_root]
#[dom_struct]
pub struct ServoXMLParser {
reflector_: Reflector,
}
impl ServoXMLParser {
pub fn new() {
}
}

Просмотреть файл

@ -0,0 +1,12 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// This interface is entirely internal to Servo, and should not be accessible to
// web pages.
[NoInterfaceObject]
interface ServoXMLParser {
};

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pub mod html;
pub mod xml;
pub trait Parser {
fn parse_chunk(self, input: String);

Просмотреть файл

@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![allow(unrooted_must_root)]
use dom::document::Document;
use url::Url;
use util::str::DOMString;
pub enum ParseContext {
Owner(Option<i32>)
}
pub fn parse_xml(document: &Document,
input: DOMString,
url: Url,
context: ParseContext) {
}

18
servo/components/servo/Cargo.lock сгенерированный
Просмотреть файл

@ -1534,6 +1534,7 @@ dependencies = [
"util 0.0.1",
"uuid 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"websocket 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)",
"xml5ever 0.1.0 (git+https://github.com/Ygg01/xml5ever)",
]
[[package]]
@ -2054,3 +2055,20 @@ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "xml5ever"
version = "0.1.0"
source = "git+https://github.com/Ygg01/xml5ever#0c36f2d93532b2d7b1ccfbd6019a6d53a1fcac69"
dependencies = [
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
]