Replace all uses of the heapsize crate with malloc_size_of.

Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
This commit is contained in:
Nicholas Nethercote 2017-10-18 10:42:01 +11:00
parent 421baa854e
commit 4506f0d30c
269 changed files with 1418 additions and 1521 deletions

View file

@ -16,12 +16,11 @@ path = "lib.rs"
doctest = false
[features]
gecko = ["malloc_size_of", "malloc_size_of_derive", "nsstring_vendor", "num_cpus",
gecko = ["nsstring_vendor", "num_cpus",
"style_traits/gecko", "fallible/known_system_malloc"]
use_bindgen = ["bindgen", "regex", "toml"]
servo = ["serde", "heapsize", "heapsize_derive",
"style_traits/servo", "servo_atoms", "servo_config", "html5ever",
"cssparser/heapsize", "cssparser/serde", "encoding", "smallvec/heapsizeof",
servo = ["serde", "style_traits/servo", "servo_atoms", "servo_config", "html5ever",
"cssparser/serde", "encoding", "malloc_size_of/servo",
# FIXME: Uncomment when https://github.com/servo/servo/pull/16953 has landed:
#"arrayvec/use_union"
@ -42,16 +41,14 @@ euclid = "0.15"
fallible = { path = "../fallible" }
fnv = "1.0"
hashglobe = { path = "../hashglobe" }
heapsize = {version = "0.4", optional = true}
heapsize_derive = {version = "0.1", optional = true}
itertools = "0.5"
itoa = "0.3"
html5ever = {version = "0.20", optional = true}
lazy_static = "0.2"
lru_cache = { path = "../lru_cache" }
log = "0.3"
malloc_size_of = { path = "../malloc_size_of", optional=true }
malloc_size_of_derive = { path = "../malloc_size_of_derive", optional=true }
malloc_size_of = { path = "../malloc_size_of" }
malloc_size_of_derive = { path = "../malloc_size_of_derive" }
matches = "0.1"
nsstring_vendor = {path = "gecko_bindings/nsstring_vendor", optional = true}
num_cpus = {version = "1.1.0", optional = true}

View file

@ -36,9 +36,7 @@ const SOURCE_ORDER_MASK: u32 = (1 << SOURCE_ORDER_BITS) - 1;
const SOURCE_ORDER_MAX: u32 = SOURCE_ORDER_MASK;
/// Stores the source order of a block and the cascade level it belongs to.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Eq, PartialEq)]
#[derive(Clone, Copy, Eq, MallocSizeOf, PartialEq)]
struct SourceOrderAndCascadeLevel(u32);
impl SourceOrderAndCascadeLevel {
@ -76,13 +74,10 @@ impl Debug for SourceOrderAndCascadeLevel {
///
/// This represents the declarations in a given declaration block for a given
/// importance.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct ApplicableDeclarationBlock {
/// The style source, either a style rule, or a property declaration block.
#[cfg_attr(feature = "gecko", ignore_malloc_size_of = "contains Arcs")]
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[ignore_malloc_size_of = "Arc"]
pub source: StyleSource,
/// The source order of the block, and the cascade level it belongs to.
order_and_level: SourceOrderAndCascadeLevel,

View file

@ -27,7 +27,7 @@ use values::specified::Length;
const UNSIGNED_LONG_MAX: u32 = 2147483647;
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum LengthOrPercentageOrAuto {
Auto,
Percentage(f32),
@ -35,7 +35,7 @@ pub enum LengthOrPercentageOrAuto {
}
#[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum AttrValue {
String(String),
TokenList(String, Vec<Atom>),
@ -66,7 +66,7 @@ pub enum AttrValue {
/// declaration block), but that avoids keeping a refcounted
/// declarationblock for longer than needed.
Declaration(String,
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[ignore_malloc_size_of = "Arc"]
Arc<Locked<PropertyDeclarationBlock>>)
}
@ -596,7 +596,7 @@ pub fn parse_length(mut value: &str) -> LengthOrPercentageOrAuto {
/// A struct that uniquely identifies an element's attribute.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct AttrIdentifier {
pub local_name: LocalName,
pub name: LocalName,

View file

@ -41,9 +41,7 @@ pub fn parse_name(s: &str) -> Result<&str, ()> {
///
/// We preserve the original CSS for serialization, and also the variable
/// references to other custom property names.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct VariableValue {
css: String,

View file

@ -44,7 +44,7 @@ use traversal_flags::{TraversalFlags, self};
/// data structures. Also, layout code tends to be faster when the DOM is not being accessed, for
/// locality reasons. Using `OpaqueNode` enforces this invariant.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf, Deserialize, Serialize))]
pub struct OpaqueNode(pub usize);
impl OpaqueNode {

View file

@ -14,8 +14,7 @@ bitflags! {
///
/// TODO(emilio): We really really want to use the NS_EVENT_STATE bindings
/// for this.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(MallocSizeOf)]
pub flags ElementState: u64 {
/// The mouse is down on this element.
/// <https://html.spec.whatwg.org/multipage/#selector-active>

View file

@ -55,14 +55,12 @@ pub fn dir_selector_to_state(s: &[u16]) -> ElementState {
/// This allows 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 elements in the document.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf)]
pub struct Dependency {
/// The dependency selector.
#[cfg_attr(feature = "gecko",
ignore_malloc_size_of = "CssRules have primary refs, we measure there")]
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
pub selector: Selector<SelectorImpl>,
/// The offset into the selector that we should match on.
@ -115,9 +113,7 @@ impl SelectorMapEntry for Dependency {
/// The same, but for state selectors, which can track more exactly what state
/// do they track.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf)]
pub struct StateDependency {
/// The other dependency fields.
pub dep: Dependency,
@ -139,9 +135,7 @@ impl SelectorMapEntry for StateDependency {
/// In particular, we want to lookup as few things as possible to get the fewer
/// selectors the better, so this looks up by id, class, or looks at the list of
/// state/other attribute affecting selectors.
#[derive(Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, MallocSizeOf)]
pub struct InvalidationMap {
/// A map from a given class name to all the selectors with that class
/// selector.

View file

@ -230,9 +230,7 @@ impl From<nsRestyleHint> for RestyleHint {
}
#[cfg(feature = "servo")]
impl ::heapsize::HeapSizeOf for RestyleHint {
fn heap_size_of_children(&self) -> usize { 0 }
}
malloc_size_of_is_0!(RestyleHint);
/// Asserts that all replacement hints have a matching nsRestyleHint value.
#[cfg(feature = "gecko")]

View file

@ -23,9 +23,7 @@ use stylesheets::{NestedRuleIterationCondition, Stylesheet, SupportsRule};
///
/// If this changes, though, we may need to remove the item from the cache if
/// present before it goes away.
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
pub struct MediaListKey(usize);
impl MediaListKey {
@ -53,9 +51,7 @@ impl ToMediaListKey for MediaRule {}
/// A struct that holds the result of a media query evaluation pass for the
/// media queries that evaluated successfully.
#[derive(Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, MallocSizeOf, PartialEq)]
pub struct EffectiveMediaQueryResults {
/// The set of media lists that matched last time.
set: FnvHashSet<MediaListKey>,

View file

@ -24,7 +24,7 @@ use stylesheets::{CssRule, StylesheetInDocument};
/// element is determined by whether the invalidation is stored in the
/// StylesheetInvalidationSet's invalid_scopes or invalid_elements table.
#[derive(Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
enum Invalidation {
/// An element with a given id.
ID(Atom),
@ -75,7 +75,7 @@ impl Invalidation {
///
/// TODO(emilio): We might be able to do the same analysis for media query
/// changes too (or even selector changes?).
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct StylesheetInvalidationSet {
/// The subtrees we know we have to restyle so far.
invalid_scopes: FnvHashSet<Invalidation>,

View file

@ -50,8 +50,6 @@ extern crate fallible;
extern crate fnv;
#[cfg(feature = "gecko")] #[macro_use] pub mod gecko_string_cache;
extern crate hashglobe;
#[cfg(feature = "servo")] extern crate heapsize;
#[cfg(feature = "servo")] #[macro_use] extern crate heapsize_derive;
extern crate itertools;
extern crate itoa;
#[cfg(feature = "servo")] #[macro_use] extern crate html5ever;
@ -60,8 +58,8 @@ extern crate lazy_static;
#[macro_use]
extern crate log;
extern crate lru_cache;
#[cfg(feature = "gecko")] #[macro_use] extern crate malloc_size_of;
#[cfg(feature = "gecko")] #[macro_use] extern crate malloc_size_of_derive;
#[macro_use] extern crate malloc_size_of;
#[macro_use] extern crate malloc_size_of_derive;
#[allow(unused_extern_crates)]
#[macro_use]
extern crate matches;

View file

@ -24,7 +24,7 @@ pub enum InlineBaseDirection {
// TODO: improve the readability of the WritingMode serialization, refer to the Debug:fmt()
bitflags!(
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Serialize))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf, Serialize))]
pub flags WritingMode: u8 {
const FLAG_RTL = 1 << 0,
const FLAG_VERTICAL = 1 << 1,

View file

@ -47,9 +47,8 @@ macro_rules! define_numbered_css_keyword_enum {
};
($name: ident: $( $css: expr => $variant: ident = $value: expr ),+) => {
#[allow(non_camel_case_types, missing_docs)]
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum $name {
$( $variant = $value ),+
}
@ -103,9 +102,7 @@ macro_rules! add_impls_for_keyword_enum {
macro_rules! define_keyword_type {
($name: ident, $css: expr) => {
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, PartialEq)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq)]
#[derive(ToAnimatedZero, ToComputedValue, ToCss)]
pub struct $name;

View file

@ -26,7 +26,7 @@ pub use gecko::media_queries::{Device, Expression};
/// A type that encapsulates a media query list.
#[derive(Clone, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct MediaList {
/// The list of media queries.
pub media_queries: Vec<MediaQuery>,
@ -48,7 +48,7 @@ impl MediaList {
}
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
pub enum Qualifier {
/// Hide a media query from legacy UAs:
@ -63,7 +63,7 @@ pub enum Qualifier {
///
/// [mq]: https://drafts.csswg.org/mediaqueries/
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct MediaQuery {
/// The qualifier for this query.
pub qualifier: Option<Qualifier>,
@ -135,7 +135,7 @@ impl ToCss for MediaQuery {
/// <http://dev.w3.org/csswg/mediaqueries-3/#media0>
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum MediaQueryType {
/// A media type that matches every device.
All,
@ -164,7 +164,7 @@ impl MediaQueryType {
/// <https://drafts.csswg.org/mediaqueries/#media-types>
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct MediaType(pub CustomIdent);
impl MediaType {

View file

@ -40,9 +40,7 @@ impl AnimationRules {
}
/// Whether a given declaration comes from CSS parsing, or from CSSOM.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
pub enum DeclarationSource {
/// The declaration was obtained from CSS parsing of sheets and such.
Parsing,
@ -53,9 +51,7 @@ pub enum DeclarationSource {
/// A declaration [importance][importance].
///
/// [importance]: https://drafts.csswg.org/css-cascade/#importance
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
pub enum Importance {
/// Indicates a declaration without `!important`.
Normal,

View file

@ -117,9 +117,7 @@
use values::computed::ComputedVecIter;
/// The computed value, effectively a list of single values.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
% if need_animatable or animation_value_type == "ComputedValue":
#[derive(Animate, ComputeSquaredDistance)]
% endif
@ -178,9 +176,7 @@
}
/// The specified value of ${name}.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct SpecifiedValue(pub Vec<single_value::SpecifiedValue>);
impl ToCss for SpecifiedValue {
@ -950,9 +946,7 @@
pub type T = ::values::computed::${length_type};
}
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct SpecifiedValue(pub ${length_type});
% if length_type == "MozLength":

View file

@ -77,9 +77,7 @@ pub fn nscsspropertyid_is_animatable(property: nsCSSPropertyID) -> bool {
/// a shorthand with at least one transitionable longhand component, or an unsupported property.
// NB: This needs to be here because it needs all the longhands generated
// beforehand.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
pub enum TransitionProperty {
/// All, any transitionable property changing should generate a transition.
///
@ -203,7 +201,7 @@ pub fn nscsspropertyid_is_transitionable(property: nsCSSPropertyID) -> bool {
/// property.
#[cfg(feature = "servo")]
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum AnimatedProperty {
% for prop in data.longhands:
% if prop.animatable:
@ -339,7 +337,7 @@ unsafe impl HasSimpleFFI for AnimationValueMap {}
/// FIXME: We need to add a path for custom properties, but that's trivial after
/// this (is a similar path to that of PropertyDeclaration).
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum AnimationValue {
% for prop in data.longhands:
% if prop.animatable:
@ -1190,7 +1188,7 @@ fn rotate_to_matrix(x: f32, y: f32, z: f32, a: Angle) -> ComputedMatrix {
/// A 2d matrix for interpolation.
#[derive(Clone, ComputeSquaredDistance, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[allow(missing_docs)]
// FIXME: We use custom derive for ComputeSquaredDistance. However, If possible, we should convert
// the InnerMatrix2D into types with physical meaning. This custom derive computes the squared
@ -1202,18 +1200,18 @@ pub struct InnerMatrix2D {
}
/// A 2d translation function.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
pub struct Translate2D(f32, f32);
/// A 2d scale function.
#[derive(Clone, ComputeSquaredDistance, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct Scale2D(f32, f32);
/// A decomposed 2d matrix.
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct MatrixDecomposed2D {
/// The translation function.
pub translate: Translate2D,
@ -1497,33 +1495,33 @@ impl From<ComputedMatrix> for RawGeckoGfxMatrix4x4 {
}
/// A 3d translation.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
pub struct Translate3D(f32, f32, f32);
/// A 3d scale function.
#[derive(Clone, ComputeSquaredDistance, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct Scale3D(f32, f32, f32);
/// A 3d skew function.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Animate, Clone, Copy, Debug)]
pub struct Skew(f32, f32, f32);
/// A 3d perspective transformation.
#[derive(Clone, ComputeSquaredDistance, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct Perspective(f32, f32, f32, f32);
/// A quaternion used to represent a rotation.
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct Quaternion(f64, f64, f64, f64);
/// A decomposed 3d matrix.
#[derive(Clone, ComputeSquaredDistance, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct MatrixDecomposed3D {
/// A translation function.
pub translate: Translate3D,

View file

@ -52,9 +52,7 @@ ${helpers.predefined_type("background-image", "ImageLayer",
"round" => Round,
"no-repeat" => NoRepeat);
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum SpecifiedValue {
RepeatX,
RepeatY,
@ -64,9 +62,7 @@ ${helpers.predefined_type("background-image", "ImageLayer",
pub mod computed_value {
pub use super::RepeatKeyword;
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct T(pub RepeatKeyword, pub RepeatKeyword);
}

View file

@ -81,15 +81,11 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
pub mod computed_value {
use cssparser::RGBA;
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct T(pub Option<Vec<RGBA>>);
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum SpecifiedValue {
None,
Colors(Vec<RGBAColor>),
@ -232,15 +228,11 @@ ${helpers.predefined_type("border-image-outset", "LengthOrNumberRect",
pub mod computed_value {
pub use super::RepeatKeyword;
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct T(pub RepeatKeyword, pub RepeatKeyword);
}
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct SpecifiedValue(pub RepeatKeyword,
pub Option<RepeatKeyword>);

View file

@ -162,9 +162,8 @@
}
#[allow(non_camel_case_types)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum SpecifiedValue {
% for value in values:
${to_rust_ident(value)},
@ -460,9 +459,7 @@ ${helpers.predefined_type("transition-delay",
pub use super::SpecifiedValue as T;
}
#[derive(Clone, Debug, Eq, Hash, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct SpecifiedValue(pub Option<KeyframesName>);
impl SpecifiedValue {
@ -555,9 +552,7 @@ ${helpers.predefined_type("animation-timing-function",
}
// https://drafts.csswg.org/css-animations/#animation-iteration-count
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss, ToComputedValue)]
pub enum SpecifiedValue {
Number(f32),
Infinite,
@ -689,9 +684,7 @@ ${helpers.predefined_type(
use values::computed;
use values::computed::{Length, LengthOrPercentage};
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub struct ComputedMatrix {
pub m11: CSSFloat, pub m12: CSSFloat, pub m13: CSSFloat, pub m14: CSSFloat,
pub m21: CSSFloat, pub m22: CSSFloat, pub m23: CSSFloat, pub m24: CSSFloat,
@ -699,9 +692,7 @@ ${helpers.predefined_type(
pub m41: CSSFloat, pub m42: CSSFloat, pub m43: CSSFloat, pub m44: CSSFloat,
}
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub struct ComputedMatrixWithPercents {
pub m11: CSSFloat, pub m12: CSSFloat, pub m13: CSSFloat, pub m14: CSSFloat,
pub m21: CSSFloat, pub m22: CSSFloat, pub m23: CSSFloat, pub m24: CSSFloat,
@ -733,9 +724,7 @@ ${helpers.predefined_type(
}
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum ComputedOperation {
Matrix(ComputedMatrix),
// For `-moz-transform` matrix and matrix3d.
@ -767,9 +756,7 @@ ${helpers.predefined_type(
count: computed::Integer },
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct T(pub Option<Vec<ComputedOperation>>);
}
@ -779,9 +766,7 @@ ${helpers.predefined_type(
/// Multiple transform functions compose a transformation.
///
/// Some transformations can be expressed by other more general functions.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum SpecifiedOperation {
/// Represents a 2D 2x3 matrix.
Matrix(Matrix<Number>),
@ -970,9 +955,7 @@ ${helpers.predefined_type(
}
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct SpecifiedValue(Vec<SpecifiedOperation>);
impl ToCss for SpecifiedValue {
@ -1688,9 +1671,7 @@ ${helpers.predefined_type("transform-origin",
}
bitflags! {
#[derive(ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(MallocSizeOf, ToComputedValue)]
pub flags SpecifiedValue: u8 {
const LAYOUT = 0x01,
const STYLE = 0x02,
@ -1829,9 +1810,7 @@ ${helpers.single_keyword("-moz-orient",
pub use super::SpecifiedValue as T;
}
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum SpecifiedValue {
Auto,
AnimateableFeatures(Vec<CustomIdent>),

View file

@ -36,9 +36,7 @@
#[cfg(feature = "gecko")]
use values::specified::Attr;
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum ContentItem {
/// Literal string content.
String(String),
@ -98,9 +96,7 @@
}
}
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum T {
Normal,
None,
@ -249,9 +245,7 @@
use style_traits::ToCss;
use values::CustomIdent;
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct T(pub Vec<(CustomIdent, i32)>);
impl ToCss for T {

View file

@ -91,25 +91,22 @@ macro_rules! impl_gecko_keyword_conversions {
use Atom;
pub use self::FontFamily as SingleComputedValue;
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum FontFamily {
FamilyName(FamilyName),
Generic(Atom),
}
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct FamilyName {
pub name: Atom,
pub syntax: FamilyNameSyntax,
}
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum FamilyNameSyntax {
/// The family name was specified in a quoted form, e.g. "Font Name"
/// or 'Font Name'.
@ -334,7 +331,7 @@ macro_rules! impl_gecko_keyword_conversions {
}
#[cfg(feature = "servo")]
#[derive(Clone, Debug, Eq, Hash, HeapSizeOf, PartialEq)]
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq)]
pub struct FontFamilyList(Vec<FontFamily>);
#[cfg(feature = "gecko")]
@ -460,7 +457,7 @@ macro_rules! impl_gecko_keyword_conversions {
}
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct T(pub FontFamilyList);
#[cfg(feature = "gecko")]
@ -625,9 +622,7 @@ ${helpers.single_keyword_system("font-variant-caps",
use properties::longhands::system_font::SystemFont;
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
pub enum SpecifiedValue {
Normal,
Bold,
@ -679,9 +674,9 @@ ${helpers.single_keyword_system("font-variant-caps",
///
/// However, system fonts may provide other values. Pango
/// may provide 350, 380, and 1000 (on top of the existing values), for example.
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, Eq, Hash, PartialEq, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq,
ToCss)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct T(pub u16);
impl T {
@ -927,9 +922,7 @@ ${helpers.single_keyword_system("font-variant-caps",
use properties::longhands::system_font::SystemFont;
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum SpecifiedValue {
None,
Number(specified::Number),
@ -976,9 +969,8 @@ ${helpers.single_keyword_system("font-variant-caps",
use values::CSSFloat;
use values::animated::{ToAnimatedValue, ToAnimatedZero};
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToCss)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq,
ToCss)]
pub enum T {
#[animation(error)]
None,
@ -1051,9 +1043,7 @@ ${helpers.single_keyword_system("font-variant-caps",
pub use super::SpecifiedValue as T;
}
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct SpecifiedValue {
pub weight: bool,
pub style: bool,
@ -1159,9 +1149,7 @@ ${helpers.single_keyword_system("font-kerning",
use values::CustomIdent;
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum VariantAlternates {
Stylistic(CustomIdent),
Styleset(Box<[CustomIdent]>),
@ -1172,14 +1160,10 @@ ${helpers.single_keyword_system("font-kerning",
HistoricalForms,
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct VariantAlternatesList(pub Box<[VariantAlternates]>);
#[derive(Clone, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum SpecifiedValue {
Value(VariantAlternatesList),
System(SystemFont)
@ -1268,7 +1252,7 @@ ${helpers.single_keyword_system("font-kerning",
}
bitflags! {
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub flags ParsingFlags: u8 {
const NORMAL = 0,
const HISTORICAL_FORMS = 0x01,
@ -1375,8 +1359,7 @@ macro_rules! exclusive_value {
bitflags! {
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(MallocSizeOf)]
pub flags VariantEastAsian: u16 {
const NORMAL = 0,
const JIS78 = 0x01,
@ -1521,8 +1504,7 @@ macro_rules! exclusive_value {
bitflags! {
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(MallocSizeOf)]
pub flags VariantLigatures: u16 {
const NORMAL = 0,
const NONE = 0x01,
@ -1681,8 +1663,7 @@ macro_rules! exclusive_value {
bitflags! {
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(MallocSizeOf)]
pub flags VariantNumeric: u8 {
const NORMAL = 0,
const LINING_NUMS = 0x01,
@ -1907,9 +1888,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
use style_traits::ToCss;
use byteorder::{BigEndian, ByteOrder};
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq)]
pub enum SpecifiedValue {
Normal,
Override(String),
@ -1965,9 +1944,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
// OpenType "language system" tag, so we should be able to compute
// it and store it as a 32-bit integer
// (see http://www.microsoft.com/typography/otspec/languagetags.htm).
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
pub struct T(pub u32);
}
@ -2074,9 +2051,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control-
}
}
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct T(pub Atom);
}
@ -2278,9 +2253,7 @@ ${helpers.single_keyword("-moz-math-variant",
}
}
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
/// text-zoom. Enable if true, disable if false
pub struct T(pub bool);
}
@ -2473,7 +2446,7 @@ ${helpers.single_keyword("-moz-math-variant",
// dummy system font module that does nothing
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, ToCss)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
/// void enum for system font, can never exist
pub enum SystemFont {}
impl SystemFont {

View file

@ -70,9 +70,7 @@ ${helpers.single_keyword("image-rendering",
use std::f64::consts::PI;
const TWO_PI: f64 = 2.0 * PI;
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub struct SpecifiedValue {
pub angle: Option<Angle>,
pub flipped: bool
@ -102,9 +100,7 @@ ${helpers.single_keyword("image-rendering",
use style_traits::ToCss;
use values::specified::Angle;
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
pub enum Orientation {
Angle0 = 0,
Angle90,
@ -135,9 +131,7 @@ ${helpers.single_keyword("image-rendering",
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub enum T {
FromImage,
AngleWithFlipped(Orientation, bool),

View file

@ -166,9 +166,7 @@ ${helpers.predefined_type("marker-end", "UrlOrNone", "Either::Second(None_)",
///
/// Higher priority values, i.e. the values specified first,
/// will be painted first (and may be covered by paintings of lower priority)
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct SpecifiedValue(pub u8);
impl SpecifiedValue {

View file

@ -285,9 +285,7 @@ ${helpers.predefined_type("word-spacing",
use std::fmt;
use style_traits::ToCss;
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq)]
pub struct SpecifiedValue {
pub underline: bool,
pub overline: bool,
@ -408,36 +406,29 @@ ${helpers.predefined_type(
pub mod computed_value {
#[derive(Clone, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, ToComputedValue))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
#[cfg_attr(feature = "servo", derive(ToComputedValue))]
pub enum T {
Keyword(KeywordValue),
None,
String(String),
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct KeywordValue {
pub fill: bool,
pub shape: super::ShapeKeyword,
}
}
#[derive(Clone, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum SpecifiedValue {
Keyword(KeywordValue),
None,
String(String),
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum KeywordValue {
Fill(bool),
Shape(ShapeKeyword),
@ -604,9 +595,7 @@ ${helpers.predefined_type(
"left" => Left);
add_impls_for_keyword_enum!(HorizontalWritingModeValue);
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub struct SpecifiedValue(pub HorizontalWritingModeValue, pub VerticalWritingModeValue);
pub mod computed_value {

View file

@ -104,9 +104,7 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
pub mod computed_value {
use values::specified::UrlOrNone;
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct T(pub UrlOrNone);
// FIXME(nox): This is wrong, there are different types for specified
@ -146,9 +144,7 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu
pub use self::computed_value::T as SpecifiedValue;
pub mod computed_value {
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct T(pub Vec<(String, String)>);
}

View file

@ -21,9 +21,7 @@
#[cfg(feature = "gecko")]
use values::specified::url::SpecifiedUrl;
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum Keyword {
Auto,
Cursor(Cursor),

View file

@ -294,17 +294,13 @@ ${helpers.predefined_type("object-position",
pub type SpecifiedValue = computed_value::T;
pub mod computed_value {
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum AutoFlow {
Row,
Column,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct T {
pub autoflow: AutoFlow,
pub dense: bool,

View file

@ -19,9 +19,7 @@ ${helpers.single_keyword("table-layout", "auto fixed",
use std::fmt;
use style_traits::ToCss;
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct T(pub i32);
impl ToCss for T {

View file

@ -19,18 +19,14 @@
use style_traits::ToCss;
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToCss)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
pub enum Side {
Clip,
Ellipsis,
String(Box<str>),
}
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToCss)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
pub struct SpecifiedValue {
pub first: Side,
pub second: Option<Side>
@ -39,9 +35,7 @@
pub mod computed_value {
pub use super::Side;
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct T {
// When the specified value only has one side, that's the "second"
// side, and the sides are logical, so "second" means "end". The
@ -153,9 +147,7 @@ ${helpers.single_keyword("unicode-bidi",
use style_traits::ToCss;
bitflags! {
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(ToComputedValue)]
#[derive(MallocSizeOf, ToComputedValue)]
pub flags SpecifiedValue: u8 {
const NONE = 0,
const UNDERLINE = 0x01,

View file

@ -48,9 +48,7 @@ ${helpers.single_keyword("-moz-window-shadow", "none default menu tooltip sheet"
use style_traits::ToCss;
pub mod computed_value {
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct T(pub bool);
}

View file

@ -250,9 +250,7 @@ static ${name}: LonghandIdSet = LonghandIdSet {
</%def>
/// A set of longhand properties
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct LonghandIdSet {
storage: [u32; (${len(data.longhands)} - 1 + 32) / 32]
}
@ -400,9 +398,7 @@ impl PropertyDeclarationIdSet {
}
/// An enum to represent a CSS Wide keyword.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToCss)]
pub enum CSSWideKeyword {
/// The `initial` keyword.
Initial,
@ -465,9 +461,7 @@ bitflags! {
}
/// An identifier for a given longhand property.
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Eq, Hash, MallocSizeOf, PartialEq)]
pub enum LonghandId {
% for i, property in enumerate(data.longhands):
/// ${property.name}
@ -731,9 +725,7 @@ impl LonghandId {
}
/// An identifier for a given shorthand property.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, ToCss)]
#[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToCss)]
pub enum ShorthandId {
% for property in data.shorthands:
/// ${property.name}
@ -1022,7 +1014,7 @@ impl<'a, T: ToCss> ToCss for DeclaredValue<'a, T> {
/// An identifier for a given property declaration, which can be either a
/// longhand or a custom property.
#[derive(Clone, Copy, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum PropertyDeclarationId<'a> {
/// A longhand.
Longhand(LonghandId),
@ -1810,12 +1802,10 @@ pub mod style_structs {
% for style_struct in data.active_style_structs():
% if style_struct.name == "Font":
#[derive(Clone, Debug)]
#[derive(Clone, Debug, MallocSizeOf)]
% else:
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
% endif
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
/// The ${style_struct.name} style struct.
pub struct ${style_struct.name} {
% for longhand in style_struct.longhands:
@ -3575,7 +3565,7 @@ pub fn adjust_border_width(style: &mut StyleBuilder) {
/// An identifier for a given alias property.
#[derive(Clone, Copy, Eq, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum AliasId {
% for i, property in enumerate(data.all_aliases()):
/// ${property.name}

View file

@ -9,8 +9,6 @@
use applicable_declarations::ApplicableDeclarationList;
#[cfg(feature = "gecko")]
use gecko::selector_parser::PseudoElement;
#[cfg(feature = "servo")]
use heapsize::HeapSizeOf;
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
@ -46,7 +44,7 @@ use thread_state;
/// logs from http://logs.glob.uno/?c=mozilla%23servo&s=3+Apr+2017&e=3+Apr+2017#c644094
/// to se a discussion about the different memory orderings used here.
#[derive(Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct RuleTree {
root: StrongRuleNode,
}
@ -463,7 +461,7 @@ const RULE_TREE_GC_INTERVAL: usize = 300;
/// [1]: https://drafts.csswg.org/css-cascade/#cascade-origin
#[repr(u8)]
#[derive(Clone, Copy, Debug, Eq, PartialEq, PartialOrd)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum CascadeLevel {
/// Normal User-Agent rules.
UANormal = 0,
@ -827,10 +825,7 @@ pub struct StrongRuleNode {
}
#[cfg(feature = "servo")]
impl HeapSizeOf for StrongRuleNode {
fn heap_size_of_children(&self) -> usize { 0 }
}
malloc_size_of_is_0!(StrongRuleNode);
impl StrongRuleNode {
fn new(n: Box<RuleNode>) -> Self {

View file

@ -94,9 +94,7 @@ pub trait SelectorMapEntry : Sized + Clone {
/// * https://bugzilla.mozilla.org/show_bug.cgi?id=681755
///
/// TODO: Tune the initial capacity of the HashMap
#[derive(Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, MallocSizeOf)]
pub struct SelectorMap<T: 'static> {
/// A hash from an ID to rules which contain that ID selector.
pub id_hash: MaybeCaseInsensitiveHashMap<Atom, SmallVec<[T; 1]>>,
@ -465,9 +463,7 @@ fn find_bucket<'a>(mut iter: SelectorIter<'a, SelectorImpl>) -> Bucket<'a> {
}
/// Wrapper for PrecomputedHashMap that does ASCII-case-insensitive lookup in quirks mode.
#[derive(Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, MallocSizeOf)]
pub struct MaybeCaseInsensitiveHashMap<K: PrecomputedHash + Hash + Eq, V: 'static>(PrecomputedDiagnosticHashMap<K, V>);
// FIXME(Manishearth) the 'static bound can be removed when

View file

@ -35,7 +35,7 @@ pub use servo::restyle_damage::ServoRestyleDamage as RestyleDamage;
pub use gecko::restyle_damage::GeckoRestyleDamage as RestyleDamage;
/// Servo's selector parser.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct SelectorParser<'a> {
/// The origin of the stylesheet we're parsing.
pub stylesheet_origin: Origin,
@ -103,8 +103,7 @@ pub enum PseudoElementCascadeType {
}
/// A per-functional-pseudo map, from a given pseudo to a `T`.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(MallocSizeOf)]
pub struct PerPseudoElementMap<T> {
entries: [Option<T>; SIMPLE_PSEUDO_COUNT],
}

View file

@ -27,7 +27,7 @@ use values::specified;
/// is displayed in.
///
/// This is the struct against which media queries are evaluated.
#[derive(HeapSizeOf)]
#[derive(MallocSizeOf)]
pub struct Device {
/// The current media type used by de device.
media_type: MediaType,
@ -44,14 +44,14 @@ pub struct Device {
/// other style being computed at the same time, given we need the style of
/// the parent to compute everything else. So it is correct to just use
/// a relaxed atomic here.
#[ignore_heap_size_of = "Pure stack type"]
#[ignore_malloc_size_of = "Pure stack type"]
root_font_size: AtomicIsize,
/// Whether any styles computed in the document relied on the root font-size
/// by using rem units.
#[ignore_heap_size_of = "Pure stack type"]
#[ignore_malloc_size_of = "Pure stack type"]
used_root_font_size: AtomicBool,
/// Whether any styles computed in the document relied on the viewport size.
#[ignore_heap_size_of = "Pure stack type"]
#[ignore_malloc_size_of = "Pure stack type"]
used_viewport_units: AtomicBool,
}
@ -153,7 +153,7 @@ impl Device {
///
/// Only `pub` for unit testing, please don't use it directly!
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum ExpressionKind {
/// <http://dev.w3.org/csswg/mediaqueries-3/#width>
Width(Range<specified::Length>),
@ -163,7 +163,7 @@ pub enum ExpressionKind {
///
/// <http://dev.w3.org/csswg/mediaqueries-3/#media1>
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct Expression(pub ExpressionKind);
impl Expression {
@ -240,7 +240,7 @@ impl ToCss for Expression {
/// Only public for testing, implementation details of `Expression` may change
/// for Stylo.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum Range<T> {
/// At least the inner value.
Min(T),

View file

@ -8,7 +8,6 @@
#![deny(missing_docs)]
use computed_values::display;
use heapsize::HeapSizeOf;
use matching::{StyleChange, StyleDifference};
use properties::ComputedValues;
use std::fmt;
@ -53,9 +52,7 @@ bitflags! {
}
}
impl HeapSizeOf for ServoRestyleDamage {
fn heap_size_of_children(&self) -> usize { 0 }
}
malloc_size_of_is_0!(ServoRestyleDamage);
impl ServoRestyleDamage {
/// Compute the `StyleDifference` (including the appropriate restyle damage)

View file

@ -30,7 +30,7 @@ use style_traits::{ParseError, StyleParseErrorKind};
///
/// NB: If you add to this list, be sure to update `each_simple_pseudo_element` too.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[allow(missing_docs)]
#[repr(usize)]
pub enum PseudoElement {
@ -251,7 +251,7 @@ pub type PseudoClassStringArg = Box<str>;
/// A non tree-structural pseudo-class.
/// See https://drafts.csswg.org/selectors-4/#structural-pseudos
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[allow(missing_docs)]
pub enum NonTSPseudoClass {
Active,
@ -368,7 +368,7 @@ impl NonTSPseudoClass {
/// The abstract struct we implement the selector parser implementation on top
/// of.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct SelectorImpl;
impl ::selectors::SelectorImpl for SelectorImpl {
@ -601,7 +601,7 @@ impl DerefMut for SnapshotMap {
/// Servo's version of an element snapshot.
#[derive(Debug)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct ServoElementSnapshot {
/// The stored state of the element.
pub state: Option<ElementState>,

View file

@ -22,7 +22,7 @@ use values::computed::{Context, ToComputedValue, ComputedUrl};
///
/// However, this approach is still not necessarily optimal: See
/// <https://bugzilla.mozilla.org/show_bug.cgi?id=1347435#c6>
#[derive(Clone, Debug, Deserialize, HeapSizeOf, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
pub struct SpecifiedUrl {
/// The original URI. This might be optional since we may insert computed
/// values of images into the cascade directly, and we don't bother to
@ -30,6 +30,7 @@ pub struct SpecifiedUrl {
///
/// Refcounted since cloning this should be cheap and data: uris can be
/// really large.
#[ignore_malloc_size_of = "Arc"]
original: Option<Arc<String>>,
/// The resolved value for the url, if valid.

View file

@ -26,10 +26,10 @@ use stylesheets::Origin;
/// but that may not be web-compatible and may need to be changed (at which
/// point Servo could use AtomicRefCell too).
#[derive(Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct SharedRwLock {
#[cfg(feature = "servo")]
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
arc: Arc<RwLock<()>>,
#[cfg(feature = "gecko")]

View file

@ -12,7 +12,7 @@ use std::slice;
use stylesheets::{Origin, OriginSet, OriginSetIterator, PerOrigin, StylesheetInDocument};
/// Entry for a StylesheetSet.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
struct StylesheetSetEntry<S>
where
S: StylesheetInDocument + PartialEq + 'static,
@ -103,7 +103,7 @@ where
/// The validity of the data in a given cascade origin.
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum OriginValidity {
/// The origin is clean, all the data already there is valid, though we may
/// have new sheets at the end.
@ -260,7 +260,7 @@ where
}
}
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
struct SheetCollection<S>
where
S: StylesheetInDocument + PartialEq + 'static,
@ -366,7 +366,7 @@ where
}
/// The set of stylesheets effective for a given document.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct StylesheetSet<S>
where
S: StylesheetInDocument + PartialEq + 'static,

View file

@ -96,9 +96,7 @@ impl DeepCloneWithLock for KeyframesRule {
/// A number from 0 to 1, indicating the percentage of the animation when this
/// keyframe should run.
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd)]
pub struct KeyframePercentage(pub f32);
impl ::std::cmp::Ord for KeyframePercentage {
@ -260,16 +258,14 @@ impl DeepCloneWithLock for Keyframe {
/// declarations to apply.
///
/// TODO: Find a better name for this?
#[derive(Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, MallocSizeOf)]
pub enum KeyframesStepValue {
/// A step formed by a declaration block specified by the CSS.
Declarations {
/// The declaration block per se.
#[cfg_attr(feature = "gecko",
ignore_malloc_size_of = "XXX: Primary ref, measure if DMD says it's worthwhile")]
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
block: Arc<Locked<PropertyDeclarationBlock>>
},
/// A synthetic step computed from the current computed values at the time
@ -278,9 +274,7 @@ pub enum KeyframesStepValue {
}
/// A single step from a keyframe animation.
#[derive(Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, MallocSizeOf)]
pub struct KeyframesStep {
/// The percentage of the animation duration when this step starts.
pub start_percentage: KeyframePercentage,
@ -350,9 +344,7 @@ impl KeyframesStep {
/// of keyframes, in order.
///
/// It only takes into account animable properties.
#[derive(Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, MallocSizeOf)]
pub struct KeyframesAnimation {
/// The difference steps of the animation.
pub steps: Vec<KeyframesStep>,

View file

@ -12,7 +12,7 @@ use std::ops::BitOrAssign;
/// <https://drafts.csswg.org/css-cascade/#cascading-origins>
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[repr(u8)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub enum Origin {
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent>
UserAgent = 1 << 0,
@ -40,7 +40,7 @@ impl Origin {
bitflags! {
/// A set of origins. This is equivalent to Gecko's OriginFlags.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub flags OriginSet: u8 {
/// <https://drafts.csswg.org/css-cascade/#cascade-origin-user-agent>
const ORIGIN_USER_AGENT = Origin::UserAgent as u8,
@ -104,9 +104,7 @@ impl Iterator for OriginSetIterator {
}
/// An object that stores a `T` for each origin of the CSS cascade.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Debug, Default)]
#[derive(Debug, Default, MallocSizeOf)]
pub struct PerOrigin<T> {
/// Data for `Origin::UserAgent`.
pub user_agent: T,

View file

@ -100,9 +100,7 @@ pub enum State {
Body = 4,
}
#[derive(Clone, Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf)]
/// Vendor prefix.
pub enum VendorPrefix {
/// -moz prefix.

View file

@ -38,7 +38,7 @@ pub struct UserAgentStylesheets {
/// A set of namespaces applying to a given stylesheet.
///
/// The namespace id is used in gecko
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug, Default, MallocSizeOf)]
#[allow(missing_docs)]
pub struct Namespaces {
pub default: Option<(Namespace, NamespaceId)>,
@ -275,9 +275,9 @@ impl StylesheetInDocument for Stylesheet {
/// A simple wrapper over an `Arc<Stylesheet>`, with pointer comparison, and
/// suitable for its use in a `StylesheetSet`.
#[derive(Clone)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct DocumentStyleSheet(
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
pub Arc<Stylesheet>
);

View file

@ -78,7 +78,7 @@ macro_rules! declare_viewport_descriptor_inner {
$number_of_variants: expr
) => {
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[allow(missing_docs)]
pub enum ViewportDescriptor {
$(
@ -140,7 +140,7 @@ trait FromMeta: Sized {
/// * http://dev.w3.org/csswg/css-device-adapt/#min-max-width-desc
/// * http://dev.w3.org/csswg/css-device-adapt/#extend-to-zoom
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[allow(missing_docs)]
pub enum ViewportLength {
Specified(LengthOrPercentageOrAuto),
@ -231,7 +231,7 @@ struct ViewportRuleParser<'a, 'b: 'a> {
}
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[allow(missing_docs)]
pub struct ViewportDescriptorDeclaration {
pub origin: Origin,
@ -330,7 +330,7 @@ impl<'a, 'b, 'i> DeclarationParser<'i> for ViewportRuleParser<'a, 'b> {
/// A `@viewport` rule.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct ViewportRule {
/// The declarations contained in this @viewport rule.
pub declarations: Vec<ViewportDescriptorDeclaration>

View file

@ -182,11 +182,11 @@ impl UserAgentCascadeData {
/// All the computed information for a stylesheet.
#[derive(Default)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
struct DocumentCascadeData {
#[cfg_attr(
feature = "servo",
ignore_heap_size_of = "Arc, owned by UserAgentCascadeDataCache"
ignore_malloc_size_of = "Arc, owned by UserAgentCascadeDataCache"
)]
user_agent: Arc<UserAgentCascadeData>,
user: CascadeData,
@ -338,7 +338,7 @@ impl DocumentCascadeData {
/// A wrapper over a StylesheetSet that can be `Sync`, since it's only used and
/// exposed via mutable methods in the `Stylist`.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
struct StylistStylesheetSet(StylesheetSet<StylistSheet>);
// Read above to see why this is fine.
unsafe impl Sync for StylistStylesheetSet {}
@ -370,7 +370,7 @@ impl ops::DerefMut for StylistStylesheetSet {
///
/// This structure is effectively created once per pipeline, in the
/// LayoutThread corresponding to that pipeline.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct Stylist {
/// Device that the stylist is currently evaluating against.
///
@ -393,7 +393,7 @@ pub struct Stylist {
stylesheets: StylistStylesheetSet,
/// If true, the quirks-mode stylesheet is applied.
#[cfg_attr(feature = "servo", ignore_heap_size_of = "defined in selectors")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "defined in selectors")]
quirks_mode: QuirksMode,
/// Selector maps for all of the style sheets in the stylist, after
@ -1517,7 +1517,7 @@ impl Stylist {
/// This struct holds data which users of Stylist may want to extract
/// from stylesheets which can be done at the same time as updating.
#[derive(Debug, Default)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct ExtraStyleData {
/// A list of effective font-face rules and their origin.
#[cfg(feature = "gecko")]
@ -1783,7 +1783,7 @@ impl<'a> SelectorVisitor for StylistSelectorVisitor<'a> {
///
/// FIXME(emilio): Consider renaming and splitting in `CascadeData` and
/// `InvalidationData`? That'd make `clear_cascade_data()` clearer.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Debug)]
struct CascadeData {
/// Rules from stylesheets at this `CascadeData`'s origin.
@ -1808,7 +1808,7 @@ struct CascadeData {
/// to avoid taking element snapshots when an irrelevant attribute changes.
/// (We don't bother storing the namespace, since namespaced attributes
/// are rare.)
#[cfg_attr(feature = "servo", ignore_heap_size_of = "just an array")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "just an array")]
attribute_dependencies: NonCountingBloomFilter,
/// Whether `"style"` appears in an attribute selector. This is not common,
@ -1828,13 +1828,13 @@ struct CascadeData {
/// hence in our selector maps). Used to determine when sharing styles is
/// safe: we disallow style sharing for elements whose id matches this
/// filter, and hence might be in one of our selector maps.
#[cfg_attr(feature = "servo", ignore_heap_size_of = "just an array")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "just an array")]
mapped_ids: NonCountingBloomFilter,
/// Selectors that require explicit cache revalidation (i.e. which depend
/// on state that is not otherwise visible to the cache, like attributes or
/// tree-structural state like child index and pseudos).
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
selectors_for_cache_revalidation: SelectorMap<RevalidationSelectorAndHashes>,
/// Effective media query results cached from the last rebuild.
@ -2251,21 +2251,16 @@ impl Default for CascadeData {
/// A rule, that wraps a style rule, but represents a single selector of the
/// rule.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug)]
#[derive(Clone, Debug, MallocSizeOf)]
pub struct Rule {
/// The selector this struct represents. We store this and the
/// any_{important,normal} booleans inline in the Rule to avoid
/// pointer-chasing when gathering applicable declarations, which
/// can ruin performance when there are a lot of rules.
#[cfg_attr(feature = "gecko",
ignore_malloc_size_of = "CssRules have primary refs, we measure there")]
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[ignore_malloc_size_of = "CssRules have primary refs, we measure there"]
pub selector: Selector<SelectorImpl>,
/// The ancestor hashes associated with the selector.
#[cfg_attr(feature = "servo", ignore_heap_size_of = "No heap data")]
pub hashes: AncestorHashes,
/// The source order this style rule appears in. Note that we only use
@ -2277,7 +2272,7 @@ pub struct Rule {
#[cfg_attr(feature = "gecko",
ignore_malloc_size_of =
"Secondary ref. Primary ref is in StyleRule under Stylesheet.")]
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
pub style_rule: Arc<Locked<StyleRule>>,
}

View file

@ -11,7 +11,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
///
/// Unlike in computed values, each component value may exceed the
/// range `[0.0, 1.0]`.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedZero)]
pub struct RGBA {
/// The red component.
@ -70,7 +70,7 @@ impl ComputeSquaredDistance for RGBA {
}
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct Color {
pub color: RGBA,

View file

@ -28,7 +28,7 @@ pub type TextShadowList = ShadowList<SimpleShadow>;
/// An animated value for shadow lists.
///
/// <https://drafts.csswg.org/css-transitions/#animtype-shadow-list>
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Debug, PartialEq)]
pub struct ShadowList<Shadow>(Vec<Shadow>);
@ -36,7 +36,7 @@ pub struct ShadowList<Shadow>(Vec<Shadow>);
pub type BoxShadow = GenericBoxShadow<Option<RGBA>, Length, NonNegativeLength, Length>;
/// An animated value for the `filter` property.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Debug, PartialEq)]
pub struct FilterList(pub Vec<Filter>);

View file

@ -14,9 +14,8 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
/// A computed angle.
#[animate(fallback = "Self::animate_fallback")]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Animate, Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, Copy, Debug, MallocSizeOf, PartialEq)]
#[derive(PartialOrd, ToAnimatedZero)]
pub enum Angle {
/// An angle with degree unit.

View file

@ -14,9 +14,7 @@ use values::animated::color::{Color as AnimatedColor, RGBA as AnimatedRGBA};
/// the current foreground color (currentcolor keyword).
/// Conceptually, the formula is "color * (1 - p) + currentcolor * p"
/// where p is foreground_ratio.
#[derive(Clone, Copy, Debug)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf)]
pub struct Color {
/// RGBA color.
pub color: RGBA,

View file

@ -11,10 +11,8 @@ use values::animated::ToAnimatedValue;
use values::computed::NonNegativeLength;
use values::specified::font as specified;
#[derive(Animate, ComputeSquaredDistance, ToAnimatedZero)]
#[derive(Animate, ComputeSquaredDistance, MallocSizeOf, ToAnimatedZero)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
/// The computed value of font-size
pub struct FontSize {
/// The size.
@ -23,10 +21,8 @@ pub struct FontSize {
pub keyword_info: Option<KeywordInfo>,
}
#[derive(Animate, ComputeSquaredDistance, ToAnimatedValue, ToAnimatedZero)]
#[derive(Animate, ComputeSquaredDistance, MallocSizeOf, ToAnimatedValue, ToAnimatedZero)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
/// Additional information for keyword-derived font sizes.
pub struct KeywordInfo {
/// The keyword used

View file

@ -51,9 +51,7 @@ pub type GradientKind = GenericGradientKind<
>;
/// A computed gradient line direction.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub enum LineDirection {
/// An angle.
Angle(Angle),

View file

@ -66,9 +66,7 @@ impl ToComputedValue for specified::Length {
}
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedZero)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedZero)]
pub struct CalcLengthOrPercentage {
#[animation(constant)]
pub clamping_mode: AllowedNumericType,
@ -294,10 +292,8 @@ impl ToComputedValue for specified::CalcLengthOrPercentage {
#[allow(missing_docs)]
#[animate(fallback = "Self::animate_fallback")]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[css(derive_debug)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, PartialEq)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq)]
#[derive(ToAnimatedZero, ToCss)]
#[distance(fallback = "Self::compute_squared_distance_fallback")]
pub enum LengthOrPercentage {
@ -452,10 +448,8 @@ impl ToComputedValue for specified::LengthOrPercentage {
#[allow(missing_docs)]
#[animate(fallback = "Self::animate_fallback")]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[css(derive_debug)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, PartialEq, ToCss)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq, ToCss)]
#[distance(fallback = "Self::compute_squared_distance_fallback")]
pub enum LengthOrPercentageOrAuto {
Length(Length),
@ -549,7 +543,7 @@ impl ToComputedValue for specified::LengthOrPercentageOrAuto {
#[allow(missing_docs)]
#[animate(fallback = "Self::animate_fallback")]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[css(derive_debug)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, PartialEq, ToCss)]
#[distance(fallback = "Self::compute_squared_distance_fallback")]
@ -684,9 +678,8 @@ impl NonNegativeLengthOrPercentage {
}
/// The computed `<length>` value.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, PartialOrd)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd)]
#[derive(ToAnimatedValue, ToAnimatedZero)]
pub struct CSSPixelLength(CSSFloat);
@ -850,7 +843,7 @@ pub type NonNegativeLengthOrNumber = Either<NonNegativeLength, NonNegativeNumber
/// A value suitable for a `min-width`, `min-height`, `width` or `height` property.
/// See values/specified/length.rs for more details.
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
#[derive(ToAnimatedZero, ToCss)]
pub enum MozLength {
@ -900,7 +893,7 @@ impl ToComputedValue for specified::MozLength {
/// A value suitable for a `max-width` or `max-height` property.
/// See values/specified/length.rs for more details.
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToCss)]
pub enum MaxLength {
LengthOrPercentageOrNone(LengthOrPercentageOrNone),

View file

@ -397,9 +397,7 @@ impl From<GreaterThanOrEqualToOneNumber> for CSSFloat {
}
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToCss)]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum NumberOrPercentage {
Percentage(Percentage),
Number(Number),
@ -468,7 +466,7 @@ pub type LengthOrPercentageOrNumber = Either<Number, LengthOrPercentage>;
pub type NonNegativeLengthOrPercentageOrNumber = Either<NonNegativeNumber, NonNegativeLengthOrPercentage>;
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
/// A computed cliprect for clip and image-region
pub struct ClipRect {
@ -550,10 +548,10 @@ pub type ColorOrAuto = Either<Color, Auto>;
/// The computed value of a CSS `url()`, resolved relative to the stylesheet URL.
#[cfg(feature = "servo")]
#[derive(Clone, Debug, Deserialize, HeapSizeOf, PartialEq, Serialize)]
#[derive(Clone, Debug, Deserialize, MallocSizeOf, PartialEq, Serialize)]
pub enum ComputedUrl {
/// The `url()` was invalid or it wasn't specified by the user.
Invalid(Arc<String>),
Invalid(#[ignore_malloc_size_of = "Arc"] Arc<String>),
/// The resolved `url()` relative to the stylesheet URL.
Valid(ServoUrl),
}

View file

@ -9,9 +9,8 @@ use style_traits::ToCss;
use values::{CSSFloat, serialize_percentage};
/// A computed percentage.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Default)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Default, MallocSizeOf)]
#[derive(PartialEq, PartialOrd, ToAnimatedZero)]
pub struct Percentage(pub CSSFloat);

View file

@ -9,9 +9,8 @@ use style_traits::ToCss;
use values::CSSFloat;
/// A computed `<time>` value.
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct Time {
seconds: CSSFloat,
}

View file

@ -5,10 +5,8 @@
//! Generic types for CSS values related to backgrounds.
/// A generic value for the `background-size` property.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(PartialEq, ToComputedValue, ToCss)]
#[derive(MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum BackgroundSize<LengthOrPercentageOrAuto> {
/// `<width> <height>`
Explicit {

View file

@ -18,9 +18,7 @@ pub type ClippingShape<BasicShape, Url> = ShapeSource<BasicShape, GeometryBox, U
/// <https://drafts.fxtf.org/css-masking-1/#typedef-geometry-box>
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum GeometryBox {
FillBox,
StrokeBox,
@ -42,9 +40,7 @@ add_impls_for_keyword_enum!(ShapeBox);
/// A shape source, for some reference box.
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Animate, Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum ShapeSource<BasicShape, ReferenceBox, Url> {
#[animation(error)]
Url(Url),
@ -60,9 +56,7 @@ pub enum ShapeSource<BasicShape, ReferenceBox, Url> {
}
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq)]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq)]
#[derive(ToComputedValue, ToCss)]
pub enum BasicShape<H, V, LengthOrPercentage> {
Inset(InsetRect<LengthOrPercentage>),
@ -73,9 +67,7 @@ pub enum BasicShape<H, V, LengthOrPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-inset>
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq, ToComputedValue)]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct InsetRect<LengthOrPercentage> {
pub rect: Rect<LengthOrPercentage>,
pub round: Option<BorderRadius<LengthOrPercentage>>,
@ -83,9 +75,7 @@ pub struct InsetRect<LengthOrPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToComputedValue)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct Circle<H, V, LengthOrPercentage> {
pub position: Position<H, V>,
pub radius: ShapeRadius<LengthOrPercentage>,
@ -93,9 +83,7 @@ pub struct Circle<H, V, LengthOrPercentage> {
/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToComputedValue)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct Ellipse<H, V, LengthOrPercentage> {
pub position: Position<H, V>,
pub semiaxis_x: ShapeRadius<LengthOrPercentage>,
@ -104,9 +92,7 @@ pub struct Ellipse<H, V, LengthOrPercentage> {
/// <https://drafts.csswg.org/css-shapes/#typedef-shape-radius>
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq)]
#[derive(ToComputedValue, ToCss)]
pub enum ShapeRadius<LengthOrPercentage> {
Length(LengthOrPercentage),
@ -116,12 +102,10 @@ pub enum ShapeRadius<LengthOrPercentage> {
FarthestSide,
}
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
/// A generic type for representing the `polygon()` function
///
/// <https://drafts.csswg.org/css-shapes/#funcdef-polygon>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct Polygon<LengthOrPercentage> {
/// The filling rule for a polygon.
pub fill: FillRule,

View file

@ -10,9 +10,7 @@ use values::generics::rect::Rect;
use values::generics::size::Size;
/// A generic value for a single side of a `border-image-width` property.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
/// `<length-or-percentage>`
Length(LengthOrPercentage),
@ -23,9 +21,7 @@ pub enum BorderImageSideWidth<LengthOrPercentage, Number> {
}
/// A generic value for the `border-image-slice` property.
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct BorderImageSlice<NumberOrPercentage> {
/// The offsets.
pub offsets: Rect<NumberOrPercentage>,
@ -34,10 +30,8 @@ pub struct BorderImageSlice<NumberOrPercentage> {
}
/// A generic value for the `border-*-radius` longhand properties.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(PartialEq, ToComputedValue, ToCss)]
#[derive(MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub struct BorderCornerRadius<L>(pub Size<L>);
impl<L> BorderCornerRadius<L> {
@ -48,9 +42,7 @@ impl<L> BorderCornerRadius<L> {
}
/// A generic value for the `border-spacing` property.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
#[derive(PartialEq, ToAnimatedValue, ToComputedValue, ToCss)]
pub struct BorderSpacing<L>(pub Size<L>);
@ -64,10 +56,8 @@ impl<L> BorderSpacing<L> {
/// A generic value for `border-radius`, `outline-radius` and `inset()`.
///
/// <https://drafts.csswg.org/css-backgrounds-3/#border-radius>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(PartialEq, ToComputedValue)]
#[derive(MallocSizeOf, PartialEq, ToComputedValue)]
pub struct BorderRadius<LengthOrPercentage> {
/// The top left radius.
pub top_left: BorderCornerRadius<LengthOrPercentage>,

View file

@ -7,9 +7,7 @@
use values::animated::ToAnimatedZero;
/// A generic value for the `vertical-align` property.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq)]
#[derive(ToComputedValue, ToCss)]
pub enum VerticalAlign<LengthOrPercentage> {
/// `baseline`

View file

@ -10,9 +10,7 @@ use style_traits::values::{SequenceWriter, ToCss};
use values::specified::url::SpecifiedUrl;
/// A generic value for a single `box-shadow`.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, Debug, PartialEq)]
#[derive(Animate, Clone, Debug, MallocSizeOf, PartialEq)]
#[derive(ToAnimatedValue, ToAnimatedZero)]
pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
/// The base shadow.
@ -25,9 +23,8 @@ pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
}
/// A generic value for a single `filter`.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
#[derive(Clone, Debug, PartialEq, ToAnimatedValue, ToComputedValue, ToCss)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToAnimatedValue, ToComputedValue, ToCss)]
pub enum Filter<Angle, Factor, Length, DropShadow> {
/// `blur(<length>)`
#[css(function)]
@ -68,10 +65,8 @@ pub enum Filter<Angle, Factor, Length, DropShadow> {
///
/// Contrary to the canonical order from the spec, the color is serialised
/// first, like in Gecko and Webkit.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug)]
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToCss)]
#[derive(MallocSizeOf, PartialEq, ToAnimatedValue, ToAnimatedZero, ToCss)]
pub struct SimpleShadow<Color, SizeLength, ShapeLength> {
/// Color.
pub color: Color,

View file

@ -7,7 +7,7 @@
use values::computed::Percentage;
/// A generic value for the `flex-basis` property.
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
pub enum FlexBasis<LengthOrPercentage> {
/// `auto`

View file

@ -17,9 +17,7 @@ use values::specified::grid::parse_line_names;
/// A `<grid-line>` type.
///
/// <https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Default, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct GridLine<Integer> {
/// Flag to check whether it's a `span` keyword.
pub is_span: bool,
@ -145,9 +143,7 @@ add_impls_for_keyword_enum!(TrackKeyword);
/// avoid re-implementing it for the computed type.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-breadth>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum TrackBreadth<L> {
/// The generic type is almost always a non-negative `<length-percentage>`
Breadth(L),
@ -184,9 +180,7 @@ impl<L: ToCss> ToCss for TrackBreadth<L> {
/// generic only to avoid code bloat. It only takes `<length-percentage>`
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-size>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum TrackSize<L> {
/// A flexible `<track-breadth>`
Breadth(TrackBreadth<L>),
@ -348,9 +342,7 @@ where
/// The initial argument of the `repeat` function.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum RepeatCount<Integer> {
/// A positive integer. This is allowed only for `<track-repeat>` and `<fixed-repeat>`
Number(Integer),
@ -382,9 +374,7 @@ impl Parse for RepeatCount<specified::Integer> {
///
/// It can also hold `repeat()` function parameters, which expands into the respective
/// values in its computed form.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct TrackRepeat<L, I> {
/// The number of times for the value to be repeated (could also be `auto-fit` or `auto-fill`)
pub count: RepeatCount<I>,
@ -465,9 +455,7 @@ impl<L: Clone> TrackRepeat<L, specified::Integer> {
}
/// Track list values. Can be <track-size> or <track-repeat>
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum TrackListValue<LengthOrPercentage, Integer> {
/// A <track-size> value.
TrackSize(TrackSize<LengthOrPercentage>),
@ -478,9 +466,7 @@ pub enum TrackListValue<LengthOrPercentage, Integer> {
/// The type of a `<track-list>` as determined during parsing.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum TrackListType {
/// [`<auto-track-list>`](https://drafts.csswg.org/css-grid/#typedef-auto-track-list)
///
@ -502,9 +488,7 @@ pub enum TrackListType {
/// A grid `<track-list>` type.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub struct TrackList<LengthOrPercentage, Integer> {
/// The type of this `<track-list>` (auto, explicit or general).
///
@ -571,9 +555,7 @@ impl<L: ToCss, I: ToCss> ToCss for TrackList<L, I> {
///
/// `subgrid [ <line-names> | repeat(<positive-integer> | auto-fill, <line-names>+) ]+`
/// Old spec: https://www.w3.org/TR/2015/WD-css-grid-1-20150917/#typedef-line-name-list
#[derive(Clone, Debug, Default, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq)]
pub struct LineNameList {
/// The optional `<line-name-list>`
pub names: Box<[Box<[CustomIdent]>]>,
@ -668,9 +650,7 @@ impl ToCss for LineNameList {
/// Variants for `<grid-template-rows> | <grid-template-columns>`
/// Subgrid deferred to Level 2 spec due to lack of implementation.
/// But it's implemented in gecko, so we have to as well.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum GridTemplateComponent<L, I> {
/// `none` value.
None,

View file

@ -16,9 +16,7 @@ use style_traits::ToCss;
/// An [image].
///
/// [image]: https://drafts.csswg.org/css-images/#image-values
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, PartialEq, ToComputedValue)]
#[derive(Clone, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum Image<Gradient, MozImageRect, ImageUrl> {
/// A `<url()>` image.
Url(ImageUrl),
@ -37,9 +35,7 @@ pub enum Image<Gradient, MozImageRect, ImageUrl> {
/// A CSS gradient.
/// <https://drafts.csswg.org/css-images/#gradients>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color, Angle> {
/// Gradients can be linear or radial.
pub kind: GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle>,
@ -53,9 +49,7 @@ pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color,
pub compat_mode: CompatMode,
}
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
pub enum CompatMode {
/// Modern syntax.
@ -67,9 +61,7 @@ pub enum CompatMode {
}
/// A gradient kind.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle> {
/// A linear gradient.
Linear(LineDirection),
@ -78,9 +70,7 @@ pub enum GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle
}
/// A radial gradient's ending shape.
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum EndingShape<Length, LengthOrPercentage> {
/// A circular gradient.
Circle(Circle<Length>),
@ -89,9 +79,7 @@ pub enum EndingShape<Length, LengthOrPercentage> {
}
/// A circle shape.
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub enum Circle<Length> {
/// A circle radius.
Radius(Length),
@ -100,9 +88,7 @@ pub enum Circle<Length> {
}
/// An ellipse shape.
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum Ellipse<LengthOrPercentage> {
/// An ellipse pair of radii.
Radii(LengthOrPercentage, LengthOrPercentage),
@ -123,9 +109,7 @@ add_impls_for_keyword_enum!(ShapeExtent);
/// A gradient item.
/// <https://drafts.csswg.org/css-images-4/#color-stop-syntax>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum GradientItem<Color, LengthOrPercentage> {
/// A color stop.
ColorStop(ColorStop<Color, LengthOrPercentage>),
@ -135,9 +119,7 @@ pub enum GradientItem<Color, LengthOrPercentage> {
/// A color stop.
/// <https://drafts.csswg.org/css-images/#typedef-color-stop-list>
#[derive(Clone, Copy, PartialEq, ToComputedValue, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub struct ColorStop<Color, LengthOrPercentage> {
/// The color of this stop.
pub color: Color,
@ -148,13 +130,13 @@ pub struct ColorStop<Color, LengthOrPercentage> {
/// Specified values for a paint worklet.
/// <https://drafts.css-houdini.org/css-paint-api/>
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
pub struct PaintWorklet {
/// The name the worklet was registered with.
pub name: Atom,
/// The arguments for the worklet.
/// TODO: store a parsed representation of the arguments.
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
#[cfg_attr(feature = "servo", ignore_malloc_size_of = "Arc")]
pub arguments: Vec<Arc<custom_properties::SpecifiedValue>>,
}
@ -176,10 +158,8 @@ impl ToCss for PaintWorklet {
///
/// `-moz-image-rect(<uri>, top, right, bottom, left);`
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[css(comma, function)]
#[derive(Clone, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub struct MozImageRect<NumberOrPercentage, MozImageRectUrl> {
pub url: MozImageRectUrl,
pub top: NumberOrPercentage,

View file

@ -131,9 +131,7 @@ impl Parse for CounterStyleOrNone {
///
/// For font-feature-settings, this is a tag and an integer,
/// for font-variation-settings this is a tag and a float
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct FontSettingTag<T> {
/// A four-character tag, packed into a u32 (one byte per character)
pub tag: u32,
@ -190,9 +188,7 @@ impl<T: Parse> Parse for FontSettingTag<T> {
/// A font settings value for font-variation-settings or font-feature-settings
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum FontSettings<T> {
/// No settings (default)
Normal,
@ -215,18 +211,15 @@ impl<T: Parse> Parse for FontSettings<T> {
///
/// Do not use this type anywhere except within FontSettings
/// because it serializes with the preceding space
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct FontSettingTagInt(pub u32);
/// A number value to be used for font-variation-settings
///
/// Do not use this type anywhere except within FontSettings
/// because it serializes with the preceding space
#[cfg_attr(feature = "gecko", derive(Animate, ComputeSquaredDistance, MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(Animate, ComputeSquaredDistance))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct FontSettingTagFloat(pub f32);
impl ToCss for FontSettingTagInt {
@ -279,15 +272,13 @@ impl ToCss for FontSettingTagFloat {
}
/// A wrapper of Non-negative values.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
pub struct NonNegative<T>(pub T);
/// A wrapper of greater-than-or-equal-to-one values.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
#[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)]
pub struct GreaterThanOrEqualToOne<T>(pub T);

View file

@ -6,10 +6,8 @@
//! [`position`](https://drafts.csswg.org/css-backgrounds-3/#position)
/// A generic type for representing a CSS [position](https://drafts.csswg.org/css-values/#position).
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(PartialEq, ToAnimatedZero, ToComputedValue)]
#[derive(MallocSizeOf, PartialEq, ToAnimatedZero, ToComputedValue)]
pub struct Position<H, V> {
/// The horizontal component of position.
pub horizontal: H,

View file

@ -11,10 +11,8 @@ use style_traits::{ToCss, ParseError};
/// A CSS value made of four components, where its `ToCss` impl will try to
/// serialize as few components as possible, like for example in `border-width`.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(PartialEq, ToComputedValue)]
#[derive(MallocSizeOf, PartialEq, ToComputedValue)]
pub struct Rect<T>(pub T, pub T, pub T, pub T);
impl<T> Rect<T> {

View file

@ -13,10 +13,8 @@ use values::animated::ToAnimatedValue;
/// A generic size, for `border-*-radius` longhand properties, or
/// `border-spacing`.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(PartialEq, ToComputedValue)]
#[derive(MallocSizeOf, PartialEq, ToComputedValue)]
pub struct Size<L>(pub Size2D<L>);
impl<L> Size<L> {

View file

@ -16,9 +16,7 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
/// An SVG paint value
///
/// <https://www.w3.org/TR/SVG2/painting.html#SpecifyingPaint>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq)]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq)]
#[derive(ToAnimatedValue, ToComputedValue, ToCss)]
pub struct SVGPaint<ColorType, UrlPaintServer> {
/// The paint source
@ -32,9 +30,7 @@ pub struct SVGPaint<ColorType, UrlPaintServer> {
/// Whereas the spec only allows PaintServer
/// to have a fallback, Gecko lets the context
/// properties have a fallback as well.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, PartialEq)]
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq)]
#[derive(ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
pub enum SVGPaintKind<ColorType, UrlPaintServer> {
/// `none`
@ -111,9 +107,7 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP
/// A value of <length> | <percentage> | <number> for svg which allow unitless length.
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeProperties>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToAnimatedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue)]
#[derive(ToAnimatedZero, ToComputedValue, ToCss)]
pub enum SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number> {
/// <length> | <percentage>
@ -194,9 +188,7 @@ impl <LengthOrPercentageType: Parse, NumberType: Parse> Parse for
}
/// An SVG length value supports `context-value` in addition to length.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, PartialEq)]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq)]
#[derive(ToAnimatedValue, ToAnimatedZero)]
#[derive(ToComputedValue, ToCss)]
pub enum SVGLength<LengthType> {
@ -207,9 +199,8 @@ pub enum SVGLength<LengthType> {
}
/// Generic value for stroke-dasharray.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, ComputeSquaredDistance, Debug, PartialEq, ToAnimatedValue, ToComputedValue)]
#[derive(Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq, ToAnimatedValue,
ToComputedValue)]
pub enum SVGStrokeDashArray<LengthType> {
/// `[ <length> | <percentage> | <number> ]#`
Values(Vec<LengthType>),
@ -242,9 +233,7 @@ impl<LengthType> ToCss for SVGStrokeDashArray<LengthType> where LengthType: ToCs
/// An SVG opacity value accepts `context-{fill,stroke}-opacity` in
/// addition to opacity value.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf)]
#[derive(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
pub enum SVGOpacity<OpacityType> {
/// `<opacity-value>`

View file

@ -12,9 +12,7 @@ use values::animated::{Animate, Procedure, ToAnimatedZero};
use values::distance::{ComputeSquaredDistance, SquaredDistance};
/// A generic value for the `initial-letter` property.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum InitialLetter<Number, Integer> {
/// `normal`
Normal,
@ -31,9 +29,7 @@ impl<N, I> InitialLetter<N, I> {
}
/// A generic spacing value for the `letter-spacing` and `word-spacing` properties.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
pub enum Spacing<Value> {
/// `normal`
Normal,
@ -111,10 +107,8 @@ where
}
/// A generic value for the `line-height` property.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(PartialEq, ToAnimatedValue, ToCss)]
#[derive(MallocSizeOf, PartialEq, ToAnimatedValue, ToCss)]
pub enum LineHeight<Number, LengthOrPercentage> {
/// `normal`
Normal,

View file

@ -10,9 +10,7 @@ use values::CSSFloat;
/// A generic 2D transformation matrix.
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[css(comma, function)]
pub struct Matrix<T, U = T> {
pub a: T,
@ -24,10 +22,8 @@ pub struct Matrix<T, U = T> {
}
/// A generic transform origin.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug)]
#[derive(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
#[derive(MallocSizeOf, PartialEq, ToAnimatedZero, ToComputedValue, ToCss)]
pub struct TransformOrigin<H, V, Depth> {
/// The horizontal origin.
pub horizontal: H,
@ -40,9 +36,7 @@ pub struct TransformOrigin<H, V, Depth> {
/// A generic timing function.
///
/// <https://drafts.csswg.org/css-timing-1/#single-timing-function-production>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub enum TimingFunction<Integer, Number> {
/// `linear | ease | ease-in | ease-out | ease-in-out`
Keyword(TimingKeyword),

View file

@ -50,7 +50,7 @@ pub fn serialize_dimension<W>(value: CSSFloat, unit: &str, dest: &mut W)
}
/// Convenience void type to disable some properties and values through types.
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
#[cfg_attr(feature = "servo", derive(Deserialize, MallocSizeOf, Serialize))]
#[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)]
pub enum Impossible {}
@ -64,9 +64,7 @@ impl Parse for Impossible {
}
/// A struct representing one of two kinds of values.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf)]
#[derive(PartialEq, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)]
pub enum Either<A, B> {
/// The first value.
@ -96,9 +94,7 @@ impl<A: Parse, B: Parse> Parse for Either<A, B> {
}
/// <https://drafts.csswg.org/css-values-4/#custom-idents>
#[derive(Clone, Debug, Eq, Hash, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct CustomIdent(pub Atom);
impl CustomIdent {
@ -127,9 +123,7 @@ impl ToCss for CustomIdent {
}
/// <https://drafts.csswg.org/css-animations/#typedef-keyframes-name>
#[derive(Clone, Debug, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, ToComputedValue)]
pub enum KeyframesName {
/// <custom-ident>
Ident(CustomIdent),

View file

@ -115,9 +115,8 @@ const ALIGN_ALL_SHIFT: u32 = structs::NS_STYLE_ALIGN_ALL_SHIFT;
///
/// The 16-bit field stores the primary value in its lower 8 bits, and the optional fallback value
/// in its upper 8 bits. This matches the representation of these properties in Gecko.
#[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct AlignJustifyContent(u16);
impl AlignJustifyContent {

View file

@ -19,9 +19,8 @@ use values::specified::calc::CalcNode;
/// Computed angles are essentially same as specified ones except for `calc()`
/// value serialization. Therefore we are storing a computed angle inside
/// to hold the actual value and its unit.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub struct Angle {
value: ComputedAngle,
was_calc: bool,

View file

@ -19,9 +19,7 @@ use values::specified::{AllowQuirks, Number, NumberOrPercentage};
use values::specified::length::{Length, LengthOrPercentage, NonNegativeLength};
/// A specified value for a single side of the `border-width` property.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum BorderSideWidth {
/// `thin`
Thin,

View file

@ -63,9 +63,7 @@ pub enum CalcUnit {
}
/// A struct to hold a simplified `<length>` or `<percentage>` expression.
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq)]
#[allow(missing_docs)]
pub struct CalcLengthOrPercentage {
pub clamping_mode: AllowedNumericType,

View file

@ -18,9 +18,7 @@ use super::AllowQuirks;
use values::computed::{Color as ComputedColor, Context, ToComputedValue};
/// Specified color value
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum Color {
/// The 'currentColor' keyword
CurrentColor,
@ -336,9 +334,7 @@ impl ToComputedValue for Color {
/// Specified color value, but resolved to just RGBA for computed value
/// with value from color property at the same context.
#[derive(Clone, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct RGBAColor(pub Color);

View file

@ -35,9 +35,7 @@ pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, SimpleShadow>;
pub type Filter = GenericFilter<Angle, Factor, NonNegativeLength, Impossible>;
/// A value for the `<factor>` parts in `Filter`.
#[derive(Clone, Debug, PartialEq, ToCss)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct Factor(NumberOrPercentage);
impl Factor {

View file

@ -15,9 +15,7 @@ use values::computed::{font as computed, Context, NonNegativeLength, ToComputedV
use values::specified::{LengthOrPercentage, NoCalcLength};
use values::specified::length::FontBaseSize;
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
/// A specified font-size value
pub enum FontSize {
/// A length; e.g. 10px.
@ -60,10 +58,8 @@ impl From<LengthOrPercentage> for FontSize {
}
/// CSS font keywords
#[derive(Animate, ComputeSquaredDistance, ToAnimatedValue, ToAnimatedZero)]
#[derive(Animate, ComputeSquaredDistance, MallocSizeOf, ToAnimatedValue, ToAnimatedZero)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[allow(missing_docs)]
pub enum KeywordSize {
XXSmall = 1, // This is to enable the NonZero optimization

View file

@ -90,7 +90,7 @@ pub fn parse_line_names<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Box<[Custo
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
enum RepeatType {
/// [`<auto-repeat>`](https://drafts.csswg.org/css-grid/#typedef-auto-repeat)
Auto,

View file

@ -85,9 +85,7 @@ pub type GradientKind = GenericGradientKind<
>;
/// A specified gradient line direction.
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
pub enum LineDirection {
/// An angular direction.
Angle(Angle),

View file

@ -52,9 +52,7 @@ pub fn au_to_int_px(au: f32) -> i32 {
(au / AU_PER_PX).round() as i32
}
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
/// A font relative length.
pub enum FontRelativeLength {
/// A "em" value: https://drafts.csswg.org/css-values/#em
@ -208,9 +206,7 @@ impl FontRelativeLength {
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
/// A viewport-relative length.
///
/// <https://drafts.csswg.org/css-values/#viewport-relative-lengths>
@ -259,9 +255,7 @@ impl ViewportPercentageLength {
}
/// HTML5 "character width", as defined in HTML5 § 14.5.4.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub struct CharacterWidth(pub i32);
impl CharacterWidth {
@ -279,9 +273,7 @@ impl CharacterWidth {
}
/// Represents an absolute length with its unit
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub enum AbsoluteLength {
/// An absolute length in pixels (px)
Px(CSSFloat),
@ -441,9 +433,7 @@ impl Mul<CSSFloat> for PhysicalLength {
/// A `<length>` without taking `calc` expressions into account
///
/// <https://drafts.csswg.org/css-values/#lengths>
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub enum NoCalcLength {
/// An absolute length
///
@ -582,9 +572,7 @@ impl NoCalcLength {
/// This is commonly used for the `<length>` values.
///
/// <https://drafts.csswg.org/css-values/#lengths>
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum Length {
/// The internal length type that cannot parse `calc`
NoCalc(NoCalcLength),
@ -798,9 +786,7 @@ pub type NonNegativeLengthOrNumber = Either<NonNegativeLength, NonNegativeNumber
/// A length or a percentage value.
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum LengthOrPercentage {
Length(NoCalcLength),
Percentage(computed::Percentage),
@ -970,9 +956,7 @@ impl LengthOrPercentage {
/// Either a `<length>`, a `<percentage>`, or the `auto` keyword.
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum LengthOrPercentageOrAuto {
Length(NoCalcLength),
Percentage(computed::Percentage),
@ -1088,9 +1072,7 @@ impl LengthOrPercentageOrAuto {
}
/// Either a `<length>`, a `<percentage>`, or the `none` keyword.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
#[allow(missing_docs)]
pub enum LengthOrPercentageOrNone {
Length(NoCalcLength),
@ -1238,9 +1220,7 @@ impl LengthOrNumber {
/// Unlike `max-width` or `max-height` properties, a MozLength can be
/// `auto`, and cannot be `none`.
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum MozLength {
LengthOrPercentageOrAuto(LengthOrPercentageOrAuto),
ExtremumLength(ExtremumLength),
@ -1265,9 +1245,7 @@ impl MozLength {
/// A value suitable for a `max-width` or `max-height` property.
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum MaxLength {
LengthOrPercentageOrNone(LengthOrPercentageOrNone),
ExtremumLength(ExtremumLength),

View file

@ -176,9 +176,7 @@ impl BorderStyle {
}
}
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd)]
#[allow(missing_docs)]
pub struct Number {
/// The numeric value itself.
@ -294,9 +292,7 @@ impl Parse for GreaterThanOrEqualToOneNumber {
///
/// FIXME(emilio): Should probably use Either.
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum NumberOrPercentage {
Percentage(Percentage),
Number(Number),
@ -330,9 +326,7 @@ impl Parse for NumberOrPercentage {
}
#[allow(missing_docs)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd, ToCss)]
pub struct Opacity(Number);
@ -366,9 +360,7 @@ impl ToComputedValue for Opacity {
/// An specified `<integer>`, optionally coming from a `calc()` expression.
///
/// <https://drafts.csswg.org/css-values/#integers>
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, PartialOrd)]
pub struct Integer {
value: CSSInteger,
was_calc: bool,
@ -521,9 +513,7 @@ pub type LengthOrPercentageOrNumber = Either<Number, LengthOrPercentage>;
/// NonNegativeLengthOrPercentage | NonNegativeNumber
pub type NonNegativeLengthOrPercentageOrNumber = Either<NonNegativeNumber, NonNegativeLengthOrPercentage>;
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, MallocSizeOf, PartialEq)]
/// rect(<top>, <left>, <bottom>, <right>) used by clip and image-region
pub struct ClipRect {
/// <top> (<length> | <auto>)
@ -693,9 +683,7 @@ pub type NamespaceId = ();
/// An attr(...) rule
///
/// `[namespace? `|`]? ident`
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
pub struct Attr {
/// Optional namespace
pub namespace: Option<(Namespace, NamespaceId)>,

View file

@ -16,9 +16,7 @@ use values::computed::percentage::Percentage as ComputedPercentage;
use values::specified::calc::CalcNode;
/// A percentage value.
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Default, MallocSizeOf, PartialEq)]
pub struct Percentage {
/// The percentage value as a float.
///

View file

@ -27,9 +27,7 @@ pub type HorizontalPosition = PositionComponent<X>;
pub type VerticalPosition = PositionComponent<Y>;
/// The specified value of a component of a CSS `<position>`.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum PositionComponent<S> {
/// `center`
Center,

View file

@ -16,9 +16,7 @@ use values::computed::time::Time as ComputedTime;
use values::specified::calc::CalcNode;
/// A time value according to CSS-VALUES § 6.2.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq)]
pub struct Time {
seconds: CSSFloat,
unit: TimeUnit,
@ -26,9 +24,7 @@ pub struct Time {
}
/// A time unit.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
pub enum TimeUnit {
/// `s`
Second,

View file

@ -21,9 +21,7 @@ use values::specified::position::{Side, X, Y};
pub type TransformOrigin = GenericTransformOrigin<OriginComponent<X>, OriginComponent<Y>, Length>;
/// The specified value of a component of a CSS `<transform-origin>`.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[derive(Clone, Debug, PartialEq, ToCss)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum OriginComponent<S> {
/// `center`
Center,