aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread/lib.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2020-01-15 11:09:37 -0500
committerJosh Matthews <josh@joshmatthews.net>2020-01-15 11:09:37 -0500
commitc385953c97d5f1eb0190487c314274c02904b7f7 (patch)
tree5f651d733950a07d2ff44a1a5f99f56bc6baabc0 /components/layout_thread/lib.rs
parent9a518cf7979b79b34611135d09c1dd0a96945255 (diff)
downloadservo-jdm-revert4.tar.gz
servo-jdm-revert4.zip
Revert "Auto merge of #24677 - jdm:iframe-sizing-cleanup, r=asajeffrey"jdm-revert4
This reverts commit 9a518cf7979b79b34611135d09c1dd0a96945255, reversing changes made to a33d493a4ff6f8a629a9b82202c49c41ecbefa49.
Diffstat (limited to 'components/layout_thread/lib.rs')
-rw-r--r--components/layout_thread/lib.rs42
1 files changed, 23 insertions, 19 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 48b7591c242..84ace1c1efe 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -86,13 +86,13 @@ use script_layout_interface::wrapper_traits::LayoutNode;
use script_traits::Painter;
use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
use script_traits::{DrawAPaintImageResult, IFrameSizeMsg, PaintWorkletError, WindowSizeType};
-use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData};
+use script_traits::{ScrollState, UntrustedNodeAddress};
use selectors::Element;
use servo_arc::Arc as ServoArc;
use servo_atoms::Atom;
use servo_config::opts;
use servo_config::pref;
-use servo_geometry::MaxRect;
+use servo_geometry::{DeviceIndependentPixel, MaxRect};
use servo_url::ServoUrl;
use std::borrow::ToOwned;
use std::cell::{Cell, RefCell};
@@ -254,6 +254,13 @@ pub struct LayoutThread {
/// Load web fonts synchronously to avoid non-deterministic network-driven reflows.
load_webfonts_synchronously: bool,
+ /// The initial request size of the window
+ initial_window_size: Size2D<u32, DeviceIndependentPixel>,
+
+ /// The ratio of device pixels per px at the default scale.
+ /// If unspecified, will use the platform default setting.
+ device_pixels_per_px: Option<f32>,
+
/// Dumps the display list form after a layout.
dump_display_list: bool,
@@ -304,7 +311,8 @@ impl LayoutThreadFactory for LayoutThread {
paint_time_metrics: PaintTimeMetrics,
busy: Arc<AtomicBool>,
load_webfonts_synchronously: bool,
- window_size: WindowSizeData,
+ initial_window_size: Size2D<u32, DeviceIndependentPixel>,
+ device_pixels_per_px: Option<f32>,
dump_display_list: bool,
dump_display_list_json: bool,
dump_style_tree: bool,
@@ -352,7 +360,8 @@ impl LayoutThreadFactory for LayoutThread {
paint_time_metrics,
busy,
load_webfonts_synchronously,
- window_size,
+ initial_window_size,
+ device_pixels_per_px,
dump_display_list,
dump_display_list_json,
dump_style_tree,
@@ -522,7 +531,8 @@ impl LayoutThread {
paint_time_metrics: PaintTimeMetrics,
busy: Arc<AtomicBool>,
load_webfonts_synchronously: bool,
- window_size: WindowSizeData,
+ initial_window_size: Size2D<u32, DeviceIndependentPixel>,
+ device_pixels_per_px: Option<f32>,
dump_display_list: bool,
dump_display_list_json: bool,
dump_style_tree: bool,
@@ -532,10 +542,12 @@ impl LayoutThread {
trace_layout: bool,
dump_flow_tree: bool,
) -> LayoutThread {
+ // The device pixel ratio is incorrect (it does not have the hidpi value),
+ // but it will be set correctly when the initial reflow takes place.
let device = Device::new(
MediaType::screen(),
- window_size.initial_viewport,
- window_size.device_pixel_ratio,
+ initial_window_size.to_f32() * Scale::new(1.0),
+ Scale::new(device_pixels_per_px.unwrap_or(1.0)),
);
// Create the channel on which new animations can be sent.
@@ -597,7 +609,6 @@ impl LayoutThread {
text_index_response: TextIndexResponse(None),
nodes_from_point_response: vec![],
element_inner_text_response: String::new(),
- inner_window_dimensions_response: None,
})),
webrender_image_cache: Arc::new(RwLock::new(FnvHashMap::default())),
timer: if pref!(layout.animations.test.enabled) {
@@ -610,6 +621,8 @@ impl LayoutThread {
last_iframe_sizes: Default::default(),
busy,
load_webfonts_synchronously,
+ initial_window_size,
+ device_pixels_per_px,
dump_display_list,
dump_display_list_json,
dump_style_tree,
@@ -940,7 +953,8 @@ impl LayoutThread {
info.paint_time_metrics,
info.layout_is_busy,
self.load_webfonts_synchronously,
- info.window_size,
+ self.initial_window_size,
+ self.device_pixels_per_px,
self.dump_display_list,
self.dump_display_list_json,
self.dump_style_tree,
@@ -1319,9 +1333,6 @@ impl LayoutThread {
&QueryMsg::ElementInnerTextQuery(_) => {
rw_data.element_inner_text_response = String::new();
},
- &QueryMsg::InnerWindowDimensionsQuery(_) => {
- rw_data.inner_window_dimensions_response = None;
- },
},
ReflowGoal::Full | ReflowGoal::TickAnimations => {},
}
@@ -1674,13 +1685,6 @@ impl LayoutThread {
rw_data.element_inner_text_response =
process_element_inner_text_query(node, &rw_data.indexable_text);
},
- &QueryMsg::InnerWindowDimensionsQuery(browsing_context_id) => {
- rw_data.inner_window_dimensions_response = self
- .last_iframe_sizes
- .borrow()
- .get(&browsing_context_id)
- .cloned();
- },
},
ReflowGoal::Full | ReflowGoal::TickAnimations => {},
}