aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface/lib.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-06-16 09:44:40 +0100
committerMs2ger <Ms2ger@gmail.com>2016-06-20 19:08:11 +0200
commit2c50318ee7c05ab926e27d225a3409c8da86c991 (patch)
tree2e9fabd857dc86c60f7a7b6f103da3d1b6137eac /components/script_layout_interface/lib.rs
parent65b93c20b7be0008ba6d49a49f8119524451ef95 (diff)
downloadservo-2c50318ee7c05ab926e27d225a3409c8da86c991.tar.gz
servo-2c50318ee7c05ab926e27d225a3409c8da86c991.zip
Move is_image_data to script_layout_interface.
Diffstat (limited to 'components/script_layout_interface/lib.rs')
-rw-r--r--components/script_layout_interface/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs
index 123792a6c6f..33d6696b782 100644
--- a/components/script_layout_interface/lib.rs
+++ b/components/script_layout_interface/lib.rs
@@ -100,3 +100,8 @@ pub struct TrustedNodeAddress(pub *const c_void);
#[allow(unsafe_code)]
unsafe impl Send for TrustedNodeAddress {}
+
+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_))
+}