diff options
author | Keegan McAllister <kmcallister@mozilla.com> | 2014-09-29 18:30:01 -0700 |
---|---|---|
committer | Keegan McAllister <kmcallister@mozilla.com> | 2014-09-29 21:40:54 -0700 |
commit | d50114c41d5233bc55ad1b86273995c0fa3f8d62 (patch) | |
tree | 1b11383f0fdfab841f3cc77c680226b9bc10aa59 /components/script/html/hubbub_html_parser.rs | |
parent | 6429750b339ca45651ac3a45df380f1badd3917c (diff) | |
download | servo-d50114c41d5233bc55ad1b86273995c0fa3f8d62.tar.gz servo-d50114c41d5233bc55ad1b86273995c0fa3f8d62.zip |
Use string-cache's Namespace type
Diffstat (limited to 'components/script/html/hubbub_html_parser.rs')
-rw-r--r-- | components/script/html/hubbub_html_parser.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/components/script/html/hubbub_html_parser.rs b/components/script/html/hubbub_html_parser.rs index 3b3a914d611..562d8b883fd 100644 --- a/components/script/html/hubbub_html_parser.rs +++ b/components/script/html/hubbub_html_parser.rs @@ -25,8 +25,6 @@ use encoding::types::{Encoding, DecodeReplace}; use hubbub::hubbub; use hubbub::hubbub::{NullNs, HtmlNs, MathMlNs, SvgNs, XLinkNs, XmlNs, XmlNsNs}; use servo_net::resource_task::{Load, LoadData, Payload, Done, ResourceTask, load_whole_resource}; -use servo_util::namespace; -use servo_util::namespace::{Namespace, Null}; use servo_util::str::DOMString; use servo_util::task::spawn_named; use std::ascii::StrAsciiExt; @@ -36,7 +34,7 @@ use std::comm::{channel, Sender, Receiver}; use url::{Url, UrlParser}; use http::headers::HeaderEnum; use time; -use string_cache::Atom; +use string_cache::{Atom, Namespace}; macro_rules! handle_element( ($document: expr, @@ -153,7 +151,7 @@ fn parse_last_modified(timestamp: &str) -> String { // via atomization (issue #85). pub fn build_element_from_tag(tag: DOMString, ns: Namespace, document: JSRef<Document>) -> Temporary<Element> { - if ns != namespace::HTML { + if ns != ns!(HTML) { return Element::new(tag, ns, None, document); } @@ -373,9 +371,9 @@ pub fn parse_html(page: &Page, let tmp_borrow = doc_cell.borrow(); let tmp = &*tmp_borrow; let namespace = match tag.ns { - HtmlNs => namespace::HTML, - MathMlNs => namespace::MathML, - SvgNs => namespace::SVG, + HtmlNs => ns!(HTML), + MathMlNs => ns!(MathML), + SvgNs => ns!(SVG), ns => fail!("Not expecting namespace {:?}", ns), }; let element: Root<Element> = build_element_from_tag(tag.name.clone(), namespace, *tmp).root(); @@ -383,10 +381,10 @@ pub fn parse_html(page: &Page, debug!("-- attach attrs"); for attr in tag.attributes.iter() { let (namespace, prefix) = match attr.ns { - NullNs => (namespace::Null, None), - XLinkNs => (namespace::XLink, Some("xlink")), - XmlNs => (namespace::XML, Some("xml")), - XmlNsNs => (namespace::XMLNS, Some("xmlns")), + NullNs => (ns!(""), None), + XLinkNs => (ns!(XLink), Some("xlink")), + XmlNs => (ns!(XML), Some("xml")), + XmlNsNs => (ns!(XMLNS), Some("xmlns")), ns => fail!("Not expecting namespace {:?}", ns), }; element.set_attribute_from_parser(Atom::from_slice(attr.name.as_slice()), @@ -472,7 +470,7 @@ pub fn parse_html(page: &Page, }; let script_element: JSRef<Element> = ElementCast::from_ref(script); - match script_element.get_attribute(Null, "src").root() { + match script_element.get_attribute(ns!(""), "src").root() { Some(src) => { debug!("found script: {:s}", src.deref().Value()); let mut url_parser = UrlParser::new(); |