diff options
author | Josh Matthews <josh@joshmatthews.net> | 2018-12-09 13:16:47 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2018-12-14 13:00:47 -0500 |
commit | 34e77f62afcd4a4f64bc28bb8c6fb45b4c0a983a (patch) | |
tree | e416320fda4a438c7d8336e821521353fe99b932 /components/script/dom/htmliframeelement.rs | |
parent | df6afb2dd1c9f83494020dcb2e3a4b66b263f855 (diff) | |
download | servo-34e77f62afcd4a4f64bc28bb8c6fb45b4c0a983a.tar.gz servo-34e77f62afcd4a4f64bc28bb8c6fb45b4c0a983a.zip |
Ensure that all new iframes have a correct initial window size.
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r-- | components/script/dom/htmliframeelement.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 6f1ee07658f..93a14f16fee 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -26,6 +26,7 @@ use crate::dom::windowproxy::WindowProxy; use crate::script_thread::ScriptThread; use crate::task_source::TaskSource; use dom_struct::dom_struct; +use euclid::TypedSize2D; use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; @@ -34,6 +35,7 @@ use script_layout_interface::message::ReflowGoal; use script_traits::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed}; use script_traits::{ IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, UpdatePipelineIdReason, + WindowSizeData, }; use script_traits::{NewLayoutInfo, ScriptMsg}; use servo_config::prefs::PREFS; @@ -192,7 +194,16 @@ impl HTMLIFrameElement { load_data: load_data.unwrap(), pipeline_port: pipeline_receiver, content_process_shutdown_chan: None, - window_size: None, + window_size: Some(WindowSizeData { + initial_viewport: { + let rect = self.upcast::<Node>().bounding_content_box_or_zero(); + TypedSize2D::new( + rect.size.width.to_f32_px(), + rect.size.height.to_f32_px(), + ) + }, + device_pixel_ratio: window.device_pixel_ratio(), + }), layout_threads: PREFS.get("layout.threads").as_u64().expect("count") as usize, }; |