diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-12-16 16:05:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-16 15:05:33 +0000 |
commit | 3e052676efb351143ffc26bb166045f272e16074 (patch) | |
tree | 98a4590601b7fe65af2973ec1f0833b0516be611 /components/layout_2020/replaced.rs | |
parent | eb82161a8ae503f3019098c3230e5b33b89ccb58 (diff) | |
download | servo-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/layout_2020/replaced.rs')
-rw-r--r-- | components/layout_2020/replaced.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/components/layout_2020/replaced.rs b/components/layout_2020/replaced.rs index 149b5fe119b..86345e0b8f5 100644 --- a/components/layout_2020/replaced.rs +++ b/components/layout_2020/replaced.rs @@ -10,9 +10,11 @@ use app_units::Au; use base::id::{BrowsingContextId, PipelineId}; use canvas_traits::canvas::{CanvasId, CanvasMsg, FromLayoutMsg}; use data_url::DataUrl; +use euclid::Size2D; use ipc_channel::ipc::{self, IpcSender}; use net_traits::image_cache::{ImageOrMetadataAvailable, UsePlaceholder}; use pixels::Image; +use script_layout_interface::IFrameSize; use serde::Serialize; use servo_arc::Arc as ServoArc; use style::computed_values::object_fit::T as ObjectFit; @@ -280,6 +282,7 @@ impl ReplacedContents { pub fn make_fragments( &self, + layout_context: &LayoutContext, style: &ServoArc<ComputedValues>, size: PhysicalSize<Au>, ) -> Vec<Fragment> { @@ -349,6 +352,15 @@ impl ReplacedContents { image_key: video.as_ref().map(|video| video.image_key), })], ReplacedContentKind::IFrame(iframe) => { + let size = Size2D::new(rect.size.width.to_f32_px(), rect.size.height.to_f32_px()); + layout_context.iframe_sizes.lock().insert( + iframe.browsing_context_id, + IFrameSize { + browsing_context_id: iframe.browsing_context_id, + pipeline_id: iframe.pipeline_id, + size, + }, + ); vec![Fragment::IFrame(IFrameFragment { base: self.base_fragment_info.into(), style: style.clone(), |