alias some euclid types

This commit is contained in:
Paul Rouget 2018-03-13 14:36:00 +08:00
parent ac4614d6ce
commit e25dd45139
11 changed files with 73 additions and 69 deletions

View file

@ -14,7 +14,8 @@ use dom_struct::dom_struct;
use euclid::TypedSize2D;
use ipc_channel::ipc;
use script_traits::ScriptMsg;
use style_traits::{CSSPixel, DevicePixel};
use style_traits::CSSPixel;
use webrender_api::DeviceUintSize;
#[dom_struct]
pub struct Screen {
@ -37,7 +38,7 @@ impl Screen {
}
fn screen_size(&self) -> TypedSize2D<u32, CSSPixel> {
let (send, recv) = ipc::channel::<(TypedSize2D<u32, DevicePixel>)>().unwrap();
let (send, recv) = ipc::channel::<DeviceUintSize>().unwrap();
self.window.upcast::<GlobalScope>()
.script_to_constellation_chan().send(ScriptMsg::GetScreenSize(send)).unwrap();
let dpr = self.window.device_pixel_ratio();
@ -46,7 +47,7 @@ impl Screen {
}
fn screen_avail_size(&self) -> TypedSize2D<u32, CSSPixel> {
let (send, recv) = ipc::channel::<(TypedSize2D<u32, DevicePixel>)>().unwrap();
let (send, recv) = ipc::channel::<DeviceUintSize>().unwrap();
self.window.upcast::<GlobalScope>()
.script_to_constellation_chan().send(ScriptMsg::GetScreenAvailSize(send)).unwrap();
let dpr = self.window.device_pixel_ratio();

View file

@ -116,7 +116,7 @@ use timers::{IsInterval, TimerCallback};
use tinyfiledialogs::{self, MessageBoxIcon};
use url::Position;
use webdriver_handlers::jsval_to_webdriver;
use webrender_api::{ExternalScrollId, DocumentId};
use webrender_api::{ExternalScrollId, DeviceIntPoint, DeviceUintSize, DocumentId};
use webvr_traits::WebVRMsg;
/// Current state of the window object
@ -1180,7 +1180,7 @@ impl Window {
}
fn client_window(&self) -> (TypedSize2D<u32, CSSPixel>, TypedPoint2D<i32, CSSPixel>) {
let (send, recv) = ipc::channel::<(TypedSize2D<u32, DevicePixel>, TypedPoint2D<i32, DevicePixel>)>().unwrap();
let (send, recv) = ipc::channel::<(DeviceUintSize, DeviceIntPoint)>().unwrap();
self.send_to_constellation(ScriptMsg::GetClientWindow(send));
let (size, point) = recv.recv().unwrap_or((TypedSize2D::zero(), TypedPoint2D::zero()));
let dpr = self.device_pixel_ratio();