Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize iframe viewport immediately #22395

Merged
merged 5 commits into from Dec 18, 2018
Next

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

  • Loading branch information
jdm committed Dec 14, 2018
commit 34e77f62afcd4a4f64bc28bb8c6fb45b4c0a983a
@@ -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,
};

@@ -4,18 +4,9 @@
[window.matchMedia exists]
expected: FAIL

[MediaQueryList.matches for "(max-width: 199px), all and (min-width: 200px)"]
expected: FAIL

[MediaQueryList.matches for "(min-aspect-ratio: 1/1)"]
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]
expected: NOTRUN

@@ -1,2 +1,8 @@
[getComputedStyle-detached-subtree.html]
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
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.