diff options
Diffstat (limited to 'components/script_layout_interface')
-rw-r--r-- | components/script_layout_interface/lib.rs | 18 | ||||
-rw-r--r-- | components/script_layout_interface/rpc.rs | 4 |
2 files changed, 21 insertions, 1 deletions
diff --git a/components/script_layout_interface/lib.rs b/components/script_layout_interface/lib.rs index 87b76763d7d..1793e06909d 100644 --- a/components/script_layout_interface/lib.rs +++ b/components/script_layout_interface/lib.rs @@ -43,6 +43,9 @@ use canvas_traits::CanvasMsg; use core::nonzero::NonZero; use ipc_channel::ipc::IpcSender; use libc::c_void; +use net_traits::image_cache_thread::PendingImageId; +use script_traits::UntrustedNodeAddress; +use servo_url::ServoUrl; use std::sync::atomic::AtomicIsize; use style::data::ElementData; @@ -137,3 +140,18 @@ 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), + PendingResponse, +} + +/// The data associated with an image that is not yet present in the image cache. +/// Used by the script thread to hold on to DOM elements that need to be repainted +/// when an image fetch is complete. +pub struct PendingImage { + pub state: PendingImageState, + pub node: UntrustedNodeAddress, + pub id: PendingImageId, +} diff --git a/components/script_layout_interface/rpc.rs b/components/script_layout_interface/rpc.rs index 2fb75f6b959..78e99571ee7 100644 --- a/components/script_layout_interface/rpc.rs +++ b/components/script_layout_interface/rpc.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use PendingImage; use app_units::Au; use euclid::point::Point2D; use euclid::rect::Rect; @@ -37,7 +38,8 @@ pub trait LayoutRPC { fn offset_parent(&self) -> OffsetParentResponse; /// Query layout for the resolve values of the margin properties for an element. fn margin_style(&self) -> MarginStyleResponse; - + /// Requests the list of not-yet-loaded images that were encountered in the last reflow. + fn pending_images(&self) -> Vec<PendingImage>; fn nodes_from_point(&self, page_point: Point2D<f32>, client_point: Point2D<f32>) -> Vec<UntrustedNodeAddress>; fn text_index(&self) -> TextIndexResponse; |