mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Expressions with percentages may be negative or positive at computed value time. So, we can only clamp lengths at computed value time, which is what the other browsers do.
59 lines
2.2 KiB
Rust
59 lines
2.2 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
//! This module contains shared types and messages for use by devtools/script.
|
|
//! The traits are here instead of in script so that the devtools crate can be
|
|
//! modified independently of the rest of Servo.
|
|
|
|
#![crate_name = "style_traits"]
|
|
#![crate_type = "rlib"]
|
|
|
|
#![deny(unsafe_code)]
|
|
|
|
#![cfg_attr(feature = "servo", feature(custom_derive))]
|
|
#![cfg_attr(feature = "servo", feature(plugin))]
|
|
#![cfg_attr(feature = "servo", plugin(serde_macros))]
|
|
#![cfg_attr(feature = "servo", plugin(heapsize_plugin))]
|
|
|
|
extern crate app_units;
|
|
#[macro_use]
|
|
extern crate cssparser;
|
|
extern crate euclid;
|
|
#[cfg(feature = "servo")] extern crate heapsize;
|
|
extern crate rustc_serialize;
|
|
#[cfg(feature = "servo")] extern crate serde;
|
|
|
|
/// 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]
|
|
pub mod values;
|
|
pub mod viewport;
|
|
|