mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
Compare commits
1 Commits
f9cfd05af8
...
jdm-revert
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c385953c97 |
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -4221,7 +4221,6 @@ dependencies = [
|
||||
"servo_atoms",
|
||||
"servo_url",
|
||||
"style",
|
||||
"style_traits",
|
||||
"webrender_api",
|
||||
]
|
||||
|
||||
|
||||
@@ -209,6 +209,9 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> {
|
||||
|
||||
/// True to translate mouse input into touch events.
|
||||
convert_mouse_to_touch: bool,
|
||||
|
||||
/// Ratio of device pixels per px at the default scale.
|
||||
device_pixels_per_px: Option<f32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
@@ -281,6 +284,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||
is_running_problem_test: bool,
|
||||
exit_after_load: bool,
|
||||
convert_mouse_to_touch: bool,
|
||||
device_pixels_per_px: Option<f32>,
|
||||
) -> Self {
|
||||
let composite_target = match output_file {
|
||||
Some(_) => CompositeTarget::PngFile,
|
||||
@@ -323,6 +327,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||
is_running_problem_test,
|
||||
exit_after_load,
|
||||
convert_mouse_to_touch,
|
||||
device_pixels_per_px,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,6 +338,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||
is_running_problem_test: bool,
|
||||
exit_after_load: bool,
|
||||
convert_mouse_to_touch: bool,
|
||||
device_pixels_per_px: Option<f32>,
|
||||
) -> Self {
|
||||
let mut compositor = IOCompositor::new(
|
||||
window,
|
||||
@@ -341,11 +347,15 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||
is_running_problem_test,
|
||||
exit_after_load,
|
||||
convert_mouse_to_touch,
|
||||
device_pixels_per_px,
|
||||
);
|
||||
|
||||
// Set the size of the root layer.
|
||||
compositor.update_zoom_transform();
|
||||
|
||||
// Tell the constellation about the initial window size.
|
||||
compositor.send_window_size(WindowSizeType::Initial);
|
||||
|
||||
compositor
|
||||
}
|
||||
|
||||
@@ -635,6 +645,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||
|
||||
self.create_pipeline_details_for_frame_tree(&frame_tree);
|
||||
|
||||
self.send_window_size(WindowSizeType::Initial);
|
||||
|
||||
self.frame_tree_id.next();
|
||||
}
|
||||
|
||||
@@ -1069,10 +1081,13 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
|
||||
}
|
||||
|
||||
fn hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
if self.output_file.is_some() {
|
||||
return Scale::new(1.0);
|
||||
match self.device_pixels_per_px {
|
||||
Some(device_pixels_per_px) => Scale::new(device_pixels_per_px),
|
||||
None => match self.output_file {
|
||||
Some(_) => Scale::new(1.0),
|
||||
None => self.embedder_coordinates.hidpi_factor,
|
||||
},
|
||||
}
|
||||
self.embedder_coordinates.hidpi_factor
|
||||
}
|
||||
|
||||
fn device_pixels_per_page_px(&self) -> Scale<f32, CSSPixel, DevicePixel> {
|
||||
|
||||
@@ -112,7 +112,7 @@ use compositing::SendableFrameTree;
|
||||
use crossbeam_channel::{after, never, unbounded, Receiver, Sender};
|
||||
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
|
||||
use embedder_traits::{Cursor, EmbedderMsg, EmbedderProxy, EventLoopWaker};
|
||||
use euclid::{default::Size2D as UntypedSize2D, Size2D};
|
||||
use euclid::{default::Size2D as UntypedSize2D, Scale, Size2D};
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx_traits::Epoch;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
@@ -157,6 +157,7 @@ use script_traits::{MessagePortMsg, PortMessageTask, StructuredSerializedData};
|
||||
use script_traits::{SWManagerMsg, ScopeThings, UpdatePipelineIdReason, WebDriverCommandMsg};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use servo_config::{opts, pref};
|
||||
use servo_geometry::DeviceIndependentPixel;
|
||||
use servo_rand::{random, Rng, ServoRng, SliceRandom};
|
||||
use servo_remutex::ReentrantMutex;
|
||||
use servo_url::{Host, ImmutableOrigin, ServoUrl};
|
||||
@@ -462,6 +463,10 @@ pub struct Constellation<Message, LTF, STF> {
|
||||
|
||||
/// Mechanism to force the compositor to process events.
|
||||
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||
|
||||
/// 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>,
|
||||
}
|
||||
|
||||
/// State needed to construct a constellation.
|
||||
@@ -518,6 +523,10 @@ pub struct InitialConstellationState {
|
||||
|
||||
/// Mechanism to force the compositor to process events.
|
||||
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||
|
||||
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
|
||||
/// platform default setting.
|
||||
pub device_pixels_per_px: Option<f32>,
|
||||
}
|
||||
|
||||
/// Data needed for webdriver
|
||||
@@ -693,7 +702,8 @@ where
|
||||
/// Create a new constellation thread.
|
||||
pub fn start(
|
||||
state: InitialConstellationState,
|
||||
initial_window_size: WindowSizeData,
|
||||
initial_window_size: Size2D<u32, DeviceIndependentPixel>,
|
||||
device_pixels_per_px: Option<f32>,
|
||||
random_pipeline_closure_probability: Option<f32>,
|
||||
random_pipeline_closure_seed: Option<usize>,
|
||||
is_running_problem_test: bool,
|
||||
@@ -801,7 +811,10 @@ where
|
||||
next_pipeline_namespace_id: PipelineNamespaceId(2),
|
||||
time_profiler_chan: state.time_profiler_chan,
|
||||
mem_profiler_chan: state.mem_profiler_chan,
|
||||
window_size: initial_window_size,
|
||||
window_size: WindowSizeData {
|
||||
initial_viewport: initial_window_size.to_f32() * Scale::new(1.0),
|
||||
device_pixel_ratio: Scale::new(device_pixels_per_px.unwrap_or(1.0)),
|
||||
},
|
||||
phantom: PhantomData,
|
||||
webdriver: WebDriverData::new(),
|
||||
timer_scheduler: TimerScheduler::new(),
|
||||
@@ -831,6 +844,7 @@ where
|
||||
glplayer_threads: state.glplayer_threads,
|
||||
player_context: state.player_context,
|
||||
event_loop_waker: state.event_loop_waker,
|
||||
device_pixels_per_px,
|
||||
};
|
||||
|
||||
constellation.run();
|
||||
@@ -1060,12 +1074,10 @@ where
|
||||
resource_threads,
|
||||
time_profiler_chan: self.time_profiler_chan.clone(),
|
||||
mem_profiler_chan: self.mem_profiler_chan.clone(),
|
||||
window_size: WindowSizeData {
|
||||
initial_viewport: initial_window_size,
|
||||
device_pixel_ratio: self.window_size.device_pixel_ratio,
|
||||
},
|
||||
window_size: initial_window_size,
|
||||
event_loop,
|
||||
load_data,
|
||||
device_pixel_ratio: self.window_size.device_pixel_ratio,
|
||||
prev_visibility: is_visible,
|
||||
webrender_api_sender: self.webrender_api_sender.clone(),
|
||||
webrender_document: self.webrender_document,
|
||||
@@ -1077,6 +1089,7 @@ where
|
||||
webxr_registry: self.webxr_registry.clone(),
|
||||
player_context: self.player_context.clone(),
|
||||
event_loop_waker: self.event_loop_waker.as_ref().map(|w| (*w).clone_box()),
|
||||
device_pixels_per_px: self.device_pixels_per_px,
|
||||
});
|
||||
|
||||
let pipeline = match result {
|
||||
@@ -2216,7 +2229,6 @@ where
|
||||
new_pipeline_id: new_pipeline_id,
|
||||
replace: None,
|
||||
new_browsing_context_info: None,
|
||||
window_size,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2361,7 +2373,6 @@ where
|
||||
is_private: is_private,
|
||||
is_visible: is_visible,
|
||||
}),
|
||||
window_size,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2533,10 +2544,6 @@ where
|
||||
// https://github.com/rust-lang/rust/issues/59159
|
||||
let browsing_context_size = browsing_context.size;
|
||||
let browsing_context_is_visible = browsing_context.is_visible;
|
||||
debug_assert_eq!(
|
||||
browsing_context_size,
|
||||
load_info.window_size.initial_viewport
|
||||
);
|
||||
|
||||
// Create the new pipeline, attached to the parent and push to pending changes
|
||||
self.new_pipeline(
|
||||
@@ -2558,7 +2565,6 @@ where
|
||||
replace: replace,
|
||||
// Browsing context for iframe already exists.
|
||||
new_browsing_context_info: None,
|
||||
window_size: load_info.window_size.initial_viewport,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2617,7 +2623,6 @@ where
|
||||
is_private: is_private,
|
||||
is_visible: is_parent_visible,
|
||||
}),
|
||||
window_size: load_info.window_size.initial_viewport,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2706,7 +2711,6 @@ where
|
||||
is_private: is_opener_private,
|
||||
is_visible: is_opener_visible,
|
||||
}),
|
||||
window_size: self.window_size.initial_viewport,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2910,7 +2914,6 @@ where
|
||||
replace,
|
||||
// `load_url` is always invoked on an existing browsing context.
|
||||
new_browsing_context_info: None,
|
||||
window_size,
|
||||
});
|
||||
Some(new_pipeline_id)
|
||||
},
|
||||
@@ -3230,7 +3233,6 @@ where
|
||||
replace: Some(NeedsToReload::Yes(pipeline_id, load_data)),
|
||||
// Browsing context must exist at this point.
|
||||
new_browsing_context_info: None,
|
||||
window_size,
|
||||
});
|
||||
return;
|
||||
},
|
||||
@@ -3988,7 +3990,7 @@ where
|
||||
change.top_level_browsing_context_id,
|
||||
change.new_pipeline_id,
|
||||
new_context_info.parent_pipeline_id,
|
||||
change.window_size,
|
||||
self.window_size.initial_viewport, //XXXjdm is this valid?
|
||||
new_context_info.is_private,
|
||||
new_context_info.is_visible,
|
||||
);
|
||||
|
||||
@@ -12,6 +12,7 @@ use compositing::CompositorProxy;
|
||||
use crossbeam_channel::{unbounded, Sender};
|
||||
use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg};
|
||||
use embedder_traits::EventLoopWaker;
|
||||
use euclid::{Scale, Size2D};
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
@@ -46,6 +47,8 @@ use std::process;
|
||||
use std::rc::Rc;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::DevicePixel;
|
||||
use webvr_traits::WebVRMsg;
|
||||
|
||||
/// A `Pipeline` is the constellation's view of a `Document`. Each pipeline has an
|
||||
@@ -162,7 +165,10 @@ pub struct InitialPipelineState {
|
||||
pub mem_profiler_chan: profile_mem::ProfilerChan,
|
||||
|
||||
/// Information about the initial window size.
|
||||
pub window_size: WindowSizeData,
|
||||
pub window_size: Size2D<f32, CSSPixel>,
|
||||
|
||||
/// Information about the device pixel ratio.
|
||||
pub device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>,
|
||||
|
||||
/// The ID of the pipeline namespace for this script thread.
|
||||
pub pipeline_namespace_id: PipelineNamespaceId,
|
||||
@@ -199,6 +205,10 @@ pub struct InitialPipelineState {
|
||||
|
||||
/// Mechanism to force the compositor to process events.
|
||||
pub event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||
|
||||
/// The ratio of device pixels per px at the default scale. If unspecified, will use the
|
||||
/// platform default setting.
|
||||
pub device_pixels_per_px: Option<f32>,
|
||||
}
|
||||
|
||||
pub struct NewPipeline {
|
||||
@@ -218,6 +228,11 @@ impl Pipeline {
|
||||
// probably requires a general low-memory strategy.
|
||||
let (pipeline_chan, pipeline_port) = ipc::channel().expect("Pipeline main chan");
|
||||
|
||||
let window_size = WindowSizeData {
|
||||
initial_viewport: state.window_size,
|
||||
device_pixel_ratio: state.device_pixel_ratio,
|
||||
};
|
||||
|
||||
let (script_chan, sampler_chan) = match state.event_loop {
|
||||
Some(script_chan) => {
|
||||
let new_layout_info = NewLayoutInfo {
|
||||
@@ -227,7 +242,7 @@ impl Pipeline {
|
||||
top_level_browsing_context_id: state.top_level_browsing_context_id,
|
||||
opener: state.opener,
|
||||
load_data: state.load_data.clone(),
|
||||
window_size: state.window_size,
|
||||
window_size: window_size,
|
||||
pipeline_port: pipeline_port,
|
||||
};
|
||||
|
||||
@@ -286,7 +301,7 @@ impl Pipeline {
|
||||
resource_threads: state.resource_threads,
|
||||
time_profiler_chan: state.time_profiler_chan,
|
||||
mem_profiler_chan: state.mem_profiler_chan,
|
||||
window_size: state.window_size,
|
||||
window_size: window_size,
|
||||
layout_to_constellation_chan: state.layout_to_constellation_chan,
|
||||
script_chan: script_chan.clone(),
|
||||
load_data: state.load_data.clone(),
|
||||
@@ -301,6 +316,7 @@ impl Pipeline {
|
||||
webvr_chan: state.webvr_chan,
|
||||
webxr_registry: state.webxr_registry,
|
||||
player_context: state.player_context,
|
||||
device_pixels_per_px: state.device_pixels_per_px,
|
||||
};
|
||||
|
||||
// Spawn the child process.
|
||||
@@ -507,6 +523,7 @@ pub struct UnprivilegedPipelineContent {
|
||||
webvr_chan: Option<IpcSender<WebVRMsg>>,
|
||||
webxr_registry: webxr_api::Registry,
|
||||
player_context: WindowGLContext,
|
||||
device_pixels_per_px: Option<f32>,
|
||||
}
|
||||
|
||||
impl UnprivilegedPipelineContent {
|
||||
@@ -597,7 +614,8 @@ impl UnprivilegedPipelineContent {
|
||||
paint_time_metrics,
|
||||
layout_thread_busy_flag.clone(),
|
||||
self.opts.load_webfonts_synchronously,
|
||||
self.window_size,
|
||||
self.opts.initial_window_size,
|
||||
self.device_pixels_per_px,
|
||||
self.opts.dump_display_list,
|
||||
self.opts.dump_display_list_json,
|
||||
self.opts.dump_style_tree,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::browsingcontext::NewBrowsingContextInfo;
|
||||
use euclid::Size2D;
|
||||
use msg::constellation_msg::{
|
||||
BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId,
|
||||
};
|
||||
@@ -11,7 +10,6 @@ use script_traits::LoadData;
|
||||
use servo_url::ServoUrl;
|
||||
use std::cmp::PartialEq;
|
||||
use std::{fmt, mem};
|
||||
use style_traits::CSSPixel;
|
||||
|
||||
/// Represents the joint session history
|
||||
/// https://html.spec.whatwg.org/multipage/#joint-session-history
|
||||
@@ -124,9 +122,6 @@ pub struct SessionHistoryChange {
|
||||
/// Holds data for not-yet constructed browsing contexts that are not
|
||||
/// easily available when they need to be constructed.
|
||||
pub new_browsing_context_info: Option<NewBrowsingContextInfo>,
|
||||
|
||||
/// The size of the viewport for the browsing context.
|
||||
pub window_size: Size2D<f32, CSSPixel>,
|
||||
}
|
||||
|
||||
/// Represents a pipeline or discarded pipeline in a history entry.
|
||||
|
||||
@@ -1800,9 +1800,18 @@ impl Fragment {
|
||||
Some(browsing_context_id) => browsing_context_id,
|
||||
None => return warn!("No browsing context id for iframe."),
|
||||
};
|
||||
let pipeline_id = match fragment_info.pipeline_id {
|
||||
Some(pipeline_id) => pipeline_id,
|
||||
None => return warn!("No pipeline id for iframe {}.", browsing_context_id),
|
||||
};
|
||||
|
||||
let base = create_base_display_item(state);
|
||||
let bounds = stacking_relative_content_box.to_layout();
|
||||
let item = DisplayItem::Iframe(Box::new(IframeDisplayItem {
|
||||
base,
|
||||
bounds,
|
||||
iframe: pipeline_id,
|
||||
}));
|
||||
|
||||
// XXXjdm: This sleight-of-hand to convert LayoutRect -> Size2D<CSSPixel>
|
||||
// looks bogus.
|
||||
@@ -1811,16 +1820,6 @@ impl Fragment {
|
||||
size: euclid::Size2D::new(bounds.size.width, bounds.size.height),
|
||||
});
|
||||
|
||||
let pipeline_id = match fragment_info.pipeline_id {
|
||||
Some(pipeline_id) => pipeline_id,
|
||||
None => return warn!("No pipeline id for iframe {}.", browsing_context_id),
|
||||
};
|
||||
|
||||
let item = DisplayItem::Iframe(Box::new(IframeDisplayItem {
|
||||
base,
|
||||
bounds,
|
||||
iframe: pipeline_id,
|
||||
}));
|
||||
state.add_display_item(item);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -16,7 +16,6 @@ use crate::sequential;
|
||||
use crate::wrapper::LayoutNodeLayoutData;
|
||||
use app_units::Au;
|
||||
use euclid::default::{Point2D, Rect, Size2D, Vector2D};
|
||||
use euclid::Size2D as TypedSize2D;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use script_layout_interface::rpc::TextIndexResponse;
|
||||
@@ -41,7 +40,7 @@ use style::dom::TElement;
|
||||
use style::logical_geometry::{BlockFlowDirection, InlineBaseDirection, WritingMode};
|
||||
use style::properties::{style_structs, LonghandId, PropertyDeclarationId, PropertyId};
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style_traits::{CSSPixel, ToCss};
|
||||
use style_traits::ToCss;
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
||||
/// Mutable data belonging to the LayoutThread.
|
||||
@@ -91,9 +90,6 @@ pub struct LayoutThreadData {
|
||||
|
||||
/// A queued response for the inner text of a given element.
|
||||
pub element_inner_text_response: String,
|
||||
|
||||
/// A queued response for the viewport dimensions for a given browsing context.
|
||||
pub inner_window_dimensions_response: Option<TypedSize2D<f32, CSSPixel>>,
|
||||
}
|
||||
|
||||
pub struct LayoutRPCImpl(pub Arc<Mutex<LayoutThreadData>>);
|
||||
@@ -197,12 +193,6 @@ impl LayoutRPC for LayoutRPCImpl {
|
||||
let rw_data = rw_data.lock().unwrap();
|
||||
rw_data.element_inner_text_response.clone()
|
||||
}
|
||||
|
||||
fn inner_window_dimensions(&self) -> Option<TypedSize2D<f32, CSSPixel>> {
|
||||
let &LayoutRPCImpl(ref rw_data) = self;
|
||||
let rw_data = rw_data.lock().unwrap();
|
||||
rw_data.inner_window_dimensions_response.clone()
|
||||
}
|
||||
}
|
||||
|
||||
struct UnioningFragmentBorderBoxIterator {
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
use crate::context::LayoutContext;
|
||||
use app_units::Au;
|
||||
use euclid::default::{Point2D, Rect};
|
||||
use euclid::Size2D;
|
||||
use euclid::Vector2D;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
@@ -23,7 +22,6 @@ use std::sync::{Arc, Mutex};
|
||||
use style::dom::OpaqueNode;
|
||||
use style::properties::PropertyId;
|
||||
use style::selector_parser::PseudoElement;
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_api::units::LayoutPixel;
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
||||
@@ -72,9 +70,6 @@ pub struct LayoutThreadData {
|
||||
|
||||
/// A queued response for the inner text of a given element.
|
||||
pub element_inner_text_response: String,
|
||||
|
||||
/// A queued response for the viewport dimensions for a given browsing context.
|
||||
pub inner_window_dimensions_response: Option<Size2D<f32, CSSPixel>>,
|
||||
}
|
||||
|
||||
pub struct LayoutRPCImpl(pub Arc<Mutex<LayoutThreadData>>);
|
||||
@@ -155,12 +150,6 @@ impl LayoutRPC for LayoutRPCImpl {
|
||||
let rw_data = rw_data.lock().unwrap();
|
||||
rw_data.element_inner_text_response.clone()
|
||||
}
|
||||
|
||||
fn inner_window_dimensions(&self) -> Option<Size2D<f32, CSSPixel>> {
|
||||
let &LayoutRPCImpl(ref rw_data) = self;
|
||||
let rw_data = rw_data.lock().unwrap();
|
||||
rw_data.inner_window_dimensions_response.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_content_box_request(_requested_node: OpaqueNode) -> Option<Rect<Au>> {
|
||||
|
||||
@@ -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 => {},
|
||||
}
|
||||
|
||||
@@ -67,12 +67,13 @@ use script_layout_interface::rpc::{LayoutRPC, OffsetParentResponse, StyleRespons
|
||||
use script_traits::Painter;
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
|
||||
use script_traits::{DrawAPaintImageResult, PaintWorkletError};
|
||||
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::DeviceIndependentPixel;
|
||||
use servo_url::ServoUrl;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::collections::HashMap;
|
||||
@@ -211,6 +212,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>,
|
||||
|
||||
/// Emits notifications when there is a relayout.
|
||||
relayout_event: bool,
|
||||
}
|
||||
@@ -238,7 +246,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,
|
||||
@@ -285,7 +294,8 @@ impl LayoutThreadFactory for LayoutThread {
|
||||
paint_time_metrics,
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
window_size,
|
||||
initial_window_size,
|
||||
device_pixels_per_px,
|
||||
relayout_event,
|
||||
);
|
||||
|
||||
@@ -447,15 +457,16 @@ 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>,
|
||||
relayout_event: 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.
|
||||
@@ -512,7 +523,6 @@ impl LayoutThread {
|
||||
text_index_response: TextIndexResponse(None),
|
||||
nodes_from_point_response: vec![],
|
||||
element_inner_text_response: String::new(),
|
||||
inner_window_dimensions_response: None,
|
||||
})),
|
||||
timer: if pref!(layout.animations.test.enabled) {
|
||||
Timer::test_mode()
|
||||
@@ -522,6 +532,8 @@ impl LayoutThread {
|
||||
paint_time_metrics: paint_time_metrics,
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
initial_window_size,
|
||||
device_pixels_per_px,
|
||||
relayout_event,
|
||||
}
|
||||
}
|
||||
@@ -807,7 +819,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,
|
||||
false, // dump_display_list
|
||||
false, // dump_display_list_json
|
||||
false, // dump_style_tree
|
||||
@@ -924,9 +937,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 => {},
|
||||
}
|
||||
@@ -1179,11 +1189,6 @@ impl LayoutThread {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
rw_data.element_inner_text_response = process_element_inner_text_query(node);
|
||||
},
|
||||
&QueryMsg::InnerWindowDimensionsQuery(_browsing_context_id) => {
|
||||
// TODO(jdm): port the iframe sizing code from layout2013's display
|
||||
// builder in order to support query iframe sizing.
|
||||
rw_data.inner_window_dimensions_response = None;
|
||||
},
|
||||
},
|
||||
ReflowGoal::Full | ReflowGoal::TickAnimations => {},
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// that these modules won't have to depend on layout.
|
||||
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use euclid::Size2D;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use metrics::PaintTimeMetrics;
|
||||
@@ -18,7 +19,8 @@ use msg::constellation_msg::{BackgroundHangMonitorRegister, PipelineId};
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use profile_traits::{mem, time};
|
||||
use script_traits::LayoutMsg as ConstellationMsg;
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg, WindowSizeData};
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
|
||||
use servo_geometry::DeviceIndependentPixel;
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
@@ -46,7 +48,8 @@ pub trait LayoutThreadFactory {
|
||||
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,
|
||||
|
||||
@@ -28,6 +28,7 @@ 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};
|
||||
@@ -172,13 +173,6 @@ 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();
|
||||
@@ -190,7 +184,6 @@ impl HTMLIFrameElement {
|
||||
load_data: load_data.clone(),
|
||||
old_pipeline_id: old_pipeline_id,
|
||||
sandbox: sandboxed,
|
||||
window_size,
|
||||
};
|
||||
global_scope
|
||||
.script_to_constellation_chan()
|
||||
@@ -205,7 +198,13 @@ impl HTMLIFrameElement {
|
||||
opener: None,
|
||||
load_data: load_data,
|
||||
pipeline_port: pipeline_receiver,
|
||||
window_size,
|
||||
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(),
|
||||
},
|
||||
};
|
||||
|
||||
self.pipeline_id.set(Some(new_pipeline_id));
|
||||
@@ -217,7 +216,6 @@ impl HTMLIFrameElement {
|
||||
load_data: load_data,
|
||||
old_pipeline_id: old_pipeline_id,
|
||||
sandbox: sandboxed,
|
||||
window_size,
|
||||
};
|
||||
global_scope
|
||||
.script_to_constellation_chan()
|
||||
|
||||
@@ -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::{BrowsingContextId, PipelineId};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::image_cache::{ImageCache, ImageResponder, ImageResponse};
|
||||
use net_traits::image_cache::{PendingImageId, PendingImageResponse};
|
||||
use net_traits::storage_thread::StorageType;
|
||||
@@ -1829,16 +1829,6 @@ 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())) {
|
||||
@@ -2369,7 +2359,6 @@ fn debug_reflow_events(id: PipelineId, reflow_goal: &ReflowGoal, reason: &Reflow
|
||||
&QueryMsg::StyleQuery(_n) => "\tStyleQuery",
|
||||
&QueryMsg::TextIndexQuery(..) => "\tTextIndexQuery",
|
||||
&QueryMsg::ElementInnerTextQuery(_) => "\tElementInnerTextQuery",
|
||||
&QueryMsg::InnerWindowDimensionsQuery(_) => "\tInnerWindowDimensionsQuery",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -2392,7 +2392,6 @@ impl ScriptThread {
|
||||
load_data.url.clone(),
|
||||
),
|
||||
layout_is_busy: layout_is_busy.clone(),
|
||||
window_size,
|
||||
});
|
||||
|
||||
// Pick a layout thread, any layout thread
|
||||
@@ -3697,15 +3696,6 @@ 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);
|
||||
|
||||
|
||||
@@ -33,5 +33,4 @@ servo_arc = {path = "../servo_arc"}
|
||||
servo_atoms = {path = "../atoms"}
|
||||
servo_url = {path = "../url"}
|
||||
style = {path = "../style", features = ["servo"]}
|
||||
style_traits = {path = "../style_traits", features = ["servo"]}
|
||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||
|
||||
@@ -10,7 +10,7 @@ use euclid::default::{Point2D, Rect};
|
||||
use gfx_traits::Epoch;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use metrics::PaintTimeMetrics;
|
||||
use msg::constellation_msg::{BackgroundHangMonitorRegister, BrowsingContextId, PipelineId};
|
||||
use msg::constellation_msg::{BackgroundHangMonitorRegister, PipelineId};
|
||||
use net_traits::image_cache::ImageCache;
|
||||
use profile_traits::mem::ReportsChan;
|
||||
use script_traits::Painter;
|
||||
@@ -128,7 +128,6 @@ pub enum QueryMsg {
|
||||
ResolvedStyleQuery(TrustedNodeAddress, Option<PseudoElement>, PropertyId),
|
||||
StyleQuery(TrustedNodeAddress),
|
||||
ElementInnerTextQuery(TrustedNodeAddress),
|
||||
InnerWindowDimensionsQuery(BrowsingContextId),
|
||||
}
|
||||
|
||||
/// Any query to perform with this reflow.
|
||||
@@ -148,7 +147,6 @@ impl ReflowGoal {
|
||||
ReflowGoal::LayoutQuery(ref querymsg, _) => match *querymsg {
|
||||
QueryMsg::NodesFromPointQuery(..) |
|
||||
QueryMsg::TextIndexQuery(..) |
|
||||
QueryMsg::InnerWindowDimensionsQuery(_) |
|
||||
QueryMsg::ElementInnerTextQuery(_) => true,
|
||||
QueryMsg::ContentBoxQuery(_) |
|
||||
QueryMsg::ContentBoxesQuery(_) |
|
||||
@@ -178,7 +176,6 @@ impl ReflowGoal {
|
||||
QueryMsg::NodeScrollIdQuery(_) |
|
||||
QueryMsg::ResolvedStyleQuery(..) |
|
||||
QueryMsg::OffsetParentQuery(_) |
|
||||
QueryMsg::InnerWindowDimensionsQuery(_) |
|
||||
QueryMsg::StyleQuery(_) => false,
|
||||
},
|
||||
}
|
||||
@@ -230,5 +227,4 @@ pub struct LayoutThreadInit {
|
||||
pub image_cache: Arc<dyn ImageCache>,
|
||||
pub paint_time_metrics: PaintTimeMetrics,
|
||||
pub layout_is_busy: Arc<AtomicBool>,
|
||||
pub window_size: WindowSizeData,
|
||||
}
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::default::Rect;
|
||||
use euclid::Size2D;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use servo_arc::Arc;
|
||||
use style::properties::ComputedValues;
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_api::ExternalScrollId;
|
||||
|
||||
/// Synchronous messages that script can send to layout.
|
||||
@@ -41,8 +39,6 @@ pub trait LayoutRPC {
|
||||
fn nodes_from_point_response(&self) -> Vec<UntrustedNodeAddress>;
|
||||
/// Query layout to get the inner text for a given element.
|
||||
fn element_inner_text(&self) -> String;
|
||||
/// Get the dimensions of an iframe's inner window.
|
||||
fn inner_window_dimensions(&self) -> Option<Size2D<f32, CSSPixel>>;
|
||||
}
|
||||
|
||||
pub struct ContentBoxResponse(pub Option<Rect<Au>>);
|
||||
|
||||
@@ -739,8 +739,6 @@ pub struct IFrameLoadInfoWithData {
|
||||
pub old_pipeline_id: Option<PipelineId>,
|
||||
/// Sandbox type of this iframe
|
||||
pub sandbox: IFrameSandboxState,
|
||||
/// The initial viewport size for this iframe.
|
||||
pub window_size: WindowSizeData,
|
||||
}
|
||||
|
||||
/// Specifies whether the script or layout thread needs to be ticked for animation.
|
||||
@@ -762,7 +760,7 @@ pub struct ScrollState {
|
||||
}
|
||||
|
||||
/// Data about the window size.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
|
||||
#[derive(Clone, Copy, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||
pub struct WindowSizeData {
|
||||
/// The size of the initial layout viewport, before parsing an
|
||||
/// <http://www.w3.org/TR/css-device-adapt/#initial-viewport>
|
||||
|
||||
@@ -84,7 +84,7 @@ use constellation::{FromCompositorLogger, FromScriptLogger};
|
||||
use crossbeam_channel::{unbounded, Sender};
|
||||
use embedder_traits::{EmbedderMsg, EmbedderProxy, EmbedderReceiver, EventLoopWaker};
|
||||
use env_logger::Builder as EnvLoggerBuilder;
|
||||
use euclid::{Scale, Size2D};
|
||||
use euclid::Size2D;
|
||||
#[cfg(all(
|
||||
not(target_os = "windows"),
|
||||
not(target_os = "ios"),
|
||||
@@ -104,9 +104,7 @@ use profile::mem as profile_mem;
|
||||
use profile::time as profile_time;
|
||||
use profile_traits::mem;
|
||||
use profile_traits::time;
|
||||
use script_traits::{
|
||||
ConstellationMsg, SWManagerSenders, ScriptToConstellationChan, WindowSizeData,
|
||||
};
|
||||
use script_traits::{ConstellationMsg, SWManagerSenders, ScriptToConstellationChan};
|
||||
use servo_config::opts;
|
||||
use servo_config::{pref, prefs};
|
||||
use servo_media::player::context::GlContext;
|
||||
@@ -315,7 +313,11 @@ impl<Window> Servo<Window>
|
||||
where
|
||||
Window: WindowMethods + 'static + ?Sized,
|
||||
{
|
||||
pub fn new(mut embedder: Box<dyn EmbedderMethods>, window: Rc<Window>) -> Servo<Window> {
|
||||
pub fn new(
|
||||
mut embedder: Box<dyn EmbedderMethods>,
|
||||
window: Rc<Window>,
|
||||
device_pixels_per_px: Option<f32>,
|
||||
) -> Servo<Window> {
|
||||
// Global configuration options, parsed from the command line.
|
||||
let opts = opts::get();
|
||||
|
||||
@@ -356,8 +358,6 @@ where
|
||||
let devtools_chan = opts.devtools_port.map(|port| devtools::start_server(port));
|
||||
|
||||
let coordinates = window.get_coordinates();
|
||||
let device_pixel_ratio = coordinates.hidpi_factor.get();
|
||||
let viewport_size = coordinates.viewport.size.to_f32() / device_pixel_ratio;
|
||||
|
||||
let (mut webrender, webrender_api_sender) = {
|
||||
let renderer_kind = if opts::get().should_use_osmesa() {
|
||||
@@ -380,7 +380,12 @@ where
|
||||
let render_notifier = Box::new(RenderNotifier::new(compositor_proxy.clone()));
|
||||
|
||||
// Cast from `DeviceIndependentPixel` to `DevicePixel`
|
||||
let window_size = Size2D::from_untyped(viewport_size.to_i32().to_untyped());
|
||||
let device_pixel_ratio = coordinates.hidpi_factor.get();
|
||||
let window_size = Size2D::from_untyped(
|
||||
(opts.initial_window_size.to_f32() / device_pixel_ratio)
|
||||
.to_i32()
|
||||
.to_untyped(),
|
||||
);
|
||||
|
||||
webrender::Renderer::new(
|
||||
window.gl(),
|
||||
@@ -487,13 +492,6 @@ where
|
||||
|
||||
let event_loop_waker = None;
|
||||
|
||||
// The division by 1 represents the page's default zoom of 100%,
|
||||
// and gives us the appropriate CSSPixel type for the viewport.
|
||||
let window_size = WindowSizeData {
|
||||
initial_viewport: viewport_size / Scale::new(1.0),
|
||||
device_pixel_ratio: Scale::new(device_pixel_ratio),
|
||||
};
|
||||
|
||||
// Create the constellation, which maintains the engine
|
||||
// pipelines, including the script and layout threads, as well
|
||||
// as the navigation context.
|
||||
@@ -515,7 +513,7 @@ where
|
||||
webvr_constellation_sender,
|
||||
glplayer_threads,
|
||||
event_loop_waker,
|
||||
window_size,
|
||||
device_pixels_per_px,
|
||||
);
|
||||
|
||||
// Send the constellation's swmanager sender to service worker manager thread
|
||||
@@ -547,6 +545,7 @@ where
|
||||
opts.is_running_problem_test,
|
||||
opts.exit_after_load,
|
||||
opts.convert_mouse_to_touch,
|
||||
device_pixels_per_px,
|
||||
);
|
||||
|
||||
Servo {
|
||||
@@ -829,7 +828,7 @@ fn create_constellation(
|
||||
webvr_constellation_sender: Option<Sender<Sender<ConstellationMsg>>>,
|
||||
glplayer_threads: Option<GLPlayerThreads>,
|
||||
event_loop_waker: Option<Box<dyn EventLoopWaker>>,
|
||||
initial_window_size: WindowSizeData,
|
||||
device_pixels_per_px: Option<f32>,
|
||||
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
|
||||
// Global configuration options, parsed from the command line.
|
||||
let opts = opts::get();
|
||||
@@ -872,6 +871,7 @@ fn create_constellation(
|
||||
glplayer_threads,
|
||||
player_context,
|
||||
event_loop_waker,
|
||||
device_pixels_per_px,
|
||||
};
|
||||
let (constellation_chan, from_swmanager_sender) = Constellation::<
|
||||
script_layout_interface::message::Msg,
|
||||
@@ -879,7 +879,8 @@ fn create_constellation(
|
||||
script::script_thread::ScriptThread,
|
||||
>::start(
|
||||
initial_state,
|
||||
initial_window_size,
|
||||
opts.initial_window_size,
|
||||
device_pixels_per_px,
|
||||
opts.random_pipeline_closure_probability,
|
||||
opts.random_pipeline_closure_seed,
|
||||
opts.is_running_problem_test,
|
||||
|
||||
@@ -70,7 +70,7 @@ impl App {
|
||||
// Handle browser state.
|
||||
let browser = Browser::new(window.clone());
|
||||
|
||||
let mut servo = Servo::new(embedder, window.clone());
|
||||
let mut servo = Servo::new(embedder, window.clone(), device_pixels_per_px);
|
||||
let browser_id = BrowserId::new();
|
||||
servo.handle_events(vec![WindowEvent::NewBrowser(get_default_url(), browser_id)]);
|
||||
servo.setup_logging();
|
||||
|
||||
@@ -211,7 +211,7 @@ pub fn init(
|
||||
gl: gl.clone(),
|
||||
});
|
||||
|
||||
let servo = Servo::new(embedder_callbacks, window_callbacks.clone());
|
||||
let servo = Servo::new(embedder_callbacks, window_callbacks.clone(), None);
|
||||
|
||||
SERVO.with(|s| {
|
||||
let mut servo_glue = ServoGlue {
|
||||
|
||||
@@ -19034,7 +19034,7 @@
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/mql_borrow.html": [
|
||||
"2f738c738f2efc7b36fcdab31741a34037e673f7",
|
||||
"17ee0dc48a30933429cb901760ef1b074ed56b6e",
|
||||
"testharness"
|
||||
],
|
||||
"mozilla/multiple_redirects.html": [
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
frame.height=600;
|
||||
frame.width=400;
|
||||
}));
|
||||
frame.width = 601;
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user