mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Ensure layout/script always have a correct viewport size when a new pipeline is created.
This commit is contained in:
parent
2aa5ddf922
commit
91dfa354b1
10 changed files with 41 additions and 56 deletions
|
@ -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};
|
||||
use script_traits::{ScrollState, UntrustedNodeAddress, WindowSizeData};
|
||||
use selectors::Element;
|
||||
use servo_arc::Arc as ServoArc;
|
||||
use servo_atoms::Atom;
|
||||
use servo_config::opts;
|
||||
use servo_config::pref;
|
||||
use servo_geometry::{DeviceIndependentPixel, MaxRect};
|
||||
use servo_geometry::MaxRect;
|
||||
use servo_url::ServoUrl;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::{Cell, RefCell};
|
||||
|
@ -254,13 +254,6 @@ 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,
|
||||
|
||||
|
@ -311,8 +304,7 @@ impl LayoutThreadFactory for LayoutThread {
|
|||
paint_time_metrics: PaintTimeMetrics,
|
||||
busy: Arc<AtomicBool>,
|
||||
load_webfonts_synchronously: bool,
|
||||
initial_window_size: Size2D<u32, DeviceIndependentPixel>,
|
||||
device_pixels_per_px: Option<f32>,
|
||||
window_size: WindowSizeData,
|
||||
dump_display_list: bool,
|
||||
dump_display_list_json: bool,
|
||||
dump_style_tree: bool,
|
||||
|
@ -360,8 +352,7 @@ impl LayoutThreadFactory for LayoutThread {
|
|||
paint_time_metrics,
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
initial_window_size,
|
||||
device_pixels_per_px,
|
||||
window_size,
|
||||
dump_display_list,
|
||||
dump_display_list_json,
|
||||
dump_style_tree,
|
||||
|
@ -531,8 +522,7 @@ impl LayoutThread {
|
|||
paint_time_metrics: PaintTimeMetrics,
|
||||
busy: Arc<AtomicBool>,
|
||||
load_webfonts_synchronously: bool,
|
||||
initial_window_size: Size2D<u32, DeviceIndependentPixel>,
|
||||
device_pixels_per_px: Option<f32>,
|
||||
window_size: WindowSizeData,
|
||||
dump_display_list: bool,
|
||||
dump_display_list_json: bool,
|
||||
dump_style_tree: bool,
|
||||
|
@ -542,12 +532,10 @@ 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(),
|
||||
initial_window_size.to_f32() * Scale::new(1.0),
|
||||
Scale::new(device_pixels_per_px.unwrap_or(1.0)),
|
||||
window_size.initial_viewport,
|
||||
window_size.device_pixel_ratio,
|
||||
);
|
||||
|
||||
// Create the channel on which new animations can be sent.
|
||||
|
@ -622,8 +610,6 @@ 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,
|
||||
|
@ -954,8 +940,7 @@ impl LayoutThread {
|
|||
info.paint_time_metrics,
|
||||
info.layout_is_busy,
|
||||
self.load_webfonts_synchronously,
|
||||
self.initial_window_size,
|
||||
self.device_pixels_per_px,
|
||||
info.window_size,
|
||||
self.dump_display_list,
|
||||
self.dump_display_list_json,
|
||||
self.dump_style_tree,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue