mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Move some unit type definitions to style_traits.
This commit is contained in:
parent
42e90f7db9
commit
cbfe77cee1
16 changed files with 42 additions and 45 deletions
|
@ -10,7 +10,7 @@ path = "lib.rs"
|
|||
|
||||
[features]
|
||||
servo = ["heapsize", "heapsize_plugin", "serde", "serde_macros", "euclid/plugins",
|
||||
"cssparser/heap_size", "cssparser/serde-serialization", "util/servo"]
|
||||
"cssparser/heap_size", "cssparser/serde-serialization"]
|
||||
|
||||
[dependencies]
|
||||
cssparser = "0.5.4"
|
||||
|
@ -20,4 +20,3 @@ heapsize_plugin = {version = "0.1.2", optional = true}
|
|||
rustc-serialize = "0.3"
|
||||
serde = {version = "0.7.11", optional = true}
|
||||
serde_macros = {version = "0.7.11", optional = true}
|
||||
util = {path = "../util"}
|
||||
|
|
|
@ -22,7 +22,34 @@ extern crate euclid;
|
|||
#[cfg(feature = "servo")] extern crate heapsize;
|
||||
extern crate rustc_serialize;
|
||||
#[cfg(feature = "servo")] extern crate serde;
|
||||
extern crate util;
|
||||
|
||||
/// One CSS "px" in the coordinate system of the "initial viewport":
|
||||
/// http://www.w3.org/TR/css-device-adapt/#initial-viewport
|
||||
///
|
||||
/// ViewportPx is equal to ScreenPx times a "page zoom" factor controlled by the user. This is
|
||||
/// the desktop-style "full page" zoom that enlarges content but then reflows the layout viewport
|
||||
/// so it still exactly fits the visible area.
|
||||
///
|
||||
/// 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.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum ViewportPx {}
|
||||
|
||||
/// One CSS "px" in the root coordinate system for the content document.
|
||||
///
|
||||
/// PagePx is equal to ViewportPx multiplied by a "viewport zoom" factor controlled by the user.
|
||||
/// 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
|
||||
/// as the viewable area.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum PagePx {}
|
||||
|
||||
// In summary, the hierarchy of pixel units and the factors to convert from one to the next:
|
||||
//
|
||||
// DevicePixel
|
||||
// / hidpi_ratio => ScreenPx
|
||||
// / desktop_zoom => ViewportPx
|
||||
// / pinch_zoom => PagePx
|
||||
|
||||
pub mod cursor;
|
||||
#[macro_use]
|
||||
|
|
|
@ -7,8 +7,8 @@ use euclid::scale_factor::ScaleFactor;
|
|||
use euclid::size::TypedSize2D;
|
||||
use std::ascii::AsciiExt;
|
||||
use std::fmt;
|
||||
use util::geometry::{PagePx, ViewportPx};
|
||||
use values::specified::AllowedNumericType;
|
||||
use {PagePx, ViewportPx};
|
||||
|
||||
define_css_keyword_enum!(UserZoom:
|
||||
"zoom" => Zoom,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue