Ensure that all new iframes have a correct initial window size.

This commit is contained in:
Josh Matthews 2018-12-09 13:16:47 -05:00
parent df6afb2dd1
commit 34e77f62af
3 changed files with 18 additions and 10 deletions

View file

@ -26,6 +26,7 @@ use crate::dom::windowproxy::WindowProxy;
use crate::script_thread::ScriptThread; use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource; use crate::task_source::TaskSource;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use euclid::TypedSize2D;
use html5ever::{LocalName, Prefix}; use html5ever::{LocalName, Prefix};
use ipc_channel::ipc; use ipc_channel::ipc;
use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; 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::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
use script_traits::{ use script_traits::{
IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, UpdatePipelineIdReason, IFrameLoadInfo, IFrameLoadInfoWithData, JsEvalResult, LoadData, UpdatePipelineIdReason,
WindowSizeData,
}; };
use script_traits::{NewLayoutInfo, ScriptMsg}; use script_traits::{NewLayoutInfo, ScriptMsg};
use servo_config::prefs::PREFS; use servo_config::prefs::PREFS;
@ -192,7 +194,16 @@ impl HTMLIFrameElement {
load_data: load_data.unwrap(), load_data: load_data.unwrap(),
pipeline_port: pipeline_receiver, pipeline_port: pipeline_receiver,
content_process_shutdown_chan: None, 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, layout_threads: PREFS.get("layout.threads").as_u64().expect("count") as usize,
}; };

View file

@ -4,18 +4,9 @@
[window.matchMedia exists] [window.matchMedia exists]
expected: FAIL expected: FAIL
[MediaQueryList.matches for "(max-width: 199px), all and (min-width: 200px)"]
expected: FAIL
[MediaQueryList.matches for "(min-aspect-ratio: 1/1)"] [MediaQueryList.matches for "(min-aspect-ratio: 1/1)"]
expected: FAIL expected: FAIL
[MediaQueryList.matches for "(width: 200px)"]
expected: FAIL
[MediaQueryList.matches for "(min-width: 150px)"]
expected: FAIL
[Resize iframe from 200x100 to 200x50, then to 100x50] [Resize iframe from 200x100 to 200x50, then to 100x50]
expected: NOTRUN expected: NOTRUN

View file

@ -1,2 +1,8 @@
[getComputedStyle-detached-subtree.html] [getComputedStyle-detached-subtree.html]
expected: ERROR expected: ERROR
[getComputedStyle returns no style for element in non-rendered iframe (display: none) from iframe's window]
expected: FAIL
[getComputedStyle returns no style for element in non-rendered iframe (display: none)]
expected: FAIL