aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/htmliframeelement.rs18
-rw-r--r--components/script/dom/window.rs13
-rw-r--r--components/script/script_thread.rs10
3 files changed, 32 insertions, 9 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index f5a820458c2..e58e65ea5bb 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -28,7 +28,6 @@ use crate::dom::windowproxy::WindowProxy;
use crate::script_thread::ScriptThread;
use crate::task_source::TaskSource;
use dom_struct::dom_struct;
-use euclid::Size2D;
use html5ever::{LocalName, Prefix};
use ipc_channel::ipc;
use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId};
@@ -173,6 +172,13 @@ impl HTMLIFrameElement {
replace: replace,
};
+ let window_size = WindowSizeData {
+ initial_viewport: window
+ .inner_window_dimensions_query(browsing_context_id)
+ .unwrap_or_default(),
+ device_pixel_ratio: window.device_pixel_ratio(),
+ };
+
match nav_type {
NavigationType::InitialAboutBlank => {
let (pipeline_sender, pipeline_receiver) = ipc::channel().unwrap();
@@ -184,6 +190,7 @@ impl HTMLIFrameElement {
load_data: load_data.clone(),
old_pipeline_id: old_pipeline_id,
sandbox: sandboxed,
+ window_size,
};
global_scope
.script_to_constellation_chan()
@@ -198,13 +205,7 @@ impl HTMLIFrameElement {
opener: None,
load_data: load_data,
pipeline_port: pipeline_receiver,
- window_size: WindowSizeData {
- initial_viewport: {
- let rect = self.upcast::<Node>().bounding_content_box_or_zero();
- Size2D::new(rect.size.width.to_f32_px(), rect.size.height.to_f32_px())
- },
- device_pixel_ratio: window.device_pixel_ratio(),
- },
+ window_size,
};
self.pipeline_id.set(Some(new_pipeline_id));
@@ -216,6 +217,7 @@ impl HTMLIFrameElement {
load_data: load_data,
old_pipeline_id: old_pipeline_id,
sandbox: sandboxed,
+ window_size,
};
global_scope
.script_to_constellation_chan()
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 70099ee5866..95326b46352 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -89,7 +89,7 @@ use js::jsval::{JSVal, NullValue};
use js::rust::wrappers::JS_DefineProperty;
use js::rust::{CustomAutoRooter, CustomAutoRooterGuard, HandleValue};
use media::WindowGLContext;
-use msg::constellation_msg::PipelineId;
+use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image_cache::{ImageCache, ImageResponder, ImageResponse};
use net_traits::image_cache::{PendingImageId, PendingImageResponse};
use net_traits::storage_thread::StorageType;
@@ -1829,6 +1829,16 @@ impl Window {
DOMString::from(resolved)
}
+ pub fn inner_window_dimensions_query(
+ &self,
+ browsing_context: BrowsingContextId,
+ ) -> Option<Size2D<f32, CSSPixel>> {
+ if !self.layout_reflow(QueryMsg::InnerWindowDimensionsQuery(browsing_context)) {
+ return None;
+ }
+ self.layout_rpc.inner_window_dimensions()
+ }
+
#[allow(unsafe_code)]
pub fn offset_parent_query(&self, node: &Node) -> (Option<DomRoot<Element>>, UntypedRect<Au>) {
if !self.layout_reflow(QueryMsg::OffsetParentQuery(node.to_opaque())) {
@@ -2359,6 +2369,7 @@ fn debug_reflow_events(id: PipelineId, reflow_goal: &ReflowGoal, reason: &Reflow
&QueryMsg::StyleQuery(_n) => "\tStyleQuery",
&QueryMsg::TextIndexQuery(..) => "\tTextIndexQuery",
&QueryMsg::ElementInnerTextQuery(_) => "\tElementInnerTextQuery",
+ &QueryMsg::InnerWindowDimensionsQuery(_) => "\tInnerWindowDimensionsQuery",
},
});
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 6a7a69651e7..191df335ec5 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -2392,6 +2392,7 @@ impl ScriptThread {
load_data.url.clone(),
),
layout_is_busy: layout_is_busy.clone(),
+ window_size,
});
// Pick a layout thread, any layout thread
@@ -3696,6 +3697,15 @@ impl ScriptThread {
};
let window = document.window();
+ if window.window_size() == new_size {
+ return;
+ }
+ debug!(
+ "resizing pipeline {:?} from {:?} to {:?}",
+ pipeline_id,
+ window.window_size(),
+ new_size
+ );
window.set_window_size(new_size);
window.force_reflow(ReflowGoal::Full, ReflowReason::WindowResize);