mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
Compare commits
1 Commits
github-act
...
jdm-revert
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf96a94252 |
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -4621,7 +4621,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();
|
||||
}
|
||||
|
||||
@@ -1065,10 +1077,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> {
|
||||
|
||||
@@ -114,7 +114,7 @@ use crossbeam_channel::{after, never, unbounded, Receiver, Sender};
|
||||
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
|
||||
use embedder_traits::{Cursor, EmbedderMsg, EmbedderProxy, EventLoopWaker};
|
||||
use embedder_traits::{MediaSessionEvent, MediaSessionPlaybackState};
|
||||
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};
|
||||
@@ -159,6 +159,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};
|
||||
@@ -493,6 +494,10 @@ pub struct Constellation<Message, LTF, STF> {
|
||||
|
||||
/// Pipeline ID of the active media session.
|
||||
active_media_session: Option<PipelineId>,
|
||||
|
||||
/// 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.
|
||||
@@ -549,6 +554,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
|
||||
@@ -807,7 +816,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,
|
||||
@@ -944,7 +954,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(),
|
||||
@@ -982,6 +995,7 @@ where
|
||||
player_context: state.player_context,
|
||||
event_loop_waker: state.event_loop_waker,
|
||||
active_media_session: None,
|
||||
device_pixels_per_px,
|
||||
};
|
||||
|
||||
constellation.run();
|
||||
@@ -1211,12 +1225,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_ipc_sender.clone(),
|
||||
webrender_image_api_sender: self.webrender_image_api_sender.clone(),
|
||||
@@ -1229,6 +1241,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 {
|
||||
@@ -2694,7 +2707,6 @@ where
|
||||
new_pipeline_id: new_pipeline_id,
|
||||
replace: None,
|
||||
new_browsing_context_info: None,
|
||||
window_size,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2843,7 +2855,6 @@ where
|
||||
is_private: is_private,
|
||||
is_visible: is_visible,
|
||||
}),
|
||||
window_size,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3015,10 +3026,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(
|
||||
@@ -3040,7 +3047,6 @@ where
|
||||
replace: replace,
|
||||
// Browsing context for iframe already exists.
|
||||
new_browsing_context_info: None,
|
||||
window_size: load_info.window_size.initial_viewport,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3099,7 +3105,6 @@ where
|
||||
is_private: is_private,
|
||||
is_visible: is_parent_visible,
|
||||
}),
|
||||
window_size: load_info.window_size.initial_viewport,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3188,7 +3193,6 @@ where
|
||||
is_private: is_opener_private,
|
||||
is_visible: is_opener_visible,
|
||||
}),
|
||||
window_size: self.window_size.initial_viewport,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3397,7 +3401,6 @@ where
|
||||
replace,
|
||||
// `load_url` is always invoked on an existing browsing context.
|
||||
new_browsing_context_info: None,
|
||||
window_size,
|
||||
});
|
||||
Some(new_pipeline_id)
|
||||
},
|
||||
@@ -3717,7 +3720,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;
|
||||
},
|
||||
@@ -4473,7 +4475,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;
|
||||
@@ -48,6 +49,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
|
||||
@@ -164,7 +167,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,
|
||||
@@ -204,6 +210,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 {
|
||||
@@ -223,6 +233,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 {
|
||||
@@ -232,7 +247,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,
|
||||
};
|
||||
|
||||
@@ -291,7 +306,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(),
|
||||
@@ -307,6 +322,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.
|
||||
@@ -514,6 +530,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 {
|
||||
@@ -604,7 +621,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.
|
||||
|
||||
@@ -1811,9 +1811,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.
|
||||
@@ -1822,16 +1831,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::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
|
||||
use script_traits::{DrawAPaintImageResult, IFrameSizeMsg, PaintWorkletError, WindowSizeType};
|
||||
use script_traits::{Painter, WebrenderIpcSender};
|
||||
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,
|
||||
@@ -535,10 +545,12 @@ impl LayoutThread {
|
||||
// Let webrender know about this pipeline by sending an empty display list.
|
||||
webrender_api.send_initial_transaction(webrender_document, id.to_webrender());
|
||||
|
||||
// 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.
|
||||
@@ -601,7 +613,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) {
|
||||
@@ -614,6 +625,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,
|
||||
@@ -942,7 +955,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,
|
||||
@@ -1316,9 +1330,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 => {},
|
||||
}
|
||||
@@ -1671,13 +1682,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::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
|
||||
use script_traits::{DrawAPaintImageResult, PaintWorkletError};
|
||||
use script_traits::{Painter, WebrenderIpcSender};
|
||||
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,
|
||||
|
||||
@@ -241,7 +249,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,
|
||||
@@ -288,7 +297,8 @@ impl LayoutThreadFactory for LayoutThread {
|
||||
paint_time_metrics,
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
window_size,
|
||||
initial_window_size,
|
||||
device_pixels_per_px,
|
||||
relayout_event,
|
||||
dump_flow_tree,
|
||||
);
|
||||
@@ -451,7 +461,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>,
|
||||
relayout_event: bool,
|
||||
dump_fragment_tree: bool,
|
||||
) -> LayoutThread {
|
||||
@@ -462,8 +473,8 @@ impl LayoutThread {
|
||||
// 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.
|
||||
@@ -521,7 +532,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()
|
||||
@@ -531,6 +541,8 @@ impl LayoutThread {
|
||||
paint_time_metrics: paint_time_metrics,
|
||||
busy,
|
||||
load_webfonts_synchronously,
|
||||
initial_window_size,
|
||||
device_pixels_per_px,
|
||||
relayout_event,
|
||||
dump_fragment_tree,
|
||||
}
|
||||
@@ -816,7 +828,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
|
||||
@@ -933,9 +946,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 => {},
|
||||
}
|
||||
@@ -1207,11 +1217,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,9 +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, WebrenderIpcSender, WindowSizeData,
|
||||
};
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg, WebrenderIpcSender};
|
||||
use servo_geometry::DeviceIndependentPixel;
|
||||
use servo_url::ServoUrl;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
@@ -48,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};
|
||||
@@ -175,13 +176,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();
|
||||
@@ -193,7 +187,6 @@ impl HTMLIFrameElement {
|
||||
load_data: load_data.clone(),
|
||||
old_pipeline_id: old_pipeline_id,
|
||||
sandbox: sandboxed,
|
||||
window_size,
|
||||
};
|
||||
global_scope
|
||||
.script_to_constellation_chan()
|
||||
@@ -208,7 +201,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));
|
||||
@@ -220,7 +219,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;
|
||||
@@ -1821,16 +1821,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())) {
|
||||
@@ -2359,7 +2349,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",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -2350,7 +2350,6 @@ impl ScriptThread {
|
||||
load_data.url.clone(),
|
||||
),
|
||||
layout_is_busy: layout_is_busy.clone(),
|
||||
window_size,
|
||||
});
|
||||
|
||||
// Pick a layout thread, any layout thread
|
||||
@@ -3668,15 +3667,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"}
|
||||
|
||||
@@ -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>>);
|
||||
|
||||
@@ -754,8 +754,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.
|
||||
@@ -777,7 +775,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>
|
||||
|
||||
@@ -85,7 +85,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"),
|
||||
@@ -106,9 +106,7 @@ use profile::time as profile_time;
|
||||
use profile_traits::mem;
|
||||
use profile_traits::time;
|
||||
use script::JSEngineSetup;
|
||||
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;
|
||||
@@ -321,7 +319,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();
|
||||
|
||||
@@ -362,8 +364,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() {
|
||||
@@ -386,7 +386,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(),
|
||||
@@ -497,13 +502,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.
|
||||
@@ -525,7 +523,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
|
||||
@@ -557,6 +555,7 @@ where
|
||||
opts.is_running_problem_test,
|
||||
opts.exit_after_load,
|
||||
opts.convert_mouse_to_touch,
|
||||
device_pixels_per_px,
|
||||
);
|
||||
|
||||
Servo {
|
||||
@@ -850,7 +849,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();
|
||||
@@ -893,6 +892,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,
|
||||
@@ -900,7 +900,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();
|
||||
|
||||
@@ -218,7 +218,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 {
|
||||
|
||||
@@ -19090,7 +19090,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