mirror of
https://github.com/servo/servo.git
synced 2025-06-15 03:44:30 +00:00
Made Page.window_size and Page.next_subpage_id Traceable, added trait Encodable for WindowSizeData, ViewportPx, PagePx, and DevicePixel
This commit is contained in:
parent
e62637fee2
commit
f085655cc6
3 changed files with 9 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
use geom::size::TypedSize2D;
|
use geom::size::TypedSize2D;
|
||||||
use geom::scale_factor::ScaleFactor;
|
use geom::scale_factor::ScaleFactor;
|
||||||
|
use serialize::Encodable;
|
||||||
use servo_util::geometry::{DevicePixel, PagePx, ViewportPx};
|
use servo_util::geometry::{DevicePixel, PagePx, ViewportPx};
|
||||||
use std::comm::{channel, Sender, Receiver};
|
use std::comm::{channel, Sender, Receiver};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
@ -35,6 +36,7 @@ pub struct Failure {
|
||||||
pub subpage_id: Option<SubpageId>,
|
pub subpage_id: Option<SubpageId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deriving(Encodable)]
|
||||||
pub struct WindowSizeData {
|
pub struct WindowSizeData {
|
||||||
/// The size of the initial layout viewport, before parsing an
|
/// The size of the initial layout viewport, before parsing an
|
||||||
/// http://www.w3.org/TR/css-device-adapt/#initial-viewport
|
/// http://www.w3.org/TR/css-device-adapt/#initial-viewport
|
||||||
|
|
|
@ -60,7 +60,7 @@ pub struct Page {
|
||||||
damage: Traceable<RefCell<Option<DocumentDamage>>>,
|
damage: Traceable<RefCell<Option<DocumentDamage>>>,
|
||||||
|
|
||||||
/// The current size of the window, in pixels.
|
/// The current size of the window, in pixels.
|
||||||
pub window_size: Untraceable<Cell<WindowSizeData>>,
|
pub window_size: Traceable<Cell<WindowSizeData>>,
|
||||||
|
|
||||||
js_info: Traceable<RefCell<Option<JSPageInfo>>>,
|
js_info: Traceable<RefCell<Option<JSPageInfo>>>,
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ pub struct Page {
|
||||||
/// when reloading.
|
/// when reloading.
|
||||||
url: Untraceable<RefCell<Option<(Url, bool)>>>,
|
url: Untraceable<RefCell<Option<(Url, bool)>>>,
|
||||||
|
|
||||||
next_subpage_id: Untraceable<Cell<SubpageId>>,
|
next_subpage_id: Traceable<Cell<SubpageId>>,
|
||||||
|
|
||||||
/// Pending resize event, if any.
|
/// Pending resize event, if any.
|
||||||
pub resize_event: Untraceable<Cell<Option<WindowSizeData>>>,
|
pub resize_event: Untraceable<Cell<Option<WindowSizeData>>>,
|
||||||
|
@ -132,10 +132,10 @@ impl Page {
|
||||||
layout_chan: Untraceable::new(layout_chan),
|
layout_chan: Untraceable::new(layout_chan),
|
||||||
layout_join_port: Untraceable::new(RefCell::new(None)),
|
layout_join_port: Untraceable::new(RefCell::new(None)),
|
||||||
damage: Traceable::new(RefCell::new(None)),
|
damage: Traceable::new(RefCell::new(None)),
|
||||||
window_size: Untraceable::new(Cell::new(window_size)),
|
window_size: Traceable::new(Cell::new(window_size)),
|
||||||
js_info: Traceable::new(RefCell::new(Some(js_info))),
|
js_info: Traceable::new(RefCell::new(Some(js_info))),
|
||||||
url: Untraceable::new(RefCell::new(None)),
|
url: Untraceable::new(RefCell::new(None)),
|
||||||
next_subpage_id: Untraceable::new(Cell::new(SubpageId(0))),
|
next_subpage_id: Traceable::new(Cell::new(SubpageId(0))),
|
||||||
resize_event: Untraceable::new(Cell::new(None)),
|
resize_event: Untraceable::new(Cell::new(None)),
|
||||||
fragment_node: Cell::new(None),
|
fragment_node: Cell::new(None),
|
||||||
last_reflow_id: Traceable::new(Cell::new(0)),
|
last_reflow_id: Traceable::new(Cell::new(0)),
|
||||||
|
|
|
@ -16,6 +16,7 @@ use std::fmt;
|
||||||
/// One hardware pixel.
|
/// One hardware pixel.
|
||||||
///
|
///
|
||||||
/// This unit corresponds to the smallest addressable element of the display hardware.
|
/// This unit corresponds to the smallest addressable element of the display hardware.
|
||||||
|
#[deriving(Encodable)]
|
||||||
pub enum DevicePixel {}
|
pub enum DevicePixel {}
|
||||||
|
|
||||||
/// A normalized "pixel" at the default resolution for the display.
|
/// A normalized "pixel" at the default resolution for the display.
|
||||||
|
@ -42,6 +43,7 @@ pub enum ScreenPx {}
|
||||||
///
|
///
|
||||||
/// At the default zoom level of 100%, one PagePx is equal to one ScreenPx. However, if the
|
/// At the default zoom level of 100%, one PagePx is equal to one ScreenPx. However, if the
|
||||||
/// document is zoomed in or out then this scale may be larger or smaller.
|
/// document is zoomed in or out then this scale may be larger or smaller.
|
||||||
|
#[deriving(Encodable)]
|
||||||
pub enum ViewportPx {}
|
pub enum ViewportPx {}
|
||||||
|
|
||||||
/// One CSS "px" in the root coordinate system for the content document.
|
/// One CSS "px" in the root coordinate system for the content document.
|
||||||
|
@ -50,6 +52,7 @@ pub enum ViewportPx {}
|
||||||
/// This is the mobile-style "pinch zoom" that enlarges content without reflowing it. When the
|
/// This is the mobile-style "pinch zoom" that enlarges content without reflowing it. When the
|
||||||
/// viewport zoom is not equal to 1.0, then the layout viewport is no longer the same physical size
|
/// viewport zoom is not equal to 1.0, then the layout viewport is no longer the same physical size
|
||||||
/// as the viewable area.
|
/// as the viewable area.
|
||||||
|
#[deriving(Encodable)]
|
||||||
pub enum PagePx {}
|
pub enum PagePx {}
|
||||||
|
|
||||||
// In summary, the hierarchy of pixel units and the factors to convert from one to the next:
|
// In summary, the hierarchy of pixel units and the factors to convert from one to the next:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue