servo: Merge #12381 - Move some unit type definitions to style_traits (from Ms2ger:units); r=nox

Source-Repo: https://github.com/servo/servo
Source-Revision: 1c7bec4b493174742c579b67ddb6f5411892d3d2
This commit is contained in:
Ms2ger 2016-07-11 03:17:55 -07:00
Родитель 74b652d758
Коммит 346257437f
16 изменённых файлов: 42 добавлений и 45 удалений

Просмотреть файл

@ -45,11 +45,12 @@ use std::mem as std_mem;
use std::rc::Rc;
use std::sync::mpsc::Sender;
use style_traits::viewport::ViewportConstraints;
use style_traits::{PagePx, ViewportPx};
use surface_map::SurfaceMap;
use time::{precise_time_ns, precise_time_s};
use touch::{TouchHandler, TouchAction};
use url::Url;
use util::geometry::{PagePx, ScreenPx, ViewportPx};
use util::geometry::ScreenPx;
use util::opts;
use util::prefs::PREFS;
use webrender;

Просмотреть файл

@ -43,7 +43,7 @@ use ipc_channel::ipc::IpcSender;
use msg::constellation_msg::PipelineId;
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
use std::sync::mpsc::Sender;
use util::geometry::PagePx;
use style_traits::PagePx;
mod compositor;
mod compositor_layer;

Просмотреть файл

@ -53,11 +53,11 @@ use std::marker::PhantomData;
use std::mem::replace;
use std::process;
use std::sync::mpsc::{Sender, channel, Receiver};
use style_traits::PagePx;
use style_traits::cursor::Cursor;
use style_traits::viewport::ViewportConstraints;
use timer_scheduler::TimerScheduler;
use url::Url;
use util::geometry::PagePx;
use util::opts;
use util::prefs::PREFS;
use util::thread::spawn_named;

Просмотреть файл

@ -31,9 +31,9 @@ use std::collections::HashMap;
use std::io::Error as IOError;
use std::process;
use std::sync::mpsc::{Sender, channel};
use style_traits::{PagePx, ViewportPx};
use url::Url;
use util;
use util::geometry::{PagePx, ViewportPx};
use util::ipc::OptionalIpcSender;
use util::opts::{self, Opts};
use util::prefs::{PREFS, Pref};

Просмотреть файл

@ -32,9 +32,10 @@ use range::Range;
use std::default::Default;
use std::{f32, mem, ptr};
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
use style_traits::PagePx;
use text::TextRun;
use text::glyph::ByteIndex;
use util::geometry::{self, MAX_RECT, PagePx, ScreenPx};
use util::geometry::{self, MAX_RECT, ScreenPx};
use util::opts;
pub struct PaintContext<'a> {

Просмотреть файл

@ -61,8 +61,8 @@ use profile_traits::mem;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::collections::HashMap;
use std::sync::mpsc::{Sender, Receiver};
use style_traits::{PagePx, ViewportPx};
use url::Url;
use util::geometry::{PagePx, ViewportPx};
use util::ipc::OptionalOpaqueIpcSender;
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};

1
servo/components/servo/Cargo.lock сгенерированный
Просмотреть файл

@ -2282,7 +2282,6 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
[[package]]

Просмотреть файл

@ -10,7 +10,7 @@ use app_units::Au;
use cssparser::{Delimiter, Parser, Token};
use euclid::size::{Size2D, TypedSize2D};
use properties::longhands;
use util::geometry::ViewportPx;
use style_traits::ViewportPx;
use values::specified;

Просмотреть файл

@ -18,9 +18,9 @@ use std::ascii::AsciiExt;
use std::fmt;
use std::iter::Enumerate;
use std::str::Chars;
use style_traits::ViewportPx;
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
use stylesheets::Origin;
use util::geometry::ViewportPx;
use values::computed::{Context, ToComputedValue};
use values::specified::{Length, LengthOrPercentageOrAuto, ViewportPercentageLength};

Просмотреть файл

@ -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,

Просмотреть файл

@ -26,35 +26,7 @@ use std::i32;
#[derive(Clone, Copy, Debug)]
pub enum ScreenPx {}
/// 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 {}
known_heap_size!(0, ScreenPx, ViewportPx, 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
known_heap_size!(0, ScreenPx);
// An Au is an "App Unit" and represents 1/60th of a CSS pixel. It was
// originally proposed in 2002 as a standard unit of measure in Gecko.

1
servo/ports/cef/Cargo.lock сгенерированный
Просмотреть файл

@ -2151,7 +2151,6 @@ dependencies = [
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
[[package]]

1
servo/ports/geckolib/Cargo.lock сгенерированный
Просмотреть файл

@ -340,7 +340,6 @@ dependencies = [
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1",
]
[[package]]

Просмотреть файл

@ -16,7 +16,7 @@ use style::dom::OpaqueNode;
use style::media_queries::{Device, MediaType};
use style::parallel::WorkQueueData;
use style::workqueue::WorkQueue;
use util::geometry::ViewportPx;
use style_traits::ViewportPx;
use util::thread_state;
pub struct PerDocumentStyleData {