mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Solving merge conficts related to the html5ever_atoms -> html5ever change
This commit is contained in:
commit
62821a6915
188 changed files with 1130 additions and 697 deletions
|
@ -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;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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>()
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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::*;
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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::*;
|
||||
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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};
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
},
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
Loading…
Add table
Add a link
Reference in a new issue