Outside of compositor, store window size in CSS px

This fixes an issue where the CSS viewport was too large on high-DPI displays
because it was set to the window size in device pixels, instead of px.  This
patch ensures that the window size is converted from device pixels to px
before being passed to script/layout code.

The Window trait now exposes the window size in both device pixels and
density-independent screen coordinates, with clearer method names.
This commit is contained in:
Matt Brubeck 2014-06-06 12:45:14 -07:00
parent e98b03f581
commit 89327aa5be
15 changed files with 104 additions and 85 deletions

View file

@ -11,10 +11,10 @@ use dom::node::{Node, LayoutDataRef};
use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
use geom::size::TypedSize2D;
use libc::c_void;
use script_task::{ScriptChan};
use servo_util::geometry::Au;
use servo_util::geometry::{Au, PagePx};
use std::cmp;
use std::comm::{channel, Receiver, Sender};
use style::Stylesheet;
@ -137,7 +137,7 @@ pub struct Reflow {
/// The channel through which messages can be sent back to the script task.
pub script_chan: ScriptChan,
/// The current window size.
pub window_size: Size2D<uint>,
pub window_size: TypedSize2D<PagePx, f32>,
/// The channel that we send a notification to.
pub script_join_chan: Sender<()>,
/// Unique identifier