Solving merge conficts related to the html5ever_atoms -> html5ever change

This commit is contained in:
Christian Poveda 2017-05-03 12:57:49 -05:00
commit 62821a6915
188 changed files with 1130 additions and 697 deletions

View file

@ -13,7 +13,7 @@ use dom::element::{AttributeMutation, Element};
use dom::virtualmethods::vtable_for;
use dom::window::Window;
use dom_struct::dom_struct;
use html5ever_atoms::{Prefix, LocalName, Namespace};
use html5ever::{Prefix, LocalName, Namespace};
use servo_atoms::Atom;
use std::borrow::ToOwned;
use std::cell::Ref;

View file

@ -4,7 +4,7 @@
//! The `ByteString` struct.
use html5ever_atoms::{LocalName, Namespace};
use html5ever::{LocalName, Namespace};
use servo_atoms::Atom;
use std::ascii::AsciiExt;
use std::borrow::{Borrow, Cow, ToOwned};

View file

@ -47,8 +47,8 @@ use euclid::{Matrix2D, Matrix4D, Point2D};
use euclid::length::Length as EuclidLength;
use euclid::rect::Rect;
use euclid::size::Size2D;
use html5ever::tokenizer::buffer_queue::BufferQueue;
use html5ever_atoms::{Prefix, LocalName, Namespace, QualName};
use html5ever::{Prefix, LocalName, Namespace, QualName};
use html5ever::buffer_queue::BufferQueue;
use hyper::header::Headers;
use hyper::method::Method;
use hyper::mime::Mime;
@ -99,6 +99,7 @@ use style::media_queries::MediaList;
use style::properties::PropertyDeclarationBlock;
use style::selector_parser::{PseudoElement, Snapshot};
use style::shared_lock::{SharedRwLock as StyleSharedRwLock, Locked as StyleLocked};
use style::stylearc::Arc as StyleArc;
use style::stylesheets::{CssRules, FontFaceRule, KeyframesRule, MediaRule};
use style::stylesheets::{NamespaceRule, StyleRule, ImportRule, SupportsRule};
use style::values::specified::Length;
@ -166,6 +167,12 @@ unsafe impl<T: JSTraceable> JSTraceable for Arc<T> {
}
}
unsafe impl<T: JSTraceable> JSTraceable for StyleArc<T> {
unsafe fn trace(&self, trc: *mut JSTracer) {
(**self).trace(trc)
}
}
unsafe impl<T: JSTraceable + ?Sized> JSTraceable for Box<T> {
unsafe fn trace(&self, trc: *mut JSTracer) {
(**self).trace(trc)

View file

@ -6,7 +6,7 @@
use dom::bindings::error::{Error, ErrorResult, Fallible};
use dom::bindings::str::DOMString;
use html5ever_atoms::{Prefix, LocalName, Namespace};
use html5ever::{Prefix, LocalName, Namespace};
/// Validate a qualified name. See https://dom.spec.whatwg.org/#validate for details.
pub fn validate_qualified_name(qualified_name: &str) -> ErrorResult {

View file

@ -76,7 +76,7 @@ use dom::htmlulistelement::HTMLUListElement;
use dom::htmlunknownelement::HTMLUnknownElement;
use dom::htmlvideoelement::HTMLVideoElement;
use dom::svgsvgelement::SVGSVGElement;
use html5ever_atoms::{Prefix, QualName};
use html5ever::{QualName, Prefix};
use servo_config::prefs::PREFS;
fn create_svg_element(name: QualName,
@ -273,14 +273,10 @@ fn create_html_element(name: QualName,
}
pub fn create_element(name: QualName,
prefix: Option<Prefix>,
document: &Document,
creator: ElementCreator)
-> Root<Element> {
// FIXME(ajeffrey): Convert directly from Prefix to DOMString.
// let prefix = prefix.map(|p| DOMString::from(&*p));
let prefix = name.prefix.clone();
match name.ns {
ns!(html) => create_html_element(name, prefix, document, creator),
ns!(svg) => create_svg_element(name, prefix, document),

View file

@ -10,8 +10,8 @@ use dom::cssmediarule::CSSMediaRule;
use dom::cssstylesheet::CSSStyleSheet;
use dom::csssupportsrule::CSSSupportsRule;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{SharedRwLock, Locked};
use style::stylearc::Arc;
use style::stylesheets::CssRules as StyleCssRules;
#[dom_struct]

View file

@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::FontFaceRule;
#[dom_struct]

View file

@ -12,8 +12,8 @@ use dom::cssrule::CSSRule;
use dom::cssrulelist::{CSSRuleList, RulesSource};
use dom::cssstylesheet::CSSStyleSheet;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{SharedRwLock, Locked};
use style::stylearc::Arc;
use style::stylesheets::CssRules as StyleCssRules;
#[dom_struct]

View file

@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::ImportRule;
#[dom_struct]

View file

@ -12,9 +12,9 @@ use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSSt
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::keyframes::Keyframe;
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
#[dom_struct]
pub struct CSSKeyframeRule {

View file

@ -16,9 +16,9 @@ use dom::cssrulelist::{CSSRuleList, RulesSource};
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::keyframes::{Keyframe, KeyframeSelector};
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::KeyframesRule;
use style::values::KeyframesName;

View file

@ -15,10 +15,10 @@ use dom::cssstylesheet::CSSStyleSheet;
use dom::medialist::MediaList;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::media_queries::parse_media_query_list;
use style::parser::{LengthParsingMode, ParserContext};
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, MediaRule};
use style_traits::ToCss;

View file

@ -11,8 +11,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::NamespaceRule;
#[dom_struct]

View file

@ -13,8 +13,8 @@ use dom::cssrule::CSSRule;
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::Locked;
use style::stylearc::Arc;
use style::stylesheets::{CssRules, CssRulesHelpers, KeyframesRule, RulesMutateError};
#[allow(unsafe_code)]

View file

@ -16,13 +16,13 @@ use dom::window::Window;
use dom_struct::dom_struct;
use servo_url::ServoUrl;
use std::ascii::AsciiExt;
use std::sync::Arc;
use style::attr::AttrValue;
use style::parser::LengthParsingMode;
use style::properties::{Importance, PropertyDeclarationBlock, PropertyId, LonghandId, ShorthandId};
use style::properties::{parse_one_declaration, parse_style_attribute};
use style::selector_parser::PseudoElement;
use style::shared_lock::Locked;
use style::stylearc::Arc;
use style_traits::ToCss;
// http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface

View file

@ -12,8 +12,8 @@ use dom::cssstyledeclaration::{CSSModificationAccess, CSSStyleDeclaration, CSSSt
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::StyleRule;
#[dom_struct]

View file

@ -15,8 +15,8 @@ use dom::stylesheet::StyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::cell::Cell;
use std::sync::Arc;
use style::shared_lock::SharedRwLock;
use style::stylearc::Arc;
use style::stylesheets::Stylesheet as StyleStyleSheet;
#[dom_struct]

View file

@ -13,9 +13,9 @@ use dom::cssrule::SpecificCSSRule;
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::parser::{LengthParsingMode, ParserContext};
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, SupportsRule};
use style::supports::SupportsCondition;
use style_traits::ToCss;

View file

@ -10,8 +10,8 @@ use dom::cssrule::{CSSRule, SpecificCSSRule};
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::shared_lock::{Locked, ToCssWithGuard};
use style::stylearc::Arc;
use style::viewport::ViewportRule;
#[dom_struct]

View file

@ -93,7 +93,7 @@ use dom_struct::dom_struct;
use encoding::EncodingRef;
use encoding::all::UTF_8;
use euclid::point::Point2D;
use html5ever_atoms::{LocalName, QualName};
use html5ever::{LocalName, QualName};
use hyper::header::{Header, SetCookie};
use hyper_serde::Serde;
use ipc_channel::ipc::{self, IpcSender};
@ -128,7 +128,6 @@ use std::default::Default;
use std::iter::once;
use std::mem;
use std::rc::Rc;
use std::sync::Arc;
use std::time::{Duration, Instant};
use style::attr::AttrValue;
use style::context::{QuirksMode, ReflowGoal};
@ -136,6 +135,7 @@ use style::restyle_hints::{RestyleHint, RESTYLE_SELF, RESTYLE_STYLE_ATTRIBUTE};
use style::selector_parser::{RestyleDamage, Snapshot};
use style::shared_lock::SharedRwLock as StyleSharedRwLock;
use style::str::{HTML_SPACE_CHARACTERS, split_html_space_chars, str_join};
use style::stylearc::Arc;
use style::stylesheets::Stylesheet;
use task_source::TaskSource;
use time;
@ -2733,7 +2733,7 @@ impl DocumentMethods for Document {
-> Root<HTMLCollection> {
let ns = namespace_from_domstring(maybe_ns);
let local = LocalName::from(tag_name);
let qname = QualName::new(ns, local);
let qname = QualName::new(None, ns, local);
match self.tagns_map.borrow_mut().entry(qname.clone()) {
Occupied(entry) => Root::from_ref(entry.get()),
Vacant(entry) => {
@ -2782,8 +2782,8 @@ impl DocumentMethods for Document {
ns!()
};
let name = QualName::new(ns, LocalName::from(local_name));
Ok(Element::create(name, None, self, ElementCreator::ScriptCreated))
let name = QualName::new(None, ns, LocalName::from(local_name));
Ok(Element::create(name, self, ElementCreator::ScriptCreated))
}
// https://dom.spec.whatwg.org/#dom-document-createelementns
@ -2793,8 +2793,8 @@ impl DocumentMethods for Document {
-> Fallible<Root<Element>> {
let (namespace, prefix, local_name) = try!(validate_and_extract(namespace,
&qualified_name));
let name = QualName::new(namespace, local_name);
Ok(Element::create(name, prefix, self, ElementCreator::ScriptCreated))
let name = QualName::new(prefix, namespace, local_name);
Ok(Element::create(name, self, ElementCreator::ScriptCreated))
}
// https://dom.spec.whatwg.org/#dom-document-createattribute
@ -3047,8 +3047,8 @@ impl DocumentMethods for Document {
match elem {
Some(elem) => Root::upcast::<Node>(elem),
None => {
let name = QualName::new(ns!(svg), local_name!("title"));
let elem = Element::create(name, None, self, ElementCreator::ScriptCreated);
let name = QualName::new(None, ns!(svg), local_name!("title"));
let elem = Element::create(name, self, ElementCreator::ScriptCreated);
let parent = root.upcast::<Node>();
let child = elem.upcast::<Node>();
parent.InsertBefore(child, parent.GetFirstChild().r())
@ -3064,9 +3064,8 @@ impl DocumentMethods for Document {
None => {
match self.GetHead() {
Some(head) => {
let name = QualName::new(ns!(html), local_name!("title"));
let name = QualName::new(None, ns!(html), local_name!("title"));
let elem = Element::create(name,
None,
self,
ElementCreator::ScriptCreated);
head.upcast::<Node>()

View file

@ -12,7 +12,7 @@ use dom::bindings::str::DOMString;
use dom::element::Element;
use dom::node::window_from_node;
use dom_struct::dom_struct;
use html5ever_atoms::LocalName;
use html5ever::LocalName;
use servo_atoms::Atom;
use style::str::HTML_SPACE_CHARACTERS;

View file

@ -75,11 +75,11 @@ use dom::validation::Validatable;
use dom::virtualmethods::{VirtualMethods, vtable_for};
use dom::window::ReflowReason;
use dom_struct::dom_struct;
use html5ever::{Prefix, LocalName, Namespace, QualName};
use html5ever::serialize;
use html5ever::serialize::SerializeOpts;
use html5ever::serialize::TraversalScope;
use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
use html5ever_atoms::{Prefix, LocalName, Namespace, QualName};
use js::jsapi::{HandleValue, JSAutoCompartment};
use net_traits::request::CorsSettings;
use ref_filter_map::ref_filter_map;
@ -96,7 +96,6 @@ use std::convert::TryFrom;
use std::default::Default;
use std::fmt;
use std::rc::Rc;
use std::sync::Arc;
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
use style::context::{QuirksMode, ReflowGoal};
use style::element_state::*;
@ -107,6 +106,7 @@ use style::rule_tree::CascadeLevel;
use style::selector_parser::{NonTSPseudoClass, RestyleDamage, SelectorImpl, SelectorParser};
use style::shared_lock::{SharedRwLock, Locked};
use style::sink::Push;
use style::stylearc::Arc;
use style::stylist::ApplicableDeclarationBlock;
use style::thread_state;
use style::values::CSSFloat;
@ -195,10 +195,10 @@ impl<'a> TryFrom<&'a str> for AdjacentPosition {
// Element methods
//
impl Element {
pub fn create(name: QualName, prefix: Option<Prefix>,
pub fn create(name: QualName,
document: &Document, creator: ElementCreator)
-> Root<Element> {
create_element(name, prefix, document, creator)
create_element(name, document, creator)
}
pub fn new_inherited(local_name: LocalName,
@ -1955,8 +1955,8 @@ impl ElementMethods for Element {
// Step 4.
NodeTypeId::DocumentFragment => {
let body_elem = Element::create(QualName::new(ns!(html), local_name!("body")),
None, &context_document,
let body_elem = Element::create(QualName::new(None, ns!(html), local_name!("body")),
&context_document,
ElementCreator::ScriptCreated);
Root::upcast(body_elem)
},

View file

@ -17,7 +17,7 @@ use dom::file::File;
use dom::globalscope::GlobalScope;
use dom::htmlformelement::{HTMLFormElement, FormDatumValue, FormDatum};
use dom_struct::dom_struct;
use html5ever_atoms::LocalName;
use html5ever::LocalName;
use std::collections::HashMap;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::iter;

View file

@ -25,7 +25,7 @@ use dom::node::{Node, document_from_node};
use dom::urlhelper::UrlHelper;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use net_traits::ReferrerPolicy;
use num_traits::ToPrimitive;
use script_traits::MozBrowserEvent;

View file

@ -12,7 +12,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use style::attr::AttrValue;
#[dom_struct]

View file

@ -20,7 +20,7 @@ use dom::node::{Node, document_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use euclid::point::Point2D;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use net_traits::ReferrerPolicy;
use std::default::Default;
use std::f32;

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlmediaelement::HTMLMediaElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLAudioElement {

View file

@ -14,7 +14,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, UnbindContext, document_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use servo_url::ServoUrl;
use style::attr::AttrValue;

View file

@ -18,7 +18,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use script_traits::ScriptMsg as ConstellationMsg;
use servo_url::ServoUrl;
use style::attr::AttrValue;

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLBRElement {

View file

@ -24,7 +24,7 @@ use dom::validation::Validatable;
use dom::validitystate::{ValidityState, ValidationFlags};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use std::cell::Cell;
use std::default::Default;
use style::element_state::*;

View file

@ -27,7 +27,7 @@ use dom::virtualmethods::VirtualMethods;
use dom::webglrenderingcontext::{LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext};
use dom_struct::dom_struct;
use euclid::size::Size2D;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use image::ColorType;
use image::png::PNGEncoder;
use ipc_channel::ipc::{self, IpcSender};

View file

@ -14,7 +14,7 @@ use dom::element::Element;
use dom::node::Node;
use dom::window::Window;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, QualName};
use html5ever::{LocalName, QualName};
use servo_atoms::Atom;
use std::cell::Cell;
use style::str::split_html_space_chars;
@ -164,7 +164,7 @@ impl HTMLCollection {
maybe_ns: Option<DOMString>) -> Root<HTMLCollection> {
let local = LocalName::from(tag);
let ns = namespace_from_domstring(maybe_ns);
let qname = QualName::new(ns, local);
let qname = QualName::new(None, ns, local);
HTMLCollection::by_qual_tag_name(window, root, qname)
}

View file

@ -10,7 +10,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLDataElement {

View file

@ -13,7 +13,7 @@ use dom::htmlelement::HTMLElement;
use dom::htmloptionelement::HTMLOptionElement;
use dom::node::{Node, window_from_node};
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLDataListElement {

View file

@ -15,7 +15,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use script_thread::Runnable;
use std::cell::Cell;
use task_source::TaskSource;

View file

@ -14,7 +14,7 @@ use dom::eventtarget::EventTarget;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, window_from_node};
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLDialogElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLDirectoryElement {

View file

@ -9,7 +9,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLDivElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLDListElement {

View file

@ -30,7 +30,7 @@ use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::default::Default;

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLEmbedElement {

View file

@ -17,7 +17,7 @@ use dom::node::{Node, window_from_node};
use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use std::default::Default;
use style::element_state::*;

View file

@ -14,7 +14,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use servo_atoms::Atom;
use style::attr::AttrValue;
use style::str::{HTML_SPACE_CHARACTERS, read_numbers};

View file

@ -45,7 +45,7 @@ use dom_struct::dom_struct;
use encoding::EncodingRef;
use encoding::all::UTF_8;
use encoding::label::encoding_from_whatwg_label;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use hyper::header::{Charset, ContentDisposition, ContentType, DispositionParam, DispositionType};
use hyper::method::Method;
use msg::constellation_msg::PipelineId;

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLFrameElement {

View file

@ -11,7 +11,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, document_from_node};
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLFrameSetElement {

View file

@ -14,7 +14,7 @@ use dom::node::{Node, document_from_node};
use dom::userscripts::load_script;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLHeadElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[derive(JSTraceable, HeapSizeOf)]
pub enum HeadingLevel {

View file

@ -13,7 +13,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
#[dom_struct]

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLHtmlElement {

View file

@ -36,7 +36,7 @@ use dom::node::{Node, NodeDamage, UnbindContext, document_from_node, window_from
use dom::virtualmethods::VirtualMethods;
use dom::window::{ReflowReason, Window};
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use ipc_channel::ipc;
use js::jsapi::{JSAutoCompartment, JSContext, MutableHandleValue};
use js::jsval::{NullValue, UndefinedValue};

View file

@ -35,7 +35,7 @@ use dom::virtualmethods::VirtualMethods;
use dom::window::Window;
use dom_struct::dom_struct;
use euclid::point::Point2D;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use net_traits::{FetchResponseListener, FetchMetadata, NetworkError, FetchResponseMsg};

View file

@ -37,7 +37,7 @@ use dom::validation::Validatable;
use dom::validitystate::ValidationFlags;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use ipc_channel::ipc::{self, IpcSender};
use mime_guess;
use net_traits::{CoreResourceMsg, IpcSend};

View file

@ -18,7 +18,7 @@ use dom::htmlformelement::{FormControl, FormControlElementHelpers, HTMLFormEleme
use dom::node::{document_from_node, Node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use style::attr::AttrValue;
#[dom_struct]

View file

@ -15,7 +15,7 @@ use dom::htmlformelement::{HTMLFormElement, FormControl};
use dom::node::{Node, UnbindContext};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLLegendElement {

View file

@ -12,7 +12,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use style::attr::AttrValue;
#[dom_struct]

View file

@ -22,7 +22,7 @@ use dom::node::{Node, UnbindContext, document_from_node, window_from_node};
use dom::stylesheet::StyleSheet as DOMStyleSheet;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use net_traits::ReferrerPolicy;
use script_layout_interface::message::Msg;
use script_traits::{MozBrowserEvent, ScriptMsg as ConstellationMsg};
@ -30,11 +30,11 @@ use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::Cell;
use std::default::Default;
use std::sync::Arc;
use style::attr::AttrValue;
use style::media_queries::parse_media_query_list;
use style::parser::{LengthParsingMode, ParserContext as CssParserContext};
use style::str::HTML_SPACE_CHARACTERS;
use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, Stylesheet};
use stylesheet_loader::{StylesheetLoader, StylesheetContextSource, StylesheetOwner};

View file

@ -10,7 +10,7 @@ use dom::htmlareaelement::HTMLAreaElement;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLMapElement {

View file

@ -28,7 +28,7 @@ use dom::mediaerror::MediaError;
use dom::node::{window_from_node, document_from_node, Node, UnbindContext};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use net_traits::{FetchResponseListener, FetchMetadata, Metadata, NetworkError};

View file

@ -18,14 +18,14 @@ use dom::htmlheadelement::HTMLHeadElement;
use dom::node::{Node, UnbindContext, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use servo_config::prefs::PREFS;
use std::ascii::AsciiExt;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use style::attr::AttrValue;
use style::media_queries::MediaList;
use style::str::HTML_SPACE_CHARACTERS;
use style::stylearc::Arc;
use style::stylesheets::{Stylesheet, CssRule, CssRules, Origin};
use style::viewport::ViewportRule;

View file

@ -10,7 +10,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::nodelist::NodeList;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLMeterElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLModElement {

View file

@ -18,10 +18,10 @@ use dom::validation::Validatable;
use dom::validitystate::{ValidityState, ValidationFlags};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use net_traits::image::base::Image;
use std::default::Default;
use std::sync::Arc;
use style::stylearc::Arc;
#[dom_struct]
pub struct HTMLObjectElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLOListElement {

View file

@ -14,7 +14,7 @@ use dom::htmloptionelement::HTMLOptionElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use style::element_state::*;
#[dom_struct]

View file

@ -23,7 +23,7 @@ use dom::node::{Node, UnbindContext};
use dom::text::Text;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use std::cell::Cell;
use style::element_state::*;
use style::str::{split_html_space_chars, str_join};

View file

@ -16,7 +16,7 @@ use dom::nodelist::NodeList;
use dom::validitystate::ValidityState;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLOutputElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLParagraphElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLParamElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLPreElement {

View file

@ -10,7 +10,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom::nodelist::NodeList;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLProgressElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLQuoteElement {

View file

@ -26,7 +26,7 @@ use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use encoding::label::encoding_from_whatwg_label;
use encoding::types::{DecoderTrap, EncodingRef};
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use js::jsval::UndefinedValue;

View file

@ -31,7 +31,7 @@ use dom::validation::Validatable;
use dom::validitystate::{ValidityState, ValidationFlags};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use std::default::Default;
use std::iter;
use style::attr::AttrValue;

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLSourceElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLSpanElement {

View file

@ -18,13 +18,13 @@ use dom::node::{ChildrenMutation, Node, UnbindContext, document_from_node, windo
use dom::stylesheet::StyleSheet as DOMStyleSheet;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use net_traits::ReferrerPolicy;
use script_layout_interface::message::Msg;
use std::cell::Cell;
use std::sync::Arc;
use style::media_queries::parse_media_query_list;
use style::parser::{LengthParsingMode, ParserContext as CssParserContext};
use style::stylearc::Arc;
use style::stylesheets::{CssRuleType, Stylesheet, Origin};
use stylesheet_loader::{StylesheetLoader, StylesheetOwner};

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTableCaptionElement {

View file

@ -15,7 +15,7 @@ use dom::htmltablerowelement::HTMLTableRowElement;
use dom::node::Node;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
const DEFAULT_COLSPAN: u32 = 1;

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTableColElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmltablecellelement::HTMLTableCellElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTableDataCellElement {

View file

@ -23,7 +23,7 @@ use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::node::{Node, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use std::cell::Cell;
use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_unsigned_integer};

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmltablecellelement::HTMLTableCellElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTableHeaderCellElement {

View file

@ -22,7 +22,7 @@ use dom::htmltablesectionelement::HTMLTableSectionElement;
use dom::node::{Node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use style::attr::AttrValue;
#[derive(JSTraceable)]

View file

@ -17,7 +17,7 @@ use dom::htmltablerowelement::HTMLTableRowElement;
use dom::node::{Node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use style::attr::AttrValue;
#[dom_struct]

View file

@ -14,7 +14,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::{CloneChildrenFlag, Node, document_from_node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTemplateElement {

View file

@ -26,7 +26,7 @@ use dom::nodelist::NodeList;
use dom::validation::Validatable;
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
use ipc_channel::ipc::IpcSender;
use script_traits::ScriptMsg as ConstellationMsg;
use std::cell::Cell;

View file

@ -10,7 +10,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTimeElement {

View file

@ -13,7 +13,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::{ChildrenMutation, Node};
use dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTitleElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLTrackElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLUListElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlelement::HTMLElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLUnknownElement {

View file

@ -8,7 +8,7 @@ use dom::document::Document;
use dom::htmlmediaelement::HTMLMediaElement;
use dom::node::Node;
use dom_struct::dom_struct;
use html5ever_atoms::{LocalName, Prefix};
use html5ever::{LocalName, Prefix};
#[dom_struct]
pub struct HTMLVideoElement {

View file

@ -12,11 +12,11 @@ use dom::bindings::str::DOMString;
use dom::cssstylesheet::CSSStyleSheet;
use dom::window::Window;
use dom_struct::dom_struct;
use std::sync::Arc;
use style::media_queries::{MediaQuery, parse_media_query_list};
use style::media_queries::MediaList as StyleMediaList;
use style::parser::{LengthParsingMode, ParserContext};
use style::shared_lock::{SharedRwLock, Locked};
use style::stylearc::Arc;
use style::stylesheets::CssRuleType;
use style_traits::ToCss;

View file

@ -14,7 +14,7 @@ use dom::bindings::xmlname::namespace_from_domstring;
use dom::element::Element;
use dom::window::Window;
use dom_struct::dom_struct;
use html5ever_atoms::LocalName;
use html5ever::LocalName;
use std::ascii::AsciiExt;
#[dom_struct]

View file

@ -58,7 +58,7 @@ use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::size::Size2D;
use heapsize::{HeapSizeOf, heap_size_of};
use html5ever_atoms::{Prefix, Namespace, QualName};
use html5ever::{Prefix, Namespace, QualName};
use js::jsapi::{JSContext, JSObject, JSRuntime};
use libc::{self, c_void, uintptr_t};
use msg::constellation_msg::PipelineId;
@ -78,10 +78,10 @@ use std::default::Default;
use std::iter;
use std::mem;
use std::ops::Range;
use std::sync::Arc;
use style::context::QuirksMode;
use style::dom::OpaqueNode;
use style::selector_parser::{SelectorImpl, SelectorParser};
use style::stylearc::Arc;
use style::stylesheets::Stylesheet;
use style::thread_state;
use uuid::Uuid;
@ -1749,11 +1749,11 @@ impl Node {
NodeTypeId::Element(..) => {
let element = node.downcast::<Element>().unwrap();
let name = QualName {
prefix: element.prefix().map(|p| Prefix::from(&**p)),
ns: element.namespace().clone(),
local: element.local_name().clone()
};
let element = Element::create(name,
element.prefix().map(|p| Prefix::from(&**p)),
&document, ElementCreator::ScriptCreated);
Root::upcast::<Node>(element)
},

View file

@ -5,38 +5,28 @@
#![allow(unrooted_must_root)]
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::{Castable, CharacterDataTypeId, NodeTypeId};
use dom::bindings::js::{JS, Root};
use dom::bindings::str::DOMString;
use dom::bindings::trace::JSTraceable;
use dom::characterdata::CharacterData;
use dom::comment::Comment;
use dom::document::Document;
use dom::documenttype::DocumentType;
use dom::element::{Element, ElementCreator};
use dom::htmlformelement::{FormControlElementHelpers, HTMLFormElement};
use dom::element::Element;
use dom::htmlscriptelement::HTMLScriptElement;
use dom::htmltemplateelement::HTMLTemplateElement;
use dom::node::Node;
use dom::processinginstruction::ProcessingInstruction;
use dom::virtualmethods::vtable_for;
use html5ever::Attribute;
use dom::servoparser::Sink;
use html5ever::QualName;
use html5ever::serialize::{AttrRef, Serializable, Serializer};
use html5ever::buffer_queue::BufferQueue;
use html5ever::serialize::{AttrRef, Serialize, Serializer};
use html5ever::serialize::TraversalScope;
use html5ever::serialize::TraversalScope::{ChildrenOnly, IncludeNode};
use html5ever::tendril::StrTendril;
use html5ever::tokenizer::{Tokenizer as HtmlTokenizer, TokenizerOpts, TokenizerResult};
use html5ever::tokenizer::buffer_queue::BufferQueue;
use html5ever::tree_builder::{NodeOrText, QuirksMode};
use html5ever::tree_builder::{Tracer as HtmlTracer, TreeBuilder, TreeBuilderOpts, TreeSink};
use html5ever::tree_builder::{Tracer as HtmlTracer, TreeBuilder, TreeBuilderOpts};
use js::jsapi::JSTracer;
use servo_url::ServoUrl;
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::io::{self, Write};
use style::context::QuirksMode as ServoQuirksMode;
use std::io;
#[derive(HeapSizeOf, JSTraceable)]
#[must_root]
@ -55,6 +45,7 @@ impl Tokenizer {
base_url: url,
document: JS::from_ref(document),
current_line: 1,
script: Default::default(),
};
let options = TreeBuilderOpts {
@ -124,179 +115,18 @@ unsafe impl JSTraceable for HtmlTokenizer<TreeBuilder<JS<Node>, Sink>> {
}
}
#[derive(JSTraceable, HeapSizeOf)]
#[must_root]
struct Sink {
base_url: ServoUrl,
document: JS<Document>,
current_line: u64,
}
impl TreeSink for Sink {
type Output = Self;
fn finish(self) -> Self { self }
type Handle = JS<Node>;
fn get_document(&mut self) -> JS<Node> {
JS::from_ref(self.document.upcast())
}
fn get_template_contents(&mut self, target: JS<Node>) -> JS<Node> {
let template = target.downcast::<HTMLTemplateElement>()
.expect("tried to get template contents of non-HTMLTemplateElement in HTML parsing");
JS::from_ref(template.Content().upcast())
}
fn same_node(&self, x: JS<Node>, y: JS<Node>) -> bool {
x == y
}
fn elem_name(&self, target: JS<Node>) -> QualName {
let elem = target.downcast::<Element>()
.expect("tried to get name of non-Element in HTML parsing");
QualName {
ns: elem.namespace().clone(),
local: elem.local_name().clone(),
}
}
fn same_tree(&self, x: JS<Node>, y: JS<Node>) -> bool {
let x = x.downcast::<Element>().expect("Element node expected");
let y = y.downcast::<Element>().expect("Element node expected");
x.is_in_same_home_subtree(y)
}
fn create_element(&mut self, name: QualName, attrs: Vec<Attribute>)
-> JS<Node> {
let elem = Element::create(name, None, &*self.document,
ElementCreator::ParserCreated(self.current_line));
for attr in attrs {
elem.set_attribute_from_parser(attr.name, DOMString::from(String::from(attr.value)), None);
}
JS::from_ref(elem.upcast())
}
fn create_comment(&mut self, text: StrTendril) -> JS<Node> {
let comment = Comment::new(DOMString::from(String::from(text)), &*self.document);
JS::from_ref(comment.upcast())
}
fn has_parent_node(&self, node: JS<Node>) -> bool {
node.GetParentNode().is_some()
}
fn associate_with_form(&mut self, target: JS<Node>, form: JS<Node>) {
let node = target;
let form = Root::downcast::<HTMLFormElement>(Root::from_ref(&*form))
.expect("Owner must be a form element");
let elem = node.downcast::<Element>();
let control = elem.as_ref().and_then(|e| e.as_maybe_form_control());
if let Some(control) = control {
control.set_form_owner_from_parser(&form);
} else {
// TODO remove this code when keygen is implemented.
assert!(node.NodeName() == "KEYGEN", "Unknown form-associatable element");
}
}
fn append_before_sibling(&mut self,
sibling: JS<Node>,
new_node: NodeOrText<JS<Node>>) {
let parent = sibling.GetParentNode()
.expect("append_before_sibling called on node without parent");
super::insert(&parent, Some(&*sibling), new_node);
}
fn parse_error(&mut self, msg: Cow<'static, str>) {
debug!("Parse error: {}", msg);
}
fn set_quirks_mode(&mut self, mode: QuirksMode) {
let mode = match mode {
QuirksMode::Quirks => ServoQuirksMode::Quirks,
QuirksMode::LimitedQuirks => ServoQuirksMode::LimitedQuirks,
QuirksMode::NoQuirks => ServoQuirksMode::NoQuirks,
};
self.document.set_quirks_mode(mode);
}
fn append(&mut self, parent: JS<Node>, child: NodeOrText<JS<Node>>) {
super::insert(&parent, None, child);
}
fn append_doctype_to_document(&mut self, name: StrTendril, public_id: StrTendril,
system_id: StrTendril) {
let doc = &*self.document;
let doctype = DocumentType::new(
DOMString::from(String::from(name)), Some(DOMString::from(String::from(public_id))),
Some(DOMString::from(String::from(system_id))), doc);
doc.upcast::<Node>().AppendChild(doctype.upcast()).expect("Appending failed");
}
fn add_attrs_if_missing(&mut self, target: JS<Node>, attrs: Vec<Attribute>) {
let elem = target.downcast::<Element>()
.expect("tried to set attrs on non-Element in HTML parsing");
for attr in attrs {
elem.set_attribute_from_parser(attr.name, DOMString::from(String::from(attr.value)), None);
}
}
fn remove_from_parent(&mut self, target: JS<Node>) {
if let Some(ref parent) = target.GetParentNode() {
parent.RemoveChild(&*target).unwrap();
}
}
fn mark_script_already_started(&mut self, node: JS<Node>) {
let script = node.downcast::<HTMLScriptElement>();
script.map(|script| script.set_already_started(true));
}
fn reparent_children(&mut self, node: JS<Node>, new_parent: JS<Node>) {
while let Some(ref child) = node.GetFirstChild() {
new_parent.AppendChild(&child).unwrap();
}
}
/// https://html.spec.whatwg.org/multipage/#html-integration-point
/// Specifically, the <annotation-xml> cases.
fn is_mathml_annotation_xml_integration_point(&self, handle: JS<Node>) -> bool {
let elem = handle.downcast::<Element>().unwrap();
elem.get_attribute(&ns!(), &local_name!("encoding")).map_or(false, |attr| {
attr.value().eq_ignore_ascii_case("text/html")
|| attr.value().eq_ignore_ascii_case("application/xhtml+xml")
})
}
fn set_current_line(&mut self, line_number: u64) {
self.current_line = line_number;
}
fn pop(&mut self, node: JS<Node>) {
let node = Root::from_ref(&*node);
vtable_for(&node).pop();
}
}
impl<'a> Serializable for &'a Node {
fn serialize<'wr, Wr: Write>(&self, serializer: &mut Serializer<'wr, Wr>,
traversal_scope: TraversalScope) -> io::Result<()> {
impl<'a> Serialize for &'a Node {
fn serialize<S: Serializer>(&self, serializer: &mut S,
traversal_scope: TraversalScope) -> io::Result<()> {
let node = *self;
match (traversal_scope, node.type_id()) {
(_, NodeTypeId::Element(..)) => {
let elem = node.downcast::<Element>().unwrap();
let name = QualName::new(elem.namespace().clone(),
let name = QualName::new(None, elem.namespace().clone(),
elem.local_name().clone());
if traversal_scope == IncludeNode {
let attrs = elem.attrs().iter().map(|attr| {
let qname = QualName::new(attr.namespace().clone(),
let qname = QualName::new(None, attr.namespace().clone(),
attr.local_name().clone());
let value = attr.value().clone();
(qname, value)

View file

@ -6,27 +6,35 @@ use document_loader::{DocumentLoader, LoadType};
use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::DocumentBinding::{DocumentMethods, DocumentReadyState};
use dom::bindings::codegen::Bindings::HTMLImageElementBinding::HTMLImageElementMethods;
use dom::bindings::codegen::Bindings::HTMLTemplateElementBinding::HTMLTemplateElementMethods;
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::codegen::Bindings::ServoParserBinding;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, Root, RootedReference};
use dom::bindings::js::{JS, MutNullableJS, Root, RootedReference};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflector, reflect_dom_object};
use dom::bindings::str::DOMString;
use dom::characterdata::CharacterData;
use dom::comment::Comment;
use dom::document::{Document, DocumentSource, HasBrowsingContext, IsHTMLDocument};
use dom::element::Element;
use dom::documenttype::DocumentType;
use dom::element::{Element, ElementCreator};
use dom::globalscope::GlobalScope;
use dom::htmlformelement::HTMLFormElement;
use dom::htmlformelement::{FormControlElementHelpers, HTMLFormElement};
use dom::htmlimageelement::HTMLImageElement;
use dom::htmlscriptelement::{HTMLScriptElement, ScriptResult};
use dom::htmltemplateelement::HTMLTemplateElement;
use dom::node::{Node, NodeSiblingIterator};
use dom::processinginstruction::ProcessingInstruction;
use dom::text::Text;
use dom::virtualmethods::vtable_for;
use dom_struct::dom_struct;
use encoding::all::UTF_8;
use encoding::types::{DecoderTrap, Encoding};
use html5ever::tokenizer::buffer_queue::BufferQueue;
use html5ever::tree_builder::NodeOrText;
use html5ever::{Attribute, QualName, ExpandedName};
use html5ever::buffer_queue::BufferQueue;
use html5ever::tendril::StrTendril;
use html5ever::tree_builder::{NodeOrText, TreeSink, NextParserState, QuirksMode, ElementFlags};
use hyper::header::ContentType;
use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper_serde::Serde;
@ -40,8 +48,10 @@ use script_traits::DocumentActivity;
use servo_config::resource_files::read_resource_file;
use servo_url::ServoUrl;
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::cell::Cell;
use std::mem;
use style::context::QuirksMode as ServoQuirksMode;
mod html;
mod xml;
@ -671,3 +681,183 @@ fn insert(parent: &Node, reference_child: Option<&Node>, child: NodeOrText<JS<No
},
}
}
#[derive(JSTraceable, HeapSizeOf)]
#[must_root]
pub struct Sink {
base_url: ServoUrl,
document: JS<Document>,
current_line: u64,
script: MutNullableJS<HTMLScriptElement>,
}
#[allow(unrooted_must_root)] // FIXME: really?
impl TreeSink for Sink {
type Output = Self;
fn finish(self) -> Self { self }
type Handle = JS<Node>;
fn get_document(&mut self) -> JS<Node> {
JS::from_ref(self.document.upcast())
}
fn get_template_contents(&mut self, target: &JS<Node>) -> JS<Node> {
let template = target.downcast::<HTMLTemplateElement>()
.expect("tried to get template contents of non-HTMLTemplateElement in HTML parsing");
JS::from_ref(template.Content().upcast())
}
fn same_node(&self, x: &JS<Node>, y: &JS<Node>) -> bool {
x == y
}
fn elem_name<'a>(&self, target: &'a JS<Node>) -> ExpandedName<'a> {
let elem = target.downcast::<Element>()
.expect("tried to get name of non-Element in HTML parsing");
ExpandedName {
ns: elem.namespace(),
local: elem.local_name(),
}
}
fn same_tree(&self, x: &JS<Node>, y: &JS<Node>) -> bool {
let x = x.downcast::<Element>().expect("Element node expected");
let y = y.downcast::<Element>().expect("Element node expected");
x.is_in_same_home_subtree(y)
}
fn create_element(&mut self, name: QualName, attrs: Vec<Attribute>, _flags: ElementFlags)
-> JS<Node> {
let elem = Element::create(name, &*self.document,
ElementCreator::ParserCreated(self.current_line));
for attr in attrs {
elem.set_attribute_from_parser(attr.name, DOMString::from(String::from(attr.value)), None);
}
JS::from_ref(elem.upcast())
}
fn create_comment(&mut self, text: StrTendril) -> JS<Node> {
let comment = Comment::new(DOMString::from(String::from(text)), &*self.document);
JS::from_ref(comment.upcast())
}
fn create_pi(&mut self, target: StrTendril, data: StrTendril) -> JS<Node> {
let doc = &*self.document;
let pi = ProcessingInstruction::new(
DOMString::from(String::from(target)), DOMString::from(String::from(data)),
doc);
JS::from_ref(pi.upcast())
}
fn has_parent_node(&self, node: &JS<Node>) -> bool {
node.GetParentNode().is_some()
}
fn associate_with_form(&mut self, target: &JS<Node>, form: &JS<Node>) {
let node = target;
let form = Root::downcast::<HTMLFormElement>(Root::from_ref(&**form))
.expect("Owner must be a form element");
let elem = node.downcast::<Element>();
let control = elem.and_then(|e| e.as_maybe_form_control());
if let Some(control) = control {
control.set_form_owner_from_parser(&form);
} else {
// TODO remove this code when keygen is implemented.
assert!(node.NodeName() == "KEYGEN", "Unknown form-associatable element");
}
}
fn append_before_sibling(&mut self,
sibling: &JS<Node>,
new_node: NodeOrText<JS<Node>>) {
let parent = sibling.GetParentNode()
.expect("append_before_sibling called on node without parent");
insert(&parent, Some(&*sibling), new_node);
}
fn parse_error(&mut self, msg: Cow<'static, str>) {
debug!("Parse error: {}", msg);
}
fn set_quirks_mode(&mut self, mode: QuirksMode) {
let mode = match mode {
QuirksMode::Quirks => ServoQuirksMode::Quirks,
QuirksMode::LimitedQuirks => ServoQuirksMode::LimitedQuirks,
QuirksMode::NoQuirks => ServoQuirksMode::NoQuirks,
};
self.document.set_quirks_mode(mode);
}
fn append(&mut self, parent: &JS<Node>, child: NodeOrText<JS<Node>>) {
insert(&parent, None, child);
}
fn append_doctype_to_document(&mut self, name: StrTendril, public_id: StrTendril,
system_id: StrTendril) {
let doc = &*self.document;
let doctype = DocumentType::new(
DOMString::from(String::from(name)), Some(DOMString::from(String::from(public_id))),
Some(DOMString::from(String::from(system_id))), doc);
doc.upcast::<Node>().AppendChild(doctype.upcast()).expect("Appending failed");
}
fn add_attrs_if_missing(&mut self, target: &JS<Node>, attrs: Vec<Attribute>) {
let elem = target.downcast::<Element>()
.expect("tried to set attrs on non-Element in HTML parsing");
for attr in attrs {
elem.set_attribute_from_parser(attr.name, DOMString::from(String::from(attr.value)), None);
}
}
fn remove_from_parent(&mut self, target: &JS<Node>) {
if let Some(ref parent) = target.GetParentNode() {
parent.RemoveChild(&*target).unwrap();
}
}
fn mark_script_already_started(&mut self, node: &JS<Node>) {
let script = node.downcast::<HTMLScriptElement>();
script.map(|script| script.set_already_started(true));
}
fn complete_script(&mut self, node: &JS<Node>) -> NextParserState {
if let Some(script) = node.downcast() {
self.script.set(Some(script));
NextParserState::Suspend
} else {
NextParserState::Continue
}
}
fn reparent_children(&mut self, node: &JS<Node>, new_parent: &JS<Node>) {
while let Some(ref child) = node.GetFirstChild() {
new_parent.AppendChild(&child).unwrap();
}
}
/// https://html.spec.whatwg.org/multipage/#html-integration-point
/// Specifically, the <annotation-xml> cases.
fn is_mathml_annotation_xml_integration_point(&self, handle: &JS<Node>) -> bool {
let elem = handle.downcast::<Element>().unwrap();
elem.get_attribute(&ns!(), &local_name!("encoding")).map_or(false, |attr| {
attr.value().eq_ignore_ascii_case("text/html")
|| attr.value().eq_ignore_ascii_case("application/xhtml+xml")
})
}
fn set_current_line(&mut self, line_number: u64) {
self.current_line = line_number;
}
fn pop(&mut self, node: &JS<Node>) {
let node = Root::from_ref(&**node);
vtable_for(&node).pop();
}
}

View file

@ -4,29 +4,17 @@
#![allow(unrooted_must_root)]
use dom::bindings::codegen::Bindings::NodeBinding::NodeMethods;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::{JS, MutNullableJS, Root};
use dom::bindings::str::DOMString;
use dom::bindings::js::{JS, Root};
use dom::bindings::trace::JSTraceable;
use dom::comment::Comment;
use dom::document::Document;
use dom::documenttype::DocumentType;
use dom::element::{Element, ElementCreator};
use dom::htmlscriptelement::HTMLScriptElement;
use dom::node::Node;
use dom::processinginstruction::ProcessingInstruction;
use dom::virtualmethods::vtable_for;
use html5ever::tokenizer::buffer_queue::BufferQueue;
use html5ever::tree_builder::{NodeOrText as H5eNodeOrText};
use html5ever_atoms::{Prefix, QualName};
use dom::servoparser::Sink;
use js::jsapi::JSTracer;
use servo_url::ServoUrl;
use std::borrow::Cow;
use xml5ever::tendril::StrTendril;
use xml5ever::tokenizer::{Attribute, QName, XmlTokenizer};
use xml5ever::tree_builder::{NextParserState, NodeOrText};
use xml5ever::tree_builder::{Tracer as XmlTracer, TreeSink, XmlTreeBuilder};
use xml5ever::buffer_queue::BufferQueue;
use xml5ever::tokenizer::XmlTokenizer;
use xml5ever::tree_builder::{Tracer as XmlTracer, XmlTreeBuilder};
#[derive(HeapSizeOf, JSTraceable)]
#[must_root]
@ -40,6 +28,7 @@ impl Tokenizer {
let sink = Sink {
base_url: url,
document: JS::from_ref(document),
current_line: 1,
script: Default::default(),
};
@ -86,7 +75,7 @@ unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<JS<Node>, Sink>> {
impl XmlTracer for Tracer {
type Handle = JS<Node>;
#[allow(unrooted_must_root)]
fn trace_handle(&self, node: JS<Node>) {
fn trace_handle(&self, node: &JS<Node>) {
unsafe { node.trace(self.0); }
}
}
@ -96,111 +85,3 @@ unsafe impl JSTraceable for XmlTokenizer<XmlTreeBuilder<JS<Node>, Sink>> {
tree_builder.sink().trace(trc);
}
}
#[derive(JSTraceable, HeapSizeOf)]
#[must_root]
struct Sink {
base_url: ServoUrl,
document: JS<Document>,
script: MutNullableJS<HTMLScriptElement>,
}
impl TreeSink for Sink {
type Output = Self;
type Handle = JS<Node>;
fn finish(self) -> Self {
self
}
fn parse_error(&mut self, msg: Cow<'static, str>) {
debug!("Parse error: {}", msg);
}
fn get_document(&mut self) -> JS<Node> {
JS::from_ref(self.document.upcast())
}
fn elem_name(&self, target: &JS<Node>) -> QName {
let elem = target.downcast::<Element>()
.expect("tried to get name of non-Element in XML parsing");
QName {
prefix: elem.prefix().map_or(namespace_prefix!(""), |p| Prefix::from(&**p)),
namespace_url: elem.namespace().clone(),
local: elem.local_name().clone(),
}
}
fn create_element(&mut self, name: QName, attrs: Vec<Attribute>)
-> JS<Node> {
let prefix = if name.prefix == namespace_prefix!("") { None } else { Some(name.prefix) };
let name = QualName {
ns: name.namespace_url,
local: name.local,
};
//TODO: Add ability to track lines to API of xml5ever
let elem = Element::create(name, prefix, &*self.document,
ElementCreator::ParserCreated(1));
for attr in attrs {
let name = QualName {
ns: attr.name.namespace_url,
local: attr.name.local,
};
elem.set_attribute_from_parser(name, DOMString::from(String::from(attr.value)), None);
}
JS::from_ref(elem.upcast())
}
fn create_comment(&mut self, text: StrTendril) -> JS<Node> {
let comment = Comment::new(DOMString::from(String::from(text)), &*self.document);
JS::from_ref(comment.upcast())
}
fn append(&mut self, parent: JS<Node>, child: NodeOrText<JS<Node>>) {
let child = match child {
NodeOrText::AppendNode(n) => H5eNodeOrText::AppendNode(n),
NodeOrText::AppendText(s) => H5eNodeOrText::AppendText(s),
};
super::insert(&*parent, None, child);
}
fn append_doctype_to_document(&mut self, name: StrTendril, public_id: StrTendril,
system_id: StrTendril) {
let doc = &*self.document;
let doctype = DocumentType::new(
DOMString::from(String::from(name)), Some(DOMString::from(String::from(public_id))),
Some(DOMString::from(String::from(system_id))), doc);
doc.upcast::<Node>().AppendChild(doctype.upcast()).expect("Appending failed");
}
fn create_pi(&mut self, target: StrTendril, data: StrTendril) -> JS<Node> {
let doc = &*self.document;
let pi = ProcessingInstruction::new(
DOMString::from(String::from(target)), DOMString::from(String::from(data)),
doc);
JS::from_ref(pi.upcast())
}
fn mark_script_already_started(&mut self, node: Self::Handle) {
let script = node.downcast::<HTMLScriptElement>();
if let Some(script) = script {
script.set_already_started(true);
}
}
fn complete_script(&mut self, node: Self::Handle) -> NextParserState {
if let Some(script) = node.downcast() {
self.script.set(Some(script));
NextParserState::Suspend
} else {
NextParserState::Continue
}
}
fn pop(&mut self, node: Self::Handle) {
let node = Root::from_ref(&*node);
vtable_for(&node).pop();
}
}

Some files were not shown because too many files have changed in this diff Show more