aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html
diff options
context:
space:
mode:
authorJack Moffitt <jack@metajack.im>2014-08-04 23:02:30 -0600
committerJack Moffitt <jack@metajack.im>2014-08-08 19:11:53 -0600
commit7a4321d649c5ccd99db379533d9b0e82eca57a1a (patch)
tree2980dad5f5f0360b543acf72d5555236abf29ead /src/components/script/html
parent62c9a779a956b8c53cab824b1a3c569dd983fadb (diff)
downloadservo-7a4321d649c5ccd99db379533d9b0e82eca57a1a.tar.gz
servo-7a4321d649c5ccd99db379533d9b0e82eca57a1a.zip
Upgrade Rust.
Diffstat (limited to 'src/components/script/html')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 91fdf1bd030..e759a87f48e 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -346,14 +346,8 @@ pub fn parse_html(page: &Page,
let comment: &JSRef<Node> = NodeCast::from_ref(&*comment);
unsafe { comment.to_hubbub_node() }
},
- create_doctype: |doctype: Box<hubbub::Doctype>| {
+ create_doctype: |box hubbub::Doctype { name: name, public_id: public_id, system_id: system_id, ..}: Box<hubbub::Doctype>| {
debug!("create doctype");
- let box hubbub::Doctype {
- name: name,
- public_id: public_id,
- system_id: system_id,
- force_quirks: _
- } = doctype;
// NOTE: tmp vars are workaround for lifetime issues. Both required.
let tmp_borrow = doc_cell.borrow();
let tmp = &*tmp_borrow;
@@ -410,16 +404,19 @@ pub fn parse_html(page: &Page,
// Handle CSS style sheets from <link> elements
ElementNodeTypeId(HTMLLinkElementTypeId) => {
match (rel, href) {
- (Some(ref rel), Some(ref href)) if rel.as_slice().split(HTML_SPACE_CHARACTERS.as_slice())
- .any(|s| {
- s.as_slice().eq_ignore_ascii_case("stylesheet")
- }) => {
- debug!("found CSS stylesheet: {:s}", *href);
- match UrlParser::new().base_url(base_url).parse(href.as_slice()) {
- Ok(url) => css_chan2.send(CSSTaskNewFile(
- UrlProvenance(url, resource_task.clone()))),
- Err(e) => debug!("Parsing url {:s} failed: {:s}", *href, e)
- };
+ (Some(ref rel), Some(ref href)) => {
+ if rel.as_slice()
+ .split(HTML_SPACE_CHARACTERS.as_slice())
+ .any(|s| {
+ s.as_slice().eq_ignore_ascii_case("stylesheet")
+ }) {
+ debug!("found CSS stylesheet: {:s}", *href);
+ match UrlParser::new().base_url(base_url).parse(href.as_slice()) {
+ Ok(url) => css_chan2.send(CSSTaskNewFile(
+ UrlProvenance(url, resource_task.clone()))),
+ Err(e) => debug!("Parsing url {:s} failed: {:?}", *href, e)
+ };
+ }
}
_ => {}
}
@@ -502,7 +499,7 @@ pub fn parse_html(page: &Page,
match UrlParser::new().base_url(base_url)
.parse(src.deref().value().as_slice()) {
Ok(new_url) => js_chan2.send(JSTaskNewFile(new_url)),
- Err(e) => debug!("Parsing url {:s} failed: {:s}", src.deref().Value(), e)
+ Err(e) => debug!("Parsing url {:s} failed: {:?}", src.deref().Value(), e)
};
}
None => {
@@ -554,7 +551,7 @@ pub fn parse_html(page: &Page,
}
}
-fn build_parser(node: hubbub::NodeDataPtr) -> hubbub::Parser {
+fn build_parser<'a>(node: hubbub::NodeDataPtr) -> hubbub::Parser<'a> {
let mut parser = hubbub::Parser::new("UTF-8", false);
parser.set_document_node(node);
parser.enable_scripting(true);