mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Move is_image_data() where it’s used.
This commit is contained in:
parent
b902e0f8f5
commit
779cb44a44
3 changed files with 7 additions and 10 deletions
|
@ -56,9 +56,10 @@ use script::dom::element::{HTMLTableRowElementTypeId, HTMLTableSectionElementTyp
|
||||||
use script::dom::node::{CommentNodeTypeId, DoctypeNodeTypeId, DocumentFragmentNodeTypeId};
|
use script::dom::node::{CommentNodeTypeId, DoctypeNodeTypeId, DocumentFragmentNodeTypeId};
|
||||||
use script::dom::node::{DocumentNodeTypeId, ElementNodeTypeId, ProcessingInstructionNodeTypeId};
|
use script::dom::node::{DocumentNodeTypeId, ElementNodeTypeId, ProcessingInstructionNodeTypeId};
|
||||||
use script::dom::node::{TextNodeTypeId};
|
use script::dom::node::{TextNodeTypeId};
|
||||||
|
use script::dom::htmlobjectelement::is_image_data;
|
||||||
use servo_util::namespace;
|
use servo_util::namespace;
|
||||||
use servo_util::range::Range;
|
use servo_util::range::Range;
|
||||||
use servo_util::url::{is_image_data, parse_url};
|
use servo_util::url::parse_url;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::sync::atomics::Relaxed;
|
use std::sync::atomics::Relaxed;
|
||||||
use style::ComputedValues;
|
use style::ComputedValues;
|
||||||
|
|
|
@ -22,7 +22,6 @@ use servo_net::image_cache_task;
|
||||||
use servo_net::image_cache_task::ImageCacheTask;
|
use servo_net::image_cache_task::ImageCacheTask;
|
||||||
use servo_util::url::parse_url;
|
use servo_util::url::parse_url;
|
||||||
use servo_util::namespace::Null;
|
use servo_util::namespace::Null;
|
||||||
use servo_util::url::is_image_data;
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
#[deriving(Encodable)]
|
#[deriving(Encodable)]
|
||||||
|
@ -74,6 +73,11 @@ impl<'a> ProcessDataURL for JSRef<'a, HTMLObjectElement> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_image_data(uri: &str) -> bool {
|
||||||
|
static types: &'static [&'static str] = &["data:image/png", "data:image/gif", "data:image/jpeg"];
|
||||||
|
types.iter().any(|&type_| uri.starts_with(type_))
|
||||||
|
}
|
||||||
|
|
||||||
pub trait HTMLObjectElementMethods {
|
pub trait HTMLObjectElementMethods {
|
||||||
fn Validity(&self) -> Temporary<ValidityState>;
|
fn Validity(&self) -> Temporary<ValidityState>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,3 @@ pub fn parse_url(str_url: &str, base_url: Option<rust_url::Url>) -> rust_url::Ur
|
||||||
// FIXME: Need to handle errors
|
// FIXME: Need to handle errors
|
||||||
try_parse_url(str_url, base_url).ok().expect("URL parsing failed")
|
try_parse_url(str_url, base_url).ok().expect("URL parsing failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn is_image_data(uri: &str) -> bool {
|
|
||||||
static types: &'static [&'static str] = &["data:image/png", "data:image/gif", "data:image/jpeg"];
|
|
||||||
types.iter().any(|&type_| uri.starts_with(type_))
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue