Auto merge of #11816 - servo:stable-style, r=nox

Make the style crate (almost) build with a stable compiler

<!-- Please describe your changes on the following line: -->

The bulk of this is adding cargo features to make derived implementations of `heapsize` and `serde` traits optional.

"Almost" because `std::intrinsics::discriminant_value` is currently unstable and doesn’t have any stable replacement that I know of. For now, this PR conditionally replaces it with `unimplemented!()`.

r? @nox

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes <s>fix</s> are part of #11815 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not <s>require tests</s> *have tests yet* because that requires https://github.com/servo/servo/issues/11806, but I still want to land this before it bitrots. (Tests should check that the build succeeds with a stable compiler.)

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11816)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-22 09:43:20 -05:00 committed by GitHub
commit 0fb5d634a0
63 changed files with 506 additions and 348 deletions

View file

@ -13,7 +13,7 @@ path = "lib.rs"
app_units = {version = "0.2.3", features = ["plugins"]} app_units = {version = "0.2.3", features = ["plugins"]}
azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]} azure = {git = "https://github.com/servo/rust-azure", features = ["plugins"]}
bitflags = "0.7" bitflags = "0.7"
euclid = {version = "0.6.4", features = ["plugins"]} euclid = {version = "0.6.4", features = ["plugins", "unstable"]}
fnv = "1.0" fnv = "1.0"
gfx_traits = {path = "../gfx_traits"} gfx_traits = {path = "../gfx_traits"}
harfbuzz-sys = "0.1" harfbuzz-sys = "0.1"

View file

@ -20,7 +20,8 @@ use azure::azure_hl::Color;
use euclid::approxeq::ApproxEq; use euclid::approxeq::ApproxEq;
use euclid::num::Zero; use euclid::num::Zero;
use euclid::rect::TypedRect; use euclid::rect::TypedRect;
use euclid::{Matrix2D, Matrix4D, Point2D, Rect, SideOffsets2D, Size2D}; use euclid::side_offsets::SideOffsets2D;
use euclid::{Matrix2D, Matrix4D, Point2D, Rect, Size2D};
use fnv::FnvHasher; use fnv::FnvHasher;
use gfx_traits::{LayerId, ScrollPolicy, StackingContextId}; use gfx_traits::{LayerId, ScrollPolicy, StackingContextId};
use ipc_channel::ipc::IpcSharedMemory; use ipc_channel::ipc::IpcSharedMemory;

View file

@ -21,6 +21,6 @@ plugins = {path = "../plugins"}
rustc-serialize = "0.3.4" rustc-serialize = "0.3.4"
serde = "0.7" serde = "0.7"
serde_macros = "0.7" serde_macros = "0.7"
url = {version = "1.0.0", features = ["heap_size"]} url = {version = "1.0.0", features = ["heap_size", "serde"]}
util = {path = "../util"} util = {path = "../util", features = ["servo"]}
webrender_traits = {git = "https://github.com/servo/webrender_traits"} webrender_traits = {git = "https://github.com/servo/webrender_traits"}

View file

@ -11,7 +11,7 @@ path = "lib.rs"
[dependencies] [dependencies]
profile_traits = {path = "../profile_traits"} profile_traits = {path = "../profile_traits"}
plugins = {path = "../plugins"} plugins = {path = "../plugins"}
util = {path = "../util"} util = {path = "../util", features = ["servo"]}
ipc-channel = {git = "https://github.com/servo/ipc-channel"} ipc-channel = {git = "https://github.com/servo/ipc-channel"}
heartbeats-simple = "0.3" heartbeats-simple = "0.3"
log = "0.3.5" log = "0.3.5"

View file

@ -15,7 +15,7 @@ msg = {path = "../msg"}
net_traits = {path = "../net_traits"} net_traits = {path = "../net_traits"}
plugins = {path = "../plugins"} plugins = {path = "../plugins"}
profile_traits = {path = "../profile_traits"} profile_traits = {path = "../profile_traits"}
style_traits = {path = "../style_traits"} style_traits = {path = "../style_traits", features = ["servo"]}
util = {path = "../util"} util = {path = "../util"}
devtools_traits = {path = "../devtools_traits"} devtools_traits = {path = "../devtools_traits"}
ipc-channel = {git = "https://github.com/servo/ipc-channel"} ipc-channel = {git = "https://github.com/servo/ipc-channel"}

View file

@ -2215,7 +2215,6 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"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)",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2253,7 +2252,6 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"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.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2438,7 +2436,6 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2446,7 +2443,6 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (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)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -59,7 +59,7 @@ script_traits = {path = "../script_traits"}
layout = {path = "../layout"} layout = {path = "../layout"}
layout_thread = {path = "../layout_thread"} layout_thread = {path = "../layout_thread"}
gfx = {path = "../gfx"} gfx = {path = "../gfx"}
style = {path = "../style"} style = {path = "../style", features = ["servo"]}
canvas = {path = "../canvas"} canvas = {path = "../canvas"}
canvas_traits = {path = "../canvas_traits"} canvas_traits = {path = "../canvas_traits"}
devtools = {path = "../devtools"} devtools = {path = "../devtools"}

View file

@ -12,31 +12,35 @@ path = "lib.rs"
[features] [features]
gecko = ["gecko_bindings"] gecko = ["gecko_bindings"]
servo = ["serde", "serde/nightly", "serde_macros", "heapsize", "heapsize_plugin",
"style_traits/servo", "app_units/plugins", "euclid/plugins",
"cssparser/heap_size", "cssparser/serde-serialization",
"selectors/heap_size", "selectors/unstable", "string_cache/heap_size",
"url/heap_size"]
[dependencies] [dependencies]
app_units = {version = "0.2.3", features = ["plugins"]} app_units = "0.2.3"
bitflags = "0.7" bitflags = "0.7"
cssparser = {version = "0.5.5", features = ["heap_size", "serde-serialization"]} cssparser = "0.5.5"
encoding = "0.2" encoding = "0.2"
euclid = {version = "0.6.4", features = ["plugins"]} euclid = "0.6.4"
fnv = "1.0" fnv = "1.0"
gecko_bindings = {path = "../../ports/geckolib/gecko_bindings", optional = true} gecko_bindings = {path = "../../ports/geckolib/gecko_bindings", optional = true}
heapsize = "0.3.0" heapsize = {version = "0.3.0", optional = true}
heapsize_plugin = "0.1.2" heapsize_plugin = {version = "0.1.2", optional = true}
lazy_static = "0.2" lazy_static = "0.2"
log = "0.3.5" log = "0.3.5"
matches = "0.1" matches = "0.1"
num-traits = "0.1.32" num-traits = "0.1.32"
plugins = {path = "../plugins"}
rustc-serialize = "0.3" rustc-serialize = "0.3"
selectors = {version = "0.6", features = ["heap_size", "unstable"]} selectors = "0.6"
serde = {version = "0.7", features = ["nightly"]} serde = {version = "0.7", optional = true}
serde_macros = "0.7" serde_macros = {version = "0.7", optional = true}
smallvec = "0.1" smallvec = "0.1"
string_cache = {version = "0.2.20", features = ["heap_size"]} string_cache = "0.2.20"
style_traits = {path = "../style_traits"} style_traits = {path = "../style_traits"}
time = "0.1" time = "0.1"
url = {version = "1.0.0", features = ["heap_size"]} url = "1.0.0"
util = {path = "../util"} util = {path = "../util"}
[build-dependencies] [build-dependencies]

View file

@ -17,14 +17,16 @@ use values::specified::Length;
// Duplicated from script::dom::values. // Duplicated from script::dom::values.
const UNSIGNED_LONG_MAX: u32 = 2147483647; const UNSIGNED_LONG_MAX: u32 = 2147483647;
#[derive(Clone, Copy, Debug, HeapSizeOf, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentageOrAuto { pub enum LengthOrPercentageOrAuto {
Auto, Auto,
Percentage(f32), Percentage(f32),
Length(Au), Length(Au),
} }
#[derive(PartialEq, Clone, HeapSizeOf)] #[derive(PartialEq, Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum AttrValue { pub enum AttrValue {
String(String), String(String),
TokenList(String, Vec<Atom>), TokenList(String, Vec<Atom>),
@ -538,7 +540,8 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
} }
} }
#[derive(Clone, HeapSizeOf, Debug)] #[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct AttrIdentifier { pub struct AttrIdentifier {
pub local_name: Atom, pub local_name: Atom,
pub name: Atom, pub name: Atom,

View file

@ -23,7 +23,8 @@ pub fn parse_name(s: &str) -> Result<&str, ()> {
} }
} }
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue { pub struct SpecifiedValue {
css: String, css: String,
@ -41,7 +42,8 @@ pub struct BorrowedSpecifiedValue<'a> {
references: Option<&'a HashSet<Name>>, references: Option<&'a HashSet<Name>>,
} }
#[derive(Clone, HeapSizeOf, Debug)] #[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ComputedValue { pub struct ComputedValue {
css: String, css: String,
first_token_type: TokenSerializationType, first_token_type: TokenSerializationType,

View file

@ -33,7 +33,7 @@ impl<Impl, ConcreteComputedValues> PrivateStyleData<Impl, ConcreteComputedValues
} }
/// Information that we need stored in each DOM node. /// Information that we need stored in each DOM node.
#[derive(HeapSizeOf)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct DomParallelInfo { pub struct DomParallelInfo {
/// The number of children that still need work done. /// The number of children that still need work done.
pub children_count: AtomicIsize, pub children_count: AtomicIsize,

View file

@ -31,7 +31,8 @@ pub type UnsafeNode = (usize, usize);
/// Because the script task's GC does not trace layout, node data cannot be safely stored in layout /// Because the script task's GC does not trace layout, node data cannot be safely stored in layout
/// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for /// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for
/// locality reasons. Using `OpaqueNode` enforces this invariant. /// locality reasons. Using `OpaqueNode` enforces this invariant.
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf, Hash, Eq, Deserialize, Serialize)] #[derive(Clone, PartialEq, Copy, Debug, Hash, Eq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub struct OpaqueNode(pub usize); pub struct OpaqueNode(pub usize);
impl OpaqueNode { impl OpaqueNode {

View file

@ -4,7 +4,7 @@
bitflags! { bitflags! {
#[doc = "Event-based element states."] #[doc = "Event-based element states."]
#[derive(HeapSizeOf)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub flags ElementState: u16 { pub flags ElementState: u16 {
#[doc = "The mouse is down on this element. \ #[doc = "The mouse is down on this element. \
https://html.spec.whatwg.org/multipage/#selector-active \ https://html.spec.whatwg.org/multipage/#selector-active \

View file

@ -20,6 +20,6 @@ impl ParseErrorReporter for StdoutErrorReporter {
} }
fn clone(&self) -> Box<ParseErrorReporter + Send + Sync> { fn clone(&self) -> Box<ParseErrorReporter + Send + Sync> {
box StdoutErrorReporter Box::new(StdoutErrorReporter)
} }
} }

View file

@ -9,19 +9,22 @@ use properties::longhands::font_family::parse_one_family;
use std::iter; use std::iter;
use url::Url; use url::Url;
#[derive(Clone, Debug, HeapSizeOf, PartialEq, Eq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub enum Source { pub enum Source {
Url(UrlSource), Url(UrlSource),
Local(FontFamily), Local(FontFamily),
} }
#[derive(Clone, Debug, HeapSizeOf, PartialEq, Eq, Deserialize, Serialize)] #[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub struct UrlSource { pub struct UrlSource {
pub url: Url, pub url: Url,
pub format_hints: Vec<String>, pub format_hints: Vec<String>,
} }
#[derive(Debug, HeapSizeOf, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct FontFaceRule { pub struct FontFaceRule {
pub family: FontFamily, pub family: FontFamily,
pub sources: Vec<Source>, pub sources: Vec<Source>,
@ -59,7 +62,8 @@ pub fn parse_font_face_block(context: &ParserContext, input: &mut Parser)
} }
} }
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct EffectiveSources(Vec<Source>); pub struct EffectiveSources(Vec<Source>);
impl FontFaceRule { impl FontFaceRule {

View file

@ -2,17 +2,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(box_syntax)] // FIXME: replace discriminant_value with per-enum methods that use `match`?
#![feature(box_patterns)]
#![feature(concat_idents)]
#![feature(core_intrinsics)] #![feature(core_intrinsics)]
#![feature(custom_attribute)]
#![feature(custom_derive)]
#![feature(plugin)]
#![plugin(heapsize_plugin)] #![cfg_attr(feature = "servo", feature(custom_attribute))]
#![plugin(plugins)] #![cfg_attr(feature = "servo", feature(custom_derive))]
#![plugin(serde_macros)] #![cfg_attr(feature = "servo", feature(plugin))]
#![cfg_attr(feature = "servo", plugin(heapsize_plugin))]
#![cfg_attr(feature = "servo", plugin(serde_macros))]
#![deny(unsafe_code)] #![deny(unsafe_code)]
@ -30,7 +27,7 @@ extern crate euclid;
extern crate fnv; extern crate fnv;
#[cfg(feature = "gecko")] #[cfg(feature = "gecko")]
extern crate gecko_bindings; extern crate gecko_bindings;
extern crate heapsize; #[cfg(feature = "servo")] extern crate heapsize;
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)]
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
@ -42,7 +39,7 @@ extern crate matches;
extern crate num_traits; extern crate num_traits;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate selectors; extern crate selectors;
extern crate serde; #[cfg(feature = "servo")] extern crate serde;
extern crate smallvec; extern crate smallvec;
#[macro_use(atom, ns)] extern crate string_cache; #[macro_use(atom, ns)] extern crate string_cache;
#[macro_use] #[macro_use]

View file

@ -5,7 +5,8 @@
//! Geometry in flow-relative space. //! Geometry in flow-relative space.
use euclid::num::Zero; use euclid::num::Zero;
use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; use euclid::side_offsets::SideOffsets2D;
use euclid::{Point2D, Rect, Size2D};
use std::cmp::{max, min}; use std::cmp::{max, min};
use std::fmt::{self, Debug, Error, Formatter}; use std::fmt::{self, Debug, Error, Formatter};
use std::ops::{Add, Sub}; use std::ops::{Add, Sub};
@ -22,7 +23,8 @@ pub enum InlineBaseDirection {
} }
bitflags!( bitflags!(
#[derive(HeapSizeOf, RustcEncodable)] #[derive(RustcEncodable)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub flags WritingMode: u8 { pub flags WritingMode: u8 {
const FLAG_RTL = 1 << 0, const FLAG_RTL = 1 << 0,
const FLAG_VERTICAL = 1 << 1, const FLAG_VERTICAL = 1 << 1,

View file

@ -10,12 +10,14 @@ use util::geometry::ViewportPx;
use values::specified; use values::specified;
#[derive(Debug, HeapSizeOf, PartialEq)] #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct MediaQueryList { pub struct MediaQueryList {
pub media_queries: Vec<MediaQuery> pub media_queries: Vec<MediaQuery>
} }
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Range<T> { pub enum Range<T> {
Min(T), Min(T),
Max(T), Max(T),
@ -58,20 +60,23 @@ impl<T: Ord> Range<T> {
} }
/// http://dev.w3.org/csswg/mediaqueries-3/#media1 /// http://dev.w3.org/csswg/mediaqueries-3/#media1
#[derive(PartialEq, Copy, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Expression { pub enum Expression {
/// http://dev.w3.org/csswg/mediaqueries-3/#width /// http://dev.w3.org/csswg/mediaqueries-3/#width
Width(Range<specified::Length>), Width(Range<specified::Length>),
} }
/// http://dev.w3.org/csswg/mediaqueries-3/#media0 /// http://dev.w3.org/csswg/mediaqueries-3/#media0
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Qualifier { pub enum Qualifier {
Only, Only,
Not, Not,
} }
#[derive(Debug, HeapSizeOf, PartialEq)] #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct MediaQuery { pub struct MediaQuery {
pub qualifier: Option<Qualifier>, pub qualifier: Option<Qualifier>,
pub media_type: MediaQueryType, pub media_type: MediaQueryType,
@ -90,20 +95,23 @@ impl MediaQuery {
} }
/// http://dev.w3.org/csswg/mediaqueries-3/#media0 /// http://dev.w3.org/csswg/mediaqueries-3/#media0
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum MediaQueryType { pub enum MediaQueryType {
All, // Always true All, // Always true
MediaType(MediaType), MediaType(MediaType),
} }
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum MediaType { pub enum MediaType {
Screen, Screen,
Print, Print,
Unknown, Unknown,
} }
#[derive(Debug, HeapSizeOf)] #[derive(Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct Device { pub struct Device {
pub media_type: MediaType, pub media_type: MediaType,
pub viewport_size: TypedSize2D<ViewportPx, f32>, pub viewport_size: TypedSize2D<ViewportPx, f32>,

View file

@ -17,7 +17,7 @@ use util::workqueue::{WorkQueue, WorkUnit, WorkerProxy};
#[allow(dead_code)] #[allow(dead_code)]
fn static_assertion(node: UnsafeNode) { fn static_assertion(node: UnsafeNode) {
unsafe { unsafe {
let _: UnsafeNodeList = ::std::intrinsics::transmute(node); let _: UnsafeNodeList = mem::transmute(node);
} }
} }
@ -46,7 +46,7 @@ pub fn traverse_dom<N, C>(root: N,
run_queue_with_custom_work_data_type(queue, |queue| { run_queue_with_custom_work_data_type(queue, |queue| {
queue.push(WorkUnit { queue.push(WorkUnit {
fun: top_down_dom::<N, C>, fun: top_down_dom::<N, C>,
data: (box vec![root.to_unsafe()], root.opaque()), data: (Box::new(vec![root.to_unsafe()]), root.opaque()),
}); });
}, queue_data); }, queue_data);
} }
@ -89,7 +89,7 @@ fn top_down_dom<N, C>(unsafe_nodes: UnsafeNodeList,
for chunk in discovered_child_nodes.chunks(CHUNK_SIZE) { for chunk in discovered_child_nodes.chunks(CHUNK_SIZE) {
proxy.push(WorkUnit { proxy.push(WorkUnit {
fun: top_down_dom::<N, C>, fun: top_down_dom::<N, C>,
data: (box chunk.iter().cloned().collect(), unsafe_nodes.1), data: (Box::new(chunk.iter().cloned().collect()), unsafe_nodes.1),
}); });
} }
} }

View file

@ -17,7 +17,8 @@ ${helpers.predefined_type(
pub mod computed_value { pub mod computed_value {
use values::computed; use values::computed;
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<computed::Image>); pub struct T(pub Option<computed::Image>);
} }
@ -32,7 +33,8 @@ ${helpers.predefined_type(
} }
} }
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(pub Option<Image>); pub struct SpecifiedValue(pub Option<Image>);
impl ToCss for SpecifiedValue { impl ToCss for SpecifiedValue {
@ -77,14 +79,16 @@ ${helpers.predefined_type(
pub mod computed_value { pub mod computed_value {
use values::computed::LengthOrPercentage; use values::computed::LengthOrPercentage;
#[derive(PartialEq, Copy, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T { pub struct T {
pub horizontal: LengthOrPercentage, pub horizontal: LengthOrPercentage,
pub vertical: LengthOrPercentage, pub vertical: LengthOrPercentage,
} }
} }
#[derive(Debug, Clone, PartialEq, Copy, HeapSizeOf)] #[derive(Debug, Clone, PartialEq, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue { pub struct SpecifiedValue {
pub horizontal: specified::LengthOrPercentage, pub horizontal: specified::LengthOrPercentage,
pub vertical: specified::LengthOrPercentage, pub vertical: specified::LengthOrPercentage,
@ -198,13 +202,15 @@ ${helpers.single_keyword("background-origin", "padding-box border-box content-bo
pub mod computed_value { pub mod computed_value {
use values::computed::LengthOrPercentageOrAuto; use values::computed::LengthOrPercentageOrAuto;
#[derive(PartialEq, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ExplicitSize { pub struct ExplicitSize {
pub width: LengthOrPercentageOrAuto, pub width: LengthOrPercentageOrAuto,
pub height: LengthOrPercentageOrAuto, pub height: LengthOrPercentageOrAuto,
} }
#[derive(PartialEq, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum T { pub enum T {
Explicit(ExplicitSize), Explicit(ExplicitSize),
Cover, Cover,
@ -222,7 +228,8 @@ ${helpers.single_keyword("background-origin", "padding-box border-box content-bo
} }
} }
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedExplicitSize { pub struct SpecifiedExplicitSize {
pub width: specified::LengthOrPercentageOrAuto, pub width: specified::LengthOrPercentageOrAuto,
pub height: specified::LengthOrPercentageOrAuto, pub height: specified::LengthOrPercentageOrAuto,
@ -245,7 +252,8 @@ ${helpers.single_keyword("background-origin", "padding-box border-box content-bo
} }
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Explicit(SpecifiedExplicitSize), Explicit(SpecifiedExplicitSize),
Cover, Cover,

View file

@ -34,7 +34,8 @@
-> Result<SpecifiedValue, ()> { -> Result<SpecifiedValue, ()> {
specified::parse_border_width(input).map(SpecifiedValue) specified::parse_border_width(input).map(SpecifiedValue)
} }
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(pub specified::Length); pub struct SpecifiedValue(pub specified::Length);
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;

View file

@ -28,8 +28,8 @@
pub mod computed_value { pub mod computed_value {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug, HeapSizeOf)] #[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug)]
#[derive(Deserialize, Serialize)] #[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub enum T { pub enum T {
% for value in values: % for value in values:
${to_rust_ident(value)}, ${to_rust_ident(value)},
@ -136,7 +136,8 @@ ${helpers.single_keyword("clear", "none left right both", gecko_ffi_name="mBreak
<% vertical_align_keywords = vertical_align.keyword.values_for(product) %> <% vertical_align_keywords = vertical_align.keyword.values_for(product) %>
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Debug, Clone, PartialEq, Copy, HeapSizeOf)] #[derive(Debug, Clone, PartialEq, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
% for keyword in vertical_align_keywords: % for keyword in vertical_align_keywords:
${to_rust_ident(keyword)}, ${to_rust_ident(keyword)},
@ -174,7 +175,8 @@ ${helpers.single_keyword("clear", "none left right both", gecko_ffi_name="mBreak
use values::AuExtensionMethods; use values::AuExtensionMethods;
use values::{CSSFloat, computed}; use values::{CSSFloat, computed};
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(PartialEq, Copy, Clone, HeapSizeOf, Debug)] #[derive(PartialEq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum T { pub enum T {
% for keyword in vertical_align_keywords: % for keyword in vertical_align_keywords:
${to_rust_ident(keyword)}, ${to_rust_ident(keyword)},
@ -243,7 +245,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone=
} }
pub mod computed_value { pub mod computed_value {
#[derive(Debug, Clone, Copy, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub super::super::overflow_x::computed_value::T); pub struct T(pub super::super::overflow_x::computed_value::T);
} }
@ -279,7 +282,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone=
pub use values::computed::Time as SingleComputedValue; pub use values::computed::Time as SingleComputedValue;
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Vec<SingleComputedValue>); pub struct T(pub Vec<SingleComputedValue>);
impl ToComputedValue for T { impl ToComputedValue for T {
@ -385,7 +389,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone=
pub use self::TransitionTimingFunction as SingleComputedValue; pub use self::TransitionTimingFunction as SingleComputedValue;
#[derive(Copy, Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum TransitionTimingFunction { pub enum TransitionTimingFunction {
CubicBezier(Point2D<f32>, Point2D<f32>), CubicBezier(Point2D<f32>, Point2D<f32>),
Steps(u32, StartEnd), Steps(u32, StartEnd),
@ -416,7 +421,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone=
} }
} }
#[derive(Copy, Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum StartEnd { pub enum StartEnd {
Start, Start,
End, End,
@ -431,7 +437,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone=
} }
} }
#[derive(Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Vec<TransitionTimingFunction>); pub struct T(pub Vec<TransitionTimingFunction>);
impl ToCss for T { impl ToCss for T {
@ -537,7 +544,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone=
pub use self::TransitionProperty as SingleComputedValue; pub use self::TransitionProperty as SingleComputedValue;
#[derive(Copy, Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum TransitionProperty { pub enum TransitionProperty {
All, All,
BackgroundColor, BackgroundColor,
@ -688,7 +696,8 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto", need_clone=
} }
} }
#[derive(Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Vec<SingleComputedValue>); pub struct T(pub Vec<SingleComputedValue>);
impl ToCss for T { impl ToCss for T {
@ -863,14 +872,16 @@ ${helpers.single_keyword("-moz-appearance",
use url::Url; use url::Url;
use values::computed::ComputedValueAsSpecified; use values::computed::ComputedValueAsSpecified;
#[derive(PartialEq, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct UrlExtraData { pub struct UrlExtraData {
pub base: GeckoArcURI, pub base: GeckoArcURI,
pub referrer: GeckoArcURI, pub referrer: GeckoArcURI,
pub principal: GeckoArcPrincipal, pub principal: GeckoArcPrincipal,
} }
#[derive(PartialEq, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Url(Url, UrlExtraData), Url(Url, UrlExtraData),
None, None,

View file

@ -11,7 +11,8 @@
use std::fmt; use std::fmt;
use values::AuExtensionMethods; use values::AuExtensionMethods;
#[derive(Debug, Clone, Copy, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Auto, Auto,
Specified(specified::Length), Specified(specified::Length),
@ -28,7 +29,8 @@
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<Au>); pub struct T(pub Option<Au>);
} }
@ -72,7 +74,8 @@
use cssparser::ToCss; use cssparser::ToCss;
use std::fmt; use std::fmt;
#[derive(Debug, Clone, Copy, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Auto, Auto,
Specified(u32), Specified(u32),
@ -88,7 +91,8 @@
} }
pub mod computed_value { pub mod computed_value {
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<u32>); pub struct T(pub Option<u32>);
} }
@ -138,7 +142,8 @@
use std::fmt; use std::fmt;
use values::AuExtensionMethods; use values::AuExtensionMethods;
#[derive(Debug, Clone, Copy, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Normal, Normal,
Specified(specified::Length), Specified(specified::Length),
@ -155,7 +160,8 @@
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<Au>); pub struct T(pub Option<Au>);
} }

View file

@ -24,7 +24,8 @@
use cssparser::{self, ToCss}; use cssparser::{self, ToCss};
use std::fmt; use std::fmt;
#[derive(Debug, PartialEq, Eq, Clone, HeapSizeOf)] #[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum ContentItem { pub enum ContentItem {
/// Literal string content. /// Literal string content.
String(String), String(String),
@ -73,7 +74,8 @@
} }
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Debug, PartialEq, Eq, Clone, HeapSizeOf)] #[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum T { pub enum T {
normal, normal,
none, none,
@ -180,7 +182,8 @@
pub use self::computed_value::T as SpecifiedValue; pub use self::computed_value::T as SpecifiedValue;
pub mod computed_value { pub mod computed_value {
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Vec<(String,i32)>); pub struct T(pub Vec<(String,i32)>);
} }

View file

@ -16,10 +16,12 @@ ${helpers.predefined_type("opacity",
use std::fmt; use std::fmt;
use values::AuExtensionMethods; use values::AuExtensionMethods;
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(Vec<SpecifiedBoxShadow>); pub struct SpecifiedValue(Vec<SpecifiedBoxShadow>);
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedBoxShadow { pub struct SpecifiedBoxShadow {
pub offset_x: specified::Length, pub offset_x: specified::Length,
pub offset_y: specified::Length, pub offset_y: specified::Length,
@ -72,10 +74,12 @@ ${helpers.predefined_type("opacity",
use std::fmt; use std::fmt;
use values::computed; use values::computed;
#[derive(Clone, PartialEq, HeapSizeOf, Debug)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Vec<BoxShadow>); pub struct T(pub Vec<BoxShadow>);
#[derive(Clone, PartialEq, Copy, HeapSizeOf, Debug)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct BoxShadow { pub struct BoxShadow {
pub offset_x: Au, pub offset_x: Au,
pub offset_y: Au, pub offset_y: Au,
@ -229,7 +233,8 @@ ${helpers.predefined_type("opacity",
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;
#[derive(Clone, PartialEq, Eq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Eq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ClipRect { pub struct ClipRect {
pub top: Au, pub top: Au,
pub right: Option<Au>, pub right: Option<Au>,
@ -237,7 +242,8 @@ ${helpers.predefined_type("opacity",
pub left: Au, pub left: Au,
} }
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<ClipRect>); pub struct T(pub Option<ClipRect>);
} }
@ -271,7 +277,8 @@ ${helpers.predefined_type("opacity",
} }
} }
#[derive(Clone, Debug, PartialEq, Copy, HeapSizeOf)] #[derive(Clone, Debug, PartialEq, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedClipRect { pub struct SpecifiedClipRect {
pub top: specified::Length, pub top: specified::Length,
pub right: Option<specified::Length>, pub right: Option<specified::Length>,
@ -279,7 +286,8 @@ ${helpers.predefined_type("opacity",
pub left: specified::Length, pub left: specified::Length,
} }
#[derive(Clone, Debug, PartialEq, Copy, HeapSizeOf)] #[derive(Clone, Debug, PartialEq, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(Option<SpecifiedClipRect>); pub struct SpecifiedValue(Option<SpecifiedClipRect>);
impl ToCss for SpecifiedClipRect { impl ToCss for SpecifiedClipRect {
@ -394,11 +402,13 @@ ${helpers.predefined_type("opacity",
use values::CSSFloat; use values::CSSFloat;
use values::specified::{Angle, Length}; use values::specified::{Angle, Length};
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(Vec<SpecifiedFilter>); pub struct SpecifiedValue(Vec<SpecifiedFilter>);
// TODO(pcwalton): `drop-shadow` // TODO(pcwalton): `drop-shadow`
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedFilter { pub enum SpecifiedFilter {
Blur(Length), Blur(Length),
Brightness(CSSFloat), Brightness(CSSFloat),
@ -416,7 +426,8 @@ ${helpers.predefined_type("opacity",
use values::CSSFloat; use values::CSSFloat;
use values::specified::{Angle}; use values::specified::{Angle};
#[derive(Clone, PartialEq, Debug, HeapSizeOf, Deserialize, Serialize)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub enum Filter { pub enum Filter {
Blur(Au), Blur(Au),
Brightness(CSSFloat), Brightness(CSSFloat),
@ -429,7 +440,8 @@ ${helpers.predefined_type("opacity",
Sepia(CSSFloat), Sepia(CSSFloat),
} }
#[derive(Clone, PartialEq, Debug, HeapSizeOf, Deserialize, Serialize)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub struct T { pub filters: Vec<Filter> } pub struct T { pub filters: Vec<Filter> }
impl T { impl T {
@ -629,7 +641,8 @@ ${helpers.predefined_type("opacity",
use values::CSSFloat; use values::CSSFloat;
use values::computed; use values::computed;
#[derive(Clone, Copy, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ComputedMatrix { pub struct ComputedMatrix {
pub m11: CSSFloat, pub m12: CSSFloat, pub m13: CSSFloat, pub m14: CSSFloat, pub m11: CSSFloat, pub m12: CSSFloat, pub m13: CSSFloat, pub m14: CSSFloat,
pub m21: CSSFloat, pub m22: CSSFloat, pub m23: CSSFloat, pub m24: CSSFloat, pub m21: CSSFloat, pub m22: CSSFloat, pub m23: CSSFloat, pub m24: CSSFloat,
@ -648,7 +661,8 @@ ${helpers.predefined_type("opacity",
} }
} }
#[derive(Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum ComputedOperation { pub enum ComputedOperation {
Matrix(ComputedMatrix), Matrix(ComputedMatrix),
Skew(computed::Angle, computed::Angle), Skew(computed::Angle, computed::Angle),
@ -660,7 +674,8 @@ ${helpers.predefined_type("opacity",
Perspective(computed::Length), Perspective(computed::Length),
} }
#[derive(Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<Vec<ComputedOperation>>); pub struct T(pub Option<Vec<ComputedOperation>>);
} }
@ -695,7 +710,8 @@ ${helpers.predefined_type("opacity",
Ok((first, second)) Ok((first, second))
} }
#[derive(Copy, Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
enum TranslateKind { enum TranslateKind {
Translate, Translate,
TranslateX, TranslateX,
@ -704,7 +720,8 @@ ${helpers.predefined_type("opacity",
Translate3D, Translate3D,
} }
#[derive(Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
enum SpecifiedOperation { enum SpecifiedOperation {
Matrix(SpecifiedMatrix), Matrix(SpecifiedMatrix),
Skew(specified::Angle, specified::Angle), Skew(specified::Angle, specified::Angle),
@ -783,7 +800,8 @@ ${helpers.predefined_type("opacity",
} }
} }
#[derive(Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(Vec<SpecifiedOperation>); pub struct SpecifiedValue(Vec<SpecifiedOperation>);
impl ToCss for SpecifiedValue { impl ToCss for SpecifiedValue {
@ -1173,7 +1191,8 @@ ${helpers.single_keyword("transform-style", "auto flat preserve-3d")}
pub mod computed_value { pub mod computed_value {
use values::computed::{Length, LengthOrPercentage}; use values::computed::{Length, LengthOrPercentage};
#[derive(Clone, Copy, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T { pub struct T {
pub horizontal: LengthOrPercentage, pub horizontal: LengthOrPercentage,
pub vertical: LengthOrPercentage, pub vertical: LengthOrPercentage,
@ -1181,7 +1200,8 @@ ${helpers.single_keyword("transform-style", "auto flat preserve-3d")}
} }
} }
#[derive(Clone, Copy, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue { pub struct SpecifiedValue {
horizontal: LengthOrPercentage, horizontal: LengthOrPercentage,
vertical: LengthOrPercentage, vertical: LengthOrPercentage,
@ -1253,7 +1273,8 @@ ${helpers.predefined_type("perspective",
pub mod computed_value { pub mod computed_value {
use values::computed::LengthOrPercentage; use values::computed::LengthOrPercentage;
#[derive(Clone, Copy, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T { pub struct T {
pub horizontal: LengthOrPercentage, pub horizontal: LengthOrPercentage,
pub vertical: LengthOrPercentage, pub vertical: LengthOrPercentage,
@ -1268,7 +1289,8 @@ ${helpers.predefined_type("perspective",
} }
} }
#[derive(Clone, Copy, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue { pub struct SpecifiedValue {
horizontal: LengthOrPercentage, horizontal: LengthOrPercentage,
vertical: LengthOrPercentage, vertical: LengthOrPercentage,

View file

@ -19,7 +19,8 @@
use std::fmt; use std::fmt;
use string_cache::Atom; use string_cache::Atom;
#[derive(Debug, PartialEq, Eq, Clone, Hash, HeapSizeOf, Deserialize, Serialize)] #[derive(Debug, PartialEq, Eq, Clone, Hash)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub enum FontFamily { pub enum FontFamily {
FamilyName(Atom), FamilyName(Atom),
Generic(Atom), Generic(Atom),
@ -73,7 +74,8 @@
Ok(()) Ok(())
} }
} }
#[derive(Debug, Clone, PartialEq, Eq, Hash, HeapSizeOf)] #[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Vec<FontFamily>); pub struct T(pub Vec<FontFamily>);
} }
@ -122,7 +124,8 @@ ${helpers.single_keyword("font-variant", "normal small-caps")}
use cssparser::ToCss; use cssparser::ToCss;
use std::fmt; use std::fmt;
#[derive(Debug, Clone, PartialEq, Eq, Copy, HeapSizeOf)] #[derive(Debug, Clone, PartialEq, Eq, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Bolder, Bolder,
Lighter, Lighter,
@ -169,7 +172,8 @@ ${helpers.single_keyword("font-variant", "normal small-caps")}
} }
pub mod computed_value { pub mod computed_value {
use std::fmt; use std::fmt;
#[derive(PartialEq, Eq, Copy, Clone, Hash, Deserialize, Serialize, HeapSizeOf, Debug)] #[derive(PartialEq, Eq, Copy, Clone, Hash, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[repr(u16)] #[repr(u16)]
pub enum T { pub enum T {
% for weight in range(100, 901, 100): % for weight in range(100, 901, 100):
@ -250,7 +254,8 @@ ${helpers.single_keyword("font-variant", "normal small-caps")}
} }
} }
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(pub specified::LengthOrPercentage); pub struct SpecifiedValue(pub specified::LengthOrPercentage);
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;

View file

@ -40,7 +40,8 @@ ${helpers.single_keyword("color-adjust", "economy exact", products="gecko")}
use cssparser::ToCss; use cssparser::ToCss;
use std::fmt; use std::fmt;
#[derive(Copy, Clone, Debug, PartialEq, HeapSizeOf, Deserialize, Serialize)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub enum T { pub enum T {
Auto, Auto,
CrispEdges, CrispEdges,
@ -96,7 +97,8 @@ ${helpers.single_keyword("color-adjust", "economy exact", products="gecko")}
use std::fmt; use std::fmt;
use values::computed::ComputedValueAsSpecified; use values::computed::ComputedValueAsSpecified;
#[derive(Copy, Clone, Debug, Eq, PartialEq, HeapSizeOf, Serialize, Deserialize)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub struct SpecifiedValue(pub bool); pub struct SpecifiedValue(pub bool);
pub mod computed_value { pub mod computed_value {

View file

@ -20,14 +20,16 @@ ${helpers.single_keyword("caption-side", "top bottom", extra_gecko_values="right
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;
#[derive(Clone, Copy, Debug, PartialEq, RustcEncodable, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq, RustcEncodable)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T { pub struct T {
pub horizontal: Au, pub horizontal: Au,
pub vertical: Au, pub vertical: Au,
} }
} }
#[derive(Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue { pub struct SpecifiedValue {
pub horizontal: specified::Length, pub horizontal: specified::Length,
pub vertical: specified::Length, pub vertical: specified::Length,

View file

@ -12,7 +12,8 @@
use values::AuExtensionMethods; use values::AuExtensionMethods;
use values::CSSFloat; use values::CSSFloat;
#[derive(Debug, Clone, PartialEq, Copy, HeapSizeOf)] #[derive(Debug, Clone, PartialEq, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Normal, Normal,
% if product == "gecko": % if product == "gecko":
@ -61,7 +62,8 @@
use app_units::Au; use app_units::Au;
use std::fmt; use std::fmt;
use values::CSSFloat; use values::CSSFloat;
#[derive(PartialEq, Copy, Clone, HeapSizeOf, Debug)] #[derive(PartialEq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum T { pub enum T {
Normal, Normal,
% if product == "gecko": % if product == "gecko":
@ -182,7 +184,8 @@
use std::fmt; use std::fmt;
use values::AuExtensionMethods; use values::AuExtensionMethods;
#[derive(Debug, Clone, Copy, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Normal, Normal,
Specified(specified::Length), Specified(specified::Length),
@ -199,7 +202,8 @@
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<Au>); pub struct T(pub Option<Au>);
} }
@ -244,7 +248,8 @@
use std::fmt; use std::fmt;
use values::AuExtensionMethods; use values::AuExtensionMethods;
#[derive(Debug, Clone, Copy, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
Normal, Normal,
Specified(specified::Length), // FIXME(SimonSapin) support percentages Specified(specified::Length), // FIXME(SimonSapin) support percentages
@ -261,7 +266,8 @@
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<Au>); pub struct T(pub Option<Au>);
} }
@ -332,7 +338,8 @@ ${helpers.single_keyword("text-justify",
impl ComputedValueAsSpecified for SpecifiedValue {} impl ComputedValueAsSpecified for SpecifiedValue {}
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue { pub struct SpecifiedValue {
pub underline: Option<RGBA>, pub underline: Option<RGBA>,
pub overline: Option<RGBA>, pub overline: Option<RGBA>,
@ -446,10 +453,12 @@ ${helpers.single_keyword("text-justify",
use std::fmt; use std::fmt;
use values::AuExtensionMethods; use values::AuExtensionMethods;
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(Vec<SpecifiedTextShadow>); pub struct SpecifiedValue(Vec<SpecifiedTextShadow>);
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedTextShadow { pub struct SpecifiedTextShadow {
pub offset_x: specified::Length, pub offset_x: specified::Length,
pub offset_y: specified::Length, pub offset_y: specified::Length,
@ -461,10 +470,12 @@ ${helpers.single_keyword("text-justify",
use app_units::Au; use app_units::Au;
use cssparser::Color; use cssparser::Color;
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Vec<TextShadow>); pub struct T(pub Vec<TextShadow>);
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct TextShadow { pub struct TextShadow {
pub offset_x: Au, pub offset_x: Au,
pub offset_y: Au, pub offset_y: Au,

View file

@ -31,7 +31,8 @@ ${helpers.single_keyword("list-style-type", """
use url::Url; use url::Url;
use values::LocalToCss; use values::LocalToCss;
#[derive(Debug, Clone, PartialEq, Eq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum SpecifiedValue { pub enum SpecifiedValue {
None, None,
Url(Url), Url(Url),
@ -52,7 +53,8 @@ ${helpers.single_keyword("list-style-type", """
use url::Url; use url::Url;
use values::LocalToCss; use values::LocalToCss;
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Option<Url>); pub struct T(pub Option<Url>);
impl ToCss for T { impl ToCss for T {
@ -100,7 +102,8 @@ ${helpers.single_keyword("list-style-type", """
pub use self::computed_value::T as SpecifiedValue; pub use self::computed_value::T as SpecifiedValue;
pub mod computed_value { pub mod computed_value {
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct T(pub Vec<(String,String)>); pub struct T(pub Vec<(String,String)>);
} }

View file

@ -41,7 +41,8 @@ ${helpers.predefined_type("outline-color", "CSSColor", "::cssparser::Color::Curr
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> { pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
specified::parse_border_width(input).map(SpecifiedValue) specified::parse_border_width(input).map(SpecifiedValue)
} }
#[derive(Debug, Clone, PartialEq, HeapSizeOf)] #[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue(pub specified::Length); pub struct SpecifiedValue(pub specified::Length);
pub mod computed_value { pub mod computed_value {
use app_units::Au; use app_units::Au;

View file

@ -17,7 +17,8 @@
use std::fmt; use std::fmt;
use style_traits::cursor::Cursor; use style_traits::cursor::Cursor;
#[derive(Clone, PartialEq, Eq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Eq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum T { pub enum T {
AutoCursor, AutoCursor,
SpecifiedCursor(Cursor), SpecifiedCursor(Cursor),

View file

@ -20,7 +20,8 @@
use cssparser::ToCss; use cssparser::ToCss;
use std::fmt; use std::fmt;
#[derive(PartialEq, Clone, Eq, Copy, Debug, HeapSizeOf)] #[derive(PartialEq, Clone, Eq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum T { pub enum T {
Auto, Auto,
Number(i32), Number(i32),

View file

@ -24,7 +24,8 @@ ${helpers.single_keyword("unicode-bidi", "normal embed isolate bidi-override iso
impl ComputedValueAsSpecified for SpecifiedValue {} impl ComputedValueAsSpecified for SpecifiedValue {}
#[derive(PartialEq, Eq, Copy, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Eq, Copy, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct SpecifiedValue { pub struct SpecifiedValue {
pub underline: bool, pub underline: bool,
pub overline: bool, pub overline: bool,

View file

@ -25,7 +25,7 @@ use cssparser::{Parser, RGBA, AtRuleParser, DeclarationParser, Delimiter,
DeclarationListParser, parse_important, ToCss, TokenSerializationType}; DeclarationListParser, parse_important, ToCss, TokenSerializationType};
use error_reporting::ParseErrorReporter; use error_reporting::ParseErrorReporter;
use url::Url; use url::Url;
use euclid::SideOffsets2D; use euclid::side_offsets::SideOffsets2D;
use euclid::size::Size2D; use euclid::size::Size2D;
use string_cache::Atom; use string_cache::Atom;
use computed_values; use computed_values;
@ -261,11 +261,12 @@ use std::slice;
/// Overridden declarations are skipped. /// Overridden declarations are skipped.
// FIXME (https://github.com/servo/servo/issues/3426) // FIXME (https://github.com/servo/servo/issues/3426)
#[derive(Debug, PartialEq, HeapSizeOf)] #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct PropertyDeclarationBlock { pub struct PropertyDeclarationBlock {
#[ignore_heap_size_of = "#7038"] #[cfg_attr(feature = "servo", ignore_heap_size_of = "#7038")]
pub important: Arc<Vec<PropertyDeclaration>>, pub important: Arc<Vec<PropertyDeclaration>>,
#[ignore_heap_size_of = "#7038"] #[cfg_attr(feature = "servo", ignore_heap_size_of = "#7038")]
pub normal: Arc<Vec<PropertyDeclaration>>, pub normal: Arc<Vec<PropertyDeclaration>>,
} }
@ -616,7 +617,8 @@ impl CSSWideKeyword {
} }
} }
#[derive(Clone, Copy, Eq, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, Copy, Eq, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Shorthand { pub enum Shorthand {
% for property in data.shorthands: % for property in data.shorthands:
${property.camel_case}, ${property.camel_case},
@ -722,7 +724,8 @@ impl Shorthand {
} }
} }
#[derive(Clone, PartialEq, Eq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum DeclaredValue<T> { pub enum DeclaredValue<T> {
Value(T), Value(T),
WithVariables { WithVariables {
@ -753,7 +756,8 @@ impl<T: ToCss> ToCss for DeclaredValue<T> {
} }
} }
#[derive(PartialEq, Clone, Debug, HeapSizeOf)] #[derive(PartialEq, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum PropertyDeclaration { pub enum PropertyDeclaration {
% for property in data.longhands: % for property in data.longhands:
${property.camel_case}(DeclaredValue<longhands::${property.ident}::SpecifiedValue>), ${property.camel_case}(DeclaredValue<longhands::${property.ident}::SpecifiedValue>),
@ -1064,9 +1068,11 @@ pub mod style_structs {
% for style_struct in data.active_style_structs(): % for style_struct in data.active_style_structs():
% if style_struct.trait_name == "Font": % if style_struct.trait_name == "Font":
#[derive(Clone, HeapSizeOf, Debug)] #[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
% else: % else:
#[derive(PartialEq, Clone, HeapSizeOf)] #[derive(PartialEq, Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
% endif % endif
pub struct ${style_struct.servo_struct_name} { pub struct ${style_struct.servo_struct_name} {
% for longhand in style_struct.longhands: % for longhand in style_struct.longhands:
@ -1233,7 +1239,8 @@ pub trait ComputedValues : Clone + Send + Sync + 'static {
fn is_multicol(&self) -> bool; fn is_multicol(&self) -> bool;
} }
#[derive(Clone, HeapSizeOf)] #[derive(Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ServoComputedValues { pub struct ServoComputedValues {
% for style_struct in data.active_style_structs(): % for style_struct in data.active_style_structs():
${style_struct.ident}: Arc<style_structs::${style_struct.servo_struct_name}>, ${style_struct.ident}: Arc<style_structs::${style_struct.servo_struct_name}>,
@ -1692,7 +1699,7 @@ pub fn make_cascade_vec<C: ComputedValues>() -> Vec<Option<CascadePropertyFn<C>>
% for property in style_struct.longhands: % for property in style_struct.longhands:
let discriminant; let discriminant;
unsafe { unsafe {
let variant = PropertyDeclaration::${property.camel_case}(intrinsics::uninit()); let variant = PropertyDeclaration::${property.camel_case}(mem::uninitialized());
discriminant = intrinsics::discriminant_value(&variant) as usize; discriminant = intrinsics::discriminant_value(&variant) as usize;
mem::forget(variant); mem::forget(variant);
} }

View file

@ -50,7 +50,8 @@ bitflags! {
/// now to reduce complexity, but it's worth measuring the performance impact (if any) of the /// now to reduce complexity, but it's worth measuring the performance impact (if any) of the
/// mStateMask approach. /// mStateMask approach.
#[derive(HeapSizeOf, Clone)] #[derive(Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ElementSnapshot { pub struct ElementSnapshot {
pub state: Option<ElementState>, pub state: Option<ElementState>,
pub attrs: Option<Vec<(AttrIdentifier, AttrValue)>>, pub attrs: Option<Vec<(AttrIdentifier, AttrValue)>>,
@ -225,7 +226,8 @@ fn combinator_to_restyle_hint(combinator: Option<Combinator>) -> RestyleHint {
} }
} }
#[derive(Debug, HeapSizeOf)] #[derive(Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
struct Sensitivities { struct Sensitivities {
pub states: ElementState, pub states: ElementState,
pub attrs: bool, pub attrs: bool,
@ -262,14 +264,16 @@ impl Sensitivities {
// us to quickly scan through the dependency sites of all style rules and determine the // us to quickly scan through the dependency sites of all style rules and determine the
// maximum effect that a given state or attribute change may have on the style of // maximum effect that a given state or attribute change may have on the style of
// elements in the document. // elements in the document.
#[derive(Debug, HeapSizeOf)] #[derive(Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
struct Dependency<Impl: SelectorImplExt> { struct Dependency<Impl: SelectorImplExt> {
selector: Arc<CompoundSelector<Impl>>, selector: Arc<CompoundSelector<Impl>>,
combinator: Option<Combinator>, combinator: Option<Combinator>,
sensitivities: Sensitivities, sensitivities: Sensitivities,
} }
#[derive(Debug, HeapSizeOf)] #[derive(Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct DependencySet<Impl: SelectorImplExt> { pub struct DependencySet<Impl: SelectorImplExt> {
deps: Vec<Dependency<Impl>>, deps: Vec<Dependency<Impl>>,
} }

View file

@ -95,7 +95,8 @@ pub trait SelectorImplExt : SelectorImpl + Sized {
fn get_quirks_mode_stylesheet() -> Option<&'static Stylesheet<Self>>; fn get_quirks_mode_stylesheet() -> Option<&'static Stylesheet<Self>>;
} }
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum PseudoElement { pub enum PseudoElement {
Before, Before,
After, After,
@ -117,7 +118,8 @@ impl PseudoElement {
} }
} }
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum NonTSPseudoClass { pub enum NonTSPseudoClass {
AnyLink, AnyLink,
Link, Link,
@ -158,7 +160,8 @@ impl NonTSPseudoClass {
} }
} }
#[derive(Clone, Debug, PartialEq, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ServoSelectorImpl; pub struct ServoSelectorImpl;
impl SelectorImpl for ServoSelectorImpl { impl SelectorImpl for ServoSelectorImpl {

View file

@ -44,7 +44,7 @@ lazy_static! {
None, None,
None, None,
Origin::UserAgent, Origin::UserAgent,
box StdoutErrorReporter, Box::new(StdoutErrorReporter),
ParserContextExtraData::default()); ParserContextExtraData::default());
stylesheets.push(ua_stylesheet); stylesheets.push(ua_stylesheet);
} }
@ -56,7 +56,7 @@ lazy_static! {
} }
for &(ref contents, ref url) in &opts::get().user_stylesheets { for &(ref contents, ref url) in &opts::get().user_stylesheets {
stylesheets.push(Stylesheet::from_bytes( stylesheets.push(Stylesheet::from_bytes(
&contents, url.clone(), None, None, Origin::User, box StdoutErrorReporter, &contents, url.clone(), None, None, Origin::User, Box::new(StdoutErrorReporter),
ParserContextExtraData::default())); ParserContextExtraData::default()));
} }
stylesheets stylesheets
@ -73,7 +73,7 @@ lazy_static! {
None, None,
None, None,
Origin::UserAgent, Origin::UserAgent,
box StdoutErrorReporter, Box::new(StdoutErrorReporter),
ParserContextExtraData::default()) ParserContextExtraData::default())
}, },
Err(..) => { Err(..) => {
@ -100,7 +100,7 @@ lazy_static! {
/// `ServoSelectorImpl`, the implementation used by Servo's layout system in /// `ServoSelectorImpl`, the implementation used by Servo's layout system in
/// regular builds, or `GeckoSelectorImpl`, the implementation used in the /// regular builds, or `GeckoSelectorImpl`, the implementation used in the
/// geckolib port. /// geckolib port.
#[derive(HeapSizeOf)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct Stylist<Impl: SelectorImplExt> { pub struct Stylist<Impl: SelectorImplExt> {
/// Device that the stylist is currently evaluating against. /// Device that the stylist is currently evaluating against.
pub device: Device, pub device: Device,
@ -269,7 +269,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
properties::cascade(self.device.au_viewport_size(), properties::cascade(self.device.au_viewport_size(),
&declarations, false, &declarations, false,
parent.map(|p| &**p), None, parent.map(|p| &**p), None,
box StdoutErrorReporter); Box::new(StdoutErrorReporter));
Some(Arc::new(computed)) Some(Arc::new(computed))
} else { } else {
parent.map(|p| p.clone()) parent.map(|p| p.clone())
@ -302,7 +302,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
properties::cascade(self.device.au_viewport_size(), properties::cascade(self.device.au_viewport_size(),
&declarations, false, &declarations, false,
Some(&**parent), None, Some(&**parent), None,
box StdoutErrorReporter); Box::new(StdoutErrorReporter));
Some(Arc::new(computed)) Some(Arc::new(computed))
} }
@ -438,7 +438,7 @@ impl<Impl: SelectorImplExt> Stylist<Impl> {
} }
/// Map that contains the CSS rules for a given origin. /// Map that contains the CSS rules for a given origin.
#[derive(HeapSizeOf)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
struct PerOriginSelectorMap<Impl: SelectorImpl> { struct PerOriginSelectorMap<Impl: SelectorImpl> {
/// Rules that contains at least one property declararion with /// Rules that contains at least one property declararion with
/// normal importance. /// normal importance.
@ -460,7 +460,7 @@ impl<Impl: SelectorImpl> PerOriginSelectorMap<Impl> {
/// Map that contains the CSS rules for a specific PseudoElement /// Map that contains the CSS rules for a specific PseudoElement
/// (or lack of PseudoElement). /// (or lack of PseudoElement).
#[derive(HeapSizeOf)] #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
struct PerPseudoElementSelectorMap<Impl: SelectorImpl> { struct PerPseudoElementSelectorMap<Impl: SelectorImpl> {
/// Rules from user agent stylesheets /// Rules from user agent stylesheets
user_agent: PerOriginSelectorMap<Impl>, user_agent: PerOriginSelectorMap<Impl>,

View file

@ -24,7 +24,8 @@ use viewport::ViewportRule;
/// Each style rule has an origin, which determines where it enters the cascade. /// Each style rule has an origin, which determines where it enters the cascade.
/// ///
/// http://dev.w3.org/csswg/css-cascade/#cascading-origins /// http://dev.w3.org/csswg/css-cascade/#cascading-origins
#[derive(Clone, PartialEq, Eq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Eq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Origin { pub enum Origin {
/// http://dev.w3.org/csswg/css-cascade/#cascade-origin-ua /// http://dev.w3.org/csswg/css-cascade/#cascade-origin-ua
UserAgent, UserAgent,
@ -37,7 +38,8 @@ pub enum Origin {
} }
#[derive(Debug, HeapSizeOf, PartialEq)] #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct Stylesheet<Impl: SelectorImpl> { pub struct Stylesheet<Impl: SelectorImpl> {
/// List of rules in the order they were found (important for /// List of rules in the order they were found (important for
/// cascading order) /// cascading order)
@ -49,7 +51,8 @@ pub struct Stylesheet<Impl: SelectorImpl> {
} }
#[derive(Debug, HeapSizeOf, PartialEq)] #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum CSSRule<Impl: SelectorImpl> { pub enum CSSRule<Impl: SelectorImpl> {
Charset(String), Charset(String),
Namespace(Option<String>, Namespace), Namespace(Option<String>, Namespace),
@ -59,7 +62,8 @@ pub enum CSSRule<Impl: SelectorImpl> {
Viewport(ViewportRule), Viewport(ViewportRule),
} }
#[derive(Debug, HeapSizeOf, PartialEq)] #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct MediaRule<Impl: SelectorImpl> { pub struct MediaRule<Impl: SelectorImpl> {
pub media_queries: MediaQueryList, pub media_queries: MediaQueryList,
pub rules: Vec<CSSRule<Impl>>, pub rules: Vec<CSSRule<Impl>>,
@ -72,7 +76,8 @@ impl<Impl: SelectorImpl> MediaRule<Impl> {
} }
} }
#[derive(Debug, HeapSizeOf, PartialEq)] #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct StyleRule<Impl: SelectorImpl> { pub struct StyleRule<Impl: SelectorImpl> {
pub selectors: Vec<Selector<Impl>>, pub selectors: Vec<Selector<Impl>>,
pub declarations: PropertyDeclarationBlock, pub declarations: PropertyDeclarationBlock,

View file

@ -53,11 +53,11 @@ fn take_thread_local_bloom_filter<N, Impl: SelectorImplExt>(parent_node: Option<
// Root node. Needs new bloom filter. // Root node. Needs new bloom filter.
(None, _ ) => { (None, _ ) => {
debug!("[{}] No parent, but new bloom filter!", tid()); debug!("[{}] No parent, but new bloom filter!", tid());
box BloomFilter::new() Box::new(BloomFilter::new())
} }
// No bloom filter for this thread yet. // No bloom filter for this thread yet.
(Some(parent), None) => { (Some(parent), None) => {
let mut bloom_filter = box BloomFilter::new(); let mut bloom_filter = Box::new(BloomFilter::new());
insert_ancestors_into_bloom_filter(&mut bloom_filter, parent, root); insert_ancestors_into_bloom_filter(&mut bloom_filter, parent, root);
bloom_filter bloom_filter
} }

View file

@ -41,8 +41,8 @@ macro_rules! define_numbered_css_keyword_enum {
}; };
($name: ident: $( $css: expr => $variant: ident = $value: expr ),+) => { ($name: ident: $( $css: expr => $variant: ident = $value: expr ),+) => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Clone, Eq, PartialEq, PartialOrd, Ord, Copy, RustcEncodable, Debug, HeapSizeOf)] #[derive(Clone, Eq, PartialEq, PartialOrd, Ord, Copy, RustcEncodable, Debug)]
#[derive(Deserialize, Serialize)] #[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub enum $name { pub enum $name {
$( $variant = $value ),+ $( $variant = $value ),+
} }
@ -104,7 +104,8 @@ pub mod specified {
use super::{CSSFloat, FONT_MEDIUM_PX}; use super::{CSSFloat, FONT_MEDIUM_PX};
use url::Url; use url::Url;
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct CSSColor { pub struct CSSColor {
pub parsed: cssparser::Color, pub parsed: cssparser::Color,
pub authored: Option<String>, pub authored: Option<String>,
@ -133,7 +134,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct CSSRGBA { pub struct CSSRGBA {
pub parsed: cssparser::RGBA, pub parsed: cssparser::RGBA,
pub authored: Option<String>, pub authored: Option<String>,
@ -148,7 +150,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum FontRelativeLength { pub enum FontRelativeLength {
Em(CSSFloat), Em(CSSFloat),
Ex(CSSFloat), Ex(CSSFloat),
@ -185,7 +188,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum ViewportPercentageLength { pub enum ViewportPercentageLength {
Vw(CSSFloat), Vw(CSSFloat),
Vh(CSSFloat), Vh(CSSFloat),
@ -226,7 +230,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct CharacterWidth(pub i32); pub struct CharacterWidth(pub i32);
impl CharacterWidth { impl CharacterWidth {
@ -241,7 +246,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Length { pub enum Length {
Absolute(Au), // application units Absolute(Au), // application units
FontRelative(FontRelativeLength), FontRelative(FontRelativeLength),
@ -439,9 +445,9 @@ pub mod specified {
SimplifiedValueNode::Angle(Angle(a)) => SimplifiedValueNode::Angle(Angle(a * scalar)), SimplifiedValueNode::Angle(Angle(a)) => SimplifiedValueNode::Angle(Angle(a * scalar)),
SimplifiedValueNode::Time(Time(t)) => SimplifiedValueNode::Time(Time(t * scalar)), SimplifiedValueNode::Time(Time(t)) => SimplifiedValueNode::Time(Time(t * scalar)),
SimplifiedValueNode::Number(n) => SimplifiedValueNode::Number(n * scalar), SimplifiedValueNode::Number(n) => SimplifiedValueNode::Number(n * scalar),
SimplifiedValueNode::Sum(box ref s) => { SimplifiedValueNode::Sum(ref s) => {
let sum = s * scalar; let sum = &**s * scalar;
SimplifiedValueNode::Sum(box sum) SimplifiedValueNode::Sum(Box::new(sum))
} }
} }
} }
@ -507,7 +513,8 @@ pub mod specified {
Time, Time,
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct CalcLengthOrPercentage { pub struct CalcLengthOrPercentage {
pub absolute: Option<Au>, pub absolute: Option<Au>,
pub vw: Option<ViewportPercentageLength>, pub vw: Option<ViewportPercentageLength>,
@ -589,7 +596,7 @@ pub mod specified {
Ok(CalcValueNode::Percentage(value.unit_value)), Ok(CalcValueNode::Percentage(value.unit_value)),
(Token::ParenthesisBlock, _) => { (Token::ParenthesisBlock, _) => {
input.parse_nested_block(|i| CalcLengthOrPercentage::parse_sum(i, expected_unit)) input.parse_nested_block(|i| CalcLengthOrPercentage::parse_sum(i, expected_unit))
.map(|result| CalcValueNode::Sum(box result)) .map(|result| CalcValueNode::Sum(Box::new(result)))
}, },
_ => Err(()) _ => Err(())
} }
@ -598,7 +605,7 @@ pub mod specified {
fn simplify_value_to_number(node: &CalcValueNode) -> Option<CSSFloat> { fn simplify_value_to_number(node: &CalcValueNode) -> Option<CSSFloat> {
match *node { match *node {
CalcValueNode::Number(number) => Some(number), CalcValueNode::Number(number) => Some(number),
CalcValueNode::Sum(box ref sum) => CalcLengthOrPercentage::simplify_sum_to_number(sum), CalcValueNode::Sum(ref sum) => CalcLengthOrPercentage::simplify_sum_to_number(sum),
_ => None _ => None
} }
} }
@ -629,7 +636,7 @@ pub mod specified {
let mut simplified = Vec::new(); let mut simplified = Vec::new();
for product in &node.products { for product in &node.products {
match try!(CalcLengthOrPercentage::simplify_product(product)) { match try!(CalcLengthOrPercentage::simplify_product(product)) {
SimplifiedValueNode::Sum(box sum) => simplified.extend_from_slice(&sum.values), SimplifiedValueNode::Sum(ref sum) => simplified.extend_from_slice(&sum.values),
val => simplified.push(val), val => simplified.push(val),
} }
} }
@ -637,7 +644,7 @@ pub mod specified {
if simplified.len() == 1 { if simplified.len() == 1 {
Ok(simplified[0].clone()) Ok(simplified[0].clone())
} else { } else {
Ok(SimplifiedValueNode::Sum(box SimplifiedSumNode { values: simplified } )) Ok(SimplifiedValueNode::Sum(Box::new(SimplifiedSumNode { values: simplified })))
} }
} }
@ -649,7 +656,7 @@ pub mod specified {
Some(number) => multiplier *= number, Some(number) => multiplier *= number,
_ if node_with_unit.is_none() => { _ if node_with_unit.is_none() => {
node_with_unit = Some(match *node { node_with_unit = Some(match *node {
CalcValueNode::Sum(box ref sum) => CalcValueNode::Sum(ref sum) =>
try!(CalcLengthOrPercentage::simplify_products_in_sum(sum)), try!(CalcLengthOrPercentage::simplify_products_in_sum(sum)),
CalcValueNode::Length(l) => SimplifiedValueNode::Length(l), CalcValueNode::Length(l) => SimplifiedValueNode::Length(l),
CalcValueNode::Angle(a) => SimplifiedValueNode::Angle(a), CalcValueNode::Angle(a) => SimplifiedValueNode::Angle(a),
@ -855,7 +862,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct Percentage(pub CSSFloat); // [0 .. 100%] maps to [0.0 .. 1.0] pub struct Percentage(pub CSSFloat); // [0 .. 100%] maps to [0.0 .. 1.0]
impl ToCss for Percentage { impl ToCss for Percentage {
@ -864,7 +872,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentage { pub enum LengthOrPercentage {
Length(Length), Length(Length),
Percentage(Percentage), Percentage(Percentage),
@ -912,7 +921,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentageOrAuto { pub enum LengthOrPercentageOrAuto {
Length(Length), Length(Length),
Percentage(Percentage), Percentage(Percentage),
@ -961,7 +971,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentageOrNone { pub enum LengthOrPercentageOrNone {
Length(Length), Length(Length),
Percentage(Percentage), Percentage(Percentage),
@ -1009,7 +1020,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrNone { pub enum LengthOrNone {
Length(Length), Length(Length),
None, None,
@ -1049,7 +1061,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentageOrAutoOrContent { pub enum LengthOrPercentageOrAutoOrContent {
Length(Length), Length(Length),
Percentage(Percentage), Percentage(Percentage),
@ -1093,7 +1106,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct BorderRadiusSize(pub Size2D<LengthOrPercentage>); pub struct BorderRadiusSize(pub Size2D<LengthOrPercentage>);
impl BorderRadiusSize { impl BorderRadiusSize {
@ -1169,7 +1183,8 @@ pub mod specified {
} }
} }
#[derive(Clone, PartialEq, PartialOrd, Copy, Debug, HeapSizeOf, Deserialize, Serialize)] #[derive(Clone, PartialEq, PartialOrd, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
pub struct Angle(pub CSSFloat); pub struct Angle(pub CSSFloat);
impl ToCss for Angle { impl ToCss for Angle {
@ -1215,7 +1230,8 @@ pub mod specified {
} }
/// Specified values for an image according to CSS-IMAGES. /// Specified values for an image according to CSS-IMAGES.
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Image { pub enum Image {
Url(Url), Url(Url),
LinearGradient(LinearGradient), LinearGradient(LinearGradient),
@ -1250,7 +1266,8 @@ pub mod specified {
} }
/// Specified values for a CSS linear gradient. /// Specified values for a CSS linear gradient.
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct LinearGradient { pub struct LinearGradient {
/// The angle or corner of the gradient. /// The angle or corner of the gradient.
pub angle_or_corner: AngleOrCorner, pub angle_or_corner: AngleOrCorner,
@ -1273,7 +1290,8 @@ pub mod specified {
} }
/// Specified values for an angle or a corner in a linear gradient. /// Specified values for an angle or a corner in a linear gradient.
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum AngleOrCorner { pub enum AngleOrCorner {
Angle(Angle), Angle(Angle),
Corner(HorizontalDirection, VerticalDirection), Corner(HorizontalDirection, VerticalDirection),
@ -1295,7 +1313,8 @@ pub mod specified {
} }
/// Specified values for one color stop in a linear gradient. /// Specified values for one color stop in a linear gradient.
#[derive(Clone, PartialEq, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ColorStop { pub struct ColorStop {
/// The color of this stop. /// The color of this stop.
pub color: CSSColor, pub color: CSSColor,
@ -1424,7 +1443,8 @@ pub mod specified {
} }
/// A time in seconds according to CSS-VALUES § 6.2. /// A time in seconds according to CSS-VALUES § 6.2.
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct Time(pub CSSFloat); pub struct Time(pub CSSFloat);
impl Time { impl Time {
@ -1473,7 +1493,8 @@ pub mod specified {
} }
} }
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct Number(pub CSSFloat); pub struct Number(pub CSSFloat);
impl Number { impl Number {
@ -1510,7 +1531,8 @@ pub mod specified {
} }
} }
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, HeapSizeOf)] #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct Opacity(pub CSSFloat); pub struct Opacity(pub CSSFloat);
impl Opacity { impl Opacity {
@ -1630,7 +1652,8 @@ pub mod computed {
} }
} }
#[derive(Clone, PartialEq, Copy, Debug, HeapSizeOf)] #[derive(Clone, PartialEq, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct CalcLengthOrPercentage { pub struct CalcLengthOrPercentage {
pub length: Option<Au>, pub length: Option<Au>,
pub percentage: Option<CSSFloat>, pub percentage: Option<CSSFloat>,
@ -1734,7 +1757,8 @@ pub mod computed {
} }
#[derive(PartialEq, Clone, Copy, HeapSizeOf)] #[derive(PartialEq, Clone, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct BorderRadiusSize(pub Size2D<LengthOrPercentage>); pub struct BorderRadiusSize(pub Size2D<LengthOrPercentage>);
impl BorderRadiusSize { impl BorderRadiusSize {
@ -1762,7 +1786,8 @@ pub mod computed {
} }
} }
#[derive(PartialEq, Clone, Copy, HeapSizeOf)] #[derive(PartialEq, Clone, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentage { pub enum LengthOrPercentage {
Length(Au), Length(Au),
Percentage(CSSFloat), Percentage(CSSFloat),
@ -1827,7 +1852,8 @@ pub mod computed {
} }
} }
#[derive(PartialEq, Clone, Copy, HeapSizeOf)] #[derive(PartialEq, Clone, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentageOrAuto { pub enum LengthOrPercentageOrAuto {
Length(Au), Length(Au),
Percentage(CSSFloat), Percentage(CSSFloat),
@ -1894,7 +1920,8 @@ pub mod computed {
} }
} }
#[derive(PartialEq, Clone, Copy, HeapSizeOf)] #[derive(PartialEq, Clone, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentageOrAutoOrContent { pub enum LengthOrPercentageOrAutoOrContent {
Length(Au), Length(Au),
Percentage(CSSFloat), Percentage(CSSFloat),
@ -1952,7 +1979,8 @@ pub mod computed {
} }
} }
#[derive(PartialEq, Clone, Copy, HeapSizeOf)] #[derive(PartialEq, Clone, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrPercentageOrNone { pub enum LengthOrPercentageOrNone {
Length(Au), Length(Au),
Percentage(CSSFloat), Percentage(CSSFloat),
@ -2004,7 +2032,8 @@ pub mod computed {
} }
} }
#[derive(PartialEq, Clone, Copy, HeapSizeOf)] #[derive(PartialEq, Clone, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum LengthOrNone { pub enum LengthOrNone {
Length(Au), Length(Au),
None, None,
@ -2062,7 +2091,8 @@ pub mod computed {
/// Computed values for an image according to CSS-IMAGES. /// Computed values for an image according to CSS-IMAGES.
#[derive(Clone, PartialEq, HeapSizeOf)] #[derive(Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Image { pub enum Image {
Url(Url), Url(Url),
LinearGradient(LinearGradient), LinearGradient(LinearGradient),
@ -2078,7 +2108,8 @@ pub mod computed {
} }
/// Computed values for a CSS linear gradient. /// Computed values for a CSS linear gradient.
#[derive(Clone, PartialEq, HeapSizeOf)] #[derive(Clone, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct LinearGradient { pub struct LinearGradient {
/// The angle or corner of the gradient. /// The angle or corner of the gradient.
pub angle_or_corner: AngleOrCorner, pub angle_or_corner: AngleOrCorner,
@ -2111,7 +2142,8 @@ pub mod computed {
} }
/// Computed values for one color stop in a linear gradient. /// Computed values for one color stop in a linear gradient.
#[derive(Clone, PartialEq, Copy, HeapSizeOf)] #[derive(Clone, PartialEq, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ColorStop { pub struct ColorStop {
/// The color of this stop. /// The color of this stop.
pub color: CSSColor, pub color: CSSColor,

View file

@ -21,7 +21,8 @@ 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};
#[derive(Copy, Clone, Debug, HeapSizeOf, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum ViewportDescriptor { pub enum ViewportDescriptor {
MinWidth(ViewportLength), MinWidth(ViewportLength),
MaxWidth(ViewportLength), MaxWidth(ViewportLength),
@ -45,7 +46,8 @@ trait FromMeta: Sized {
// See: // See:
// * http://dev.w3.org/csswg/css-device-adapt/#min-max-width-desc // * http://dev.w3.org/csswg/css-device-adapt/#min-max-width-desc
// * http://dev.w3.org/csswg/css-device-adapt/#extend-to-zoom // * http://dev.w3.org/csswg/css-device-adapt/#extend-to-zoom
#[derive(Copy, Clone, Debug, HeapSizeOf, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum ViewportLength { pub enum ViewportLength {
Specified(LengthOrPercentageOrAuto), Specified(LengthOrPercentageOrAuto),
ExtendToZoom ExtendToZoom
@ -133,7 +135,8 @@ struct ViewportRuleParser<'a, 'b: 'a> {
context: &'a ParserContext<'b> context: &'a ParserContext<'b>
} }
#[derive(Copy, Clone, Debug, HeapSizeOf, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ViewportDescriptorDeclaration { pub struct ViewportDescriptorDeclaration {
pub origin: Origin, pub origin: Origin,
pub descriptor: ViewportDescriptor, pub descriptor: ViewportDescriptor,
@ -228,7 +231,8 @@ impl<'a, 'b> DeclarationParser for ViewportRuleParser<'a, 'b> {
} }
} }
#[derive(Debug, HeapSizeOf, PartialEq)] #[derive(Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub struct ViewportRule { pub struct ViewportRule {
pub declarations: Vec<ViewportDescriptorDeclaration> pub declarations: Vec<ViewportDescriptorDeclaration>
} }

View file

@ -8,13 +8,16 @@ publish = false
name = "style_traits" name = "style_traits"
path = "lib.rs" path = "lib.rs"
[features]
servo = ["heapsize", "heapsize_plugin", "serde", "serde_macros", "euclid/plugins",
"cssparser/heap_size", "cssparser/serde-serialization", "util/servo"]
[dependencies] [dependencies]
util = {path = "../util"} util = {path = "../util"}
plugins = {path = "../plugins"} cssparser = "0.5.4"
cssparser = {version = "0.5.4", features = ["heap_size", "serde-serialization"]} euclid = "0.6.4"
euclid = {version = "0.6.4", features = ["plugins"]} heapsize = {version = "0.3.0", optional = true}
heapsize = "0.3.0" heapsize_plugin = {version = "0.1.2", optional = true}
heapsize_plugin = "0.1.2"
rustc-serialize = "0.3" rustc-serialize = "0.3"
serde = "0.7" serde = {version = "0.7", optional = true}
serde_macros = "0.7" serde_macros = {version = "0.7", optional = true}

View file

@ -8,7 +8,8 @@ use cssparser::ToCss;
macro_rules! define_cursor { macro_rules! define_cursor {
($( $css: expr => $variant: ident = $value: expr, )+) => { ($( $css: expr => $variant: ident = $value: expr, )+) => {
#[derive(Clone, Copy, Debug, Deserialize, Eq, HeapSizeOf, PartialEq, Serialize)] #[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize, HeapSizeOf))]
#[repr(u8)] #[repr(u8)]
pub enum Cursor { pub enum Cursor {
$( $variant = $value ),+ $( $variant = $value ),+

View file

@ -8,19 +8,20 @@
#![crate_name = "style_traits"] #![crate_name = "style_traits"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![feature(custom_derive)]
#![feature(plugin)]
#![plugin(heapsize_plugin)]
#![plugin(serde_macros)]
#![plugin(plugins)]
#![deny(unsafe_code)] #![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))]
#[macro_use] #[macro_use]
extern crate cssparser; extern crate cssparser;
extern crate euclid; extern crate euclid;
extern crate heapsize; #[cfg(feature = "servo")] extern crate heapsize;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate serde; #[cfg(feature = "servo")] extern crate serde;
extern crate util; extern crate util;
pub mod cursor; pub mod cursor;

View file

@ -5,12 +5,38 @@
#[macro_export] #[macro_export]
macro_rules! define_css_keyword_enum { macro_rules! define_css_keyword_enum {
($name: ident: $( $css: expr => $variant: ident ),+,) => { ($name: ident: $( $css: expr => $variant: ident ),+,) => {
define_css_keyword_enum!($name: $( $css => $variant ),+); __define_css_keyword_enum__add_optional_traits!($name [ $( $css => $variant ),+ ]);
}; };
($name: ident: $( $css: expr => $variant: ident ),+) => { ($name: ident: $( $css: expr => $variant: ident ),+) => {
__define_css_keyword_enum__add_optional_traits!($name [ $( $css => $variant ),+ ]);
};
}
#[cfg(feature = "servo")]
#[macro_export]
macro_rules! __define_css_keyword_enum__add_optional_traits {
($name: ident [ $( $css: expr => $variant: ident ),+ ]) => {
__define_css_keyword_enum__actual! {
$name [ Deserialize, Serialize, HeapSizeOf ] [ $( $css => $variant ),+ ]
}
};
}
#[cfg(not(feature = "servo"))]
#[macro_export]
macro_rules! __define_css_keyword_enum__add_optional_traits {
($name: ident [ $( $css: expr => $variant: ident ),+ ]) => {
__define_css_keyword_enum__actual! {
$name [] [ $( $css => $variant ),+ ]
}
};
}
#[macro_export]
macro_rules! __define_css_keyword_enum__actual {
($name: ident [ $( $derived_trait: ident),* ] [ $( $css: expr => $variant: ident ),+ ]) => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug, HeapSizeOf)] #[derive(Clone, Eq, PartialEq, Copy, Hash, RustcEncodable, Debug $(, $derived_trait )* )]
#[derive(Deserialize, Serialize)]
pub enum $name { pub enum $name {
$( $variant ),+ $( $variant ),+
} }

View file

@ -20,7 +20,8 @@ define_css_keyword_enum!(Orientation:
"landscape" => Landscape); "landscape" => Landscape);
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, HeapSizeOf)] #[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize, HeapSizeOf))]
pub struct ViewportConstraints { pub struct ViewportConstraints {
pub size: TypedSize2D<ViewportPx, f32>, pub size: TypedSize2D<ViewportPx, f32>,
@ -54,7 +55,8 @@ impl ToCss for ViewportConstraints {
/// Zoom is a number | percentage | auto /// Zoom is a number | percentage | auto
/// See http://dev.w3.org/csswg/css-device-adapt/#descdef-viewport-zoom /// See http://dev.w3.org/csswg/css-device-adapt/#descdef-viewport-zoom
#[derive(Copy, Clone, Debug, HeapSizeOf, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
pub enum Zoom { pub enum Zoom {
Number(f32), Number(f32),
Percentage(f32), Percentage(f32),

View file

@ -8,28 +8,31 @@ publish = false
name = "util" name = "util"
path = "lib.rs" path = "lib.rs"
[features]
# servo as opposed to geckolib
servo = ["serde", "serde_macros", "backtrace", "ipc-channel", "app_units/plugins",
"euclid/plugins", "euclid/unstable", "url/heap_size", "url/serde"]
[dependencies] [dependencies]
app_units = {version = "0.2.3", features = ["plugins"]} app_units = "0.2.3"
backtrace = "0.2.1" backtrace = {version = "0.2.1", optional = true}
bitflags = "0.7" bitflags = "0.7"
deque = "0.3.1" deque = "0.3.1"
euclid = {version = "0.6.4", features = ["unstable", "plugins"]} euclid = "0.6.4"
getopts = "0.2.11" getopts = "0.2.11"
heapsize = "0.3.0" heapsize = "0.3.0"
heapsize_plugin = "0.1.2" ipc-channel = {git = "https://github.com/servo/ipc-channel", optional = true}
ipc-channel = {git = "https://github.com/servo/ipc-channel"}
lazy_static = "0.2" lazy_static = "0.2"
libc = "0.2" libc = "0.2"
log = "0.3.5" log = "0.3.5"
num_cpus = "0.2.2" num_cpus = "0.2.2"
num-traits = "0.1.32" num-traits = "0.1.32"
plugins = {path = "../plugins"}
rand = "0.3" rand = "0.3"
rustc-serialize = "0.3" rustc-serialize = "0.3"
serde = "0.7" serde = {version = "0.7", optional = true}
serde_macros = "0.7" serde_macros = {version = "0.7", optional = true}
smallvec = "0.1" smallvec = "0.1"
url = {version = "1.0.0", features = ["heap_size", "serde"]} url = "1.0.0"
[target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))'.dependencies] [target.'cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))'.dependencies]
xdg = "2.0" xdg = "2.0"

View file

@ -23,7 +23,7 @@ use std::i32;
/// ///
/// The ratio between ScreenPx and DevicePixel for a given display be found by calling /// The ratio between ScreenPx and DevicePixel for a given display be found by calling
/// `servo::windowing::WindowMethods::hidpi_factor`. /// `servo::windowing::WindowMethods::hidpi_factor`.
#[derive(Clone, Copy, Debug, HeapSizeOf)] #[derive(Clone, Copy, Debug)]
pub enum ScreenPx {} pub enum ScreenPx {}
/// One CSS "px" in the coordinate system of the "initial viewport": /// One CSS "px" in the coordinate system of the "initial viewport":
@ -35,7 +35,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.
#[derive(Clone, Copy, Debug, HeapSizeOf)] #[derive(Clone, Copy, Debug)]
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.
@ -44,9 +44,11 @@ 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.
#[derive(Clone, Copy, Debug, HeapSizeOf)] #[derive(Clone, Copy, Debug)]
pub enum PagePx {} 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: // In summary, the hierarchy of pixel units and the factors to convert from one to the next:
// //
// DevicePixel // DevicePixel

View file

@ -2,39 +2,31 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(box_syntax)] #![cfg_attr(feature = "servo", feature(core_intrinsics))]
#![feature(core_intrinsics)] #![cfg_attr(feature = "servo", feature(custom_derive))]
#![feature(custom_derive)] #![cfg_attr(feature = "servo", feature(fnbox))]
#![feature(fnbox)] #![cfg_attr(feature = "servo", feature(plugin))]
#![feature(plugin)] #![cfg_attr(feature = "servo", feature(reflect_marker))]
#![feature(reflect_marker)] #![cfg_attr(feature = "servo", plugin(serde_macros))]
#![feature(step_by)]
#![plugin(heapsize_plugin, plugins, serde_macros)]
#![deny(unsafe_code)] #![deny(unsafe_code)]
extern crate app_units; extern crate app_units;
extern crate backtrace; #[cfg(feature = "servo")] extern crate backtrace;
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)] #[macro_use] extern crate bitflags;
#[macro_use]
extern crate bitflags;
extern crate deque; extern crate deque;
extern crate euclid; extern crate euclid;
extern crate getopts; extern crate getopts;
extern crate heapsize; #[macro_use] extern crate heapsize;
extern crate ipc_channel; #[cfg(feature = "servo")] extern crate ipc_channel;
#[allow(unused_extern_crates)] #[allow(unused_extern_crates)] #[macro_use] extern crate lazy_static;
#[macro_use]
extern crate lazy_static;
extern crate libc; extern crate libc;
#[macro_use] #[macro_use] extern crate log;
extern crate log;
extern crate num_cpus; extern crate num_cpus;
extern crate num_traits; extern crate num_traits;
extern crate rand; extern crate rand;
extern crate rustc_serialize; extern crate rustc_serialize;
extern crate serde; #[cfg(feature = "servo")] extern crate serde;
extern crate smallvec; extern crate smallvec;
extern crate url; extern crate url;
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))] #[cfg(all(unix, not(target_os = "macos"), not(target_os = "ios"), not(target_os = "android")))]
@ -44,28 +36,24 @@ use std::sync::Arc;
pub mod basedir; pub mod basedir;
pub mod cache; pub mod cache;
#[allow(unsafe_code)] #[allow(unsafe_code)] pub mod debug_utils;
pub mod debug_utils;
pub mod geometry; pub mod geometry;
#[allow(unsafe_code)] #[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
pub mod ipc; #[cfg(feature = "servo")] pub mod linked_list;
pub mod linked_list; #[allow(unsafe_code)] pub mod opts;
#[allow(unsafe_code)] #[cfg(feature = "servo")] pub mod panicking;
pub mod opts;
pub mod panicking;
pub mod prefs; pub mod prefs;
pub mod print_tree; #[cfg(feature = "servo")] pub mod print_tree;
pub mod resource_files; pub mod resource_files;
#[allow(unsafe_code)]
pub mod str; pub mod str;
pub mod thread; pub mod thread;
pub mod thread_state; pub mod thread_state;
pub mod tid; pub mod tid;
pub mod time; #[cfg(feature = "servo")] pub mod time;
pub mod vec; pub mod vec;
#[allow(unsafe_code)] #[allow(unsafe_code)] pub mod workqueue;
pub mod workqueue;
#[cfg(feature = "servo")]
#[allow(unsafe_code)] #[allow(unsafe_code)]
pub fn breakpoint() { pub fn breakpoint() {
unsafe { ::std::intrinsics::breakpoint() }; unsafe { ::std::intrinsics::breakpoint() };

View file

@ -23,7 +23,8 @@ use url::{self, Url};
/// Global flags for Servo, currently set on the command line. /// Global flags for Servo, currently set on the command line.
#[derive(Clone, Deserialize, Serialize)] #[derive(Clone)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct Opts { pub struct Opts {
pub is_running_problem_test: bool, pub is_running_problem_test: bool,
@ -379,7 +380,8 @@ pub fn print_debug_usage(app: &str) -> ! {
process::exit(0) process::exit(0)
} }
#[derive(Clone, Deserialize, Serialize)] #[derive(Clone)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum OutputOptions { pub enum OutputOptions {
FileName(String), FileName(String),
Stdout(f64) Stdout(f64)
@ -404,7 +406,8 @@ enum UserAgent {
Android, Android,
} }
#[derive(Clone, Debug, Eq, Deserialize, PartialEq, Serialize)] #[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum RenderApi { pub enum RenderApi {
GL, GL,
ES2, ES2,
@ -858,7 +861,7 @@ pub fn set_defaults(opts: Opts) {
unsafe { unsafe {
assert!(DEFAULT_OPTIONS.is_null()); assert!(DEFAULT_OPTIONS.is_null());
assert!(DEFAULT_OPTIONS != INVALID_OPTIONS); assert!(DEFAULT_OPTIONS != INVALID_OPTIONS);
let box_opts = box opts; let box_opts = Box::new(opts);
DEFAULT_OPTIONS = Box::into_raw(box_opts); DEFAULT_OPTIONS = Box::into_raw(box_opts);
} }
} }

View file

@ -20,7 +20,8 @@ lazy_static! {
}; };
} }
#[derive(PartialEq, Clone, Debug, Deserialize, Serialize)] #[derive(PartialEq, Clone, Debug)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum PrefValue { pub enum PrefValue {
Boolean(bool), Boolean(bool),
String(String), String(String),
@ -91,7 +92,8 @@ impl ToJson for PrefValue {
} }
} }
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum Pref { pub enum Pref {
NoDefault(Arc<PrefValue>), NoDefault(Arc<PrefValue>),
WithDefault(Arc<PrefValue>, Option<Arc<PrefValue>>) WithDefault(Arc<PrefValue>, Option<Arc<PrefValue>>)

View file

@ -2,13 +2,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use backtrace::Backtrace; #[cfg(feature = "servo")] use backtrace::Backtrace;
use ipc_channel::ipc::IpcSender; #[cfg(feature = "servo")] use ipc_channel::ipc::IpcSender;
use panicking; #[cfg(feature = "servo")] use panicking;
use serde::Serialize; #[cfg(feature = "servo")] use serde::Serialize;
use std::any::Any; #[cfg(feature = "servo")] use std::any::Any;
#[cfg(feature = "servo")] use thread_state;
use std::thread; use std::thread;
use thread_state;
pub fn spawn_named<F>(name: String, f: F) pub fn spawn_named<F>(name: String, f: F)
where F: FnOnce() + Send + 'static where F: FnOnce() + Send + 'static
@ -17,6 +17,7 @@ pub fn spawn_named<F>(name: String, f: F)
} }
/// Arrange to send a particular message to a channel if the thread fails. /// Arrange to send a particular message to a channel if the thread fails.
#[cfg(feature = "servo")]
pub fn spawn_named_with_send_on_panic<F, Id>(name: String, pub fn spawn_named_with_send_on_panic<F, Id>(name: String,
state: thread_state::ThreadState, state: thread_state::ThreadState,
f: F, f: F,

View file

@ -9,10 +9,13 @@ use super::smallvec::VecLike;
// TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this. // TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this.
pub fn byte_swap(data: &mut [u8]) { pub fn byte_swap(data: &mut [u8]) {
let length = data.len(); let length = data.len();
for i in (0..length).step_by(4) { // FIXME(rust #27741): Range::step_by is not stable yet as of this writing.
let mut i = 0;
while i < length {
let r = data[i + 2]; let r = data[i + 2];
data[i + 2] = data[i + 0]; data[i + 2] = data[i + 0];
data[i + 0] = r; data[i + 0] = r;
i += 4;
} }
} }

4
ports/cef/Cargo.lock generated
View file

@ -2100,7 +2100,6 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"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)",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2122,7 +2121,6 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"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.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2307,7 +2305,6 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2315,7 +2312,6 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (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)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -8,12 +8,10 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"gecko_bindings 0.0.1", "gecko_bindings 0.0.1",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)",
@ -76,7 +74,7 @@ dependencies = [
[[package]] [[package]]
name = "bincode" name = "bincode"
version = "0.5.6" version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -257,15 +255,14 @@ dependencies = [
[[package]] [[package]]
name = "ipc-channel" name = "ipc-channel"
version = "0.2.3" version = "0.2.4"
source = "git+https://github.com/servo/ipc-channel#48137d69955f5460da586c552de275ecdc3f4efe" source = "git+https://github.com/servo/ipc-channel#8411eeabf3a712006ad1b47637b2d8fe71177f85"
dependencies = [ dependencies = [
"bincode 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -319,13 +316,6 @@ dependencies = [
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "plugins"
version = "0.0.1"
dependencies = [
"tenacious 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "quasi" name = "quasi"
version = "0.12.0" version = "0.12.0"
@ -468,7 +458,6 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"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)",
"selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -490,18 +479,12 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"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.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde_macros 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
"util 0.0.1", "util 0.0.1",
] ]
[[package]]
name = "tenacious"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "thread-id" name = "thread-id"
version = "2.0.0" version = "2.0.0"
@ -581,15 +564,13 @@ dependencies = [
"euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.2.4 (git+https://github.com/servo/ipc-channel)",
"ipc-channel 0.2.3 (git+https://github.com/servo/ipc-channel)",
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)",
"plugins 0.0.1",
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.14 (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)",
"serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -17,6 +17,8 @@ default = ["servo_features"]
# in the full Servo build. Enabling this reduces the number of things # in the full Servo build. Enabling this reduces the number of things
# recompiled when building both Servo and geckolib in the same source tree. # recompiled when building both Servo and geckolib in the same source tree.
servo_features = [ servo_features = [
"heapsize",
"style/servo",
"time", "time",
"url/query_encoding", "url/query_encoding",
"url/rustc-serialize", "url/rustc-serialize",
@ -28,8 +30,7 @@ app_units = "0.2.3"
cssparser = "0.5.4" cssparser = "0.5.4"
euclid = "0.6.4" euclid = "0.6.4"
gecko_bindings = {version = "0.0.1", path = "gecko_bindings"} gecko_bindings = {version = "0.0.1", path = "gecko_bindings"}
heapsize = "0.3.0" heapsize = {version = "0.3.0", optional = true}
heapsize_plugin = "0.1.2"
lazy_static = "0.2" lazy_static = "0.2"
libc = "0.2" libc = "0.2"
num_cpus = "0.2.2" num_cpus = "0.2.2"
@ -38,7 +39,6 @@ smallvec = "0.1"
string_cache = {version = "0.2.20", features = ["unstable"]} string_cache = {version = "0.2.20", features = ["unstable"]}
url = "1.0.0" url = "1.0.0"
log = {version = "0.3.5", features = ["release_max_level_info"]} log = {version = "0.3.5", features = ["release_max_level_info"]}
plugins = {path = "../../components/plugins"}
time = {version = "0.1", optional = true, features = ["rustc-serialize"]} time = {version = "0.1", optional = true, features = ["rustc-serialize"]}
util = {path = "../../components/util"} util = {path = "../../components/util"}
uuid = {version = "0.2", optional = true, features = ["v4", "serde"]} uuid = {version = "0.2", optional = true, features = ["v4", "serde"]}

View file

@ -3,8 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(const_fn)] #![feature(const_fn)]
#![feature(concat_idents)]
#![feature(type_macros)]
extern crate heapsize; extern crate heapsize;

View file

@ -10,7 +10,7 @@ use std::fmt::{self, Debug};
// in a ThreadSafeFooHolder smart pointer. Used in tandem with the // in a ThreadSafeFooHolder smart pointer. Used in tandem with the
// NS_DECL_HOLDER_FFI_REFCOUNTING-defined types and functions in Gecko. // NS_DECL_HOLDER_FFI_REFCOUNTING-defined types and functions in Gecko.
macro_rules! define_holder_arc { macro_rules! define_holder_arc {
($arc_type:ident, $name:ident, $holder_type:ident) => ( ($arc_type:ident, $name:ident, $holder_type:ident, $addref: ident, $release: ident) => (
#[derive(PartialEq)] #[derive(PartialEq)]
pub struct $arc_type { pub struct $arc_type {
ptr: *mut $holder_type, ptr: *mut $holder_type,
@ -19,7 +19,7 @@ macro_rules! define_holder_arc {
impl $arc_type { impl $arc_type {
pub fn new(data: *mut $holder_type) -> $arc_type { pub fn new(data: *mut $holder_type) -> $arc_type {
debug_assert!(!data.is_null()); debug_assert!(!data.is_null());
unsafe { concat_idents!(Gecko_AddRef, $name, ArbitraryThread)(data); } unsafe { $addref(data); }
$arc_type { $arc_type {
ptr: data ptr: data
} }
@ -39,7 +39,7 @@ macro_rules! define_holder_arc {
impl Drop for $arc_type { impl Drop for $arc_type {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { concat_idents!(Gecko_Release, $name, ArbitraryThread)(self.ptr); } unsafe { $release(self.ptr); }
} }
} }
@ -55,5 +55,7 @@ macro_rules! define_holder_arc {
) )
} }
define_holder_arc!(GeckoArcPrincipal, Principal, ThreadSafePrincipalHolder); define_holder_arc!(GeckoArcPrincipal, Principal, ThreadSafePrincipalHolder,
define_holder_arc!(GeckoArcURI, URI, ThreadSafeURIHolder); Gecko_AddRefPrincipalArbitraryThread, Gecko_ReleasePrincipalArbitraryThread);
define_holder_arc!(GeckoArcURI, URI, ThreadSafeURIHolder,
Gecko_AddRefURIArbitraryThread, Gecko_ReleaseURIArbitraryThread);

View file

@ -3,13 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#![feature(as_unsafe_cell)] #![feature(as_unsafe_cell)]
#![feature(box_syntax)]
#![feature(custom_attribute)]
#![feature(custom_derive)]
#![feature(plugin)]
#![plugin(heapsize_plugin)]
#![plugin(plugins)]
extern crate app_units; extern crate app_units;
#[macro_use] #[macro_use]
@ -17,7 +10,7 @@ extern crate cssparser;
extern crate env_logger; extern crate env_logger;
extern crate euclid; extern crate euclid;
extern crate gecko_bindings; extern crate gecko_bindings;
extern crate heapsize; #[cfg(feature = "servo_features")] #[macro_use] extern crate heapsize;
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;
extern crate libc; extern crate libc;

View file

@ -136,7 +136,6 @@ impl ComputedValues for GeckoComputedValues {
} }
<%def name="declare_style_struct(style_struct)"> <%def name="declare_style_struct(style_struct)">
#[derive(HeapSizeOf)]
pub struct ${style_struct.gecko_struct_name} { pub struct ${style_struct.gecko_struct_name} {
gecko: ${style_struct.gecko_ffi_name}, gecko: ${style_struct.gecko_ffi_name},
} }

View file

@ -13,9 +13,12 @@ pub type Stylesheet = style::stylesheets::Stylesheet<GeckoSelectorImpl>;
pub type SharedStyleContext = style::context::SharedStyleContext<GeckoSelectorImpl>; pub type SharedStyleContext = style::context::SharedStyleContext<GeckoSelectorImpl>;
pub type PrivateStyleData = style::data::PrivateStyleData<GeckoSelectorImpl, GeckoComputedValues>; pub type PrivateStyleData = style::data::PrivateStyleData<GeckoSelectorImpl, GeckoComputedValues>;
#[cfg(feature = "servo_features")]
known_heap_size!(0, GeckoSelectorImpl, PseudoElement, NonTSPseudoClass);
pub struct GeckoSelectorImpl; pub struct GeckoSelectorImpl;
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum PseudoElement { pub enum PseudoElement {
Before, Before,
After, After,
@ -46,7 +49,7 @@ pub enum PseudoElement {
} }
// https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSAnonBoxList.h // https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSAnonBoxList.h
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum AnonBoxPseudoElement { pub enum AnonBoxPseudoElement {
MozNonElement, MozNonElement,
MozAnonymousBlock, MozAnonymousBlock,
@ -114,7 +117,7 @@ pub enum AnonBoxPseudoElement {
MozSVGText, MozSVGText,
} }
#[derive(Clone, Debug, PartialEq, Eq, HeapSizeOf, Hash)] #[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum NonTSPseudoClass { pub enum NonTSPseudoClass {
AnyLink, AnyLink,
Link, Link,

View file

@ -85,7 +85,7 @@ impl<'ln> GeckoNode<'ln> {
pub fn initialize_data(self) { pub fn initialize_data(self) {
unsafe { unsafe {
if self.get_node_data().is_null() { if self.get_node_data().is_null() {
let ptr: NonOpaqueStyleData = Box::into_raw(box RefCell::new(PrivateStyleData::new())); let ptr: NonOpaqueStyleData = Box::into_raw(Box::new(RefCell::new(PrivateStyleData::new())));
Gecko_SetNodeData(self.node, ptr as *mut ServoNodeData); Gecko_SetNodeData(self.node, ptr as *mut ServoNodeData);
} }
} }