Skip to content

Commit

Permalink
Move is_image_data to the layout crate
Browse files Browse the repository at this point in the history
It's only used there.
  • Loading branch information
nox committed Jan 9, 2019
1 parent 1120da6 commit ddef621
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 7 additions & 1 deletion components/layout/construct.rs
Expand Up @@ -51,7 +51,7 @@ use crate::ServoArc;
use script_layout_interface::wrapper_traits::{
PseudoElementType, ThreadSafeLayoutElement, ThreadSafeLayoutNode,
};
use script_layout_interface::{is_image_data, LayoutElementType, LayoutNodeType};
use script_layout_interface::{LayoutElementType, LayoutNodeType};
use servo_config::opts;
use servo_url::ServoUrl;
use std::collections::LinkedList;
Expand Down Expand Up @@ -2472,3 +2472,9 @@ impl Legalizer {
FlowRef::new(Arc::new(constructor(fragment)))
}
}

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_))
}
6 changes: 0 additions & 6 deletions components/script_layout_interface/lib.rs
Expand Up @@ -128,12 +128,6 @@ 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_))
}

/// Whether the pending image needs to be fetched or is waiting on an existing fetch.
pub enum PendingImageState {
Unrequested(ServoUrl),
Expand Down

0 comments on commit ddef621

Please sign in to comment.