From fd260f78c80a070727ba88d7b5f7cc40eb7efb5a Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 6 Nov 2019 15:55:11 -0500 Subject: dom: Calculate the viewport size of iframes when they are first added to the tree. --- components/script_layout_interface/Cargo.toml | 1 + components/script_layout_interface/message.rs | 5 ++++- components/script_layout_interface/rpc.rs | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'components/script_layout_interface') diff --git a/components/script_layout_interface/Cargo.toml b/components/script_layout_interface/Cargo.toml index 8ad33fc7d43..2e436761dc8 100644 --- a/components/script_layout_interface/Cargo.toml +++ b/components/script_layout_interface/Cargo.toml @@ -33,4 +33,5 @@ servo_arc = {path = "../servo_arc"} servo_atoms = {path = "../atoms"} servo_url = {path = "../url"} style = {path = "../style", features = ["servo"]} +style_traits = {path = "../style_traits", features = ["servo"]} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index 01a589d53cb..66e0e446cfa 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -10,7 +10,7 @@ use euclid::default::{Point2D, Rect}; use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use metrics::PaintTimeMetrics; -use msg::constellation_msg::{BackgroundHangMonitorRegister, PipelineId}; +use msg::constellation_msg::{BackgroundHangMonitorRegister, BrowsingContextId, PipelineId}; use net_traits::image_cache::ImageCache; use profile_traits::mem::ReportsChan; use script_traits::Painter; @@ -128,6 +128,7 @@ pub enum QueryMsg { ResolvedStyleQuery(TrustedNodeAddress, Option, PropertyId), StyleQuery(TrustedNodeAddress), ElementInnerTextQuery(TrustedNodeAddress), + InnerWindowDimensionsQuery(BrowsingContextId), } /// Any query to perform with this reflow. @@ -147,6 +148,7 @@ impl ReflowGoal { ReflowGoal::LayoutQuery(ref querymsg, _) => match *querymsg { QueryMsg::NodesFromPointQuery(..) | QueryMsg::TextIndexQuery(..) | + QueryMsg::InnerWindowDimensionsQuery(_) | QueryMsg::ElementInnerTextQuery(_) => true, QueryMsg::ContentBoxQuery(_) | QueryMsg::ContentBoxesQuery(_) | @@ -176,6 +178,7 @@ impl ReflowGoal { QueryMsg::NodeScrollIdQuery(_) | QueryMsg::ResolvedStyleQuery(..) | QueryMsg::OffsetParentQuery(_) | + QueryMsg::InnerWindowDimensionsQuery(_) | QueryMsg::StyleQuery(_) => false, }, } diff --git a/components/script_layout_interface/rpc.rs b/components/script_layout_interface/rpc.rs index 95d25082ed8..19da8fa6afc 100644 --- a/components/script_layout_interface/rpc.rs +++ b/components/script_layout_interface/rpc.rs @@ -4,9 +4,11 @@ use app_units::Au; use euclid::default::Rect; +use euclid::Size2D; use script_traits::UntrustedNodeAddress; use servo_arc::Arc; use style::properties::ComputedValues; +use style_traits::CSSPixel; use webrender_api::ExternalScrollId; /// Synchronous messages that script can send to layout. @@ -39,6 +41,8 @@ pub trait LayoutRPC { fn nodes_from_point_response(&self) -> Vec; /// Query layout to get the inner text for a given element. fn element_inner_text(&self) -> String; + /// Get the dimensions of an iframe's inner window. + fn inner_window_dimensions(&self) -> Option>; } pub struct ContentBoxResponse(pub Option>); -- cgit v1.2.3 From 91dfa354b16535f1c55c722b10cf4538f2385e0e Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Wed, 6 Nov 2019 16:13:43 -0500 Subject: Ensure layout/script always have a correct viewport size when a new pipeline is created. --- components/script_layout_interface/message.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'components/script_layout_interface') diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index 66e0e446cfa..fb2bac65d07 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -230,4 +230,5 @@ pub struct LayoutThreadInit { pub image_cache: Arc, pub paint_time_metrics: PaintTimeMetrics, pub layout_is_busy: Arc, + pub window_size: WindowSizeData, } -- cgit v1.2.3