pub(crate) struct ImageResolver {
pub origin: ImmutableOrigin,
pub image_cache: Arc<dyn ImageCache>,
pub pending_images: Mutex<Vec<PendingImage>>,
pub pending_rasterization_images: Mutex<Vec<PendingRasterizationImage>>,
pub pending_svg_elements_for_serialization: Mutex<Vec<UntrustedNodeAddress>>,
pub animating_images: Arc<RwLock<AnimatingImages>>,
pub resolved_images_cache: Arc<RwLock<HashMap<(ServoUrl, UsePlaceholder), Result<Image, ResolveImageError>>>>,
pub animation_timeline_value: f64,
}Fields§
§origin: ImmutableOriginThe origin of the Document that this ImageResolver resolves images for.
image_cache: Arc<dyn ImageCache>Reference to the script thread image cache.
pending_images: Mutex<Vec<PendingImage>>A list of in-progress image loads to be shared with the script thread.
pending_rasterization_images: Mutex<Vec<PendingRasterizationImage>>A list of fully loaded vector images that need to be rasterized to a specific size determined by layout. This will be shared with the script thread.
pending_svg_elements_for_serialization: Mutex<Vec<UntrustedNodeAddress>>A list of SVGSVGElements encountered during layout that are not
serialized yet. This is needed to support inline SVGs as they are treated
as replaced elements and the layout is responsible for triggering the
network load for the corresponding serialzed data: urls (similar to
background images).
animating_images: Arc<RwLock<AnimatingImages>>A shared reference to script’s map of DOM nodes with animated images. This is used to manage image animations in script and inform the script about newly animating nodes.
resolved_images_cache: Arc<RwLock<HashMap<(ServoUrl, UsePlaceholder), Result<Image, ResolveImageError>>>>§animation_timeline_value: f64The current animation timeline value used to properly initialize animating images.
Implementations§
Source§impl ImageResolver
impl ImageResolver
pub(crate) fn get_or_request_image_or_meta( &self, node: OpaqueNode, url: ServoUrl, use_placeholder: UsePlaceholder, destination: LayoutImageDestination, ) -> LayoutImageCacheResult
pub(crate) fn handle_animated_image( &self, node: OpaqueNode, image: Arc<RasterImage>, )
pub(crate) fn get_cached_image_for_url( &self, node: OpaqueNode, url: ServoUrl, use_placeholder: UsePlaceholder, destination: LayoutImageDestination, ) -> Result<CachedImage, ResolveImageError>
pub(crate) fn rasterize_vector_image( &self, image_id: PendingImageId, size: DeviceIntSize, node: OpaqueNode, ) -> Option<RasterImage>
pub(crate) fn queue_svg_element_for_serialization( &self, element: ServoThreadSafeLayoutNode<'_>, )
pub(crate) fn resolve_image<'a>( &self, node: Option<OpaqueNode>, image: &'a Image, ) -> Result<ResolvedImage<'a>, ResolveImageError>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ImageResolver
impl !RefUnwindSafe for ImageResolver
impl Send for ImageResolver
impl Sync for ImageResolver
impl Unpin for ImageResolver
impl !UnwindSafe for ImageResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more