mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Introduce CSSPixel as a replacement for ViewportPx and PagePx.
This commit is contained in:
parent
56a99577b3
commit
30ff2f8f0d
16 changed files with 81 additions and 92 deletions
|
@ -119,7 +119,7 @@ use std::sync::Arc;
|
|||
use std::sync::mpsc::{Receiver, Sender, channel};
|
||||
use std::thread;
|
||||
use std::time::Instant;
|
||||
use style_traits::PagePx;
|
||||
use style_traits::CSSPixel;
|
||||
use style_traits::cursor::Cursor;
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use timer_scheduler::TimerScheduler;
|
||||
|
@ -534,8 +534,6 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
time_profiler_chan: state.time_profiler_chan,
|
||||
mem_profiler_chan: state.mem_profiler_chan,
|
||||
window_size: WindowSizeData {
|
||||
visible_viewport: opts::get().initial_window_size.to_f32() *
|
||||
ScaleFactor::new(1.0),
|
||||
initial_viewport: opts::get().initial_window_size.to_f32() *
|
||||
ScaleFactor::new(1.0),
|
||||
device_pixel_ratio:
|
||||
|
@ -588,7 +586,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
pipeline_id: PipelineId,
|
||||
frame_id: FrameId,
|
||||
parent_info: Option<(PipelineId, FrameType)>,
|
||||
initial_window_size: Option<TypedSize2D<f32, PagePx>>,
|
||||
initial_window_size: Option<TypedSize2D<f32, CSSPixel>>,
|
||||
load_data: LoadData,
|
||||
sandbox: IFrameSandboxState,
|
||||
is_private: bool) {
|
||||
|
@ -1335,7 +1333,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
}
|
||||
|
||||
fn handle_init_load(&mut self, url: ServoUrl) {
|
||||
let window_size = self.window_size.visible_viewport;
|
||||
let window_size = self.window_size.initial_viewport;
|
||||
let root_pipeline_id = PipelineId::new();
|
||||
let root_frame_id = self.root_frame_id;
|
||||
let load_data = LoadData::new(url.clone(), None, None);
|
||||
|
@ -1353,7 +1351,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
}
|
||||
|
||||
fn handle_frame_size_msg(&mut self,
|
||||
iframe_sizes: Vec<(PipelineId, TypedSize2D<f32, PagePx>)>) {
|
||||
iframe_sizes: Vec<(PipelineId, TypedSize2D<f32, CSSPixel>)>) {
|
||||
for (pipeline_id, size) in iframe_sizes {
|
||||
let result = {
|
||||
let pipeline = match self.pipelines.get_mut(&pipeline_id) {
|
||||
|
@ -1367,8 +1365,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
|
||||
pipeline.size = Some(size);
|
||||
let msg = ConstellationControlMsg::Resize(pipeline_id, WindowSizeData {
|
||||
visible_viewport: size,
|
||||
initial_viewport: size * ScaleFactor::new(1.0),
|
||||
initial_viewport: size,
|
||||
device_pixel_ratio: self.window_size.device_pixel_ratio,
|
||||
}, WindowSizeType::Initial);
|
||||
|
||||
|
@ -2212,8 +2209,7 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
|
||||
/// Called when the window is resized.
|
||||
fn handle_window_size_msg(&mut self, new_size: WindowSizeData, size_type: WindowSizeType) {
|
||||
debug!("handle_window_size_msg: {:?} {:?}", new_size.initial_viewport.to_untyped(),
|
||||
new_size.visible_viewport.to_untyped());
|
||||
debug!("handle_window_size_msg: {:?}", new_size.initial_viewport.to_untyped());
|
||||
|
||||
if let Some(frame) = self.frames.get(&self.root_frame_id) {
|
||||
// Send Resize (or ResizeInactive) messages to each
|
||||
|
|
|
@ -35,7 +35,7 @@ use std::ffi::OsStr;
|
|||
use std::process;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::Sender;
|
||||
use style_traits::{PagePx, ViewportPx};
|
||||
use style_traits::CSSPixel;
|
||||
use webrender_traits;
|
||||
use webvr_traits::WebVRMsg;
|
||||
|
||||
|
@ -76,7 +76,7 @@ pub struct Pipeline {
|
|||
|
||||
/// The size of the frame.
|
||||
/// TODO: move this field to `Frame`.
|
||||
pub size: Option<TypedSize2D<f32, PagePx>>,
|
||||
pub size: Option<TypedSize2D<f32, CSSPixel>>,
|
||||
|
||||
/// Whether this pipeline is currently running animations. Pipelines that are running
|
||||
/// animations cause composites to be continually scheduled.
|
||||
|
@ -149,10 +149,10 @@ pub struct InitialPipelineState {
|
|||
pub mem_profiler_chan: profile_mem::ProfilerChan,
|
||||
|
||||
/// Information about the initial window size.
|
||||
pub window_size: Option<TypedSize2D<f32, PagePx>>,
|
||||
pub window_size: Option<TypedSize2D<f32, CSSPixel>>,
|
||||
|
||||
/// Information about the device pixel ratio.
|
||||
pub device_pixel_ratio: ScaleFactor<f32, ViewportPx, DevicePixel>,
|
||||
pub device_pixel_ratio: ScaleFactor<f32, CSSPixel, DevicePixel>,
|
||||
|
||||
/// The event loop to run in, if applicable.
|
||||
pub event_loop: Option<Rc<EventLoop>>,
|
||||
|
@ -193,8 +193,7 @@ impl Pipeline {
|
|||
let device_pixel_ratio = state.device_pixel_ratio;
|
||||
let window_size = state.window_size.map(|size| {
|
||||
WindowSizeData {
|
||||
visible_viewport: size,
|
||||
initial_viewport: size * ScaleFactor::new(1.0),
|
||||
initial_viewport: size,
|
||||
device_pixel_ratio: device_pixel_ratio,
|
||||
}
|
||||
});
|
||||
|
@ -307,7 +306,7 @@ impl Pipeline {
|
|||
compositor_proxy: Box<CompositorProxy + 'static + Send>,
|
||||
is_private: bool,
|
||||
url: ServoUrl,
|
||||
size: Option<TypedSize2D<f32, PagePx>>,
|
||||
size: Option<TypedSize2D<f32, CSSPixel>>,
|
||||
visible: bool)
|
||||
-> Pipeline {
|
||||
let pipeline = Pipeline {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue