aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/html/cssparse.rs
diff options
context:
space:
mode:
authorJack Moffitt <jack@metajack.im>2013-12-20 22:04:46 -0700
committerJack Moffitt <jack@metajack.im>2014-01-12 19:45:45 -0700
commita7ef1cd35e9347a285f245041db4eb94047f4ab0 (patch)
treea6dc269d9f3cb031d7ea096628c81b7edc971c1c /src/components/script/html/cssparse.rs
parent728fb9a7dedf67445e7f12eafb314117efede70d (diff)
downloadservo-a7ef1cd35e9347a285f245041db4eb94047f4ab0.tar.gz
servo-a7ef1cd35e9347a285f245041db4eb94047f4ab0.zip
Upgrade to latest Rust.
Diffstat (limited to 'src/components/script/html/cssparse.rs')
-rw-r--r--src/components/script/html/cssparse.rs24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/components/script/html/cssparse.rs b/src/components/script/html/cssparse.rs
index 0ba1aadbe03..5f5ba17653b 100644
--- a/src/components/script/html/cssparse.rs
+++ b/src/components/script/html/cssparse.rs
@@ -4,10 +4,7 @@
/// Some little helpers for hooking up the HTML parser with the CSS parser.
-use std::cell::Cell;
-use std::comm;
use std::comm::Port;
-use std::task;
use encoding::EncodingRef;
use encoding::all::UTF_8;
use style::Stylesheet;
@@ -23,25 +20,22 @@ pub enum StylesheetProvenance {
pub fn spawn_css_parser(provenance: StylesheetProvenance,
resource_task: ResourceTask)
-> Port<Stylesheet> {
- let (result_port, result_chan) = comm::stream();
+ let (result_port, result_chan) = Chan::new();
// TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding
let environment_encoding = UTF_8 as EncodingRef;
- let provenance_cell = Cell::new(provenance);
- do task::spawn {
+ spawn(proc() {
// TODO: CSS parsing should take a base URL.
- let _url = do provenance_cell.with_ref |p| {
- match *p {
- UrlProvenance(ref the_url) => (*the_url).clone(),
- InlineProvenance(ref the_url, _) => (*the_url).clone()
- }
+ let _url = match provenance {
+ UrlProvenance(ref the_url) => (*the_url).clone(),
+ InlineProvenance(ref the_url, _) => (*the_url).clone()
};
- let sheet = match provenance_cell.take() {
+ let sheet = match provenance {
UrlProvenance(url) => {
debug!("cssparse: loading style sheet at {:s}", url.to_str());
- let (input_port, input_chan) = comm::stream();
+ let (input_port, input_chan) = Chan::new();
resource_task.send(Load(url, input_chan));
let LoadResponse { metadata: metadata, progress_port: progress_port }
= input_port.recv();
@@ -56,7 +50,7 @@ pub fn spawn_css_parser(provenance: StylesheetProvenance,
}
};
result_chan.send(sheet);
- }
+ });
return result_port;
}
@@ -69,7 +63,7 @@ impl Iterator<~[u8]> for ProgressMsgPortIterator {
fn next(&mut self) -> Option<~[u8]> {
match self.progress_port.recv() {
Payload(data) => Some(data),
- Done(*) => None
+ Done(..) => None
}
}
}