diff --git a/Cargo.lock b/Cargo.lock index 2e7cc018923..bdd5cc0ceee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6088,6 +6088,7 @@ dependencies = [ "canvas_traits", "crossbeam-channel", "euclid", + "fnv", "fonts", "fonts_traits", "html5ever", diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index e7713b11674..f85f6c676e4 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -1865,6 +1865,7 @@ where pipeline.title = title; } }, + FromScriptMsg::IFrameSizes(iframe_sizes) => self.handle_iframe_size_msg(iframe_sizes), } } @@ -2138,11 +2139,6 @@ where fn handle_request_from_layout(&mut self, message: FromLayoutMsg) { trace_layout_msg!(message, "{message:?}"); match message { - // Layout sends new sizes for all subframes. This needs to be reflected by all - // frame trees in the navigation context containing the subframe. - FromLayoutMsg::IFrameSizes(iframe_sizes) => { - self.handle_iframe_size_msg(iframe_sizes); - }, FromLayoutMsg::PendingPaintMetric(pipeline_id, epoch) => { self.handle_pending_paint_metric(pipeline_id, epoch); }, diff --git a/components/constellation/tracing.rs b/components/constellation/tracing.rs index 06ee3ee44e3..c81da81fa89 100644 --- a/components/constellation/tracing.rs +++ b/components/constellation/tracing.rs @@ -189,6 +189,7 @@ mod from_script { #[cfg(feature = "webgpu")] Self::GetWebGPUChan(..) => target!("GetWebGPUChan"), Self::TitleChanged(..) => target!("TitleChanged"), + Self::IFrameSizes(..) => target!("IFrameSizes"), } } } @@ -257,7 +258,6 @@ mod from_layout { impl LogTarget for script_traits::LayoutMsg { fn log_target(&self) -> &'static str { match self { - Self::IFrameSizes(..) => target!("IFrameSizes"), Self::PendingPaintMetric(..) => target!("PendingPaintMetric"), } } diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index bece8e09557..4046f45f314 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -13,7 +13,7 @@ use std::sync::Arc; use std::{f32, mem}; use app_units::{Au, AU_PER_PX}; -use base::id::{BrowsingContextId, PipelineId}; +use base::id::PipelineId; use bitflags::bitflags; use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg}; use embedder_traits::Cursor; @@ -25,7 +25,9 @@ use ipc_channel::ipc; use log::{debug, warn}; use net_traits::image_cache::UsePlaceholder; use range::Range; -use script_layout_interface::{combine_id_with_fragment_type, FragmentType}; +use script_layout_interface::{ + combine_id_with_fragment_type, FragmentType, IFrameSize, IFrameSizes, +}; use servo_config::opts; use servo_geometry::{self, MaxRect}; use style::color::AbsoluteColor; @@ -43,7 +45,7 @@ use style::values::computed::{ClipRectOrAuto, Gradient}; use style::values::generics::background::BackgroundSize; use style::values::generics::image::PaintWorklet; use style::values::specified::ui::CursorKind; -use style_traits::{CSSPixel, ToCss}; +use style_traits::ToCss; use webrender_api::units::{LayoutRect, LayoutTransform, LayoutVector2D}; use webrender_api::{ self, BorderDetails, BorderRadius, BorderSide, BoxShadowClipMode, ColorF, ColorU, @@ -327,7 +329,7 @@ pub struct DisplayListBuildState<'a> { /// Vector containing iframe sizes, used to inform the constellation about /// new iframe sizes - pub iframe_sizes: FnvHashMap>, + pub iframe_sizes: IFrameSizes, /// Stores text runs to answer text queries used to place a cursor inside text. pub indexable_text: IndexableText, @@ -1872,19 +1874,25 @@ impl Fragment { }, SpecificFragmentInfo::Iframe(ref fragment_info) => { if !stacking_relative_content_box.is_empty() { - let browsing_context_id = match fragment_info.browsing_context_id { - Some(browsing_context_id) => browsing_context_id, - None => return warn!("No browsing context id for iframe."), + let Some(browsing_context_id) = fragment_info.browsing_context_id else { + return warn!("No browsing context id for iframe."); + }; + let Some(pipeline_id) = fragment_info.pipeline_id else { + return warn!("No pipeline id for iframe."); }; let base = create_base_display_item(state); let bounds = stacking_relative_content_box.to_layout(); - // XXXjdm: This sleight-of-hand to convert LayoutRect -> Size2D - // looks bogus. state.iframe_sizes.insert( browsing_context_id, - euclid::Size2D::new(bounds.size().width, bounds.size().height), + IFrameSize { + browsing_context_id, + pipeline_id, + // XXXjdm: This sleight-of-hand to convert LayoutRect -> Size2D + // looks bogus. + size: euclid::Size2D::new(bounds.size().width, bounds.size().height), + }, ); let pipeline_id = match fragment_info.pipeline_id { diff --git a/components/layout_2020/context.rs b/components/layout_2020/context.rs index f1542327422..871fce6cb0d 100644 --- a/components/layout_2020/context.rs +++ b/components/layout_2020/context.rs @@ -11,7 +11,7 @@ use net_traits::image_cache::{ ImageCache, ImageCacheResult, ImageOrMetadataAvailable, UsePlaceholder, }; use parking_lot::{Mutex, RwLock}; -use script_layout_interface::{PendingImage, PendingImageState}; +use script_layout_interface::{IFrameSizes, PendingImage, PendingImageState}; use servo_url::{ImmutableOrigin, ServoUrl}; use style::context::SharedStyleContext; use style::dom::OpaqueNode; @@ -35,6 +35,9 @@ pub struct LayoutContext<'a> { /// A list of in-progress image loads to be shared with the script thread. pub pending_images: Mutex>, + /// A collection of `