aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2019-11-06 15:55:11 -0500
committerJosh Matthews <josh@joshmatthews.net>2019-11-06 16:13:55 -0500
commitfd260f78c80a070727ba88d7b5f7cc40eb7efb5a (patch)
treee5d20c19d3a8e3a79f88e9ceff0e8b8f772568a9 /components/script/dom/window.rs
parent38e4ae0833fbc15c8579d40bca7fc87e9d37cb03 (diff)
downloadservo-fd260f78c80a070727ba88d7b5f7cc40eb7efb5a.tar.gz
servo-fd260f78c80a070727ba88d7b5f7cc40eb7efb5a.zip
dom: Calculate the viewport size of iframes when they are first added to the tree.
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs13
1 files changed, 12 insertions, 1 deletions
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",
},
});