Used rust-url directly instead of servo_util::url

The latter now only calls the former.
This commit is contained in:
Simon Sapin 2014-07-19 18:45:11 +01:00
parent 779cb44a44
commit 6917fbf28e
13 changed files with 78 additions and 71 deletions

View file

@ -20,7 +20,6 @@ use servo_util::str::DOMString;
use servo_net::image_cache_task;
use servo_net::image_cache_task::ImageCacheTask;
use servo_util::url::parse_url;
use servo_util::namespace::Null;
use url::Url;
@ -49,13 +48,13 @@ impl HTMLObjectElement {
}
trait ProcessDataURL {
fn process_data_url(&self, image_cache: ImageCacheTask, url: Option<Url>);
fn process_data_url(&self, image_cache: ImageCacheTask);
}
impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> {
// Makes the local `data` member match the status of the `data` attribute and starts
/// prefetching the image. This method must be called after `data` is changed.
fn process_data_url(&self, image_cache: ImageCacheTask, url: Option<Url>) {
fn process_data_url(&self, image_cache: ImageCacheTask) {
let elem: &JSRef<Element> = ElementCast::from_ref(self);
// TODO: support other values
@ -63,7 +62,7 @@ impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> {
elem.get_attribute(Null, "data").map(|x| x.root().Value())) {
(None, Some(uri)) => {
if is_image_data(uri.as_slice()) {
let data_url = parse_url(uri.as_slice(), url);
let data_url = Url::parse(uri.as_slice()).unwrap();
// Issue #84
image_cache.send(image_cache_task::Prefetch(data_url));
}
@ -103,8 +102,7 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLObjectElement> {
if "data" == name.as_slice() {
let window = window_from_node(self).root();
let url = Some(window.deref().get_url());
self.process_data_url(window.deref().image_cache_task.clone(), url);
self.process_data_url(window.deref().image_cache_task.clone());
}
}
}