mirror of
https://github.com/servo/servo.git
synced 2025-08-14 01:45:33 +01:00
Auto merge of #17892 - kvark:wr, r=glennw
WR multi-document update <!-- Please describe your changes on the following line: --> The PR updates WR version to support multiple documents (https://github.com/servo/webrender/pull/1509) but doesn't take advantage of this new feature yet. It also makes Servo to use `DevicePixel` from WR instead of rolling out another one. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because _____ no extra logic <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17892) <!-- Reviewable:end -->
This commit is contained in:
commit
12a49dc0be
14 changed files with 111 additions and 85 deletions
|
@ -19,7 +19,7 @@ use wrappers::CefWrap;
|
|||
|
||||
use compositing::compositor_thread::EventLoopWaker;
|
||||
use compositing::windowing::{WindowEvent, WindowMethods};
|
||||
use euclid::{Point2D, TypedPoint2D, TypedRect, Size2D, TypedSize2D, ScaleFactor};
|
||||
use euclid::{Point2D, TypedPoint2D, Size2D, TypedSize2D, ScaleFactor};
|
||||
use gleam::gl;
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use net_traits::net_error_list::NetError;
|
||||
|
@ -38,6 +38,7 @@ use style_traits::DevicePixel;
|
|||
extern crate x11;
|
||||
#[cfg(target_os="linux")]
|
||||
use self::x11::xlib::{XInitThreads,XOpenDisplay};
|
||||
use webrender_api::{DeviceUintSize, DeviceUintRect};
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
pub static mut DISPLAY: *mut c_void = 0 as *mut c_void;
|
||||
|
@ -46,7 +47,7 @@ pub static mut DISPLAY: *mut c_void = 0 as *mut c_void;
|
|||
#[derive(Clone)]
|
||||
pub struct Window {
|
||||
cef_browser: RefCell<Option<CefBrowser>>,
|
||||
size: TypedSize2D<u32, DevicePixel>,
|
||||
size: DeviceUintSize,
|
||||
gl: Rc<gl::Gl>,
|
||||
}
|
||||
|
||||
|
@ -174,7 +175,7 @@ impl WindowMethods for Window {
|
|||
self.gl.clone()
|
||||
}
|
||||
|
||||
fn framebuffer_size(&self) -> TypedSize2D<u32, DevicePixel> {
|
||||
fn framebuffer_size(&self) -> DeviceUintSize {
|
||||
let browser = self.cef_browser.borrow();
|
||||
match *browser {
|
||||
None => self.size,
|
||||
|
@ -205,16 +206,16 @@ impl WindowMethods for Window {
|
|||
}
|
||||
}
|
||||
|
||||
TypedSize2D::new(rect.width as u32, rect.height as u32)
|
||||
DeviceUintSize::new(rect.width as u32, rect.height as u32)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn window_rect(&self) -> TypedRect<u32, DevicePixel> {
|
||||
fn window_rect(&self) -> DeviceUintRect {
|
||||
let size = self.framebuffer_size();
|
||||
let origin = TypedPoint2D::zero();
|
||||
TypedRect::new(origin, size)
|
||||
DeviceUintRect::new(origin, size)
|
||||
}
|
||||
|
||||
fn size(&self) -> TypedSize2D<f32, DeviceIndependentPixel> {
|
||||
|
|
|
@ -8,7 +8,7 @@ use NestedEventLoopListener;
|
|||
use compositing::compositor_thread::EventLoopWaker;
|
||||
use compositing::windowing::{AnimationState, MouseWindowEvent};
|
||||
use compositing::windowing::{WindowEvent, WindowMethods};
|
||||
use euclid::{Point2D, Size2D, TypedPoint2D, TypedVector2D, TypedRect, ScaleFactor, TypedSize2D};
|
||||
use euclid::{Point2D, Size2D, TypedPoint2D, TypedVector2D, ScaleFactor, TypedSize2D};
|
||||
#[cfg(target_os = "windows")]
|
||||
use gdi32;
|
||||
use gleam::gl;
|
||||
|
@ -43,7 +43,7 @@ use style_traits::DevicePixel;
|
|||
use style_traits::cursor::Cursor;
|
||||
#[cfg(target_os = "windows")]
|
||||
use user32;
|
||||
use webrender_api::ScrollLocation;
|
||||
use webrender_api::{DeviceUintRect, DeviceUintSize, ScrollLocation};
|
||||
#[cfg(target_os = "windows")]
|
||||
use winapi;
|
||||
|
||||
|
@ -962,24 +962,24 @@ impl WindowMethods for Window {
|
|||
self.gl.clone()
|
||||
}
|
||||
|
||||
fn framebuffer_size(&self) -> TypedSize2D<u32, DevicePixel> {
|
||||
fn framebuffer_size(&self) -> DeviceUintSize {
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
let scale_factor = window.hidpi_factor() as u32;
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (width, height) = window.get_inner_size().expect("Failed to get window inner size.");
|
||||
TypedSize2D::new(width * scale_factor, height * scale_factor)
|
||||
DeviceUintSize::new(width, height) * scale_factor
|
||||
}
|
||||
WindowKind::Headless(ref context) => {
|
||||
TypedSize2D::new(context.width, context.height)
|
||||
DeviceUintSize::new(context.width, context.height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn window_rect(&self) -> TypedRect<u32, DevicePixel> {
|
||||
fn window_rect(&self) -> DeviceUintRect {
|
||||
let size = self.framebuffer_size();
|
||||
let origin = TypedPoint2D::zero();
|
||||
TypedRect::new(origin, size)
|
||||
DeviceUintRect::new(origin, size)
|
||||
}
|
||||
|
||||
fn size(&self) -> TypedSize2D<f32, DeviceIndependentPixel> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue