aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/hubbub_html_parser.rs
diff options
context:
space:
mode:
authorJack Moffitt <jack@metajack.im>2014-01-22 17:02:21 -0700
committerJack Moffitt <jack@metajack.im>2014-01-22 17:02:21 -0700
commitc443bcbfff2a68e0f37dba7e20fe752d6d8fa2d8 (patch)
treef3583c22c2d377dc8f987cd817ac41b7de3d966c /src/components/script/html/hubbub_html_parser.rs
parent539cf58f732e62be3fd23a86603d78e53f33c82e (diff)
downloadservo-c443bcbfff2a68e0f37dba7e20fe752d6d8fa2d8.tar.gz
servo-c443bcbfff2a68e0f37dba7e20fe752d6d8fa2d8.zip
Change `get_attr()` to `get_attr_val_for_layout()`.
The old code was used by both layout and script, but was erroneously borrowing for the layout case (which causes parallelism problems). script now uses only `value_ref()` or `get_attribute()`, and layout now has its own unsafe version that dances around the borrows of `@mut Attr`.
Diffstat (limited to 'src/components/script/html/hubbub_html_parser.rs')
-rw-r--r--src/components/script/html/hubbub_html_parser.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/components/script/html/hubbub_html_parser.rs b/src/components/script/html/hubbub_html_parser.rs
index 776f5a480f8..7724dc80e30 100644
--- a/src/components/script/html/hubbub_html_parser.rs
+++ b/src/components/script/html/hubbub_html_parser.rs
@@ -28,7 +28,7 @@ use std::comm::{Port, SharedChan};
use std::from_str::FromStr;
use std::str::eq_slice;
use std::str;
-use style::{Stylesheet, TElement};
+use style::Stylesheet;
macro_rules! handle_element(
($document: expr,
@@ -339,11 +339,11 @@ pub fn parse_html(cx: *JSContext,
// Handle CSS style sheets from <link> elements
ElementNodeTypeId(HTMLLinkElementTypeId) => {
node.with_imm_element(|element| {
- match (element.get_attr(Null, "rel"), element.get_attr(Null, "href")) {
+ match (element.get_attribute(Null, "rel"), element.get_attribute(Null, "href")) {
(Some(rel), Some(href)) => {
- if "stylesheet" == rel {
- debug!("found CSS stylesheet: {:s}", href);
- let url = make_url(href.to_str(), Some(url2.clone()));
+ if "stylesheet" == rel.value_ref() {
+ debug!("found CSS stylesheet: {:s}", href.value_ref());
+ let url = make_url(href.Value(), Some(url2.clone()));
css_chan2.send(CSSTaskNewFile(UrlProvenance(url)));
}
}
@@ -357,7 +357,7 @@ pub fn parse_html(cx: *JSContext,
node.with_mut_iframe_element(|iframe_element| {
let sandboxed = iframe_element.is_sandboxed();
let elem = &mut iframe_element.htmlelement.element;
- let src_opt = elem.get_attr(Null, "src").map(|x| x.to_str());
+ let src_opt = elem.get_attribute(Null, "src").map(|x| x.Value());
for src in src_opt.iter() {
let iframe_url = make_url(src.clone(), Some(url2.clone()));
iframe_element.frame = Some(iframe_url.clone());
@@ -453,10 +453,10 @@ pub fn parse_html(cx: *JSContext,
unsafe {
let scriptnode: AbstractNode = NodeWrapping::from_hubbub_node(script);
scriptnode.with_imm_element(|script| {
- match script.get_attr(Null, "src") {
+ match script.get_attribute(Null, "src") {
Some(src) => {
- debug!("found script: {:s}", src);
- let new_url = make_url(src.to_str(), Some(url3.clone()));
+ debug!("found script: {:s}", src.Value());
+ let new_url = make_url(src.Value(), Some(url3.clone()));
js_chan2.send(JSTaskNewFile(new_url));
}
None => {