зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
74b652d758
Коммит
346257437f
|
@ -45,11 +45,12 @@ use std::mem as std_mem;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use style_traits::viewport::ViewportConstraints;
|
use style_traits::viewport::ViewportConstraints;
|
||||||
|
use style_traits::{PagePx, ViewportPx};
|
||||||
use surface_map::SurfaceMap;
|
use surface_map::SurfaceMap;
|
||||||
use time::{precise_time_ns, precise_time_s};
|
use time::{precise_time_ns, precise_time_s};
|
||||||
use touch::{TouchHandler, TouchAction};
|
use touch::{TouchHandler, TouchAction};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::geometry::{PagePx, ScreenPx, ViewportPx};
|
use util::geometry::ScreenPx;
|
||||||
use util::opts;
|
use util::opts;
|
||||||
use util::prefs::PREFS;
|
use util::prefs::PREFS;
|
||||||
use webrender;
|
use webrender;
|
||||||
|
|
|
@ -43,7 +43,7 @@ use ipc_channel::ipc::IpcSender;
|
||||||
use msg::constellation_msg::PipelineId;
|
use msg::constellation_msg::PipelineId;
|
||||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
|
use script_traits::{ConstellationControlMsg, LayoutControlMsg};
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use util::geometry::PagePx;
|
use style_traits::PagePx;
|
||||||
|
|
||||||
mod compositor;
|
mod compositor;
|
||||||
mod compositor_layer;
|
mod compositor_layer;
|
||||||
|
|
|
@ -53,11 +53,11 @@ use std::marker::PhantomData;
|
||||||
use std::mem::replace;
|
use std::mem::replace;
|
||||||
use std::process;
|
use std::process;
|
||||||
use std::sync::mpsc::{Sender, channel, Receiver};
|
use std::sync::mpsc::{Sender, channel, Receiver};
|
||||||
|
use style_traits::PagePx;
|
||||||
use style_traits::cursor::Cursor;
|
use style_traits::cursor::Cursor;
|
||||||
use style_traits::viewport::ViewportConstraints;
|
use style_traits::viewport::ViewportConstraints;
|
||||||
use timer_scheduler::TimerScheduler;
|
use timer_scheduler::TimerScheduler;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::geometry::PagePx;
|
|
||||||
use util::opts;
|
use util::opts;
|
||||||
use util::prefs::PREFS;
|
use util::prefs::PREFS;
|
||||||
use util::thread::spawn_named;
|
use util::thread::spawn_named;
|
||||||
|
|
|
@ -31,9 +31,9 @@ use std::collections::HashMap;
|
||||||
use std::io::Error as IOError;
|
use std::io::Error as IOError;
|
||||||
use std::process;
|
use std::process;
|
||||||
use std::sync::mpsc::{Sender, channel};
|
use std::sync::mpsc::{Sender, channel};
|
||||||
|
use style_traits::{PagePx, ViewportPx};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util;
|
use util;
|
||||||
use util::geometry::{PagePx, ViewportPx};
|
|
||||||
use util::ipc::OptionalIpcSender;
|
use util::ipc::OptionalIpcSender;
|
||||||
use util::opts::{self, Opts};
|
use util::opts::{self, Opts};
|
||||||
use util::prefs::{PREFS, Pref};
|
use util::prefs::{PREFS, Pref};
|
||||||
|
|
|
@ -32,9 +32,10 @@ use range::Range;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::{f32, mem, ptr};
|
use std::{f32, mem, ptr};
|
||||||
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
|
use style::computed_values::{border_style, filter, image_rendering, mix_blend_mode};
|
||||||
|
use style_traits::PagePx;
|
||||||
use text::TextRun;
|
use text::TextRun;
|
||||||
use text::glyph::ByteIndex;
|
use text::glyph::ByteIndex;
|
||||||
use util::geometry::{self, MAX_RECT, PagePx, ScreenPx};
|
use util::geometry::{self, MAX_RECT, ScreenPx};
|
||||||
use util::opts;
|
use util::opts;
|
||||||
|
|
||||||
pub struct PaintContext<'a> {
|
pub struct PaintContext<'a> {
|
||||||
|
|
|
@ -61,8 +61,8 @@ use profile_traits::mem;
|
||||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::mpsc::{Sender, Receiver};
|
use std::sync::mpsc::{Sender, Receiver};
|
||||||
|
use style_traits::{PagePx, ViewportPx};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use util::geometry::{PagePx, ViewportPx};
|
|
||||||
use util::ipc::OptionalOpaqueIpcSender;
|
use util::ipc::OptionalOpaqueIpcSender;
|
||||||
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
|
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
|
||||||
|
|
||||||
|
|
|
@ -2282,7 +2282,6 @@ dependencies = [
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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 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)",
|
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"util 0.0.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -10,7 +10,7 @@ use app_units::Au;
|
||||||
use cssparser::{Delimiter, Parser, Token};
|
use cssparser::{Delimiter, Parser, Token};
|
||||||
use euclid::size::{Size2D, TypedSize2D};
|
use euclid::size::{Size2D, TypedSize2D};
|
||||||
use properties::longhands;
|
use properties::longhands;
|
||||||
use util::geometry::ViewportPx;
|
use style_traits::ViewportPx;
|
||||||
use values::specified;
|
use values::specified;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@ use std::ascii::AsciiExt;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::iter::Enumerate;
|
use std::iter::Enumerate;
|
||||||
use std::str::Chars;
|
use std::str::Chars;
|
||||||
|
use style_traits::ViewportPx;
|
||||||
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
|
use style_traits::viewport::{Orientation, UserZoom, ViewportConstraints, Zoom};
|
||||||
use stylesheets::Origin;
|
use stylesheets::Origin;
|
||||||
use util::geometry::ViewportPx;
|
|
||||||
use values::computed::{Context, ToComputedValue};
|
use values::computed::{Context, ToComputedValue};
|
||||||
use values::specified::{Length, LengthOrPercentageOrAuto, ViewportPercentageLength};
|
use values::specified::{Length, LengthOrPercentageOrAuto, ViewportPercentageLength};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ path = "lib.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
servo = ["heapsize", "heapsize_plugin", "serde", "serde_macros", "euclid/plugins",
|
servo = ["heapsize", "heapsize_plugin", "serde", "serde_macros", "euclid/plugins",
|
||||||
"cssparser/heap_size", "cssparser/serde-serialization", "util/servo"]
|
"cssparser/heap_size", "cssparser/serde-serialization"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cssparser = "0.5.4"
|
cssparser = "0.5.4"
|
||||||
|
@ -20,4 +20,3 @@ heapsize_plugin = {version = "0.1.2", optional = true}
|
||||||
rustc-serialize = "0.3"
|
rustc-serialize = "0.3"
|
||||||
serde = {version = "0.7.11", optional = true}
|
serde = {version = "0.7.11", optional = true}
|
||||||
serde_macros = {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;
|
#[cfg(feature = "servo")] extern crate heapsize;
|
||||||
extern crate rustc_serialize;
|
extern crate rustc_serialize;
|
||||||
#[cfg(feature = "servo")] extern crate serde;
|
#[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;
|
pub mod cursor;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -7,8 +7,8 @@ use euclid::scale_factor::ScaleFactor;
|
||||||
use euclid::size::TypedSize2D;
|
use euclid::size::TypedSize2D;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use util::geometry::{PagePx, ViewportPx};
|
|
||||||
use values::specified::AllowedNumericType;
|
use values::specified::AllowedNumericType;
|
||||||
|
use {PagePx, ViewportPx};
|
||||||
|
|
||||||
define_css_keyword_enum!(UserZoom:
|
define_css_keyword_enum!(UserZoom:
|
||||||
"zoom" => Zoom,
|
"zoom" => Zoom,
|
||||||
|
|
|
@ -26,35 +26,7 @@ use std::i32;
|
||||||
#[derive(Clone, Copy, Debug)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
pub enum ScreenPx {}
|
pub enum ScreenPx {}
|
||||||
|
|
||||||
/// One CSS "px" in the coordinate system of the "initial viewport":
|
known_heap_size!(0, ScreenPx);
|
||||||
/// 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
|
|
||||||
|
|
||||||
// An Au is an "App Unit" and represents 1/60th of a CSS pixel. It was
|
// 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.
|
// originally proposed in 2002 as a standard unit of measure in Gecko.
|
||||||
|
|
|
@ -2151,7 +2151,6 @@ dependencies = [
|
||||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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 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)",
|
"serde_macros 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"util 0.0.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -340,7 +340,6 @@ dependencies = [
|
||||||
"cssparser 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"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)",
|
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"util 0.0.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
@ -16,7 +16,7 @@ use style::dom::OpaqueNode;
|
||||||
use style::media_queries::{Device, MediaType};
|
use style::media_queries::{Device, MediaType};
|
||||||
use style::parallel::WorkQueueData;
|
use style::parallel::WorkQueueData;
|
||||||
use style::workqueue::WorkQueue;
|
use style::workqueue::WorkQueue;
|
||||||
use util::geometry::ViewportPx;
|
use style_traits::ViewportPx;
|
||||||
use util::thread_state;
|
use util::thread_state;
|
||||||
|
|
||||||
pub struct PerDocumentStyleData {
|
pub struct PerDocumentStyleData {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче