mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Initial window sizes are mandatory.
This commit is contained in:
parent
34e77f62af
commit
231a37be24
12 changed files with 101 additions and 130 deletions
|
@ -2806,17 +2806,11 @@ impl Document {
|
|||
///
|
||||
/// FIXME(emilio): This really needs to be somehow more in sync with layout.
|
||||
/// Feels like a hack.
|
||||
///
|
||||
/// Also, shouldn't return an option, I'm quite sure.
|
||||
pub fn device(&self) -> Option<Device> {
|
||||
let window_size = self.window().window_size()?;
|
||||
pub fn device(&self) -> Device {
|
||||
let window_size = self.window().window_size();
|
||||
let viewport_size = window_size.initial_viewport;
|
||||
let device_pixel_ratio = window_size.device_pixel_ratio;
|
||||
Some(Device::new(
|
||||
MediaType::screen(),
|
||||
viewport_size,
|
||||
device_pixel_ratio,
|
||||
))
|
||||
Device::new(MediaType::screen(), viewport_size, device_pixel_ratio)
|
||||
}
|
||||
|
||||
/// Remove a stylesheet owned by `owner` from the list of document sheets.
|
||||
|
@ -4183,7 +4177,7 @@ impl DocumentMethods for Document {
|
|||
let y = *y as f32;
|
||||
let point = &Point2D::new(x, y);
|
||||
let window = window_from_node(self);
|
||||
let viewport = window.window_size()?.initial_viewport;
|
||||
let viewport = window.window_size().initial_viewport;
|
||||
|
||||
if self.browsing_context().is_none() {
|
||||
return None;
|
||||
|
@ -4218,10 +4212,7 @@ impl DocumentMethods for Document {
|
|||
let y = *y as f32;
|
||||
let point = &Point2D::new(x, y);
|
||||
let window = window_from_node(self);
|
||||
let viewport = match window.window_size() {
|
||||
Some(size) => size.initial_viewport,
|
||||
None => return vec![],
|
||||
};
|
||||
let viewport = window.window_size().initial_viewport;
|
||||
|
||||
if self.browsing_context().is_none() {
|
||||
return vec![];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue