Update string_cache to 0.2.

Updated string_cache, html5ever, xml5ever and selectors in Cargo.toml files and Cargo.lock.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced atom!(foo) by atom!("foo").
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
This commit is contained in:
Alan Jeffrey 2015-11-24 13:44:59 -06:00
parent e7b1924948
commit 3dec6edd10
68 changed files with 328 additions and 434 deletions

View file

@ -22,7 +22,7 @@ rustc-serialize = "0.3"
serde = "0.6" serde = "0.6"
serde_macros = "0.6" serde_macros = "0.6"
smallvec = "0.1" smallvec = "0.1"
string_cache = "0.1" string_cache = "0.2"
time = "0.1.12" time = "0.1.12"
unicode-script = { version = "0.1", features = ["harfbuzz"] } unicode-script = { version = "0.1", features = ["harfbuzz"] }

View file

@ -174,7 +174,7 @@ impl FontCache {
Source::Local(ref local_family_name) => { Source::Local(ref local_family_name) => {
let family = &mut self.web_families.get_mut(&family_name).unwrap(); let family = &mut self.web_families.get_mut(&family_name).unwrap();
for_each_variation(&local_family_name, |path| { for_each_variation(&local_family_name, |path| {
family.add_template(Atom::from_slice(&path), None); family.add_template(Atom::from(&*path), None);
}); });
result.send(()).unwrap(); result.send(()).unwrap();
} }
@ -182,7 +182,7 @@ impl FontCache {
} }
Command::AddDownloadedWebFont(family_name, url, bytes, result) => { Command::AddDownloadedWebFont(family_name, url, bytes, result) => {
let family = &mut self.web_families.get_mut(&family_name).unwrap(); let family = &mut self.web_families.get_mut(&family_name).unwrap();
family.add_template(Atom::from_slice(&url.to_string()), Some(bytes)); family.add_template(Atom::from(&*url.to_string()), Some(bytes));
drop(result.send(())); drop(result.send(()));
} }
Command::Exit(result) => { Command::Exit(result) => {
@ -221,7 +221,7 @@ impl FontCache {
if s.templates.is_empty() { if s.templates.is_empty() {
for_each_variation(family_name, |path| { for_each_variation(family_name, |path| {
s.add_template(Atom::from_slice(&path), None); s.add_template(Atom::from(&*path), None);
}); });
} }

View file

@ -24,7 +24,7 @@ impl FontTemplateData {
}, },
None => { None => {
// TODO: Handle file load failure! // TODO: Handle file load failure!
let mut file = File::open(identifier.as_slice()).unwrap(); let mut file = File::open(&*identifier).unwrap();
let mut buffer = vec![]; let mut buffer = vec![];
file.read_to_end(&mut buffer).unwrap(); file.read_to_end(&mut buffer).unwrap();
buffer buffer

View file

@ -57,7 +57,7 @@ impl FontTemplateData {
Err(_) => None Err(_) => None
} }
} }
None => core_text::font::new_from_name(self.identifier.as_slice(), 0.0).ok(), None => core_text::font::new_from_name(&*self.identifier, 0.0).ok(),
} }
} }
ctfont.as_ref().map(|ctfont| (*ctfont).clone()) ctfont.as_ref().map(|ctfont| (*ctfont).clone())

View file

@ -71,8 +71,7 @@ rustc-serialize = "0.3"
libc = "0.1" libc = "0.1"
selectors = "0.2" selectors = "0.2"
smallvec = "0.1" smallvec = "0.1"
string_cache = "0.1" string_cache = "0.2"
string_cache_plugin = "0.1"
euclid = {version = "0.3", features = ["plugins"]} euclid = {version = "0.3", features = ["plugins"]}
serde = "0.6" serde = "0.6"
serde_macros = "0.6" serde_macros = "0.6"

View file

@ -1642,7 +1642,7 @@ trait ObjectElement<'a> {
impl<'ln> ObjectElement<'ln> for ServoThreadSafeLayoutNode<'ln> { impl<'ln> ObjectElement<'ln> for ServoThreadSafeLayoutNode<'ln> {
fn get_type_and_data(&self) -> (Option<&'ln str>, Option<&'ln str>) { fn get_type_and_data(&self) -> (Option<&'ln str>, Option<&'ln str>) {
let elem = self.as_element(); let elem = self.as_element();
(elem.get_attr(&ns!(""), &atom!("type")), elem.get_attr(&ns!(""), &atom!("data"))) (elem.get_attr(&ns!(), &atom!("type")), elem.get_attr(&ns!(), &atom!("data")))
} }
fn has_object_data(&self) -> bool { fn has_object_data(&self) -> bool {

View file

@ -166,12 +166,12 @@ fn create_common_style_affecting_attributes_from_element(element: &ServoLayoutEl
for attribute_info in &common_style_affecting_attributes() { for attribute_info in &common_style_affecting_attributes() {
match attribute_info.mode { match attribute_info.mode {
CommonStyleAffectingAttributeMode::IsPresent(flag) => { CommonStyleAffectingAttributeMode::IsPresent(flag) => {
if element.get_attr(&ns!(""), &attribute_info.atom).is_some() { if element.get_attr(&ns!(), &attribute_info.atom).is_some() {
flags.insert(flag) flags.insert(flag)
} }
} }
CommonStyleAffectingAttributeMode::IsEqual(target_value, flag) => { CommonStyleAffectingAttributeMode::IsEqual(target_value, flag) => {
match element.get_attr(&ns!(""), &attribute_info.atom) { match element.get_attr(&ns!(), &attribute_info.atom) {
Some(element_value) if element_value == target_value => { Some(element_value) if element_value == target_value => {
flags.insert(flag) flags.insert(flag)
} }
@ -248,7 +248,7 @@ impl StyleSharingCandidate {
style: style, style: style,
parent_style: parent_style, parent_style: parent_style,
local_name: element.get_local_name().clone(), local_name: element.get_local_name().clone(),
class: element.get_attr(&ns!(""), &atom!("class")) class: element.get_attr(&ns!(), &atom!("class"))
.map(|string| string.to_owned()), .map(|string| string.to_owned()),
link: element.is_link(), link: element.is_link(),
namespace: (*element.get_namespace()).clone(), namespace: (*element.get_namespace()).clone(),
@ -263,7 +263,7 @@ impl StyleSharingCandidate {
} }
// FIXME(pcwalton): Use `each_class` here instead of slow string comparison. // FIXME(pcwalton): Use `each_class` here instead of slow string comparison.
match (&self.class, element.get_attr(&ns!(""), &atom!("class"))) { match (&self.class, element.get_attr(&ns!(), &atom!("class"))) {
(&None, Some(_)) | (&Some(_), None) => return false, (&None, Some(_)) | (&Some(_), None) => return false,
(&Some(ref this_class), Some(element_class)) if (&Some(ref this_class), Some(element_class)) if
element_class != &**this_class => { element_class != &**this_class => {
@ -289,12 +289,12 @@ impl StyleSharingCandidate {
match attribute_info.mode { match attribute_info.mode {
CommonStyleAffectingAttributeMode::IsPresent(flag) => { CommonStyleAffectingAttributeMode::IsPresent(flag) => {
if self.common_style_affecting_attributes.contains(flag) != if self.common_style_affecting_attributes.contains(flag) !=
element.get_attr(&ns!(""), &attribute_info.atom).is_some() { element.get_attr(&ns!(), &attribute_info.atom).is_some() {
return false return false
} }
} }
CommonStyleAffectingAttributeMode::IsEqual(target_value, flag) => { CommonStyleAffectingAttributeMode::IsEqual(target_value, flag) => {
match element.get_attr(&ns!(""), &attribute_info.atom) { match element.get_attr(&ns!(), &attribute_info.atom) {
Some(ref element_value) if self.common_style_affecting_attributes Some(ref element_value) if self.common_style_affecting_attributes
.contains(flag) && .contains(flag) &&
*element_value != target_value => { *element_value != target_value => {
@ -313,7 +313,7 @@ impl StyleSharingCandidate {
} }
for attribute_name in &rare_style_affecting_attributes() { for attribute_name in &rare_style_affecting_attributes() {
if element.get_attr(&ns!(""), attribute_name).is_some() { if element.get_attr(&ns!(), attribute_name).is_some() {
return false return false
} }
} }
@ -621,7 +621,7 @@ impl<'ln> ElementMatchMethods for ServoLayoutElement<'ln> {
if self.style_attribute().is_some() { if self.style_attribute().is_some() {
return StyleSharingResult::CannotShare return StyleSharingResult::CannotShare
} }
if self.get_attr(&ns!(""), &atom!("id")).is_some() { if self.get_attr(&ns!(), &atom!("id")).is_some() {
return StyleSharingResult::CannotShare return StyleSharingResult::CannotShare
} }

View file

@ -351,7 +351,7 @@ impl ImageFragmentInfo {
-> ImageFragmentInfo { -> ImageFragmentInfo {
fn convert_length(node: &ServoThreadSafeLayoutNode, name: &Atom) -> Option<Au> { fn convert_length(node: &ServoThreadSafeLayoutNode, name: &Atom) -> Option<Au> {
let element = node.as_element(); let element = node.as_element();
element.get_attr(&ns!(""), name) element.get_attr(&ns!(), name)
.and_then(|string| string.parse().ok()) .and_then(|string| string.parse().ok())
.map(Au::from_px) .map(Au::from_px)
} }
@ -760,7 +760,7 @@ impl TableColumnFragmentInfo {
/// Create the information specific to an table column fragment. /// Create the information specific to an table column fragment.
pub fn new(node: &ServoThreadSafeLayoutNode) -> TableColumnFragmentInfo { pub fn new(node: &ServoThreadSafeLayoutNode) -> TableColumnFragmentInfo {
let element = node.as_element(); let element = node.as_element();
let span = element.get_attr(&ns!(""), &atom!("span")) let span = element.get_attr(&ns!(), &atom!("span"))
.and_then(|string| string.parse().ok()) .and_then(|string| string.parse().ok())
.unwrap_or(0); .unwrap_or(0);
TableColumnFragmentInfo { TableColumnFragmentInfo {

View file

@ -16,7 +16,6 @@
#![deny(unsafe_code)] #![deny(unsafe_code)]
#![plugin(string_cache_plugin)]
#![plugin(plugins)] #![plugin(plugins)]
extern crate app_units; extern crate app_units;
@ -52,7 +51,7 @@ extern crate script_traits;
extern crate serde; extern crate serde;
extern crate serde_json; extern crate serde_json;
extern crate smallvec; extern crate smallvec;
extern crate string_cache; #[macro_use(atom, ns)] extern crate string_cache;
extern crate style; extern crate style;
extern crate unicode_bidi; extern crate unicode_bidi;
extern crate unicode_script; extern crate unicode_script;

View file

@ -555,7 +555,7 @@ pub fn process_resolved_style_request(requested_node: ServoLayoutNode,
} }
// FIXME: implement used value computation for line-height // FIXME: implement used value computation for line-height
ref property => { ref property => {
style.computed_value_to_string(property.as_slice()).ok() style.computed_value_to_string(&*property).ok()
} }
} }
} }

View file

@ -662,7 +662,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) | NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLAreaElement)) |
NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => { NodeTypeId::Element(ElementTypeId::HTMLElement(HTMLElementTypeId::HTMLLinkElement)) => {
unsafe { unsafe {
(*self.element.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("href")).is_some() (*self.element.unsafe_get()).get_attr_val_for_layout(&ns!(), &atom!("href")).is_some()
} }
} }
_ => false, _ => false,
@ -712,7 +712,7 @@ impl<'le> ::selectors::Element for ServoLayoutElement<'le> {
#[inline] #[inline]
fn has_servo_nonzero_border(&self) -> bool { fn has_servo_nonzero_border(&self) -> bool {
unsafe { unsafe {
match (*self.element.unsafe_get()).get_attr_for_layout(&ns!(""), &atom!("border")) { match (*self.element.unsafe_get()).get_attr_for_layout(&ns!(), &atom!("border")) {
None | Some(&AttrValue::UInt(_, 0)) => false, None | Some(&AttrValue::UInt(_, 0)) => false,
_ => true, _ => true,
} }

View file

@ -84,8 +84,7 @@ uuid = "0.1.16"
smallvec = "0.1" smallvec = "0.1"
html5ever = { version = "0.2.1", features = ["unstable"] } html5ever = { version = "0.2.1", features = ["unstable"] }
selectors = "0.2" selectors = "0.2"
string_cache = { version = "0.1.15", features = ["unstable"] } string_cache = { version = "0.2", features = ["unstable"] }
string_cache_plugin = "0.1"
euclid = {version = "0.3", features = ["plugins"]} euclid = {version = "0.3", features = ["plugins"]}
tendril = "0.1.1" tendril = "0.1.1"
rand = "0.3" rand = "0.3"

View file

@ -170,7 +170,7 @@ impl Attr {
assert!(Some(owner) == self.owner().r()); assert!(Some(owner) == self.owner().r());
owner.will_mutate_attr(); owner.will_mutate_attr();
mem::swap(&mut *self.value.borrow_mut(), &mut value); mem::swap(&mut *self.value.borrow_mut(), &mut value);
if self.identifier.namespace == ns!("") { if self.identifier.namespace == ns!() {
vtable_for(owner.upcast()) vtable_for(owner.upcast())
.attribute_mutated(self, AttributeMutation::Set(Some(&value))); .attribute_mutated(self, AttributeMutation::Set(Some(&value)));
} }

View file

@ -57,25 +57,25 @@ pub fn validate_and_extract(namespace: Option<DOMString>,
debug_assert!(!local_name.contains(colon)); debug_assert!(!local_name.contains(colon));
match (namespace, maybe_prefix) { match (namespace, maybe_prefix) {
(ns!(""), Some(_)) => { (ns!(), Some(_)) => {
// Step 6. // Step 6.
Err(Error::Namespace) Err(Error::Namespace)
}, },
(ref ns, Some("xml")) if ns != &ns!(XML) => { (ref ns, Some("xml")) if ns != &ns!(xml) => {
// Step 7. // Step 7.
Err(Error::Namespace) Err(Error::Namespace)
}, },
(ref ns, p) if ns != &ns!(XMLNS) && (qualified_name == "xmlns" || p == Some("xmlns")) => { (ref ns, p) if ns != &ns!(xmlns) && (qualified_name == "xmlns" || p == Some("xmlns")) => {
// Step 8. // Step 8.
Err(Error::Namespace) Err(Error::Namespace)
}, },
(ns!(XMLNS), p) if qualified_name != "xmlns" && p != Some("xmlns") => { (ns!(xmlns), p) if qualified_name != "xmlns" && p != Some("xmlns") => {
// Step 9. // Step 9.
Err(Error::Namespace) Err(Error::Namespace)
}, },
(ns, p) => { (ns, p) => {
// Step 10. // Step 10.
Ok((ns, p.map(Atom::from_slice), Atom::from_slice(local_name))) Ok((ns, p.map(Atom::from), Atom::from(local_name)))
} }
} }
} }
@ -171,7 +171,7 @@ pub fn xml_name_type(name: &str) -> XMLName {
/// If the URL is None, returns the empty namespace. /// If the URL is None, returns the empty namespace.
pub fn namespace_from_domstring(url: Option<DOMString>) -> Namespace { pub fn namespace_from_domstring(url: Option<DOMString>) -> Namespace {
match url { match url {
None => ns!(""), None => ns!(),
Some(ref s) => Namespace(Atom::from_slice(s)), Some(s) => Namespace(Atom::from(&*s)),
} }
} }

View file

@ -86,7 +86,7 @@ pub fn create_element(name: QualName,
let prefix = prefix.map(|p| DOMString::from(&*p)); let prefix = prefix.map(|p| DOMString::from(&*p));
if name.ns != ns!(HTML) { if name.ns != ns!(html) {
return Element::new(DOMString::from(&*name.local), name.ns, prefix, document); return Element::new(DOMString::from(&*name.local), name.ns, prefix, document);
} }

View file

@ -145,7 +145,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// Step 1 // Step 1
property.make_ascii_lowercase(); property.make_ascii_lowercase();
let property = Atom::from_slice(&property); let property = Atom::from(&*property);
if self.readonly { if self.readonly {
// Readonly style declarations are used for getComputedStyle. // Readonly style declarations are used for getComputedStyle.
@ -160,7 +160,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
// Step 2.2 // Step 2.2
for longhand in shorthand.longhands() { for longhand in shorthand.longhands() {
// Step 2.2.1 // Step 2.2.1
let declaration = owner.get_inline_style_declaration(&Atom::from_slice(&longhand)); let declaration = owner.get_inline_style_declaration(&Atom::from(*longhand));
// Step 2.2.2 & 2.2.3 // Step 2.2.2 & 2.2.3
match declaration { match declaration {
@ -185,7 +185,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
fn GetPropertyPriority(&self, mut property: DOMString) -> DOMString { fn GetPropertyPriority(&self, mut property: DOMString) -> DOMString {
// Step 1 // Step 1
property.make_ascii_lowercase(); property.make_ascii_lowercase();
let property = Atom::from_slice(&property); let property = Atom::from(&*property);
// Step 2 // Step 2
if let Some(shorthand) = Shorthand::from_name(&property) { if let Some(shorthand) = Shorthand::from_name(&property) {

View file

@ -478,10 +478,10 @@ impl Document {
/// Attempt to find a named element in this page's document. /// Attempt to find a named element in this page's document.
/// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document /// https://html.spec.whatwg.org/multipage/#the-indicated-part-of-the-document
pub fn find_fragment_node(&self, fragid: &str) -> Option<Root<Element>> { pub fn find_fragment_node(&self, fragid: &str) -> Option<Root<Element>> {
self.get_element_by_id(&Atom::from_slice(fragid)).or_else(|| { self.get_element_by_id(&Atom::from(fragid)).or_else(|| {
let check_anchor = |node: &HTMLAnchorElement| { let check_anchor = |node: &HTMLAnchorElement| {
let elem = node.upcast::<Element>(); let elem = node.upcast::<Element>();
elem.get_attribute(&ns!(""), &atom!("name")) elem.get_attribute(&ns!(), &atom!("name"))
.map_or(false, |attr| &**attr.value() == fragid) .map_or(false, |attr| &**attr.value() == fragid)
}; };
let doc_node = self.upcast::<Node>(); let doc_node = self.upcast::<Node>();
@ -1037,7 +1037,7 @@ impl Document {
pub fn set_body_attribute(&self, local_name: &Atom, value: DOMString) { pub fn set_body_attribute(&self, local_name: &Atom, value: DOMString) {
if let Some(ref body) = self.GetBody().and_then(Root::downcast::<HTMLBodyElement>) { if let Some(ref body) = self.GetBody().and_then(Root::downcast::<HTMLBodyElement>) {
let body = body.upcast::<Element>(); let body = body.upcast::<Element>();
let value = body.parse_attribute(&ns!(""), &local_name, value); let value = body.parse_attribute(&ns!(), &local_name, value);
body.set_attribute(local_name, value); body.set_attribute(local_name, value);
} }
} }
@ -1700,13 +1700,13 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-document-getelementsbytagname // https://dom.spec.whatwg.org/#dom-document-getelementsbytagname
fn GetElementsByTagName(&self, tag_name: DOMString) -> Root<HTMLCollection> { fn GetElementsByTagName(&self, tag_name: DOMString) -> Root<HTMLCollection> {
let tag_atom = Atom::from_slice(&tag_name); let tag_atom = Atom::from(&*tag_name);
match self.tag_map.borrow_mut().entry(tag_atom.clone()) { match self.tag_map.borrow_mut().entry(tag_atom.clone()) {
Occupied(entry) => Root::from_ref(entry.get()), Occupied(entry) => Root::from_ref(entry.get()),
Vacant(entry) => { Vacant(entry) => {
let mut tag_copy = tag_name; let mut tag_copy = tag_name;
tag_copy.make_ascii_lowercase(); tag_copy.make_ascii_lowercase();
let ascii_lower_tag = Atom::from_slice(&tag_copy); let ascii_lower_tag = Atom::from(&*tag_copy);
let result = HTMLCollection::by_atomic_tag_name(&self.window, let result = HTMLCollection::by_atomic_tag_name(&self.window,
self.upcast(), self.upcast(),
tag_atom, tag_atom,
@ -1723,7 +1723,7 @@ impl DocumentMethods for Document {
tag_name: DOMString) tag_name: DOMString)
-> Root<HTMLCollection> { -> Root<HTMLCollection> {
let ns = namespace_from_domstring(maybe_ns); let ns = namespace_from_domstring(maybe_ns);
let local = Atom::from_slice(&tag_name); let local = Atom::from(&*tag_name);
let qname = QualName::new(ns, local); let qname = QualName::new(ns, local);
match self.tagns_map.borrow_mut().entry(qname.clone()) { match self.tagns_map.borrow_mut().entry(qname.clone()) {
Occupied(entry) => Root::from_ref(entry.get()), Occupied(entry) => Root::from_ref(entry.get()),
@ -1738,7 +1738,7 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname // https://dom.spec.whatwg.org/#dom-document-getelementsbyclassname
fn GetElementsByClassName(&self, classes: DOMString) -> Root<HTMLCollection> { fn GetElementsByClassName(&self, classes: DOMString) -> Root<HTMLCollection> {
let class_atoms: Vec<Atom> = split_html_space_chars(&classes) let class_atoms: Vec<Atom> = split_html_space_chars(&classes)
.map(Atom::from_slice) .map(Atom::from)
.collect(); .collect();
match self.classes_map.borrow_mut().entry(class_atoms.clone()) { match self.classes_map.borrow_mut().entry(class_atoms.clone()) {
Occupied(entry) => Root::from_ref(entry.get()), Occupied(entry) => Root::from_ref(entry.get()),
@ -1754,7 +1754,7 @@ impl DocumentMethods for Document {
// https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid // https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(&self, id: DOMString) -> Option<Root<Element>> { fn GetElementById(&self, id: DOMString) -> Option<Root<Element>> {
self.get_element_by_id(&Atom::from_slice(&id)) self.get_element_by_id(&Atom::from(&*id))
} }
// https://dom.spec.whatwg.org/#dom-document-createelement // https://dom.spec.whatwg.org/#dom-document-createelement
@ -1766,7 +1766,7 @@ impl DocumentMethods for Document {
if self.is_html_document { if self.is_html_document {
local_name.make_ascii_lowercase(); local_name.make_ascii_lowercase();
} }
let name = QualName::new(ns!(HTML), Atom::from_slice(&local_name)); let name = QualName::new(ns!(html), Atom::from(&*local_name));
Ok(Element::create(name, None, self, ElementCreator::ScriptCreated)) Ok(Element::create(name, None, self, ElementCreator::ScriptCreated))
} }
@ -1788,12 +1788,12 @@ impl DocumentMethods for Document {
return Err(Error::InvalidCharacter); return Err(Error::InvalidCharacter);
} }
let name = Atom::from_slice(&local_name); let name = Atom::from(&*local_name);
// repetition used because string_cache::atom::Atom is non-copyable // repetition used because string_cache::atom::Atom is non-copyable
let l_name = Atom::from_slice(&local_name); let l_name = Atom::from(&*local_name);
let value = AttrValue::String(DOMString::new()); let value = AttrValue::String(DOMString::new());
Ok(Attr::new(&self.window, name, value, l_name, ns!(""), None, None)) Ok(Attr::new(&self.window, name, value, l_name, ns!(), None, None))
} }
// https://dom.spec.whatwg.org/#dom-document-createattributens // https://dom.spec.whatwg.org/#dom-document-createattributens
@ -1804,7 +1804,7 @@ impl DocumentMethods for Document {
let (namespace, prefix, local_name) = try!(validate_and_extract(namespace, let (namespace, prefix, local_name) = try!(validate_and_extract(namespace,
&qualified_name)); &qualified_name));
let value = AttrValue::String(DOMString::new()); let value = AttrValue::String(DOMString::new());
let qualified_name = Atom::from_slice(&qualified_name); let qualified_name = Atom::from(&*qualified_name);
Ok(Attr::new(&self.window, Ok(Attr::new(&self.window,
local_name, local_name,
value, value,
@ -1964,12 +1964,12 @@ impl DocumentMethods for Document {
// https://html.spec.whatwg.org/multipage/#document.title // https://html.spec.whatwg.org/multipage/#document.title
fn Title(&self) -> DOMString { fn Title(&self) -> DOMString {
let title = self.GetDocumentElement().and_then(|root| { let title = self.GetDocumentElement().and_then(|root| {
if root.namespace() == &ns!(SVG) && root.local_name() == &atom!("svg") { if root.namespace() == &ns!(svg) && root.local_name() == &atom!("svg") {
// Step 1. // Step 1.
root.upcast::<Node>() root.upcast::<Node>()
.child_elements() .child_elements()
.find(|node| { .find(|node| {
node.namespace() == &ns!(SVG) && node.local_name() == &atom!("title") node.namespace() == &ns!(svg) && node.local_name() == &atom!("title")
}) })
.map(Root::upcast::<Node>) .map(Root::upcast::<Node>)
} else { } else {
@ -1997,14 +1997,14 @@ impl DocumentMethods for Document {
None => return, None => return,
}; };
let elem = if root.namespace() == &ns!(SVG) && root.local_name() == &atom!("svg") { let elem = if root.namespace() == &ns!(svg) && root.local_name() == &atom!("svg") {
let elem = root.upcast::<Node>().child_elements().find(|node| { let elem = root.upcast::<Node>().child_elements().find(|node| {
node.namespace() == &ns!(SVG) && node.local_name() == &atom!("title") node.namespace() == &ns!(svg) && node.local_name() == &atom!("title")
}); });
match elem { match elem {
Some(elem) => Root::upcast::<Node>(elem), Some(elem) => Root::upcast::<Node>(elem),
None => { None => {
let name = QualName::new(ns!(SVG), atom!("title")); let name = QualName::new(ns!(svg), atom!("title"));
let elem = Element::create(name, None, self, ElementCreator::ScriptCreated); let elem = Element::create(name, None, self, ElementCreator::ScriptCreated);
let parent = root.upcast::<Node>(); let parent = root.upcast::<Node>();
let child = elem.upcast::<Node>(); let child = elem.upcast::<Node>();
@ -2012,7 +2012,7 @@ impl DocumentMethods for Document {
.unwrap() .unwrap()
} }
} }
} else if root.namespace() == &ns!(HTML) { } else if root.namespace() == &ns!(html) {
let elem = root.upcast::<Node>() let elem = root.upcast::<Node>()
.traverse_preorder() .traverse_preorder()
.find(|node| node.is::<HTMLTitleElement>()); .find(|node| node.is::<HTMLTitleElement>());
@ -2021,7 +2021,7 @@ impl DocumentMethods for Document {
None => { None => {
match self.GetHead() { match self.GetHead() {
Some(head) => { Some(head) => {
let name = QualName::new(ns!(HTML), atom!("title")); let name = QualName::new(ns!(html), atom!("title"));
let elem = Element::create(name, let elem = Element::create(name,
None, None,
self, self,
@ -2113,10 +2113,10 @@ impl DocumentMethods for Document {
Some(element) => element, Some(element) => element,
None => return false, None => return false,
}; };
if element.namespace() != &ns!(HTML) { if element.namespace() != &ns!(html) {
return false; return false;
} }
element.get_attribute(&ns!(""), &atom!("name")) element.get_attribute(&ns!(), &atom!("name"))
.map_or(false, |attr| &**attr.value() == &*name) .map_or(false, |attr| &**attr.value() == &*name)
}) })
} }
@ -2299,10 +2299,10 @@ impl DocumentMethods for Document {
}; };
match html_elem_type { match html_elem_type {
HTMLElementTypeId::HTMLAppletElement => { HTMLElementTypeId::HTMLAppletElement => {
match elem.get_attribute(&ns!(""), &atom!("name")) { match elem.get_attribute(&ns!(), &atom!("name")) {
Some(ref attr) if attr.value().as_atom() == name => true, Some(ref attr) if attr.value().as_atom() == name => true,
_ => { _ => {
match elem.get_attribute(&ns!(""), &atom!("id")) { match elem.get_attribute(&ns!(), &atom!("id")) {
Some(ref attr) => attr.value().as_atom() == name, Some(ref attr) => attr.value().as_atom() == name,
None => false, None => false,
} }
@ -2310,18 +2310,18 @@ impl DocumentMethods for Document {
} }
}, },
HTMLElementTypeId::HTMLFormElement => { HTMLElementTypeId::HTMLFormElement => {
match elem.get_attribute(&ns!(""), &atom!("name")) { match elem.get_attribute(&ns!(), &atom!("name")) {
Some(ref attr) => attr.value().as_atom() == name, Some(ref attr) => attr.value().as_atom() == name,
None => false, None => false,
} }
}, },
HTMLElementTypeId::HTMLImageElement => { HTMLElementTypeId::HTMLImageElement => {
match elem.get_attribute(&ns!(""), &atom!("name")) { match elem.get_attribute(&ns!(), &atom!("name")) {
Some(ref attr) => { Some(ref attr) => {
if attr.value().as_atom() == name { if attr.value().as_atom() == name {
true true
} else { } else {
match elem.get_attribute(&ns!(""), &atom!("id")) { match elem.get_attribute(&ns!(), &atom!("id")) {
Some(ref attr) => attr.value().as_atom() == name, Some(ref attr) => attr.value().as_atom() == name,
None => false, None => false,
} }
@ -2334,7 +2334,7 @@ impl DocumentMethods for Document {
_ => false, _ => false,
} }
} }
let name = Atom::from_slice(&name); let name = Atom::from(&*name);
let root = self.upcast::<Node>(); let root = self.upcast::<Node>();
{ {
// Step 1. // Step 1.

View file

@ -55,9 +55,9 @@ impl DocumentFragmentMethods for DocumentFragment {
// https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid // https://dom.spec.whatwg.org/#dom-nonelementparentnode-getelementbyid
fn GetElementById(&self, id: DOMString) -> Option<Root<Element>> { fn GetElementById(&self, id: DOMString) -> Option<Root<Element>> {
let node = self.upcast::<Node>(); let node = self.upcast::<Node>();
let id = Atom::from_slice(&id); let id = Atom::from(&*id);
node.traverse_preorder().filter_map(Root::downcast::<Element>).find(|descendant| { node.traverse_preorder().filter_map(Root::downcast::<Element>).find(|descendant| {
match descendant.get_attribute(&ns!(""), &atom!(id)) { match descendant.get_attribute(&ns!(), &atom!("id")) {
None => false, None => false,
Some(attr) => *attr.value().as_atom() == id, Some(attr) => *attr.value().as_atom() == id,
} }

View file

@ -38,14 +38,14 @@ impl DOMTokenList {
} }
fn attribute(&self) -> Option<Root<Attr>> { fn attribute(&self) -> Option<Root<Attr>> {
self.element.get_attribute(&ns!(""), &self.local_name) self.element.get_attribute(&ns!(), &self.local_name)
} }
fn check_token_exceptions(&self, token: &str) -> Fallible<Atom> { fn check_token_exceptions(&self, token: &str) -> Fallible<Atom> {
match token { match token {
"" => Err(Error::Syntax), "" => Err(Error::Syntax),
slice if slice.find(HTML_SPACE_CHARACTERS).is_some() => Err(Error::InvalidCharacter), slice if slice.find(HTML_SPACE_CHARACTERS).is_some() => Err(Error::InvalidCharacter),
slice => Ok(Atom::from_slice(slice)), slice => Ok(Atom::from(slice)),
} }
} }
} }

View file

@ -138,7 +138,7 @@ impl Element {
-> Element { -> Element {
Element { Element {
node: Node::new_inherited(document), node: Node::new_inherited(document),
local_name: Atom::from_slice(&local_name), local_name: Atom::from(&*local_name),
namespace: namespace, namespace: namespace,
prefix: prefix, prefix: prefix,
attrs: DOMRefCell::new(vec![]), attrs: DOMRefCell::new(vec![]),
@ -241,7 +241,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
#[allow(unsafe_code)] #[allow(unsafe_code)]
#[inline] #[inline]
unsafe fn has_class_for_layout(&self, name: &Atom) -> bool { unsafe fn has_class_for_layout(&self, name: &Atom) -> bool {
get_attr_for_layout(&*self.unsafe_get(), &ns!(""), &atom!("class")).map_or(false, |attr| { get_attr_for_layout(&*self.unsafe_get(), &ns!(), &atom!("class")).map_or(false, |attr| {
attr.value_tokens_forever().unwrap().iter().any(|atom| atom == name) attr.value_tokens_forever().unwrap().iter().any(|atom| atom == name)
}) })
} }
@ -249,7 +249,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
#[allow(unsafe_code)] #[allow(unsafe_code)]
#[inline] #[inline]
unsafe fn get_classes_for_layout(&self) -> Option<&'static [Atom]> { unsafe fn get_classes_for_layout(&self) -> Option<&'static [Atom]> {
get_attr_for_layout(&*self.unsafe_get(), &ns!(""), &atom!("class")) get_attr_for_layout(&*self.unsafe_get(), &ns!(), &atom!("class"))
.map(|attr| attr.value_tokens_forever().unwrap()) .map(|attr| attr.value_tokens_forever().unwrap())
} }
@ -364,7 +364,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
// FIXME(pcwalton): More use of atoms, please! // FIXME(pcwalton): More use of atoms, please!
// FIXME(Ms2ger): this is nonsense! Invalid values also end up as // FIXME(Ms2ger): this is nonsense! Invalid values also end up as
// a text field // a text field
match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(""), &atom!("type")) { match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(), &atom!("type")) {
Some("text") | Some("password") => { Some("text") | Some("password") => {
match this.get_size_for_layout() { match this.get_size_for_layout() {
0 => None, 0 => None,
@ -517,7 +517,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
#[inline] #[inline]
#[allow(unsafe_code)] #[allow(unsafe_code)]
unsafe fn html_element_in_html_document_for_layout(&self) -> bool { unsafe fn html_element_in_html_document_for_layout(&self) -> bool {
if (*self.unsafe_get()).namespace != ns!(HTML) { if (*self.unsafe_get()).namespace != ns!(html) {
return false; return false;
} }
self.upcast::<Node>().owner_doc_for_layout().is_html_document_for_layout() self.upcast::<Node>().owner_doc_for_layout().is_html_document_for_layout()
@ -593,7 +593,7 @@ pub enum StylePriority {
impl Element { impl Element {
pub fn html_element_in_html_document(&self) -> bool { pub fn html_element_in_html_document(&self) -> bool {
self.namespace == ns!(HTML) && self.upcast::<Node>().is_in_html_doc() self.namespace == ns!(html) && self.upcast::<Node>().is_in_html_doc()
} }
pub fn local_name(&self) -> &Atom { pub fn local_name(&self) -> &Atom {
@ -604,7 +604,7 @@ impl Element {
if self.html_element_in_html_document() { if self.html_element_in_html_document() {
name.make_ascii_lowercase(); name.make_ascii_lowercase();
} }
Atom::from_slice(&name) Atom::from(&*name)
} }
pub fn namespace(&self) -> &Namespace { pub fn namespace(&self) -> &Namespace {
@ -630,15 +630,17 @@ impl Element {
} }
pub fn is_void(&self) -> bool { pub fn is_void(&self) -> bool {
if self.namespace != ns!(HTML) { if self.namespace != ns!(html) {
return false return false
} }
match self.local_name { match self.local_name {
/* List of void elements from /* List of void elements from
https://html.spec.whatwg.org/multipage/#html-fragment-serialisation-algorithm */ https://html.spec.whatwg.org/multipage/#html-fragment-serialisation-algorithm */
atom!(area) | atom!(base) | atom!(basefont) | atom!(bgsound) | atom!(br) | atom!(col) | atom!(embed) |
atom!(frame) | atom!(hr) | atom!(img) | atom!(input) | atom!(keygen) | atom!(link) | atom!(menuitem) | atom!("area") | atom!("base") | atom!("basefont") | atom!("bgsound") | atom!("br") |
atom!(meta) | atom!(param) | atom!(source) | atom!(track) | atom!(wbr) => true, atom!("col") | atom!("embed") | atom!("frame") | atom!("hr") | atom!("img") |
atom!("input") | atom!("keygen") | atom!("link") | atom!("menuitem") | atom!("meta") |
atom!("param") | atom!("source") | atom!("track") | atom!("wbr") => true,
_ => false _ => false
} }
} }
@ -855,7 +857,7 @@ impl Element {
prefix: Option<Atom>) { prefix: Option<Atom>) {
self.will_mutate_attr(); self.will_mutate_attr();
let window = window_from_node(self); let window = window_from_node(self);
let in_empty_ns = namespace == ns!(""); let in_empty_ns = namespace == ns!();
let attr = Attr::new(&window, let attr = Attr::new(&window,
local_name, local_name,
value, value,
@ -899,7 +901,7 @@ impl Element {
None => qname.local.clone(), None => qname.local.clone(),
Some(ref prefix) => { Some(ref prefix) => {
let name = format!("{}:{}", &**prefix, &*qname.local); let name = format!("{}:{}", &**prefix, &*qname.local);
Atom::from_slice(&name) Atom::from(&*name)
}, },
}; };
let value = self.parse_attribute(&qname.ns, &qname.local, value); let value = self.parse_attribute(&qname.ns, &qname.local, value);
@ -913,7 +915,7 @@ impl Element {
self.set_first_matching_attribute(name.clone(), self.set_first_matching_attribute(name.clone(),
value, value,
name.clone(), name.clone(),
ns!(""), ns!(),
None, None,
|attr| attr.local_name() == name); |attr| attr.local_name() == name);
} }
@ -927,15 +929,15 @@ impl Element {
} }
// Steps 2-5. // Steps 2-5.
let name = Atom::from_slice(&name); let name = Atom::from(&*name);
let value = self.parse_attribute(&ns!(""), &name, value); let value = self.parse_attribute(&ns!(), &name, value);
self.set_first_matching_attribute(name.clone(), self.set_first_matching_attribute(name.clone(),
value, value,
name.clone(), name.clone(),
ns!(""), ns!(),
None, None,
|attr| { |attr| {
*attr.name() == name && *attr.namespace() == ns!("") *attr.name() == name && *attr.namespace() == ns!()
}); });
Ok(()) Ok(())
} }
@ -966,7 +968,7 @@ impl Element {
local_name: &Atom, local_name: &Atom,
value: DOMString) value: DOMString)
-> AttrValue { -> AttrValue {
if *namespace == ns!("") { if *namespace == ns!() {
vtable_for(self.upcast()).parse_plain_attribute(local_name, value) vtable_for(self.upcast()).parse_plain_attribute(local_name, value)
} else { } else {
AttrValue::String(value) AttrValue::String(value)
@ -993,7 +995,7 @@ impl Element {
let attr = Root::from_ref(&*(*self.attrs.borrow())[idx]); let attr = Root::from_ref(&*(*self.attrs.borrow())[idx]);
self.attrs.borrow_mut().remove(idx); self.attrs.borrow_mut().remove(idx);
attr.set_owner(None); attr.set_owner(None);
if attr.namespace() == &ns!("") { if attr.namespace() == &ns!() {
vtable_for(self.upcast()).attribute_mutated(&attr, AttributeMutation::Removed); vtable_for(self.upcast()).attribute_mutated(&attr, AttributeMutation::Removed);
} }
attr attr
@ -1008,7 +1010,7 @@ impl Element {
Quirks => lhs.eq_ignore_ascii_case(&rhs), Quirks => lhs.eq_ignore_ascii_case(&rhs),
} }
}; };
self.get_attribute(&ns!(""), &atom!("class")) self.get_attribute(&ns!(), &atom!("class"))
.map(|attr| attr.value().as_tokens().iter().any(|atom| is_equal(name, atom))) .map(|attr| attr.value().as_tokens().iter().any(|atom| is_equal(name, atom)))
.unwrap_or(false) .unwrap_or(false)
} }
@ -1024,7 +1026,7 @@ impl Element {
self.attrs self.attrs
.borrow() .borrow()
.iter() .iter()
.any(|attr| attr.local_name() == local_name && attr.namespace() == &ns!("")) .any(|attr| attr.local_name() == local_name && attr.namespace() == &ns!())
} }
pub fn set_bool_attribute(&self, local_name: &Atom, value: bool) { pub fn set_bool_attribute(&self, local_name: &Atom, value: bool) {
@ -1034,7 +1036,7 @@ impl Element {
if value { if value {
self.set_string_attribute(local_name, DOMString::new()); self.set_string_attribute(local_name, DOMString::new());
} else { } else {
self.remove_attribute(&ns!(""), local_name); self.remove_attribute(&ns!(), local_name);
} }
} }
@ -1058,7 +1060,7 @@ impl Element {
} }
pub fn get_string_attribute(&self, local_name: &Atom) -> DOMString { pub fn get_string_attribute(&self, local_name: &Atom) -> DOMString {
match self.get_attribute(&ns!(""), local_name) { match self.get_attribute(&ns!(), local_name) {
Some(x) => x.Value(), Some(x) => x.Value(),
None => DOMString::new(), None => DOMString::new(),
} }
@ -1069,7 +1071,7 @@ impl Element {
} }
pub fn get_tokenlist_attribute(&self, local_name: &Atom) -> Vec<Atom> { pub fn get_tokenlist_attribute(&self, local_name: &Atom) -> Vec<Atom> {
self.get_attribute(&ns!(""), local_name).map(|attr| { self.get_attribute(&ns!(), local_name).map(|attr| {
attr.r() attr.r()
.value() .value()
.as_tokens() .as_tokens()
@ -1089,7 +1091,7 @@ impl Element {
pub fn get_uint_attribute(&self, local_name: &Atom, default: u32) -> u32 { pub fn get_uint_attribute(&self, local_name: &Atom, default: u32) -> u32 {
assert!(local_name.chars().all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch)); assert!(local_name.chars().all(|ch| !ch.is_ascii() || ch.to_ascii_lowercase() == ch));
let attribute = self.get_attribute(&ns!(""), local_name); let attribute = self.get_attribute(&ns!(), local_name);
match attribute { match attribute {
Some(ref attribute) => { Some(ref attribute) => {
match *attribute.value() { match *attribute.value() {
@ -1201,7 +1203,7 @@ impl ElementMethods for Element {
local_name: DOMString) local_name: DOMString)
-> Option<Root<Attr>> { -> Option<Root<Attr>> {
let namespace = &namespace_from_domstring(namespace); let namespace = &namespace_from_domstring(namespace);
self.get_attribute(namespace, &Atom::from_slice(&local_name)) self.get_attribute(namespace, &Atom::from(&*local_name))
} }
// https://dom.spec.whatwg.org/#dom-element-setattribute // https://dom.spec.whatwg.org/#dom-element-setattribute
@ -1215,9 +1217,9 @@ impl ElementMethods for Element {
let name = self.parsed_name(name); let name = self.parsed_name(name);
// Step 3-5. // Step 3-5.
let value = self.parse_attribute(&ns!(""), &name, value); let value = self.parse_attribute(&ns!(), &name, value);
self.set_first_matching_attribute( self.set_first_matching_attribute(
name.clone(), value, name.clone(), ns!(""), None, name.clone(), value, name.clone(), ns!(), None,
|attr| *attr.name() == name); |attr| *attr.name() == name);
Ok(()) Ok(())
} }
@ -1229,7 +1231,7 @@ impl ElementMethods for Element {
value: DOMString) -> ErrorResult { value: DOMString) -> ErrorResult {
let (namespace, prefix, local_name) = let (namespace, prefix, local_name) =
try!(validate_and_extract(namespace, &qualified_name)); try!(validate_and_extract(namespace, &qualified_name));
let qualified_name = Atom::from_slice(&qualified_name); let qualified_name = Atom::from(&*qualified_name);
let value = self.parse_attribute(&namespace, &local_name, value); let value = self.parse_attribute(&namespace, &local_name, value);
self.set_first_matching_attribute( self.set_first_matching_attribute(
local_name.clone(), value, qualified_name, namespace.clone(), prefix, local_name.clone(), value, qualified_name, namespace.clone(), prefix,
@ -1246,7 +1248,7 @@ impl ElementMethods for Element {
// https://dom.spec.whatwg.org/#dom-element-removeattributens // https://dom.spec.whatwg.org/#dom-element-removeattributens
fn RemoveAttributeNS(&self, namespace: Option<DOMString>, local_name: DOMString) { fn RemoveAttributeNS(&self, namespace: Option<DOMString>, local_name: DOMString) {
let namespace = namespace_from_domstring(namespace); let namespace = namespace_from_domstring(namespace);
let local_name = Atom::from_slice(&local_name); let local_name = Atom::from(&*local_name);
self.remove_attribute(&namespace, &local_name); self.remove_attribute(&namespace, &local_name);
} }
@ -1372,7 +1374,7 @@ impl ElementMethods for Element {
// Step 4. // Step 4.
NodeTypeId::DocumentFragment => { NodeTypeId::DocumentFragment => {
let body_elem = Element::create(QualName::new(ns!(HTML), atom!(body)), let body_elem = Element::create(QualName::new(ns!(html), atom!("body")),
None, context_document.r(), None, context_document.r(),
ElementCreator::ScriptCreated); ElementCreator::ScriptCreated);
Root::upcast(body_elem) Root::upcast(body_elem)
@ -1508,7 +1510,7 @@ impl VirtualMethods for Element {
let node = self.upcast::<Node>(); let node = self.upcast::<Node>();
let doc = node.owner_doc(); let doc = node.owner_doc();
match attr.local_name() { match attr.local_name() {
&atom!(style) => { &atom!("style") => {
// Modifying the `style` attribute might change style. // Modifying the `style` attribute might change style.
*self.style_attribute.borrow_mut() = *self.style_attribute.borrow_mut() =
mutation.new_value(attr).map(|value| { mutation.new_value(attr).map(|value| {
@ -1518,7 +1520,7 @@ impl VirtualMethods for Element {
doc.content_changed(node, NodeDamage::NodeStyleDamaged); doc.content_changed(node, NodeDamage::NodeStyleDamaged);
} }
}, },
&atom!(id) => { &atom!("id") => {
*self.id_attribute.borrow_mut() = *self.id_attribute.borrow_mut() =
mutation.new_value(attr).and_then(|value| { mutation.new_value(attr).and_then(|value| {
let value = value.as_atom(); let value = value.as_atom();
@ -1548,7 +1550,7 @@ impl VirtualMethods for Element {
} }
} }
}, },
_ if attr.namespace() == &ns!("") => { _ if attr.namespace() == &ns!() => {
if fragment_affecting_attributes().iter().any(|a| a == attr.local_name()) || if fragment_affecting_attributes().iter().any(|a| a == attr.local_name()) ||
common_style_affecting_attributes().iter().any(|a| &a.atom == attr.local_name()) || common_style_affecting_attributes().iter().any(|a| &a.atom == attr.local_name()) ||
rare_style_affecting_attributes().iter().any(|a| a == attr.local_name()) rare_style_affecting_attributes().iter().any(|a| a == attr.local_name())
@ -1691,7 +1693,7 @@ impl<'a> ::selectors::Element for Root<Element> {
fn each_class<F>(&self, mut callback: F) fn each_class<F>(&self, mut callback: F)
where F: FnMut(&Atom) where F: FnMut(&Atom)
{ {
if let Some(ref attr) = self.get_attribute(&ns!(""), &atom!("class")) { if let Some(ref attr) = self.get_attribute(&ns!(), &atom!("class")) {
let tokens = attr.value(); let tokens = attr.value();
let tokens = tokens.as_tokens(); let tokens = tokens.as_tokens();
for token in tokens { for token in tokens {

View file

@ -234,7 +234,7 @@ impl EventMethods for Event {
self.canceled.set(false); self.canceled.set(false);
self.trusted.set(false); self.trusted.set(false);
self.target.set(None); self.target.set(None);
*self.type_.borrow_mut() = Atom::from_slice(&type_); *self.type_.borrow_mut() = Atom::from(&*type_);
self.bubbles.set(bubbles); self.bubbles.set(bubbles);
self.cancelable.set(cancelable); self.cancelable.set(cancelable);
} }

View file

@ -309,7 +309,7 @@ impl EventTarget {
let event_listener = listener.map(|listener| let event_listener = listener.map(|listener|
CommonEventHandler::EventHandler( CommonEventHandler::EventHandler(
EventHandlerNonNull::new(listener.callback()))); EventHandlerNonNull::new(listener.callback())));
self.set_inline_event_listener(Atom::from_slice(ty), event_listener); self.set_inline_event_listener(Atom::from(ty), event_listener);
} }
pub fn set_error_event_handler<T: CallbackContainer>( pub fn set_error_event_handler<T: CallbackContainer>(
@ -318,11 +318,11 @@ impl EventTarget {
let event_listener = listener.map(|listener| let event_listener = listener.map(|listener|
CommonEventHandler::ErrorEventHandler( CommonEventHandler::ErrorEventHandler(
OnErrorEventHandlerNonNull::new(listener.callback()))); OnErrorEventHandlerNonNull::new(listener.callback())));
self.set_inline_event_listener(Atom::from_slice(ty), event_listener); self.set_inline_event_listener(Atom::from(ty), event_listener);
} }
pub fn get_event_handler_common<T: CallbackContainer>(&self, ty: &str) -> Option<Rc<T>> { pub fn get_event_handler_common<T: CallbackContainer>(&self, ty: &str) -> Option<Rc<T>> {
let listener = self.get_inline_event_listener(&Atom::from_slice(ty)); let listener = self.get_inline_event_listener(&Atom::from(ty));
listener.map(|listener| CallbackContainer::new(listener.parent().callback())) listener.map(|listener| CallbackContainer::new(listener.parent().callback()))
} }
@ -340,7 +340,7 @@ impl EventTargetMethods for EventTarget {
match listener { match listener {
Some(listener) => { Some(listener) => {
let mut handlers = self.handlers.borrow_mut(); let mut handlers = self.handlers.borrow_mut();
let entry = match handlers.entry(Atom::from_slice(&ty)) { let entry = match handlers.entry(Atom::from(&*ty)) {
Occupied(entry) => entry.into_mut(), Occupied(entry) => entry.into_mut(),
Vacant(entry) => entry.insert(vec!()), Vacant(entry) => entry.insert(vec!()),
}; };
@ -366,7 +366,7 @@ impl EventTargetMethods for EventTarget {
match listener { match listener {
Some(ref listener) => { Some(ref listener) => {
let mut handlers = self.handlers.borrow_mut(); let mut handlers = self.handlers.borrow_mut();
let entry = handlers.get_mut(&Atom::from_slice(&ty)); let entry = handlers.get_mut(&Atom::from(&*ty));
for entry in entry { for entry in entry {
let phase = if capture { ListenerPhase::Capturing } else { ListenerPhase::Bubbling }; let phase = if capture { ListenerPhase::Capturing } else { ListenerPhase::Bubbling };
let old_entry = EventListenerEntry { let old_entry = EventListenerEntry {

View file

@ -176,7 +176,7 @@ fn follow_hyperlink(subject: &Element, hyperlink_suffix: Option<String>) {
// Step 3: target browsing context. // Step 3: target browsing context.
// Step 4. // Step 4.
let attribute = subject.get_attribute(&ns!(""), &atom!("href")).unwrap(); let attribute = subject.get_attribute(&ns!(), &atom!("href")).unwrap();
let mut href = attribute.Value(); let mut href = attribute.Value();
// Step 6. // Step 6.

View file

@ -36,7 +36,7 @@ impl HTMLBaseElement {
/// https://html.spec.whatwg.org/multipage/#frozen-base-url /// https://html.spec.whatwg.org/multipage/#frozen-base-url
pub fn frozen_base_url(&self) -> Url { pub fn frozen_base_url(&self) -> Url {
let href = self.upcast::<Element>().get_attribute(&ns!(""), &atom!("href")) let href = self.upcast::<Element>().get_attribute(&ns!(), &atom!("href"))
.expect("The frozen base url is only defined for base elements \ .expect("The frozen base url is only defined for base elements \
that have a base url."); that have a base url.");
let document = document_from_node(self); let document = document_from_node(self);
@ -66,7 +66,7 @@ impl VirtualMethods for HTMLBaseElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
if *attr.local_name() == atom!(href) { if *attr.local_name() == atom!("href") {
document_from_node(self).refresh_base_element(); document_from_node(self).refresh_base_element();
} }
} }

View file

@ -97,7 +97,7 @@ impl HTMLBodyElementLayoutHelpers for LayoutJS<HTMLBodyElement> {
fn get_background_color(&self) -> Option<RGBA> { fn get_background_color(&self) -> Option<RGBA> {
unsafe { unsafe {
(*self.upcast::<Element>().unsafe_get()) (*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("bgcolor")) .get_attr_for_layout(&ns!(), &atom!("bgcolor"))
.and_then(AttrValue::as_color) .and_then(AttrValue::as_color)
.cloned() .cloned()
} }
@ -107,7 +107,7 @@ impl HTMLBodyElementLayoutHelpers for LayoutJS<HTMLBodyElement> {
fn get_color(&self) -> Option<RGBA> { fn get_color(&self) -> Option<RGBA> {
unsafe { unsafe {
(*self.upcast::<Element>().unsafe_get()) (*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("text")) .get_attr_for_layout(&ns!(), &atom!("text"))
.and_then(AttrValue::as_color) .and_then(AttrValue::as_color)
.cloned() .cloned()
} }
@ -153,7 +153,7 @@ impl VirtualMethods for HTMLBodyElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
let do_super_mutate = match (attr.local_name(), mutation) { let do_super_mutate = match (attr.local_name(), mutation) {
(&atom!(background), _) => { (&atom!("background"), _) => {
*self.background.borrow_mut() = mutation.new_value(attr).and_then(|value| { *self.background.borrow_mut() = mutation.new_value(attr).and_then(|value| {
let document = document_from_node(self); let document = document_from_node(self);
let base = document.url(); let base = document.url();
@ -169,11 +169,11 @@ impl VirtualMethods for HTMLBodyElement {
// https://html.spec.whatwg.org/multipage/ // https://html.spec.whatwg.org/multipage/
// #event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-3 // #event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-3
match name { match name {
&atom!(onfocus) | &atom!(onload) | &atom!(onscroll) | &atom!(onafterprint) | &atom!("onfocus") | &atom!("onload") | &atom!("onscroll") | &atom!("onafterprint") |
&atom!(onbeforeprint) | &atom!(onbeforeunload) | &atom!(onhashchange) | &atom!("onbeforeprint") | &atom!("onbeforeunload") | &atom!("onhashchange") |
&atom!(onlanguagechange) | &atom!(onmessage) | &atom!(onoffline) | &atom!(ononline) | &atom!("onlanguagechange") | &atom!("onmessage") | &atom!("onoffline") | &atom!("ononline") |
&atom!(onpagehide) | &atom!(onpageshow) | &atom!(onpopstate) | &atom!(onstorage) | &atom!("onpagehide") | &atom!("onpageshow") | &atom!("onpopstate") | &atom!("onstorage") |
&atom!(onresize) | &atom!(onunload) | &atom!(onerror) &atom!("onresize") | &atom!("onunload") | &atom!("onerror")
=> { => {
let evtarget = window.upcast::<EventTarget>(); // forwarded event let evtarget = window.upcast::<EventTarget>(); // forwarded event
evtarget.set_event_handler_uncompiled(cx, url, reflector, evtarget.set_event_handler_uncompiled(cx, url, reflector,

View file

@ -138,7 +138,7 @@ impl VirtualMethods for HTMLButtonElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(disabled) => { &atom!("disabled") => {
let el = self.upcast::<Element>(); let el = self.upcast::<Element>();
match mutation { match mutation {
AttributeMutation::Set(Some(_)) => {} AttributeMutation::Set(Some(_)) => {}

View file

@ -120,8 +120,8 @@ impl LayoutHTMLCanvasElementHelpers for LayoutJS<HTMLCanvasElement> {
None => (None, None), None => (None, None),
}; };
let width_attr = canvas.upcast::<Element>().get_attr_for_layout(&ns!(""), &atom!(width)); let width_attr = canvas.upcast::<Element>().get_attr_for_layout(&ns!(), &atom!("width"));
let height_attr = canvas.upcast::<Element>().get_attr_for_layout(&ns!(""), &atom!(height)); let height_attr = canvas.upcast::<Element>().get_attr_for_layout(&ns!(), &atom!("height"));
HTMLCanvasData { HTMLCanvasData {
renderer_id: renderer_id, renderer_id: renderer_id,
ipc_renderer: ipc_renderer, ipc_renderer: ipc_renderer,
@ -292,7 +292,7 @@ impl VirtualMethods for HTMLCanvasElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(width) | &atom!(height) => self.recreate_contexts(), &atom!("width") | &atom!("height") => self.recreate_contexts(),
_ => (), _ => (),
}; };
} }

View file

@ -161,9 +161,9 @@ impl HTMLCollection {
pub fn by_tag_name(window: &Window, root: &Node, mut tag: DOMString) pub fn by_tag_name(window: &Window, root: &Node, mut tag: DOMString)
-> Root<HTMLCollection> { -> Root<HTMLCollection> {
let tag_atom = Atom::from_slice(&tag); let tag_atom = Atom::from(&*tag); // FIXME(ajeffrey): Convert directly from DOMString to Atom
tag.make_ascii_lowercase(); tag.make_ascii_lowercase();
let ascii_lower_tag = Atom::from_slice(&tag); let ascii_lower_tag = Atom::from(&*tag); // FIXME(ajeffrey): Convert directly from DOMString to Atom
HTMLCollection::by_atomic_tag_name(window, root, tag_atom, ascii_lower_tag) HTMLCollection::by_atomic_tag_name(window, root, tag_atom, ascii_lower_tag)
} }
@ -194,7 +194,7 @@ impl HTMLCollection {
pub fn by_tag_name_ns(window: &Window, root: &Node, tag: DOMString, pub fn by_tag_name_ns(window: &Window, root: &Node, tag: DOMString,
maybe_ns: Option<DOMString>) -> Root<HTMLCollection> { maybe_ns: Option<DOMString>) -> Root<HTMLCollection> {
let local = Atom::from_slice(&tag); let local = Atom::from(&*tag); // FIXME(ajeffrey): Convert directly from DOMString to Atom
let ns = namespace_from_domstring(maybe_ns); let ns = namespace_from_domstring(maybe_ns);
let qname = QualName::new(ns, local); let qname = QualName::new(ns, local);
HTMLCollection::by_qual_tag_name(window, root, qname) HTMLCollection::by_qual_tag_name(window, root, qname)
@ -219,7 +219,7 @@ impl HTMLCollection {
pub fn by_class_name(window: &Window, root: &Node, classes: DOMString) pub fn by_class_name(window: &Window, root: &Node, classes: DOMString)
-> Root<HTMLCollection> { -> Root<HTMLCollection> {
let class_atoms = split_html_space_chars(&classes).map(Atom::from_slice).collect(); let class_atoms = split_html_space_chars(&classes).map(Atom::from).collect();
HTMLCollection::by_atomic_class_name(window, root, class_atoms) HTMLCollection::by_atomic_class_name(window, root, class_atoms)
} }
@ -370,7 +370,7 @@ impl HTMLCollectionMethods for HTMLCollection {
} }
// Step 2.2 // Step 2.2
let name_attr = elem.get_string_attribute(&atom!("name")); let name_attr = elem.get_string_attribute(&atom!("name"));
if !name_attr.is_empty() && !result.contains(&name_attr) && *elem.namespace() == ns!(HTML) { if !name_attr.is_empty() && !result.contains(&name_attr) && *elem.namespace() == ns!(html) {
result.push(name_attr) result.push(name_attr)
} }
} }

View file

@ -64,7 +64,7 @@ impl HTMLElement {
-> HTMLElement { -> HTMLElement {
HTMLElement { HTMLElement {
element: element:
Element::new_inherited_with_state(state, tag_name, ns!(HTML), prefix, document), Element::new_inherited_with_state(state, tag_name, ns!(html), prefix, document),
style_decl: Default::default(), style_decl: Default::default(),
dataset: Default::default(), dataset: Default::default(),
} }
@ -100,7 +100,7 @@ impl HTMLElement {
} }
}, },
_ => { _ => {
if let Some(attr) = element.get_attribute(&ns!(""), &atom!("draggable")) { if let Some(attr) = element.get_attribute(&ns!(), &atom!("draggable")) {
let attr = attr.r(); let attr = attr.r();
let value = attr.value(); let value = attr.value();
let is_true = match *value { let is_true = match *value {
@ -328,15 +328,17 @@ impl HTMLElement {
} }
pub fn get_custom_attr(&self, local_name: DOMString) -> Option<DOMString> { pub fn get_custom_attr(&self, local_name: DOMString) -> Option<DOMString> {
let local_name = Atom::from_slice(&to_snake_case(local_name)); // FIXME(ajeffrey): Convert directly from DOMString to Atom
self.upcast::<Element>().get_attribute(&ns!(""), &local_name).map(|attr| { let local_name = Atom::from(&*to_snake_case(local_name));
self.upcast::<Element>().get_attribute(&ns!(), &local_name).map(|attr| {
DOMString::from(&**attr.value()) // FIXME(ajeffrey): Convert directly from AttrValue to DOMString DOMString::from(&**attr.value()) // FIXME(ajeffrey): Convert directly from AttrValue to DOMString
}) })
} }
pub fn delete_custom_attr(&self, local_name: DOMString) { pub fn delete_custom_attr(&self, local_name: DOMString) {
let local_name = Atom::from_slice(&to_snake_case(local_name)); // FIXME(ajeffrey): Convert directly from DOMString to Atom
self.upcast::<Element>().remove_attribute(&ns!(""), &local_name); let local_name = Atom::from(&*to_snake_case(local_name));
self.upcast::<Element>().remove_attribute(&ns!(), &local_name);
} }
// https://html.spec.whatwg.org/multipage/#category-label // https://html.spec.whatwg.org/multipage/#category-label

View file

@ -87,7 +87,7 @@ impl VirtualMethods for HTMLFieldSetElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(disabled) => { &atom!("disabled") => {
let disabled_state = match mutation { let disabled_state = match mutation {
AttributeMutation::Set(None) => true, AttributeMutation::Set(None) => true,
AttributeMutation::Set(Some(_)) => { AttributeMutation::Set(Some(_)) => {

View file

@ -92,7 +92,7 @@ impl HTMLFontElementLayoutHelpers for LayoutJS<HTMLFontElement> {
fn get_color(&self) -> Option<RGBA> { fn get_color(&self) -> Option<RGBA> {
unsafe { unsafe {
(*self.upcast::<Element>().unsafe_get()) (*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("color")) .get_attr_for_layout(&ns!(), &atom!("color"))
.and_then(AttrValue::as_color) .and_then(AttrValue::as_color)
.cloned() .cloned()
} }
@ -102,7 +102,7 @@ impl HTMLFontElementLayoutHelpers for LayoutJS<HTMLFontElement> {
fn get_face(&self) -> Option<Atom> { fn get_face(&self) -> Option<Atom> {
unsafe { unsafe {
(*self.upcast::<Element>().unsafe_get()) (*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("face")) .get_attr_for_layout(&ns!(), &atom!("face"))
.map(AttrValue::as_atom) .map(AttrValue::as_atom)
.cloned() .cloned()
} }
@ -112,7 +112,7 @@ impl HTMLFontElementLayoutHelpers for LayoutJS<HTMLFontElement> {
fn get_size(&self) -> Option<specified::Length> { fn get_size(&self) -> Option<specified::Length> {
unsafe { unsafe {
(*self.upcast::<Element>().unsafe_get()) (*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("size")) .get_attr_for_layout(&ns!(), &atom!("size"))
.and_then(AttrValue::as_length) .and_then(AttrValue::as_length)
.cloned() .cloned()
} }

View file

@ -60,7 +60,7 @@ impl HTMLHRLayoutHelpers for LayoutJS<HTMLHRElement> {
fn get_color(&self) -> Option<RGBA> { fn get_color(&self) -> Option<RGBA> {
unsafe { unsafe {
(&*self.upcast::<Element>().unsafe_get()) (&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("color")) .get_attr_for_layout(&ns!(), &atom!("color"))
.and_then(AttrValue::as_color) .and_then(AttrValue::as_color)
.cloned() .cloned()
} }
@ -70,7 +70,7 @@ impl HTMLHRLayoutHelpers for LayoutJS<HTMLHRElement> {
fn get_width(&self) -> LengthOrPercentageOrAuto { fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe { unsafe {
(&*self.upcast::<Element>().unsafe_get()) (&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("width")) .get_attr_for_layout(&ns!(), &atom!("width"))
.map(AttrValue::as_dimension) .map(AttrValue::as_dimension)
.cloned() .cloned()
.unwrap_or(LengthOrPercentageOrAuto::Auto) .unwrap_or(LengthOrPercentageOrAuto::Auto)

View file

@ -68,7 +68,7 @@ impl HTMLIFrameElement {
pub fn get_url(&self) -> Option<Url> { pub fn get_url(&self) -> Option<Url> {
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
element.get_attribute(&ns!(""), &atom!("src")).and_then(|src| { element.get_attribute(&ns!(), &atom!("src")).and_then(|src| {
let url = src.value(); let url = src.value();
if url.is_empty() { if url.is_empty() {
None None
@ -210,7 +210,7 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
fn get_width(&self) -> LengthOrPercentageOrAuto { fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe { unsafe {
(*self.upcast::<Element>().unsafe_get()) (*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("width")) .get_attr_for_layout(&ns!(), &atom!("width"))
.map(|attribute| str::parse_length(&attribute)) .map(|attribute| str::parse_length(&attribute))
.unwrap_or(LengthOrPercentageOrAuto::Auto) .unwrap_or(LengthOrPercentageOrAuto::Auto)
} }
@ -220,7 +220,7 @@ impl HTMLIFrameElementLayoutMethods for LayoutJS<HTMLIFrameElement> {
fn get_height(&self) -> LengthOrPercentageOrAuto { fn get_height(&self) -> LengthOrPercentageOrAuto {
unsafe { unsafe {
(*self.upcast::<Element>().unsafe_get()) (*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("height")) .get_attr_for_layout(&ns!(), &atom!("height"))
.map(|attribute| str::parse_length(&attribute)) .map(|attribute| str::parse_length(&attribute))
.unwrap_or(LengthOrPercentageOrAuto::Auto) .unwrap_or(LengthOrPercentageOrAuto::Auto)
} }
@ -398,7 +398,7 @@ impl VirtualMethods for HTMLIFrameElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(sandbox) => { &atom!("sandbox") => {
self.sandbox.set(mutation.new_value(attr).map(|value| { self.sandbox.set(mutation.new_value(attr).map(|value| {
let mut modes = SandboxAllowance::AllowNothing as u8; let mut modes = SandboxAllowance::AllowNothing as u8;
for token in value.as_tokens() { for token in value.as_tokens() {
@ -415,7 +415,7 @@ impl VirtualMethods for HTMLIFrameElement {
modes modes
})); }));
}, },
&atom!(src) => { &atom!("src") => {
if let AttributeMutation::Set(_) = mutation { if let AttributeMutation::Set(_) = mutation {
if self.upcast::<Node>().is_in_doc() { if self.upcast::<Node>().is_in_doc() {
self.process_the_iframe_attributes(); self.process_the_iframe_attributes();

View file

@ -292,7 +292,7 @@ impl VirtualMethods for HTMLImageElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(src) => { &atom!("src") => {
self.update_image(mutation.new_value(attr).map(|value| { self.update_image(mutation.new_value(attr).map(|value| {
// FIXME(ajeffrey): convert directly from AttrValue to DOMString // FIXME(ajeffrey): convert directly from AttrValue to DOMString
(DOMString::from(&**value), window_from_node(self).get_url()) (DOMString::from(&**value), window_from_node(self).get_url())

View file

@ -131,7 +131,7 @@ impl HTMLInputElement {
pub fn type_(&self) -> Atom { pub fn type_(&self) -> Atom {
self.upcast::<Element>() self.upcast::<Element>()
.get_attribute(&ns!(""), &atom!("type")) .get_attribute(&ns!(), &atom!("type"))
.map_or_else(|| atom!(""), |a| a.value().as_atom().to_owned()) .map_or_else(|| atom!(""), |a| a.value().as_atom().to_owned())
} }
} }
@ -166,7 +166,7 @@ impl LayoutHTMLInputElementHelpers for LayoutJS<HTMLInputElement> {
unsafe fn get_raw_attr_value(input: LayoutJS<HTMLInputElement>, default: &str) -> String { unsafe fn get_raw_attr_value(input: LayoutJS<HTMLInputElement>, default: &str) -> String {
let elem = input.upcast::<Element>(); let elem = input.upcast::<Element>();
let value = (*elem.unsafe_get()) let value = (*elem.unsafe_get())
.get_attr_val_for_layout(&ns!(""), &atom!("value")) .get_attr_val_for_layout(&ns!(), &atom!("value"))
.unwrap_or(default); .unwrap_or(default);
String::from(value) String::from(value)
} }
@ -451,7 +451,7 @@ impl HTMLInputElement {
fn get_radio_group_name(&self) -> Option<Atom> { fn get_radio_group_name(&self) -> Option<Atom> {
//TODO: determine form owner //TODO: determine form owner
self.upcast::<Element>() self.upcast::<Element>()
.get_attribute(&ns!(""), &atom!("name")) .get_attribute(&ns!(), &atom!("name"))
.map(|name| name.value().as_atom().clone()) .map(|name| name.value().as_atom().clone())
} }
@ -507,7 +507,7 @@ impl VirtualMethods for HTMLInputElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(disabled) => { &atom!("disabled") => {
let disabled_state = match mutation { let disabled_state = match mutation {
AttributeMutation::Set(None) => true, AttributeMutation::Set(None) => true,
AttributeMutation::Set(Some(_)) => { AttributeMutation::Set(Some(_)) => {
@ -521,7 +521,7 @@ impl VirtualMethods for HTMLInputElement {
el.set_enabled_state(!disabled_state); el.set_enabled_state(!disabled_state);
el.check_ancestors_disabled_state_for_form_control(); el.check_ancestors_disabled_state_for_form_control();
}, },
&atom!(checked) if !self.checked_changed.get() => { &atom!("checked") if !self.checked_changed.get() => {
let checked_state = match mutation { let checked_state = match mutation {
AttributeMutation::Set(None) => true, AttributeMutation::Set(None) => true,
AttributeMutation::Set(Some(_)) => { AttributeMutation::Set(Some(_)) => {
@ -532,13 +532,13 @@ impl VirtualMethods for HTMLInputElement {
}; };
self.update_checked_state(checked_state, false); self.update_checked_state(checked_state, false);
}, },
&atom!(size) => { &atom!("size") => {
let size = mutation.new_value(attr).map(|value| { let size = mutation.new_value(attr).map(|value| {
value.as_uint() value.as_uint()
}); });
self.size.set(size.unwrap_or(DEFAULT_INPUT_SIZE)); self.size.set(size.unwrap_or(DEFAULT_INPUT_SIZE));
} }
&atom!(type) => { &atom!("type") => {
match mutation { match mutation {
AttributeMutation::Set(_) => { AttributeMutation::Set(_) => {
let value = match &**attr.value() { let value = match &**attr.value() {
@ -567,16 +567,16 @@ impl VirtualMethods for HTMLInputElement {
} }
} }
}, },
&atom!(value) if !self.value_changed.get() => { &atom!("value") if !self.value_changed.get() => {
let value = mutation.new_value(attr).map(|value| (**value).to_owned()); let value = mutation.new_value(attr).map(|value| (**value).to_owned());
self.textinput.borrow_mut().set_content( self.textinput.borrow_mut().set_content(
value.map(DOMString::from).unwrap_or(DOMString::from(""))); value.map(DOMString::from).unwrap_or(DOMString::from("")));
}, },
&atom!(name) if self.input_type.get() == InputType::InputRadio => { &atom!("name") if self.input_type.get() == InputType::InputRadio => {
self.radio_group_updated( self.radio_group_updated(
mutation.new_value(attr).as_ref().map(|name| name.as_atom())); mutation.new_value(attr).as_ref().map(|name| name.as_atom()));
}, },
&atom!(placeholder) => { &atom!("placeholder") => {
// FIXME(ajeffrey): Should we do in-place mutation of the placeholder? // FIXME(ajeffrey): Should we do in-place mutation of the placeholder?
let mut placeholder = self.placeholder.borrow_mut(); let mut placeholder = self.placeholder.borrow_mut();
placeholder.clear(); placeholder.clear();
@ -591,9 +591,9 @@ impl VirtualMethods for HTMLInputElement {
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue { fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
match name { match name {
&atom!(name) => AttrValue::from_atomic(value), &atom!("name") => AttrValue::from_atomic(value),
&atom!("size") => AttrValue::from_limited_u32(value, DEFAULT_INPUT_SIZE), &atom!("size") => AttrValue::from_limited_u32(value, DEFAULT_INPUT_SIZE),
&atom!(type) => AttrValue::from_atomic(value), &atom!("type") => AttrValue::from_atomic(value),
_ => self.super_type().unwrap().parse_plain_attribute(name, value), _ => self.super_type().unwrap().parse_plain_attribute(name, value),
} }
} }

View file

@ -95,7 +95,7 @@ impl HTMLLabelElementMethods for HTMLLabelElement {
return None; return None;
} }
let for_attr = match self.upcast::<Element>().get_attribute(&ns!(""), &atom!("for")) { let for_attr = match self.upcast::<Element>().get_attribute(&ns!(), &atom!("for")) {
Some(for_attr) => for_attr, Some(for_attr) => for_attr,
None => return self.first_labelable_descendant(), None => return self.first_labelable_descendant(),
}; };

View file

@ -78,7 +78,7 @@ impl HTMLLinkElement {
} }
fn get_attr(element: &Element, local_name: &Atom) -> Option<String> { fn get_attr(element: &Element, local_name: &Atom) -> Option<String> {
let elem = element.get_attribute(&ns!(""), local_name); let elem = element.get_attribute(&ns!(), local_name);
elem.map(|e| { elem.map(|e| {
let value = e.value(); let value = e.value();
(**value).to_owned() (**value).to_owned()
@ -119,9 +119,9 @@ impl VirtualMethods for HTMLLinkElement {
return; return;
} }
let rel = get_attr(self.upcast(), &atom!(rel)); let rel = get_attr(self.upcast(), &atom!("rel"));
match attr.local_name() { match attr.local_name() {
&atom!(href) => { &atom!("href") => {
if string_is_stylesheet(&rel) { if string_is_stylesheet(&rel) {
self.handle_stylesheet_url(&attr.value()); self.handle_stylesheet_url(&attr.value());
} else if is_favicon(&rel) { } else if is_favicon(&rel) {
@ -136,7 +136,7 @@ impl VirtualMethods for HTMLLinkElement {
} }
} }
}, },
&atom!(media) => { &atom!("media") => {
if string_is_stylesheet(&rel) { if string_is_stylesheet(&rel) {
self.handle_stylesheet_url(&attr.value()); self.handle_stylesheet_url(&attr.value());
} }
@ -186,7 +186,7 @@ impl HTMLLinkElement {
Ok(url) => { Ok(url) => {
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
let mq_attribute = element.get_attribute(&ns!(""), &atom!("media")); let mq_attribute = element.get_attribute(&ns!(), &atom!("media"));
let value = mq_attribute.r().map(|a| a.value()); let value = mq_attribute.r().map(|a| a.value());
let mq_str = match value { let mq_str = match value {
Some(ref value) => &***value, Some(ref value) => &***value,

View file

@ -48,7 +48,7 @@ impl HTMLMetaElement {
fn process_attributes(&self) { fn process_attributes(&self) {
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
if let Some(name) = element.get_attribute(&ns!(""), &atom!("name")).r() { if let Some(name) = element.get_attribute(&ns!(), &atom!("name")).r() {
let name = name.value().to_ascii_lowercase(); let name = name.value().to_ascii_lowercase();
let name = name.trim_matches(HTML_SPACE_CHARACTERS); let name = name.trim_matches(HTML_SPACE_CHARACTERS);
@ -64,7 +64,7 @@ impl HTMLMetaElement {
return; return;
} }
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
if let Some(content) = element.get_attribute(&ns!(""), &atom!("content")).r() { if let Some(content) = element.get_attribute(&ns!(), &atom!("content")).r() {
let content = content.value(); let content = content.value();
if !content.is_empty() { if !content.is_empty() {
if let Some(translated_rule) = ViewportRule::from_meta(&**content) { if let Some(translated_rule) = ViewportRule::from_meta(&**content) {

View file

@ -56,8 +56,8 @@ impl<'a> ProcessDataURL for &'a HTMLObjectElement {
let elem = self.upcast::<Element>(); let elem = self.upcast::<Element>();
// TODO: support other values // TODO: support other values
match (elem.get_attribute(&ns!(""), &atom!("type")), match (elem.get_attribute(&ns!(), &atom!("type")),
elem.get_attribute(&ns!(""), &atom!("data"))) { elem.get_attribute(&ns!(), &atom!("data"))) {
(None, Some(_uri)) => { (None, Some(_uri)) => {
// TODO(gw): Prefetch the image here. // TODO(gw): Prefetch the image here.
} }
@ -98,7 +98,7 @@ impl VirtualMethods for HTMLObjectElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(data) => { &atom!("data") => {
if let AttributeMutation::Set(_) = mutation { if let AttributeMutation::Set(_) = mutation {
self.process_data_url(); self.process_data_url();
} }

View file

@ -57,7 +57,7 @@ impl VirtualMethods for HTMLOptGroupElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(disabled) => { &atom!("disabled") => {
let disabled_state = match mutation { let disabled_state = match mutation {
AttributeMutation::Set(None) => true, AttributeMutation::Set(None) => true,
AttributeMutation::Set(Some(_)) => { AttributeMutation::Set(Some(_)) => {

View file

@ -72,7 +72,7 @@ impl HTMLOptionElement {
// FIXME(ajeffrey): Provide a way of buffering DOMStrings other than using Strings // FIXME(ajeffrey): Provide a way of buffering DOMStrings other than using Strings
fn collect_text(element: &Element, value: &mut String) { fn collect_text(element: &Element, value: &mut String) {
let svg_script = *element.namespace() == ns!(SVG) && element.local_name() == &atom!("script"); let svg_script = *element.namespace() == ns!(svg) && element.local_name() == &atom!("script");
let html_script = element.is::<HTMLScriptElement>(); let html_script = element.is::<HTMLScriptElement>();
if svg_script || html_script { if svg_script || html_script {
return; return;
@ -162,7 +162,7 @@ impl VirtualMethods for HTMLOptionElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match attr.local_name() { match attr.local_name() {
&atom!(disabled) => { &atom!("disabled") => {
let el = self.upcast::<Element>(); let el = self.upcast::<Element>();
match mutation { match mutation {
AttributeMutation::Set(_) => { AttributeMutation::Set(_) => {
@ -176,7 +176,7 @@ impl VirtualMethods for HTMLOptionElement {
} }
} }
}, },
&atom!(selected) => { &atom!("selected") => {
match mutation { match mutation {
AttributeMutation::Set(_) => { AttributeMutation::Set(_) => {
// https://html.spec.whatwg.org/multipage/#concept-option-selectedness // https://html.spec.whatwg.org/multipage/#concept-option-selectedness

View file

@ -216,8 +216,8 @@ impl HTMLScriptElement {
} }
// Step 12. // Step 12.
let for_attribute = element.get_attribute(&ns!(""), &atom!("for")); let for_attribute = element.get_attribute(&ns!(), &atom!("for"));
let event_attribute = element.get_attribute(&ns!(""), &atom!("event")); let event_attribute = element.get_attribute(&ns!(), &atom!("event"));
match (for_attribute.r(), event_attribute.r()) { match (for_attribute.r(), event_attribute.r()) {
(Some(for_attribute), Some(event_attribute)) => { (Some(for_attribute), Some(event_attribute)) => {
let for_value = for_attribute.value().to_ascii_lowercase(); let for_value = for_attribute.value().to_ascii_lowercase();
@ -236,7 +236,7 @@ impl HTMLScriptElement {
} }
// Step 13. // Step 13.
if let Some(ref charset) = element.get_attribute(&ns!(""), &atom!("charset")) { if let Some(ref charset) = element.get_attribute(&ns!(), &atom!("charset")) {
if let Some(encodingRef) = encoding_from_whatwg_label(&charset.Value()) { if let Some(encodingRef) = encoding_from_whatwg_label(&charset.Value()) {
*self.block_character_encoding.borrow_mut() = encodingRef; *self.block_character_encoding.borrow_mut() = encodingRef;
} }
@ -248,7 +248,7 @@ impl HTMLScriptElement {
let base_url = window.get_url(); let base_url = window.get_url();
let deferred = element.has_attribute(&atom!("defer")); let deferred = element.has_attribute(&atom!("defer"));
let is_external = match element.get_attribute(&ns!(""), &atom!("src")) { let is_external = match element.get_attribute(&ns!(), &atom!("src")) {
// Step 14. // Step 14.
Some(ref src) => { Some(ref src) => {
// Step 14.1 // Step 14.1
@ -500,7 +500,7 @@ impl HTMLScriptElement {
pub fn is_javascript(&self) -> bool { pub fn is_javascript(&self) -> bool {
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
let type_attr = element.get_attribute(&ns!(""), &atom!("type")); let type_attr = element.get_attribute(&ns!(), &atom!("type"));
let is_js = match type_attr.as_ref().map(|s| s.value()) { let is_js = match type_attr.as_ref().map(|s| s.value()) {
Some(ref s) if s.is_empty() => { Some(ref s) if s.is_empty() => {
// type attr exists, but empty means js // type attr exists, but empty means js
@ -513,7 +513,7 @@ impl HTMLScriptElement {
}, },
None => { None => {
debug!("no script type"); debug!("no script type");
let language_attr = element.get_attribute(&ns!(""), &atom!("language")); let language_attr = element.get_attribute(&ns!(), &atom!("language"));
let is_js = match language_attr.as_ref().map(|s| s.value()) { let is_js = match language_attr.as_ref().map(|s| s.value()) {
Some(ref s) if s.is_empty() => { Some(ref s) if s.is_empty() => {
debug!("script language empty, inferring js"); debug!("script language empty, inferring js");

View file

@ -172,7 +172,7 @@ impl VirtualMethods for HTMLSelectElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
if attr.local_name() == &atom!(disabled) { if attr.local_name() == &atom!("disabled") {
let el = self.upcast::<Element>(); let el = self.upcast::<Element>();
match mutation { match mutation {
AttributeMutation::Set(_) => { AttributeMutation::Set(_) => {

View file

@ -51,7 +51,7 @@ impl HTMLStyleElement {
let win = window_from_node(node); let win = window_from_node(node);
let url = win.get_url(); let url = win.get_url();
let mq_attribute = element.get_attribute(&ns!(""), &atom!("media")); let mq_attribute = element.get_attribute(&ns!(), &atom!("media"));
let mq_str = match mq_attribute { let mq_str = match mq_attribute {
Some(a) => String::from(&**a.value()), Some(a) => String::from(&**a.value()),
None => String::new(), None => String::new(),

View file

@ -85,7 +85,7 @@ impl HTMLTableCellElementLayoutHelpers for LayoutJS<HTMLTableCellElement> {
fn get_background_color(&self) -> Option<RGBA> { fn get_background_color(&self) -> Option<RGBA> {
unsafe { unsafe {
(&*self.upcast::<Element>().unsafe_get()) (&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("bgcolor")) .get_attr_for_layout(&ns!(), &atom!("bgcolor"))
.and_then(AttrValue::as_color) .and_then(AttrValue::as_color)
.cloned() .cloned()
} }
@ -94,7 +94,7 @@ impl HTMLTableCellElementLayoutHelpers for LayoutJS<HTMLTableCellElement> {
fn get_colspan(&self) -> Option<u32> { fn get_colspan(&self) -> Option<u32> {
unsafe { unsafe {
(&*self.upcast::<Element>().unsafe_get()) (&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("colspan")) .get_attr_for_layout(&ns!(), &atom!("colspan"))
.map(AttrValue::as_uint) .map(AttrValue::as_uint)
} }
} }
@ -114,7 +114,7 @@ impl VirtualMethods for HTMLTableCellElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match *attr.local_name() { match *attr.local_name() {
atom!(width) => { atom!("width") => {
let width = mutation.new_value(attr).map(|value| { let width = mutation.new_value(attr).map(|value| {
str::parse_length(&value) str::parse_length(&value)
}); });

View file

@ -156,7 +156,7 @@ impl HTMLTableElementLayoutHelpers for LayoutJS<HTMLTableElement> {
fn get_width(&self) -> LengthOrPercentageOrAuto { fn get_width(&self) -> LengthOrPercentageOrAuto {
unsafe { unsafe {
(*self.upcast::<Element>().unsafe_get()) (*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("width")) .get_attr_for_layout(&ns!(), &atom!("width"))
.map(AttrValue::as_dimension) .map(AttrValue::as_dimension)
.cloned() .cloned()
.unwrap_or(LengthOrPercentageOrAuto::Auto) .unwrap_or(LengthOrPercentageOrAuto::Auto)
@ -172,18 +172,18 @@ impl VirtualMethods for HTMLTableElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match *attr.local_name() { match *attr.local_name() {
atom!(bgcolor) => { atom!("bgcolor") => {
self.background_color.set(mutation.new_value(attr).and_then(|value| { self.background_color.set(mutation.new_value(attr).and_then(|value| {
str::parse_legacy_color(&value).ok() str::parse_legacy_color(&value).ok()
})); }));
}, },
atom!(border) => { atom!("border") => {
// According to HTML5 § 14.3.9, invalid values map to 1px. // According to HTML5 § 14.3.9, invalid values map to 1px.
self.border.set(mutation.new_value(attr).map(|value| { self.border.set(mutation.new_value(attr).map(|value| {
str::parse_unsigned_integer(value.chars()).unwrap_or(1) str::parse_unsigned_integer(value.chars()).unwrap_or(1)
})); }));
} }
atom!(cellspacing) => { atom!("cellspacing") => {
self.cellspacing.set(mutation.new_value(attr).and_then(|value| { self.cellspacing.set(mutation.new_value(attr).and_then(|value| {
str::parse_unsigned_integer(value.chars()) str::parse_unsigned_integer(value.chars())
})); }));

View file

@ -98,7 +98,7 @@ impl HTMLTableRowElementLayoutHelpers for LayoutJS<HTMLTableRowElement> {
fn get_background_color(&self) -> Option<RGBA> { fn get_background_color(&self) -> Option<RGBA> {
unsafe { unsafe {
(&*self.upcast::<Element>().unsafe_get()) (&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("bgcolor")) .get_attr_for_layout(&ns!(), &atom!("bgcolor"))
.and_then(AttrValue::as_color) .and_then(AttrValue::as_color)
.cloned() .cloned()
} }

View file

@ -83,7 +83,7 @@ impl HTMLTableSectionElementLayoutHelpers for LayoutJS<HTMLTableSectionElement>
fn get_background_color(&self) -> Option<RGBA> { fn get_background_color(&self) -> Option<RGBA> {
unsafe { unsafe {
(&*self.upcast::<Element>().unsafe_get()) (&*self.upcast::<Element>().unsafe_get())
.get_attr_for_layout(&ns!(""), &atom!("bgcolor")) .get_attr_for_layout(&ns!(), &atom!("bgcolor"))
.and_then(AttrValue::as_color) .and_then(AttrValue::as_color)
.cloned() .cloned()
} }

View file

@ -254,7 +254,7 @@ impl VirtualMethods for HTMLTextAreaElement {
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) { fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
self.super_type().unwrap().attribute_mutated(attr, mutation); self.super_type().unwrap().attribute_mutated(attr, mutation);
match *attr.local_name() { match *attr.local_name() {
atom!(disabled) => { atom!("disabled") => {
let el = self.upcast::<Element>(); let el = self.upcast::<Element>();
match mutation { match mutation {
AttributeMutation::Set(_) => { AttributeMutation::Set(_) => {
@ -268,13 +268,13 @@ impl VirtualMethods for HTMLTextAreaElement {
} }
} }
}, },
atom!(cols) => { atom!("cols") => {
let cols = mutation.new_value(attr).map(|value| { let cols = mutation.new_value(attr).map(|value| {
value.as_uint() value.as_uint()
}); });
self.cols.set(cols.unwrap_or(DEFAULT_COLS)); self.cols.set(cols.unwrap_or(DEFAULT_COLS));
}, },
atom!(rows) => { atom!("rows") => {
let rows = mutation.new_value(attr).map(|value| { let rows = mutation.new_value(attr).map(|value| {
value.as_uint() value.as_uint()
}); });

View file

@ -10,7 +10,7 @@ macro_rules! make_getter(
use dom::element::Element; use dom::element::Element;
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
element.get_string_attribute(&Atom::from_slice($htmlname)) element.get_string_attribute(&Atom::from($htmlname))
} }
); );
($attr:ident) => { ($attr:ident) => {
@ -27,7 +27,7 @@ macro_rules! make_bool_getter(
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not runtime. // FIXME(pcwalton): Do this at compile time, not runtime.
element.has_attribute(&Atom::from_slice($htmlname)) element.has_attribute(&Atom::from($htmlname))
} }
); );
($attr:ident) => { ($attr:ident) => {
@ -44,7 +44,7 @@ macro_rules! make_uint_getter(
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not runtime. // FIXME(pcwalton): Do this at compile time, not runtime.
element.get_uint_attribute(&Atom::from_slice($htmlname), $default) element.get_uint_attribute(&Atom::from($htmlname), $default)
} }
); );
($attr:ident, $htmlname:expr) => { ($attr:ident, $htmlname:expr) => {
@ -64,7 +64,7 @@ macro_rules! make_url_getter(
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not runtime. // FIXME(pcwalton): Do this at compile time, not runtime.
element.get_url_attribute(&Atom::from_slice($htmlname)) element.get_url_attribute(&Atom::from($htmlname))
} }
); );
($attr:ident) => { ($attr:ident) => {
@ -81,7 +81,7 @@ macro_rules! make_url_or_base_getter(
use dom::element::Element; use dom::element::Element;
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
let url = element.get_url_attribute(&Atom::from_slice($htmlname)); let url = element.get_url_attribute(&Atom::from($htmlname));
if url.is_empty() { if url.is_empty() {
let window = window_from_node(self); let window = window_from_node(self);
DOMString::from(window.get_url().serialize()) DOMString::from(window.get_url().serialize())
@ -104,7 +104,7 @@ macro_rules! make_enumerated_getter(
use std::ascii::AsciiExt; use std::ascii::AsciiExt;
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
let mut val = element.get_string_attribute(&Atom::from_slice($htmlname)); let mut val = element.get_string_attribute(&Atom::from(*$htmlname));
val.make_ascii_lowercase(); val.make_ascii_lowercase();
// https://html.spec.whatwg.org/multipage/#attr-fs-method // https://html.spec.whatwg.org/multipage/#attr-fs-method
match &*val { match &*val {
@ -129,7 +129,7 @@ macro_rules! make_setter(
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not at runtime. // FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_string_attribute(&Atom::from_slice($htmlname), value) element.set_string_attribute(&Atom::from($htmlname), value)
} }
); );
); );
@ -143,7 +143,7 @@ macro_rules! make_bool_setter(
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not at runtime. // FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_bool_attribute(&Atom::from_slice($htmlname), value) element.set_bool_attribute(&Atom::from($htmlname), value)
} }
); );
); );
@ -163,7 +163,7 @@ macro_rules! make_uint_setter(
}; };
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not at runtime. // FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_uint_attribute(&Atom::from_slice($htmlname), value) element.set_uint_attribute(&Atom::from($htmlname), value)
} }
); );
($attr:ident, $htmlname:expr) => { ($attr:ident, $htmlname:expr) => {
@ -188,7 +188,7 @@ macro_rules! make_limited_uint_setter(
}; };
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not runtime. // FIXME(pcwalton): Do this at compile time, not runtime.
element.set_uint_attribute(&Atom::from_slice($htmlname), value); element.set_uint_attribute(&Atom::from($htmlname), value);
Ok(()) Ok(())
} }
); );
@ -209,7 +209,7 @@ macro_rules! make_atomic_setter(
use string_cache::Atom; use string_cache::Atom;
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
// FIXME(pcwalton): Do this at compile time, not at runtime. // FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_atomic_attribute(&Atom::from_slice($htmlname), value) element.set_atomic_attribute(&Atom::from($htmlname), value)
} }
); );
); );
@ -225,7 +225,7 @@ macro_rules! make_legacy_color_setter(
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
let value = AttrValue::from_legacy_color(value); let value = AttrValue::from_legacy_color(value);
// FIXME(pcwalton): Do this at compile time, not at runtime. // FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_attribute(&Atom::from_slice($htmlname), value) element.set_attribute(&Atom::from($htmlname), value)
} }
); );
); );
@ -240,7 +240,7 @@ macro_rules! make_dimension_setter(
let element = self.upcast::<Element>(); let element = self.upcast::<Element>();
let value = AttrValue::from_dimension(value); let value = AttrValue::from_dimension(value);
// FIXME(pcwalton): Do this at compile time, not at runtime. // FIXME(pcwalton): Do this at compile time, not at runtime.
element.set_attribute(&Atom::from_slice($htmlname), value) element.set_attribute(&Atom::from($htmlname), value)
} }
); );
); );

View file

@ -55,7 +55,7 @@ impl NamedNodeMapMethods for NamedNodeMap {
fn GetNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString) fn GetNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString)
-> Option<Root<Attr>> { -> Option<Root<Attr>> {
let ns = namespace_from_domstring(namespace); let ns = namespace_from_domstring(namespace);
self.owner.get_attribute(&ns, &Atom::from_slice(&local_name)) self.owner.get_attribute(&ns, &Atom::from(&*local_name))
} }
// https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem // https://dom.spec.whatwg.org/#dom-namednodemap-removenameditem
@ -68,7 +68,7 @@ impl NamedNodeMapMethods for NamedNodeMap {
fn RemoveNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString) fn RemoveNamedItemNS(&self, namespace: Option<DOMString>, local_name: DOMString)
-> Fallible<Root<Attr>> { -> Fallible<Root<Attr>> {
let ns = namespace_from_domstring(namespace); let ns = namespace_from_domstring(namespace);
self.owner.remove_attribute(&ns, &Atom::from_slice(&local_name)) self.owner.remove_attribute(&ns, &Atom::from(&*local_name))
.ok_or(Error::NotFound) .ok_or(Error::NotFound)
} }

View file

@ -1631,7 +1631,7 @@ impl Node {
local: element.local_name().clone() local: element.local_name().clone()
}; };
let element = Element::create(name, let element = Element::create(name,
element.prefix().as_ref().map(|p| Atom::from_slice(&p)), element.prefix().as_ref().map(|p| Atom::from(&**p)),
document.r(), ElementCreator::ScriptCreated); document.r(), ElementCreator::ScriptCreated);
Root::upcast::<Node>(element) Root::upcast::<Node>(element)
}, },
@ -1707,7 +1707,7 @@ impl Node {
pub fn namespace_to_string(namespace: Namespace) -> Option<DOMString> { pub fn namespace_to_string(namespace: Namespace) -> Option<DOMString> {
match namespace { match namespace {
ns!("") => None, ns!() => None,
// FIXME(ajeffrey): convert directly from &Atom to DOMString // FIXME(ajeffrey): convert directly from &Atom to DOMString
Namespace(ref ns) => Some(DOMString::from(&**ns)) Namespace(ref ns) => Some(DOMString::from(&**ns))
} }
@ -1717,7 +1717,7 @@ impl Node {
pub fn locate_namespace(node: &Node, prefix: Option<DOMString>) -> Namespace { pub fn locate_namespace(node: &Node, prefix: Option<DOMString>) -> Namespace {
fn attr_defines_namespace(attr: &Attr, fn attr_defines_namespace(attr: &Attr,
prefix: &Option<Atom>) -> bool { prefix: &Option<Atom>) -> bool {
*attr.namespace() == ns!(XMLNS) && *attr.namespace() == ns!(xmlns) &&
match (attr.prefix(), prefix) { match (attr.prefix(), prefix) {
(&Some(ref attr_prefix), &Some(ref prefix)) => (&Some(ref attr_prefix), &Some(ref prefix)) =>
attr_prefix == &atom!("xmlns") && attr_prefix == &atom!("xmlns") &&
@ -1731,12 +1731,12 @@ impl Node {
NodeTypeId::Element(_) => { NodeTypeId::Element(_) => {
let element = node.downcast::<Element>().unwrap(); let element = node.downcast::<Element>().unwrap();
// Step 1. // Step 1.
if *element.namespace() != ns!("") && *element.prefix() == prefix { if *element.namespace() != ns!() && *element.prefix() == prefix {
return element.namespace().clone() return element.namespace().clone()
} }
// FIXME(ajeffrey): directly convert DOMString to Atom
let prefix_atom = prefix.as_ref().map(|s| Atom::from_slice(s)); let prefix_atom = prefix.as_ref().map(|s| Atom::from(&**s));
// Step 2. // Step 2.
let attrs = element.attrs(); let attrs = element.attrs();
@ -1751,7 +1751,7 @@ impl Node {
match node.GetParentElement() { match node.GetParentElement() {
// Step 3. // Step 3.
None => ns!(""), None => ns!(),
// Step 4. // Step 4.
Some(parent) => Node::locate_namespace(parent.upcast(), prefix) Some(parent) => Node::locate_namespace(parent.upcast(), prefix)
} }
@ -1759,18 +1759,18 @@ impl Node {
NodeTypeId::Document => { NodeTypeId::Document => {
match node.downcast::<Document>().unwrap().GetDocumentElement().r() { match node.downcast::<Document>().unwrap().GetDocumentElement().r() {
// Step 1. // Step 1.
None => ns!(""), None => ns!(),
// Step 2. // Step 2.
Some(document_element) => { Some(document_element) => {
Node::locate_namespace(document_element.upcast(), prefix) Node::locate_namespace(document_element.upcast(), prefix)
} }
} }
}, },
NodeTypeId::DocumentType => ns!(""), NodeTypeId::DocumentType => ns!(),
NodeTypeId::DocumentFragment => ns!(""), NodeTypeId::DocumentFragment => ns!(),
_ => match node.GetParentElement() { _ => match node.GetParentElement() {
// Step 1. // Step 1.
None => ns!(""), None => ns!(),
// Step 2. // Step 2.
Some(parent) => Node::locate_namespace(parent.upcast(), prefix) Some(parent) => Node::locate_namespace(parent.upcast(), prefix)
} }
@ -2270,7 +2270,7 @@ impl NodeMethods for Node {
let namespace = namespace_from_domstring(namespace); let namespace = namespace_from_domstring(namespace);
// Step 1. // Step 1.
if namespace == ns!("") { if namespace == ns!() {
return None; return None;
} }

View file

@ -31,7 +31,6 @@
#![doc = "The script crate contains all matters DOM."] #![doc = "The script crate contains all matters DOM."]
#![plugin(string_cache_plugin)]
#![plugin(plugins)] #![plugin(plugins)]
extern crate app_units; extern crate app_units;
@ -72,7 +71,7 @@ extern crate script_traits;
#[macro_use(state_pseudo_classes)] extern crate selectors; #[macro_use(state_pseudo_classes)] extern crate selectors;
extern crate serde; extern crate serde;
extern crate smallvec; extern crate smallvec;
extern crate string_cache; #[macro_use(atom, ns)] extern crate string_cache;
extern crate tendril; extern crate tendril;
extern crate time; extern crate time;
extern crate unicase; extern crate unicase;

View file

@ -1183,7 +1183,7 @@ impl ScriptTask {
// Checks if the html element has reftest-wait attribute present. // Checks if the html element has reftest-wait attribute present.
// See http://testthewebforward.org/docs/reftests.html // See http://testthewebforward.org/docs/reftests.html
let html_element = doc.GetDocumentElement(); let html_element = doc.GetDocumentElement();
let reftest_wait = html_element.map_or(false, |elem| elem.has_class(&Atom::from_slice("reftest-wait"))); let reftest_wait = html_element.map_or(false, |elem| elem.has_class(&Atom::from("reftest-wait")));
if reftest_wait { if reftest_wait {
return ScriptState::DocumentLoading; return ScriptState::DocumentLoading;
} }
@ -1810,7 +1810,7 @@ impl ScriptTask {
// Notify Constellation about the topmost anchor mouse over target. // Notify Constellation about the topmost anchor mouse over target.
for target in &*mouse_over_targets { for target in &*mouse_over_targets {
if target.is::<HTMLAnchorElement>() { if target.is::<HTMLAnchorElement>() {
let status = target.get_attribute(&ns!(""), &atom!("href")) let status = target.get_attribute(&ns!(), &atom!("href"))
.and_then(|href| { .and_then(|href| {
let value = href.value(); let value = href.value();
let url = document.url(); let url = document.url();

View file

@ -673,7 +673,7 @@ dependencies = [
"simd 0.1.0 (git+https://github.com/huonw/simd)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)", "skia 0.0.20130412 (git+https://github.com/servo/skia)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -861,30 +861,20 @@ dependencies = [
[[package]] [[package]]
name = "html5ever" name = "html5ever"
version = "0.2.6" version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"html5ever_macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "html5ever_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.0.0" version = "1.0.0"
@ -1031,13 +1021,12 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1540,7 +1529,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
@ -1556,11 +1545,10 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1603,7 +1591,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1612,8 +1600,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1716,33 +1703,14 @@ dependencies = [
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.1.17" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_plugin"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_shared"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1761,12 +1729,11 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
@ -1780,9 +1747,8 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"style_traits 0.0.1", "style_traits 0.0.1",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1800,7 +1766,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1932,7 +1898,7 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)", "js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
@ -1945,11 +1911,11 @@ dependencies = [
"plugins 0.0.1", "plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2096,7 +2062,7 @@ dependencies = [
[[package]] [[package]]
name = "xml5ever" name = "xml5ever"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/Ygg01/xml5ever#0c36f2d93532b2d7b1ccfbd6019a6d53a1fcac69" source = "git+https://github.com/Ygg01/xml5ever#9da3b1628bfcb69a48420f7aef69739d6706aa6a"
dependencies = [ dependencies = [
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2104,8 +2070,7 @@ dependencies = [
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View file

@ -35,8 +35,7 @@ num = "0.1.24"
lazy_static = "0.1.10" lazy_static = "0.1.10"
selectors = { version = "0.2", features = ["unstable"] } selectors = { version = "0.2", features = ["unstable"] }
smallvec = "0.1" smallvec = "0.1"
string_cache = "0.1" string_cache = "0.2"
string_cache_plugin = "0.1"
euclid = {version = "0.3", features = ["plugins"]} euclid = {version = "0.3", features = ["plugins"]}
serde = "0.6" serde = "0.6"
serde_macros = "0.6" serde_macros = "0.6"

View file

@ -27,7 +27,7 @@ impl AttrValue {
pub fn from_serialized_tokenlist(tokens: DOMString) -> AttrValue { pub fn from_serialized_tokenlist(tokens: DOMString) -> AttrValue {
let atoms = let atoms =
split_html_space_chars(&tokens) split_html_space_chars(&tokens)
.map(Atom::from_slice) .map(Atom::from)
.fold(vec![], |mut acc, atom| { .fold(vec![], |mut acc, atom| {
if !acc.contains(&atom) { acc.push(atom) } if !acc.contains(&atom) { acc.push(atom) }
acc acc
@ -64,7 +64,8 @@ impl AttrValue {
} }
pub fn from_atomic(string: DOMString) -> AttrValue { pub fn from_atomic(string: DOMString) -> AttrValue {
let value = Atom::from_slice(&string); // FIXME(ajeffrey): convert directly from DOMString to Atom
let value = Atom::from(&*string);
AttrValue::Atom(value) AttrValue::Atom(value)
} }

View file

@ -286,7 +286,7 @@ fn parse_var_function<'i, 't>(input: &mut Parser<'i, 't>,
})); }));
} }
if let Some(ref mut refs) = *references { if let Some(ref mut refs) = *references {
refs.insert(Atom::from_slice(name)); refs.insert(Atom::from(name));
} }
Ok(()) Ok(())
} }
@ -510,7 +510,7 @@ fn substitute_block<F>(input: &mut Parser,
try!(input.parse_nested_block(|input| { try!(input.parse_nested_block(|input| {
// parse_var_function() ensures neither .unwrap() will fail. // parse_var_function() ensures neither .unwrap() will fail.
let name = input.expect_ident().unwrap(); let name = input.expect_ident().unwrap();
let name = Atom::from_slice(parse_name(&name).unwrap()); let name = Atom::from(parse_name(&name).unwrap());
if let Ok(last) = substitute_one(&name, partial_computed_value) { if let Ok(last) = substitute_one(&name, partial_computed_value) {
last_token_type = last; last_token_type = last;

View file

@ -12,7 +12,6 @@
#![feature(vec_push_all)] #![feature(vec_push_all)]
#![plugin(serde_macros)] #![plugin(serde_macros)]
#![plugin(string_cache_plugin)]
#![plugin(serde_macros)] #![plugin(serde_macros)]
#![plugin(plugins)] #![plugin(plugins)]
@ -37,7 +36,7 @@ extern crate rustc_serialize;
#[macro_use(state_pseudo_classes)] extern crate selectors; #[macro_use(state_pseudo_classes)] extern crate selectors;
extern crate serde; extern crate serde;
extern crate smallvec; extern crate smallvec;
extern crate string_cache; #[macro_use(atom, ns)] extern crate string_cache;
extern crate url; extern crate url;
extern crate util; extern crate util;

View file

@ -1721,14 +1721,14 @@ pub mod longhands {
#[inline] #[inline]
pub fn name(&self) -> &str { pub fn name(&self) -> &str {
match *self { match *self {
FontFamily::FamilyName(ref name) => name.as_slice(), FontFamily::FamilyName(ref name) => &*name,
} }
} }
} }
impl ToCss for FontFamily { impl ToCss for FontFamily {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self { match *self {
FontFamily::FamilyName(ref name) => dest.write_str(name.as_slice()), FontFamily::FamilyName(ref name) => dest.write_str(&*name),
} }
} }
} }
@ -1759,7 +1759,7 @@ pub mod longhands {
} }
pub fn parse_one_family(input: &mut Parser) -> Result<FontFamily, ()> { pub fn parse_one_family(input: &mut Parser) -> Result<FontFamily, ()> {
if let Ok(value) = input.try(|input| input.expect_string()) { if let Ok(value) = input.try(|input| input.expect_string()) {
return Ok(FontFamily::FamilyName(Atom::from_slice(&value))) return Ok(FontFamily::FamilyName(Atom::from(&*value)))
} }
let first_ident = try!(input.expect_ident()); let first_ident = try!(input.expect_ident());
// match_ignore_ascii_case! { first_ident, // match_ignore_ascii_case! { first_ident,
@ -1775,7 +1775,7 @@ pub mod longhands {
value.push_str(" "); value.push_str(" ");
value.push_str(&ident); value.push_str(&ident);
} }
Ok(FontFamily::FamilyName(Atom::from_slice(&value))) Ok(FontFamily::FamilyName(Atom::from(&*value)))
} }
</%self:longhand> </%self:longhand>
@ -6006,7 +6006,7 @@ impl PropertyDeclaration {
Err(()) => return PropertyDeclarationParseResult::InvalidValue, Err(()) => return PropertyDeclarationParseResult::InvalidValue,
} }
}; };
result_list.push(PropertyDeclaration::Custom(Atom::from_slice(name), value)); result_list.push(PropertyDeclaration::Custom(Atom::from(name), value));
return PropertyDeclarationParseResult::ValidOrIgnoredDeclaration; return PropertyDeclarationParseResult::ValidOrIgnoredDeclaration;
} }
match_ignore_ascii_case! { name, match_ignore_ascii_case! { name,
@ -6317,7 +6317,7 @@ impl ComputedValues {
_ => { _ => {
let name = try!(::custom_properties::parse_name(name)); let name = try!(::custom_properties::parse_name(name));
let map = try!(self.custom_properties.as_ref().ok_or(())); let map = try!(self.custom_properties.as_ref().ok_or(()));
let value = try!(map.get(&Atom::from_slice(name)).ok_or(())); let value = try!(map.get(&Atom::from(name)).ok_or(()));
Ok(value.to_css_string()) Ok(value.to_css_string())
} }
} }

View file

@ -137,13 +137,13 @@ impl<'a, E> Element for ElementWrapper<'a, E> where E: Element {
} }
fn get_id(&self) -> Option<Atom> { fn get_id(&self) -> Option<Atom> {
match self.snapshot.attrs { match self.snapshot.attrs {
Some(_) => self.snapshot.get_attr(&ns!(""), &atom!("id")).map(|value| value.as_atom().clone()), Some(_) => self.snapshot.get_attr(&ns!(), &atom!("id")).map(|value| value.as_atom().clone()),
None => self.element.get_id(), None => self.element.get_id(),
} }
} }
fn has_class(&self, name: &Atom) -> bool { fn has_class(&self, name: &Atom) -> bool {
match self.snapshot.attrs { match self.snapshot.attrs {
Some(_) => self.snapshot.get_attr(&ns!(""), &atom!("class")) Some(_) => self.snapshot.get_attr(&ns!(), &atom!("class"))
.map_or(false, |v| { v.as_tokens().iter().any(|atom| atom == name) }), .map_or(false, |v| { v.as_tokens().iter().any(|atom| atom == name) }),
None => self.element.has_class(name), None => self.element.has_class(name),
} }
@ -180,7 +180,7 @@ impl<'a, E> Element for ElementWrapper<'a, E> where E: Element {
fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) { fn each_class<F>(&self, mut callback: F) where F: FnMut(&Atom) {
match self.snapshot.attrs { match self.snapshot.attrs {
Some(_) => { Some(_) => {
if let Some(v) = self.snapshot.get_attr(&ns!(""), &atom!("class")) { if let Some(v) = self.snapshot.get_attr(&ns!(), &atom!("class")) {
for c in v.as_tokens() { callback(c) } for c in v.as_tokens() { callback(c) }
} }
} }

View file

@ -385,7 +385,7 @@ impl<'a> AtRuleParser for TopLevelRuleParser<'a> {
self.state.set(State::Namespaces); self.state.set(State::Namespaces);
let prefix = input.try(|input| input.expect_ident()).ok().map(|p| p.into_owned()); let prefix = input.try(|input| input.expect_ident()).ok().map(|p| p.into_owned());
let url = Namespace(Atom::from_slice(&*try!(input.expect_url_or_string()))); let url = Namespace(Atom::from(&*try!(input.expect_url_or_string())));
return Ok(AtRuleType::WithoutBlock(CSSRule::Namespace(prefix, url))) return Ok(AtRuleType::WithoutBlock(CSSRule::Namespace(prefix, url)))
} else { } else {
return Err(()) // "@namespace must be before any rule but @charset and @import" return Err(()) // "@namespace must be before any rule but @charset and @import"

View file

@ -52,7 +52,7 @@ euclid = {version = "0.3", features = ["plugins"]}
selectors = "0.2" selectors = "0.2"
serde = "0.6" serde = "0.6"
serde_macros = "0.6" serde_macros = "0.6"
string_cache = "0.1" string_cache = "0.2"
lazy_static = "0.1" lazy_static = "0.1"
getopts = "0.2.11" getopts = "0.2.11"
hyper = "0.6" hyper = "0.6"

76
ports/cef/Cargo.lock generated
View file

@ -629,7 +629,7 @@ dependencies = [
"simd 0.1.0 (git+https://github.com/huonw/simd)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)", "skia 0.0.20130412 (git+https://github.com/servo/skia)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -810,30 +810,20 @@ dependencies = [
[[package]] [[package]]
name = "html5ever" name = "html5ever"
version = "0.2.6" version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"html5ever_macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "html5ever_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.0.0" version = "1.0.0"
@ -980,13 +970,12 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1454,7 +1443,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
@ -1470,11 +1459,10 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1508,7 +1496,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1517,8 +1505,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1657,33 +1644,14 @@ dependencies = [
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.1.17" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_plugin"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_shared"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1702,12 +1670,11 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
@ -1724,7 +1691,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1856,7 +1823,7 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)", "js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
@ -1869,11 +1836,11 @@ dependencies = [
"plugins 0.0.1", "plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2009,7 +1976,7 @@ dependencies = [
[[package]] [[package]]
name = "xml5ever" name = "xml5ever"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/Ygg01/xml5ever#0c36f2d93532b2d7b1ccfbd6019a6d53a1fcac69" source = "git+https://github.com/Ygg01/xml5ever#9da3b1628bfcb69a48420f7aef69739d6706aa6a"
dependencies = [ dependencies = [
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2017,8 +1984,7 @@ dependencies = [
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

76
ports/gonk/Cargo.lock generated
View file

@ -631,7 +631,7 @@ dependencies = [
"simd 0.1.0 (git+https://github.com/huonw/simd)", "simd 0.1.0 (git+https://github.com/huonw/simd)",
"skia 0.0.20130412 (git+https://github.com/servo/skia)", "skia 0.0.20130412 (git+https://github.com/servo/skia)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -790,30 +790,20 @@ dependencies = [
[[package]] [[package]]
name = "html5ever" name = "html5ever"
version = "0.2.6" version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"html5ever_macros 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "html5ever_macros"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "httparse" name = "httparse"
version = "1.0.0" version = "1.0.0"
@ -960,13 +950,12 @@ dependencies = [
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script 0.0.1", "script 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1434,7 +1423,7 @@ dependencies = [
"encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)", "encoding 0.2.32 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
@ -1450,11 +1439,10 @@ dependencies = [
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"script_traits 0.0.1", "script_traits 0.0.1",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style 0.0.1", "style 0.0.1",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1488,7 +1476,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.2.1" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1497,8 +1485,7 @@ dependencies = [
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "quickersort 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1635,33 +1622,14 @@ dependencies = [
[[package]] [[package]]
name = "string_cache" name = "string_cache"
version = "0.1.17" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_plugin"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_shared 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache_shared"
version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "debug_unreachable 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_generator 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1680,12 +1648,11 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"style_traits 0.0.1", "style_traits 0.0.1",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
@ -1702,7 +1669,7 @@ dependencies = [
"num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1834,7 +1801,7 @@ dependencies = [
"cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.1.0 (git+https://github.com/servo/ipc-channel)",
"js 0.1.1 (git+https://github.com/servo/rust-mozjs)", "js 0.1.1 (git+https://github.com/servo/rust-mozjs)",
@ -1847,11 +1814,11 @@ dependencies = [
"plugins 0.0.1", "plugins 0.0.1",
"rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1957,7 +1924,7 @@ dependencies = [
[[package]] [[package]]
name = "xml5ever" name = "xml5ever"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/Ygg01/xml5ever#0c36f2d93532b2d7b1ccfbd6019a6d53a1fcac69" source = "git+https://github.com/Ygg01/xml5ever#9da3b1628bfcb69a48420f7aef69739d6706aa6a"
dependencies = [ dependencies = [
"log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1965,8 +1932,7 @@ dependencies = [
"phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rc 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_plugin 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View file

@ -25,6 +25,5 @@ app_units = {version = "0.1", features = ["plugins"]}
url = "0.2" url = "0.2"
cssparser = "0.4" cssparser = "0.4"
selectors = "0.2" selectors = "0.2"
string_cache = "0.1" string_cache = "0.2"
string_cache_plugin = "0.1"
euclid = {version = "0.3", features = ["plugins"]} euclid = {version = "0.3", features = ["plugins"]}

View file

@ -4,14 +4,13 @@
#![feature(plugin)] #![feature(plugin)]
#![cfg_attr(test, feature(core_intrinsics))] #![cfg_attr(test, feature(core_intrinsics))]
#![plugin(string_cache_plugin)]
#![plugin(plugins)] #![plugin(plugins)]
extern crate app_units; extern crate app_units;
extern crate cssparser; extern crate cssparser;
extern crate euclid; extern crate euclid;
extern crate selectors; extern crate selectors;
extern crate string_cache; #[macro_use(atom, ns)] extern crate string_cache;
extern crate style; extern crate style;
extern crate style_traits; extern crate style_traits;
extern crate url; extern crate url;

View file

@ -26,21 +26,21 @@ fn test_parse_stylesheet() {
origin: Origin::UserAgent, origin: Origin::UserAgent,
media: None, media: None,
rules: vec![ rules: vec![
CSSRule::Namespace(None, ns!(HTML)), CSSRule::Namespace(None, ns!(html)),
CSSRule::Style(StyleRule { CSSRule::Style(StyleRule {
selectors: vec![ selectors: vec![
Selector { Selector {
compound_selectors: Arc::new(CompoundSelector { compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Namespace(ns!(HTML)), SimpleSelector::Namespace(ns!(html)),
SimpleSelector::LocalName(LocalName { SimpleSelector::LocalName(LocalName {
name: atom!(input), name: atom!("input"),
lower_name: atom!(input), lower_name: atom!("input"),
}), }),
SimpleSelector::AttrEqual(AttrSelector { SimpleSelector::AttrEqual(AttrSelector {
name: atom!(type), name: atom!("type"),
lower_name: atom!(type), lower_name: atom!("type"),
namespace: NamespaceConstraint::Specific(ns!("")), namespace: NamespaceConstraint::Specific(ns!()),
}, "hidden".to_owned(), CaseSensitivity::CaseInsensitive) }, "hidden".to_owned(), CaseSensitivity::CaseInsensitive)
], ],
next: None, next: None,
@ -62,10 +62,10 @@ fn test_parse_stylesheet() {
Selector { Selector {
compound_selectors: Arc::new(CompoundSelector { compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Namespace(ns!(HTML)), SimpleSelector::Namespace(ns!(html)),
SimpleSelector::LocalName(LocalName { SimpleSelector::LocalName(LocalName {
name: atom!(html), name: atom!("html"),
lower_name: atom!(html), lower_name: atom!("html"),
}), }),
], ],
next: None, next: None,
@ -76,10 +76,10 @@ fn test_parse_stylesheet() {
Selector { Selector {
compound_selectors: Arc::new(CompoundSelector { compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Namespace(ns!(HTML)), SimpleSelector::Namespace(ns!(html)),
SimpleSelector::LocalName(LocalName { SimpleSelector::LocalName(LocalName {
name: atom!(body), name: atom!("body"),
lower_name: atom!(body), lower_name: atom!("body"),
}), }),
], ],
next: None, next: None,
@ -101,11 +101,11 @@ fn test_parse_stylesheet() {
Selector { Selector {
compound_selectors: Arc::new(CompoundSelector { compound_selectors: Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::Class(Atom::from_slice("ok")), SimpleSelector::Class(Atom::from("ok")),
], ],
next: Some((Arc::new(CompoundSelector { next: Some((Arc::new(CompoundSelector {
simple_selectors: vec![ simple_selectors: vec![
SimpleSelector::ID(Atom::from_slice("d1")), SimpleSelector::ID(Atom::from("d1")),
], ],
next: None, next: None,
}), Combinator::Child)), }), Combinator::Child)),