diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-11-07 07:40:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-07 07:40:29 -0500 |
commit | 9a518cf7979b79b34611135d09c1dd0a96945255 (patch) | |
tree | 9ffeb03a554620b6741494bc80fc77596195a649 /components/script/dom/window.rs | |
parent | a33d493a4ff6f8a629a9b82202c49c41ecbefa49 (diff) | |
parent | 4578ae834c286570361d8cc6c1322b3acd3b7751 (diff) | |
download | servo-9a518cf7979b79b34611135d09c1dd0a96945255.tar.gz servo-9a518cf7979b79b34611135d09c1dd0a96945255.zip |
Auto merge of #24677 - jdm:iframe-sizing-cleanup, r=asajeffrey
Ensure all iframes are sized correctly at creation
Following in the path of #22395, these commits serve several purposes:
* prevent layout instability early during iframe loads caused by a succession of resize events
* reduce the complexity of determining what actual DPI and initial window size values are being used at startup
* ensure that all documents have a correct initial viewport size at creation
These changes fix problems that were exposed by the changes in #24462 but are independent of that PR.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 13 |
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", }, }); |