/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use std::collections::HashMap; use std::sync::Arc; use embedder_traits::UntrustedNodeAddress; use euclid::Size2D; use fonts::FontContext; use layout_api::wrapper_traits::ThreadSafeLayoutNode; use layout_api::{ IFrameSizes, ImageAnimationState, LayoutImageDestination, PendingImage, PendingImageState, PendingRasterizationImage, }; use net_traits::image_cache::{ Image as CachedImage, ImageCache, ImageCacheResult, ImageOrMetadataAvailable, PendingImageId, UsePlaceholder, }; use parking_lot::{Mutex, RwLock}; use pixels::RasterImage; use rustc_hash::FxHashMap; use script::layout_dom::ServoThreadSafeLayoutNode; use servo_url::{ImmutableOrigin, ServoUrl}; use style::context::SharedStyleContext; use style::dom::OpaqueNode; use style::values::computed::image::{Gradient, Image}; use webrender_api::units::{DeviceIntSize, DeviceSize}; pub(crate) type CachedImageOrError = Result; pub(crate) struct LayoutContext<'a> { pub use_rayon: bool, /// Bits shared by the layout and style system. pub style_context: SharedStyleContext<'a>, /// A FontContext to be used during layout. pub font_context: Arc, /// A collection of `