aboutsummaryrefslogtreecommitdiffstats
path: root/components/shared/script_layout/lib.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-12-16 16:05:33 +0100
committerGitHub <noreply@github.com>2024-12-16 15:05:33 +0000
commit3e052676efb351143ffc26bb166045f272e16074 (patch)
tree98a4590601b7fe65af2973ec1f0833b0516be611 /components/shared/script_layout/lib.rs
parenteb82161a8ae503f3019098c3230e5b33b89ccb58 (diff)
downloadservo-3e052676efb351143ffc26bb166045f272e16074.tar.gz
servo-3e052676efb351143ffc26bb166045f272e16074.zip
script: Manage `<iframe>` sizes in `Window` (#34643)
Manage `<iframe>` size updates in `Window`. In addition to removing duplicated code, this will allow setting `<iframe>` sizes synchronously on child `Pipeline`s of the same origin in the script process in a followup change. The goal is remove flakiness from `<iframe>` sizing. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/shared/script_layout/lib.rs')
-rw-r--r--components/shared/script_layout/lib.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/components/shared/script_layout/lib.rs b/components/shared/script_layout/lib.rs
index 591e356320c..f8643e866e7 100644
--- a/components/shared/script_layout/lib.rs
+++ b/components/shared/script_layout/lib.rs
@@ -23,6 +23,7 @@ use base::Epoch;
use canvas_traits::canvas::{CanvasId, CanvasMsg};
use euclid::default::{Point2D, Rect};
use euclid::Size2D;
+use fnv::FnvHashMap;
use fonts::SystemFontServiceProxy;
use ipc_channel::ipc::IpcSender;
use libc::c_void;
@@ -257,10 +258,6 @@ pub trait Layout {
fn query_content_boxes(&self, node: OpaqueNode) -> Vec<Rect<Au>>;
fn query_client_rect(&self, node: OpaqueNode) -> Rect<i32>;
fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String;
- fn query_inner_window_dimension(
- &self,
- context: BrowsingContextId,
- ) -> Option<Size2D<f32, CSSPixel>>;
fn query_nodes_from_point(
&self,
point: Point2D<f32>,
@@ -400,11 +397,24 @@ pub struct Reflow {
pub page_clip_rect: Rect<Au>,
}
+#[derive(Clone, Debug, MallocSizeOf)]
+pub struct IFrameSize {
+ pub browsing_context_id: BrowsingContextId,
+ pub pipeline_id: PipelineId,
+ pub size: Size2D<f32, CSSPixel>,
+}
+
+pub type IFrameSizes = FnvHashMap<BrowsingContextId, IFrameSize>;
+
/// Information derived from a layout pass that needs to be returned to the script thread.
#[derive(Debug, Default)]
pub struct ReflowResult {
/// The list of images that were encountered that are in progress.
pub pending_images: Vec<PendingImage>,
+ /// The list of iframes in this layout and their sizes, used in order
+ /// to communicate them with the Constellation and also the `Window`
+ /// element of their content pages.
+ pub iframe_sizes: IFrameSizes,
}
/// Information needed for a script-initiated reflow.