diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2015-11-26 00:10:39 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2015-11-26 00:10:39 +0530 |
commit | 188fa9378c103093f1f8dac24bff0d9d237fd2bc (patch) | |
tree | 9ef42584eb3b543904524248ad11c1dff84082a5 /components/script/dom/node.rs | |
parent | e7b19249489eff7a7fd49bf458ee7bd681f8ad13 (diff) | |
parent | 3dec6edd10ec800de50a04c105a75fb98e0411ca (diff) | |
download | servo-188fa9378c103093f1f8dac24bff0d9d237fd2bc.tar.gz servo-188fa9378c103093f1f8dac24bff0d9d237fd2bc.zip |
Auto merge of #8667 - asajeffrey:update-string-cache, r=SimonSapin
Update string cache
Updated string_cache to 0.2, and updated the dependencies that depend on string_cache.
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::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
r? @SimonSapin
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8667)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 57e1abd61b1..768a2accb1d 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1631,7 +1631,7 @@ impl Node { local: element.local_name().clone() }; 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); Root::upcast::<Node>(element) }, @@ -1707,7 +1707,7 @@ impl Node { pub fn namespace_to_string(namespace: Namespace) -> Option<DOMString> { match namespace { - ns!("") => None, + ns!() => None, // FIXME(ajeffrey): convert directly from &Atom to DOMString Namespace(ref ns) => Some(DOMString::from(&**ns)) } @@ -1717,7 +1717,7 @@ impl Node { pub fn locate_namespace(node: &Node, prefix: Option<DOMString>) -> Namespace { fn attr_defines_namespace(attr: &Attr, prefix: &Option<Atom>) -> bool { - *attr.namespace() == ns!(XMLNS) && + *attr.namespace() == ns!(xmlns) && match (attr.prefix(), prefix) { (&Some(ref attr_prefix), &Some(ref prefix)) => attr_prefix == &atom!("xmlns") && @@ -1731,12 +1731,12 @@ impl Node { NodeTypeId::Element(_) => { let element = node.downcast::<Element>().unwrap(); // Step 1. - if *element.namespace() != ns!("") && *element.prefix() == prefix { + if *element.namespace() != ns!() && *element.prefix() == prefix { return element.namespace().clone() } - - let prefix_atom = prefix.as_ref().map(|s| Atom::from_slice(s)); + // FIXME(ajeffrey): directly convert DOMString to Atom + let prefix_atom = prefix.as_ref().map(|s| Atom::from(&**s)); // Step 2. let attrs = element.attrs(); @@ -1751,7 +1751,7 @@ impl Node { match node.GetParentElement() { // Step 3. - None => ns!(""), + None => ns!(), // Step 4. Some(parent) => Node::locate_namespace(parent.upcast(), prefix) } @@ -1759,18 +1759,18 @@ impl Node { NodeTypeId::Document => { match node.downcast::<Document>().unwrap().GetDocumentElement().r() { // Step 1. - None => ns!(""), + None => ns!(), // Step 2. Some(document_element) => { Node::locate_namespace(document_element.upcast(), prefix) } } }, - NodeTypeId::DocumentType => ns!(""), - NodeTypeId::DocumentFragment => ns!(""), + NodeTypeId::DocumentType => ns!(), + NodeTypeId::DocumentFragment => ns!(), _ => match node.GetParentElement() { // Step 1. - None => ns!(""), + None => ns!(), // Step 2. Some(parent) => Node::locate_namespace(parent.upcast(), prefix) } @@ -2270,7 +2270,7 @@ impl NodeMethods for Node { let namespace = namespace_from_domstring(namespace); // Step 1. - if namespace == ns!("") { + if namespace == ns!() { return None; } |