diff options
author | Christian Poveda <z1mvader@protonmail.com> | 2017-05-03 12:57:49 -0500 |
---|---|---|
committer | Christian Poveda <z1mvader@protonmail.com> | 2017-05-03 12:57:49 -0500 |
commit | 62821a69153441f36b8ff10050a29502dea71037 (patch) | |
tree | bb1560f8965520a1bded497d81c18f1dabfe57e8 /components/script/dom | |
parent | 875e422fe67f68bdf57bd3635279e224b0c90996 (diff) | |
parent | 3905b5af1804ad912c6e1854a0bcdfe9bda79065 (diff) | |
download | servo-62821a69153441f36b8ff10050a29502dea71037.tar.gz servo-62821a69153441f36b8ff10050a29502dea71037.zip |
Solving merge conficts related to the html5ever_atoms -> html5ever change
Diffstat (limited to 'components/script/dom')
104 files changed, 345 insertions, 442 deletions
diff --git a/components/script/dom/attr.rs b/components/script/dom/attr.rs index 55f2adcfdb6..3c775ffdf57 100644 --- a/components/script/dom/attr.rs +++ b/components/script/dom/attr.rs @@ -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; diff --git a/components/script/dom/bindings/str.rs b/components/script/dom/bindings/str.rs index e75958d974a..6cb17fae4e3 100644 --- a/components/script/dom/bindings/str.rs +++ b/components/script/dom/bindings/str.rs @@ -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}; diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 1bc9c165fb1..a0f26d12c23 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -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) diff --git a/components/script/dom/bindings/xmlname.rs b/components/script/dom/bindings/xmlname.rs index 4522c9c4ac0..e688052fba8 100644 --- a/components/script/dom/bindings/xmlname.rs +++ b/components/script/dom/bindings/xmlname.rs @@ -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 { diff --git a/components/script/dom/create.rs b/components/script/dom/create.rs index de20420d03f..91ea3e1e7da 100644 --- a/components/script/dom/create.rs +++ b/components/script/dom/create.rs @@ -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), diff --git a/components/script/dom/cssconditionrule.rs b/components/script/dom/cssconditionrule.rs index 8bf5dad6c93..1944c28c379 100644 --- a/components/script/dom/cssconditionrule.rs +++ b/components/script/dom/cssconditionrule.rs @@ -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] diff --git a/components/script/dom/cssfontfacerule.rs b/components/script/dom/cssfontfacerule.rs index 1f247c25fdc..560722d2452 100644 --- a/components/script/dom/cssfontfacerule.rs +++ b/components/script/dom/cssfontfacerule.rs @@ -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] diff --git a/components/script/dom/cssgroupingrule.rs b/components/script/dom/cssgroupingrule.rs index 249aaccd42e..4fd77b46a7c 100644 --- a/components/script/dom/cssgroupingrule.rs +++ b/components/script/dom/cssgroupingrule.rs @@ -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] diff --git a/components/script/dom/cssimportrule.rs b/components/script/dom/cssimportrule.rs index 3c0eb7eb4aa..d9d867cbc19 100644 --- a/components/script/dom/cssimportrule.rs +++ b/components/script/dom/cssimportrule.rs @@ -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] diff --git a/components/script/dom/csskeyframerule.rs b/components/script/dom/csskeyframerule.rs index d36e8988e04..46dac811d9f 100644 --- a/components/script/dom/csskeyframerule.rs +++ b/components/script/dom/csskeyframerule.rs @@ -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 { diff --git a/components/script/dom/csskeyframesrule.rs b/components/script/dom/csskeyframesrule.rs index a3715e914ed..f48abe60751 100644 --- a/components/script/dom/csskeyframesrule.rs +++ b/components/script/dom/csskeyframesrule.rs @@ -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; diff --git a/components/script/dom/cssmediarule.rs b/components/script/dom/cssmediarule.rs index 45bf65b1adf..afc41d31be0 100644 --- a/components/script/dom/cssmediarule.rs +++ b/components/script/dom/cssmediarule.rs @@ -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; diff --git a/components/script/dom/cssnamespacerule.rs b/components/script/dom/cssnamespacerule.rs index 744a8020667..eafabf8a4a6 100644 --- a/components/script/dom/cssnamespacerule.rs +++ b/components/script/dom/cssnamespacerule.rs @@ -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] diff --git a/components/script/dom/cssrulelist.rs b/components/script/dom/cssrulelist.rs index 67eac2beda2..d0dfe120410 100644 --- a/components/script/dom/cssrulelist.rs +++ b/components/script/dom/cssrulelist.rs @@ -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)] diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index d0996f04567..8b81201de77 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -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 diff --git a/components/script/dom/cssstylerule.rs b/components/script/dom/cssstylerule.rs index fed2b947f90..607f2cfb816 100644 --- a/components/script/dom/cssstylerule.rs +++ b/components/script/dom/cssstylerule.rs @@ -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] diff --git a/components/script/dom/cssstylesheet.rs b/components/script/dom/cssstylesheet.rs index ee097313c2e..cb378b2261a 100644 --- a/components/script/dom/cssstylesheet.rs +++ b/components/script/dom/cssstylesheet.rs @@ -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] diff --git a/components/script/dom/csssupportsrule.rs b/components/script/dom/csssupportsrule.rs index 86aedf10864..9a0743856d6 100644 --- a/components/script/dom/csssupportsrule.rs +++ b/components/script/dom/csssupportsrule.rs @@ -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; diff --git a/components/script/dom/cssviewportrule.rs b/components/script/dom/cssviewportrule.rs index 38abf909ff0..4438aabb53e 100644 --- a/components/script/dom/cssviewportrule.rs +++ b/components/script/dom/cssviewportrule.rs @@ -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] diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 06b8f7596cf..2043c4ed429 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -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>() diff --git a/components/script/dom/domtokenlist.rs b/components/script/dom/domtokenlist.rs index 28266709f67..b07a4357e83 100644 --- a/components/script/dom/domtokenlist.rs +++ b/components/script/dom/domtokenlist.rs @@ -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; diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index c6e04424e3a..d54b79cdc28 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -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) }, diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index af4c692e7d9..2d8657e3564 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -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; diff --git a/components/script/dom/htmlanchorelement.rs b/components/script/dom/htmlanchorelement.rs index dad4002b104..aefa776531c 100644 --- a/components/script/dom/htmlanchorelement.rs +++ b/components/script/dom/htmlanchorelement.rs @@ -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; diff --git a/components/script/dom/htmlappletelement.rs b/components/script/dom/htmlappletelement.rs index 68ae0c32c85..c8d07f48804 100644 --- a/components/script/dom/htmlappletelement.rs +++ b/components/script/dom/htmlappletelement.rs @@ -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] diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 68f8c5cbfa3..548efbd43de 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -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; diff --git a/components/script/dom/htmlaudioelement.rs b/components/script/dom/htmlaudioelement.rs index e121ca6b47d..6d98e94209b 100644 --- a/components/script/dom/htmlaudioelement.rs +++ b/components/script/dom/htmlaudioelement.rs @@ -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 { diff --git a/components/script/dom/htmlbaseelement.rs b/components/script/dom/htmlbaseelement.rs index 38c606f17ff..0b42265617d 100644 --- a/components/script/dom/htmlbaseelement.rs +++ b/components/script/dom/htmlbaseelement.rs @@ -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; diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs index 6dc742b880c..c5c03164a61 100644 --- a/components/script/dom/htmlbodyelement.rs +++ b/components/script/dom/htmlbodyelement.rs @@ -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; diff --git a/components/script/dom/htmlbrelement.rs b/components/script/dom/htmlbrelement.rs index a7f6f38abd3..dba06c52a0f 100644 --- a/components/script/dom/htmlbrelement.rs +++ b/components/script/dom/htmlbrelement.rs @@ -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 { diff --git a/components/script/dom/htmlbuttonelement.rs b/components/script/dom/htmlbuttonelement.rs index a697ec21b88..ee39f3a88c9 100755 --- a/components/script/dom/htmlbuttonelement.rs +++ b/components/script/dom/htmlbuttonelement.rs @@ -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::*; diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index fbd00004af7..6dd10aa3c82 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -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}; diff --git a/components/script/dom/htmlcollection.rs b/components/script/dom/htmlcollection.rs index 4e05de86922..aff4125a29f 100644 --- a/components/script/dom/htmlcollection.rs +++ b/components/script/dom/htmlcollection.rs @@ -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) } diff --git a/components/script/dom/htmldataelement.rs b/components/script/dom/htmldataelement.rs index 2201d9b8c72..baf9c565b4d 100644 --- a/components/script/dom/htmldataelement.rs +++ b/components/script/dom/htmldataelement.rs @@ -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 { diff --git a/components/script/dom/htmldatalistelement.rs b/components/script/dom/htmldatalistelement.rs index 37a7b2f3a75..1603ac39bf7 100644 --- a/components/script/dom/htmldatalistelement.rs +++ b/components/script/dom/htmldatalistelement.rs @@ -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 { diff --git a/components/script/dom/htmldetailselement.rs b/components/script/dom/htmldetailselement.rs index 9f0010b683f..6c44ad48fa9 100644 --- a/components/script/dom/htmldetailselement.rs +++ b/components/script/dom/htmldetailselement.rs @@ -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; diff --git a/components/script/dom/htmldialogelement.rs b/components/script/dom/htmldialogelement.rs index acb8b839d0f..15bbdbfe99e 100644 --- a/components/script/dom/htmldialogelement.rs +++ b/components/script/dom/htmldialogelement.rs @@ -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 { diff --git a/components/script/dom/htmldirectoryelement.rs b/components/script/dom/htmldirectoryelement.rs index bea1c192960..67d1b567c52 100644 --- a/components/script/dom/htmldirectoryelement.rs +++ b/components/script/dom/htmldirectoryelement.rs @@ -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 { diff --git a/components/script/dom/htmldivelement.rs b/components/script/dom/htmldivelement.rs index ea5d8f39f02..6e20b3796f5 100644 --- a/components/script/dom/htmldivelement.rs +++ b/components/script/dom/htmldivelement.rs @@ -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 { diff --git a/components/script/dom/htmldlistelement.rs b/components/script/dom/htmldlistelement.rs index e3ac55598ab..796f104c240 100644 --- a/components/script/dom/htmldlistelement.rs +++ b/components/script/dom/htmldlistelement.rs @@ -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 { diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index 1dc63b7c831..59846595166 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -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; diff --git a/components/script/dom/htmlembedelement.rs b/components/script/dom/htmlembedelement.rs index db522158bbc..0b3c80b9bea 100644 --- a/components/script/dom/htmlembedelement.rs +++ b/components/script/dom/htmlembedelement.rs @@ -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 { diff --git a/components/script/dom/htmlfieldsetelement.rs b/components/script/dom/htmlfieldsetelement.rs index 1cc53e4ec7c..4deb3190340 100644 --- a/components/script/dom/htmlfieldsetelement.rs +++ b/components/script/dom/htmlfieldsetelement.rs @@ -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::*; diff --git a/components/script/dom/htmlfontelement.rs b/components/script/dom/htmlfontelement.rs index c8a8b683d10..618c0d62240 100644 --- a/components/script/dom/htmlfontelement.rs +++ b/components/script/dom/htmlfontelement.rs @@ -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}; diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs index 16555c1abe6..4397364f68f 100755 --- a/components/script/dom/htmlformelement.rs +++ b/components/script/dom/htmlformelement.rs @@ -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; diff --git a/components/script/dom/htmlframeelement.rs b/components/script/dom/htmlframeelement.rs index 0f57c586b4f..68cd8f8a405 100644 --- a/components/script/dom/htmlframeelement.rs +++ b/components/script/dom/htmlframeelement.rs @@ -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 { diff --git a/components/script/dom/htmlframesetelement.rs b/components/script/dom/htmlframesetelement.rs index e653a2119d1..c8d4b440cf8 100644 --- a/components/script/dom/htmlframesetelement.rs +++ b/components/script/dom/htmlframesetelement.rs @@ -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 { diff --git a/components/script/dom/htmlheadelement.rs b/components/script/dom/htmlheadelement.rs index 7c469b93488..5c14f110c8f 100644 --- a/components/script/dom/htmlheadelement.rs +++ b/components/script/dom/htmlheadelement.rs @@ -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 { diff --git a/components/script/dom/htmlheadingelement.rs b/components/script/dom/htmlheadingelement.rs index a7ec1a8ec24..ca60441ac93 100644 --- a/components/script/dom/htmlheadingelement.rs +++ b/components/script/dom/htmlheadingelement.rs @@ -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 { diff --git a/components/script/dom/htmlhrelement.rs b/components/script/dom/htmlhrelement.rs index cb1b90f4e17..85b160bb848 100644 --- a/components/script/dom/htmlhrelement.rs +++ b/components/script/dom/htmlhrelement.rs @@ -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] diff --git a/components/script/dom/htmlhtmlelement.rs b/components/script/dom/htmlhtmlelement.rs index 07f17d366d1..47aa909035d 100644 --- a/components/script/dom/htmlhtmlelement.rs +++ b/components/script/dom/htmlhtmlelement.rs @@ -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 { diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 3f410bdce54..e1a7fb7c672 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -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}; diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index 066f0ef6959..b706288a2cf 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -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}; diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index 9da2f4be30a..fc20326b906 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -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}; diff --git a/components/script/dom/htmllabelelement.rs b/components/script/dom/htmllabelelement.rs index d1bde9cd957..cd5044fe4ed 100644 --- a/components/script/dom/htmllabelelement.rs +++ b/components/script/dom/htmllabelelement.rs @@ -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] diff --git a/components/script/dom/htmllegendelement.rs b/components/script/dom/htmllegendelement.rs index f2e04fceea3..d527df711ef 100644 --- a/components/script/dom/htmllegendelement.rs +++ b/components/script/dom/htmllegendelement.rs @@ -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 { diff --git a/components/script/dom/htmllielement.rs b/components/script/dom/htmllielement.rs index 6a39905ae99..9d949764a61 100644 --- a/components/script/dom/htmllielement.rs +++ b/components/script/dom/htmllielement.rs @@ -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] diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs index b2c276ad292..09f24ace0d7 100644 --- a/components/script/dom/htmllinkelement.rs +++ b/components/script/dom/htmllinkelement.rs @@ -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}; diff --git a/components/script/dom/htmlmapelement.rs b/components/script/dom/htmlmapelement.rs index ce64f13edc2..e3ec4dc42eb 100644 --- a/components/script/dom/htmlmapelement.rs +++ b/components/script/dom/htmlmapelement.rs @@ -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 { diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 30820cc5734..679294dae1a 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -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}; diff --git a/components/script/dom/htmlmetaelement.rs b/components/script/dom/htmlmetaelement.rs index 878bf44d1c3..30bce19c299 100644 --- a/components/script/dom/htmlmetaelement.rs +++ b/components/script/dom/htmlmetaelement.rs @@ -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; diff --git a/components/script/dom/htmlmeterelement.rs b/components/script/dom/htmlmeterelement.rs index 7eccf0a5ec2..ccf1e9a07bb 100644 --- a/components/script/dom/htmlmeterelement.rs +++ b/components/script/dom/htmlmeterelement.rs @@ -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 { diff --git a/components/script/dom/htmlmodelement.rs b/components/script/dom/htmlmodelement.rs index 07335e71cc5..fc3ac075242 100644 --- a/components/script/dom/htmlmodelement.rs +++ b/components/script/dom/htmlmodelement.rs @@ -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 { diff --git a/components/script/dom/htmlobjectelement.rs b/components/script/dom/htmlobjectelement.rs index c2a3224d0d9..28ce00942cc 100755 --- a/components/script/dom/htmlobjectelement.rs +++ b/components/script/dom/htmlobjectelement.rs @@ -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 { diff --git a/components/script/dom/htmlolistelement.rs b/components/script/dom/htmlolistelement.rs index cb3dff65354..42351aea0ff 100644 --- a/components/script/dom/htmlolistelement.rs +++ b/components/script/dom/htmlolistelement.rs @@ -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 { diff --git a/components/script/dom/htmloptgroupelement.rs b/components/script/dom/htmloptgroupelement.rs index 8ba57318d77..d7a50906a76 100644 --- a/components/script/dom/htmloptgroupelement.rs +++ b/components/script/dom/htmloptgroupelement.rs @@ -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] diff --git a/components/script/dom/htmloptionelement.rs b/components/script/dom/htmloptionelement.rs index 0db31d89240..251bbc62a84 100644 --- a/components/script/dom/htmloptionelement.rs +++ b/components/script/dom/htmloptionelement.rs @@ -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}; diff --git a/components/script/dom/htmloutputelement.rs b/components/script/dom/htmloutputelement.rs index ad09228ab74..f0b9377e447 100644 --- a/components/script/dom/htmloutputelement.rs +++ b/components/script/dom/htmloutputelement.rs @@ -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 { diff --git a/components/script/dom/htmlparagraphelement.rs b/components/script/dom/htmlparagraphelement.rs index f946e8d64e3..f0b0e176152 100644 --- a/components/script/dom/htmlparagraphelement.rs +++ b/components/script/dom/htmlparagraphelement.rs @@ -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 { diff --git a/components/script/dom/htmlparamelement.rs b/components/script/dom/htmlparamelement.rs index f7c3079b4ae..46dd705ef3b 100644 --- a/components/script/dom/htmlparamelement.rs +++ b/components/script/dom/htmlparamelement.rs @@ -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 { diff --git a/components/script/dom/htmlpreelement.rs b/components/script/dom/htmlpreelement.rs index 96cfab5924d..76862160847 100644 --- a/components/script/dom/htmlpreelement.rs +++ b/components/script/dom/htmlpreelement.rs @@ -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 { diff --git a/components/script/dom/htmlprogresselement.rs b/components/script/dom/htmlprogresselement.rs index ce837906727..2ad3371da94 100644 --- a/components/script/dom/htmlprogresselement.rs +++ b/components/script/dom/htmlprogresselement.rs @@ -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 { diff --git a/components/script/dom/htmlquoteelement.rs b/components/script/dom/htmlquoteelement.rs index da5756a4618..7ccb59b5e84 100644 --- a/components/script/dom/htmlquoteelement.rs +++ b/components/script/dom/htmlquoteelement.rs @@ -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 { diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs index 450c3e6c892..a29490ff5f4 100644 --- a/components/script/dom/htmlscriptelement.rs +++ b/components/script/dom/htmlscriptelement.rs @@ -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; diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs index a9adefc92fb..1f4f3c426bf 100755 --- a/components/script/dom/htmlselectelement.rs +++ b/components/script/dom/htmlselectelement.rs @@ -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; diff --git a/components/script/dom/htmlsourceelement.rs b/components/script/dom/htmlsourceelement.rs index ddc343c1e59..84adbc16548 100644 --- a/components/script/dom/htmlsourceelement.rs +++ b/components/script/dom/htmlsourceelement.rs @@ -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 { diff --git a/components/script/dom/htmlspanelement.rs b/components/script/dom/htmlspanelement.rs index 5d98797260f..657b4aca17b 100644 --- a/components/script/dom/htmlspanelement.rs +++ b/components/script/dom/htmlspanelement.rs @@ -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 { diff --git a/components/script/dom/htmlstyleelement.rs b/components/script/dom/htmlstyleelement.rs index 531dc45ff2f..e96954efe26 100644 --- a/components/script/dom/htmlstyleelement.rs +++ b/components/script/dom/htmlstyleelement.rs @@ -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}; diff --git a/components/script/dom/htmltablecaptionelement.rs b/components/script/dom/htmltablecaptionelement.rs index 2dab17ee42a..b21a00bc190 100644 --- a/components/script/dom/htmltablecaptionelement.rs +++ b/components/script/dom/htmltablecaptionelement.rs @@ -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 { diff --git a/components/script/dom/htmltablecellelement.rs b/components/script/dom/htmltablecellelement.rs index fd613d144e6..de0bab2ce9a 100644 --- a/components/script/dom/htmltablecellelement.rs +++ b/components/script/dom/htmltablecellelement.rs @@ -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; diff --git a/components/script/dom/htmltablecolelement.rs b/components/script/dom/htmltablecolelement.rs index bf43f4ca3a7..875e6e696bd 100644 --- a/components/script/dom/htmltablecolelement.rs +++ b/components/script/dom/htmltablecolelement.rs @@ -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 { diff --git a/components/script/dom/htmltabledatacellelement.rs b/components/script/dom/htmltabledatacellelement.rs index e2430082c75..1c70ffbd8fb 100644 --- a/components/script/dom/htmltabledatacellelement.rs +++ b/components/script/dom/htmltabledatacellelement.rs @@ -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 { diff --git a/components/script/dom/htmltableelement.rs b/components/script/dom/htmltableelement.rs index b1e928b292e..3e0310dad9a 100644 --- a/components/script/dom/htmltableelement.rs +++ b/components/script/dom/htmltableelement.rs @@ -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}; diff --git a/components/script/dom/htmltableheadercellelement.rs b/components/script/dom/htmltableheadercellelement.rs index a0607d9b3f6..7655db7ee77 100644 --- a/components/script/dom/htmltableheadercellelement.rs +++ b/components/script/dom/htmltableheadercellelement.rs @@ -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 { diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs index 5faf50cdae1..d18ef77f8d8 100644 --- a/components/script/dom/htmltablerowelement.rs +++ b/components/script/dom/htmltablerowelement.rs @@ -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)] diff --git a/components/script/dom/htmltablesectionelement.rs b/components/script/dom/htmltablesectionelement.rs index 2da0f8b0843..66703305bc7 100644 --- a/components/script/dom/htmltablesectionelement.rs +++ b/components/script/dom/htmltablesectionelement.rs @@ -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] diff --git a/components/script/dom/htmltemplateelement.rs b/components/script/dom/htmltemplateelement.rs index 4798cd6c46d..9b058607aff 100644 --- a/components/script/dom/htmltemplateelement.rs +++ b/components/script/dom/htmltemplateelement.rs @@ -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 { diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs index c93fbc080a1..3033480b03d 100755 --- a/components/script/dom/htmltextareaelement.rs +++ b/components/script/dom/htmltextareaelement.rs @@ -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; diff --git a/components/script/dom/htmltimeelement.rs b/components/script/dom/htmltimeelement.rs index 41846635df1..7fc3245ed41 100644 --- a/components/script/dom/htmltimeelement.rs +++ b/components/script/dom/htmltimeelement.rs @@ -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 { diff --git a/components/script/dom/htmltitleelement.rs b/components/script/dom/htmltitleelement.rs index 092ec9d62ea..751f3c0ef2e 100644 --- a/components/script/dom/htmltitleelement.rs +++ b/components/script/dom/htmltitleelement.rs @@ -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 { diff --git a/components/script/dom/htmltrackelement.rs b/components/script/dom/htmltrackelement.rs index 8339a49734a..eb9a5ecf80d 100644 --- a/components/script/dom/htmltrackelement.rs +++ b/components/script/dom/htmltrackelement.rs @@ -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 { diff --git a/components/script/dom/htmlulistelement.rs b/components/script/dom/htmlulistelement.rs index 4275364b198..b40f4a1f8db 100644 --- a/components/script/dom/htmlulistelement.rs +++ b/components/script/dom/htmlulistelement.rs @@ -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 { diff --git a/components/script/dom/htmlunknownelement.rs b/components/script/dom/htmlunknownelement.rs index d9f533e1364..cb3db5be292 100644 --- a/components/script/dom/htmlunknownelement.rs +++ b/components/script/dom/htmlunknownelement.rs @@ -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 { diff --git a/components/script/dom/htmlvideoelement.rs b/components/script/dom/htmlvideoelement.rs index f7602e860d5..00befe9a109 100644 --- a/components/script/dom/htmlvideoelement.rs +++ b/components/script/dom/htmlvideoelement.rs @@ -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 { diff --git a/components/script/dom/medialist.rs b/components/script/dom/medialist.rs index f2a2299d169..514bccecc4a 100644 --- a/components/script/dom/medialist.rs +++ b/components/script/dom/medialist.rs @@ -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; diff --git a/components/script/dom/namednodemap.rs b/components/script/dom/namednodemap.rs index 273b87c8d00..9d92bf11c2d 100644 --- a/components/script/dom/namednodemap.rs +++ b/components/script/dom/namednodemap.rs @@ -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] diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 0384c4ed19d..6f65faaed07 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -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) }, diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index 6142dba20f6..f25e95507e4 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -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) diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 3904910d3a3..39c199a34f7 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -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(); + } +} diff --git a/components/script/dom/servoparser/xml.rs b/components/script/dom/servoparser/xml.rs index 1ef5f882db0..da5e1987253 100644 --- a/components/script/dom/servoparser/xml.rs +++ b/components/script/dom/servoparser/xml.rs @@ -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(); - } -} diff --git a/components/script/dom/svgelement.rs b/components/script/dom/svgelement.rs index 022b04232db..2be5b9613f2 100644 --- a/components/script/dom/svgelement.rs +++ b/components/script/dom/svgelement.rs @@ -7,7 +7,7 @@ use dom::document::Document; use dom::element::Element; use dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; -use html5ever_atoms::{LocalName, Prefix}; +use html5ever::{LocalName, Prefix}; use style::element_state::ElementState; #[dom_struct] diff --git a/components/script/dom/svggraphicselement.rs b/components/script/dom/svggraphicselement.rs index a25c4b169f6..4e4f6fadf65 100644 --- a/components/script/dom/svggraphicselement.rs +++ b/components/script/dom/svggraphicselement.rs @@ -7,7 +7,7 @@ use dom::document::Document; use dom::svgelement::SVGElement; use dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; -use html5ever_atoms::{LocalName, Prefix}; +use html5ever::{LocalName, Prefix}; use style::element_state::ElementState; #[dom_struct] diff --git a/components/script/dom/svgsvgelement.rs b/components/script/dom/svgsvgelement.rs index e94001b2d51..90a272885a0 100644 --- a/components/script/dom/svgsvgelement.rs +++ b/components/script/dom/svgsvgelement.rs @@ -13,7 +13,7 @@ use dom::node::Node; use dom::svggraphicselement::SVGGraphicsElement; use dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; -use html5ever_atoms::{LocalName, Prefix}; +use html5ever::{LocalName, Prefix}; use script_layout_interface::SVGSVGData; use style::attr::AttrValue; diff --git a/components/script/dom/virtualmethods.rs b/components/script/dom/virtualmethods.rs index 8ff47f9ced5..ecb4d2ee559 100644 --- a/components/script/dom/virtualmethods.rs +++ b/components/script/dom/virtualmethods.rs @@ -51,7 +51,7 @@ use dom::htmltextareaelement::HTMLTextAreaElement; use dom::htmltitleelement::HTMLTitleElement; use dom::node::{ChildrenMutation, CloneChildrenFlag, Node, UnbindContext}; use dom::svgsvgelement::SVGSVGElement; -use html5ever_atoms::LocalName; +use html5ever::LocalName; use style::attr::AttrValue; /// Trait to allow DOM nodes to opt-in to overriding (or adding to) common |