diff options
author | Nicholas Nethercote <nnethercote@mozilla.com> | 2017-09-14 13:18:03 +1000 |
---|---|---|
committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2017-09-14 13:18:03 +1000 |
commit | c5aa2cb98662f7385f53e75f699cdec35c661e5b (patch) | |
tree | 800c2ce79d5faf3b55393a7e5a5f1d19704dfe62 /components/style | |
parent | 1aa8be392b0ab8e7a8426f525361b40b69d70b4f (diff) | |
download | servo-c5aa2cb98662f7385f53e75f699cdec35c661e5b.tar.gz servo-c5aa2cb98662f7385f53e75f699cdec35c661e5b.zip |
Measure PropertyDeclaration more thoroughly.
This patch replaces the handwritten MallocSizeOf implementation for
PropertyDeclaration with a derived one, which gives much more thorough
measurement.
This requires (a) deriving MallocSizeOf for a *lot* of additional types (most
of which already have `derive(HeapSizeOf)` in Servo builds), and (b)
implementing MallocSizeOf for a few more types in the `malloc_size_of` crate.
These changes would significantly improve the reporting coverage for gmail if
it weren't for the fact that SpecifiedUrl isn't measured due to a lack of
clarity about its fields; that can be fixed as a follow-up once bug 1397971 has
landed.
Diffstat (limited to 'components/style')
59 files changed, 226 insertions, 42 deletions
diff --git a/components/style/counter_style/mod.rs b/components/style/counter_style/mod.rs index 6bdd22d8e07..cb0a9f3d8c7 100644 --- a/components/style/counter_style/mod.rs +++ b/components/style/counter_style/mod.rs @@ -342,6 +342,7 @@ impl ToCss for System { } /// https://drafts.csswg.org/css-counter-styles/#typedef-symbol +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)] pub enum Symbol { /// <string> @@ -489,6 +490,7 @@ impl Parse for Fallback { } /// https://drafts.csswg.org/css-counter-styles/#descdef-counter-style-symbols +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)] pub struct Symbols(pub Vec<Symbol>); diff --git a/components/style/custom_properties.rs b/components/style/custom_properties.rs index 6d72bb7b369..974f27e47eb 100644 --- a/components/style/custom_properties.rs +++ b/components/style/custom_properties.rs @@ -40,6 +40,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))] pub struct SpecifiedValue { css: String, diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index 0c2348fbaa2..04d3459aeec 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -15,19 +15,22 @@ use std::fmt; use style_traits::{ToCss, ParseError}; /// A specified url() value for gecko. Gecko does not eagerly resolve SpecifiedUrls. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq)] pub struct SpecifiedUrl { /// The URL in unresolved string form. /// /// Refcounted since cloning this should be cheap and data: uris can be /// really large. + #[ignore_malloc_size_of = "XXX: do this once bug 1397971 lands"] serialization: Arc<String>, /// The URL extra data. + #[ignore_malloc_size_of = "RefPtr is tricky, and there aren't many of these in practise"] pub extra_data: RefPtr<URLExtraData>, /// Cache ImageValue, if any, so that we can reuse it while rematching a /// a property with this specified url value. + #[ignore_malloc_size_of = "XXX: do this once bug 1397971 lands"] pub image_value: Option<RefPtr<ImageValue>>, } trivial_to_computed_value!(SpecifiedUrl); diff --git a/components/style/gecko_string_cache/namespace.rs b/components/style/gecko_string_cache/namespace.rs index c8c4deee8b6..61a89a86f06 100644 --- a/components/style/gecko_string_cache/namespace.rs +++ b/components/style/gecko_string_cache/namespace.rs @@ -18,7 +18,7 @@ macro_rules! ns { } /// A Gecko namespace is just a wrapped atom. -#[derive(Clone, Debug, Default, Eq, Hash, PartialEq)] +#[derive(Clone, Debug, Default, Eq, Hash, MallocSizeOf, PartialEq)] pub struct Namespace(pub Atom); impl PrecomputedHash for Namespace { diff --git a/components/style/macros.rs b/components/style/macros.rs index e2791e6f09f..7a5d8ba9abf 100644 --- a/components/style/macros.rs +++ b/components/style/macros.rs @@ -45,6 +45,7 @@ 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))] pub enum $name { $( $variant = $value ),+ @@ -99,6 +100,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(ToAnimatedZero, ToComputedValue, ToCss)] diff --git a/components/style/properties/helpers.mako.rs b/components/style/properties/helpers.mako.rs index 3e24a08103b..be7bb7ea9c5 100644 --- a/components/style/properties/helpers.mako.rs +++ b/components/style/properties/helpers.mako.rs @@ -117,6 +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)] % if need_animatable or animation_value_type == "ComputedValue": @@ -178,6 +179,7 @@ /// The specified value of ${name}. #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct SpecifiedValue(pub Vec<single_value::SpecifiedValue>); @@ -443,6 +445,7 @@ ${gecko_keyword_conversion(keyword, keyword.values_for(product), type="T", cast_to="i32")} } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)] pub enum SpecifiedValue { Keyword(computed_value::T), @@ -941,6 +944,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)] pub struct SpecifiedValue(pub ${length_type}); diff --git a/components/style/properties/helpers/animated_properties.mako.rs b/components/style/properties/helpers/animated_properties.mako.rs index 0f1db632c91..8771093624a 100644 --- a/components/style/properties/helpers/animated_properties.mako.rs +++ b/components/style/properties/helpers/animated_properties.mako.rs @@ -202,6 +202,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, ToCss, ToComputedValue)] pub enum TransitionProperty { diff --git a/components/style/properties/longhand/background.mako.rs b/components/style/properties/longhand/background.mako.rs index 5e608315f19..4ec1d3151e8 100644 --- a/components/style/properties/longhand/background.mako.rs +++ b/components/style/properties/longhand/background.mako.rs @@ -53,6 +53,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)] pub enum SpecifiedValue { @@ -65,6 +66,7 @@ ${helpers.predefined_type("background-image", "ImageLayer", pub use super::RepeatKeyword; #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub RepeatKeyword, pub RepeatKeyword); } diff --git a/components/style/properties/longhand/border.mako.rs b/components/style/properties/longhand/border.mako.rs index 25460d010d9..615d7bafa0c 100644 --- a/components/style/properties/longhand/border.mako.rs +++ b/components/style/properties/longhand/border.mako.rs @@ -82,11 +82,13 @@ ${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))] pub struct T(pub Option<Vec<RGBA>>); } #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { None, @@ -233,11 +235,13 @@ ${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)] pub struct T(pub RepeatKeyword, pub RepeatKeyword); } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[derive(Clone, Debug, PartialEq, ToCss)] pub struct SpecifiedValue(pub RepeatKeyword, diff --git a/components/style/properties/longhand/box.mako.rs b/components/style/properties/longhand/box.mako.rs index 52befd9c67d..b63a9329288 100644 --- a/components/style/properties/longhand/box.mako.rs +++ b/components/style/properties/longhand/box.mako.rs @@ -137,6 +137,7 @@ #[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))] pub enum SpecifiedValue { % for value in values: @@ -407,6 +408,7 @@ ${helpers.predefined_type("transition-delay", } #[derive(Clone, Debug, Eq, Hash, PartialEq, ToComputedValue)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct SpecifiedValue(pub Option<KeyframesName>); @@ -500,6 +502,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)] pub enum SpecifiedValue { @@ -635,6 +638,7 @@ ${helpers.predefined_type( use values::computed::{Length, LengthOrPercentage}; #[derive(Clone, Copy, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct ComputedMatrix { pub m11: CSSFloat, pub m12: CSSFloat, pub m13: CSSFloat, pub m14: CSSFloat, @@ -644,6 +648,7 @@ ${helpers.predefined_type( } #[derive(Clone, Copy, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct ComputedMatrixWithPercents { pub m11: CSSFloat, pub m12: CSSFloat, pub m13: CSSFloat, pub m14: CSSFloat, @@ -677,6 +682,7 @@ ${helpers.predefined_type( } #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum ComputedOperation { Matrix(ComputedMatrix), @@ -710,6 +716,7 @@ ${helpers.predefined_type( } #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub Option<Vec<ComputedOperation>>); } @@ -721,6 +728,7 @@ ${helpers.predefined_type( /// /// 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))] pub enum SpecifiedOperation { /// Represents a 2D 2x3 matrix. @@ -911,6 +919,7 @@ ${helpers.predefined_type( } #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct SpecifiedValue(Vec<SpecifiedOperation>); @@ -1628,6 +1637,7 @@ ${helpers.predefined_type("transform-origin", bitflags! { #[derive(ToComputedValue)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub flags SpecifiedValue: u8 { const LAYOUT = 0x01, @@ -1769,6 +1779,7 @@ ${helpers.single_keyword("-moz-orient", } #[derive(Clone, Debug, PartialEq, ToComputedValue)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { Auto, @@ -1840,6 +1851,7 @@ ${helpers.predefined_type( bitflags! { /// These constants match Gecko's `NS_STYLE_TOUCH_ACTION_*` constants. + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(ToComputedValue)] pub flags SpecifiedValue: u8 { const TOUCH_ACTION_NONE = structs::NS_STYLE_TOUCH_ACTION_NONE as u8, diff --git a/components/style/properties/longhand/color.mako.rs b/components/style/properties/longhand/color.mako.rs index 620d2a11b29..1eb761a3cbb 100644 --- a/components/style/properties/longhand/color.mako.rs +++ b/components/style/properties/longhand/color.mako.rs @@ -67,6 +67,10 @@ pub mod system_colors { pub type SystemColor = LookAndFeel_ColorID; + // It's hard to implement MallocSizeOf for LookAndFeel_ColorID because it + // is a bindgen type. So we implement it on the typedef instead. + size_of_is_0!(SystemColor); + impl ToCss for SystemColor { fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write { let s = match *self { diff --git a/components/style/properties/longhand/counters.mako.rs b/components/style/properties/longhand/counters.mako.rs index 16aca0ff60f..fa1eab1a623 100644 --- a/components/style/properties/longhand/counters.mako.rs +++ b/components/style/properties/longhand/counters.mako.rs @@ -37,6 +37,7 @@ use values::specified::Attr; #[cfg_attr(feature = "servo", derive(HeapSizeOf))] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)] pub enum ContentItem { /// Literal string content. @@ -97,6 +98,7 @@ } } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[derive(Clone, Debug, Eq, PartialEq, ToComputedValue)] pub enum T { @@ -236,6 +238,7 @@ use style_traits::ToCss; use values::CustomIdent; + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq)] pub struct SpecifiedValue(pub Vec<(CustomIdent, specified::Integer)>); @@ -245,6 +248,7 @@ use values::CustomIdent; #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub Vec<(CustomIdent, i32)>); diff --git a/components/style/properties/longhand/font.mako.rs b/components/style/properties/longhand/font.mako.rs index eafff197287..ec611a4edec 100644 --- a/components/style/properties/longhand/font.mako.rs +++ b/components/style/properties/longhand/font.mako.rs @@ -85,6 +85,7 @@ macro_rules! impl_gecko_keyword_conversions { 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))] pub enum FontFamily { FamilyName(FamilyName), @@ -92,6 +93,7 @@ macro_rules! impl_gecko_keyword_conversions { } #[derive(Clone, Debug, Eq, Hash, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))] pub struct FamilyName { pub name: Atom, @@ -99,6 +101,7 @@ macro_rules! impl_gecko_keyword_conversions { } #[derive(Clone, Debug, Eq, Hash, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf, Deserialize, Serialize))] pub enum FamilyNameSyntax { /// The family name was specified in a quoted form, e.g. "Font Name" @@ -296,6 +299,7 @@ macro_rules! impl_gecko_keyword_conversions { } #[derive(Clone, Debug, Eq, Hash, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub Vec<FontFamily>); } @@ -313,6 +317,7 @@ macro_rules! impl_gecko_keyword_conversions { SpecifiedValue::parse(input) } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, Eq, Hash, PartialEq)] pub enum SpecifiedValue { Values(Vec<FontFamily>), @@ -430,6 +435,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)] pub enum SpecifiedValue { @@ -484,6 +490,7 @@ ${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))] pub struct T(pub u16); @@ -614,6 +621,7 @@ ${helpers.single_keyword_system("font-variant-caps", } #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { Length(specified::LengthOrPercentage), @@ -646,6 +654,7 @@ ${helpers.single_keyword_system("font-variant-caps", /// CSS font keywords #[derive(Clone, Copy, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum KeywordSize { XXSmall = 1, // This is to enable the NonZero optimization @@ -1080,6 +1089,7 @@ ${helpers.single_keyword_system("font-variant-caps", #[derive(Clone, Copy, Debug, PartialEq, ToCss)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { None, @@ -1127,6 +1137,7 @@ ${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)] pub enum T { @@ -1202,6 +1213,7 @@ ${helpers.single_keyword_system("font-variant-caps", } #[derive(Clone, Debug, PartialEq, ToComputedValue)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct SpecifiedValue { pub weight: bool, @@ -1309,6 +1321,7 @@ ${helpers.single_keyword_system("font-kerning", #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum VariantAlternates { Stylistic(CustomIdent), @@ -1321,10 +1334,12 @@ ${helpers.single_keyword_system("font-kerning", } #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct VariantAlternatesList(pub Box<[VariantAlternates]>); #[derive(Clone, Debug, PartialEq, ToCss)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { Value(VariantAlternatesList), @@ -1518,6 +1533,7 @@ macro_rules! exclusive_value { bitflags! { + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub flags VariantEastAsian: u16 { const NORMAL = 0, @@ -1533,7 +1549,7 @@ macro_rules! exclusive_value { } } - + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq, ToCss)] pub enum SpecifiedValue { Value(VariantEastAsian), @@ -1663,6 +1679,7 @@ macro_rules! exclusive_value { bitflags! { + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub flags VariantLigatures: u16 { const NORMAL = 0, @@ -1678,7 +1695,7 @@ macro_rules! exclusive_value { } } - + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq, ToCss)] pub enum SpecifiedValue { Value(VariantLigatures), @@ -1822,6 +1839,7 @@ macro_rules! exclusive_value { bitflags! { + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub flags VariantNumeric: u8 { const NORMAL = 0, @@ -1836,8 +1854,7 @@ macro_rules! exclusive_value { } } - - + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq, ToCss)] pub enum SpecifiedValue { Value(VariantNumeric), @@ -1977,6 +1994,7 @@ ${helpers.single_keyword_system("font-variant-position", use properties::longhands::system_font::SystemFont; use values::generics::FontSettings; + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq, ToCss)] pub enum SpecifiedValue { Value(computed_value::T), @@ -2048,6 +2066,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control- use byteorder::{BigEndian, ByteOrder}; #[derive(Clone, Debug, Eq, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { Normal, @@ -2105,6 +2124,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control- // 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))] pub struct T(pub u32); } @@ -2213,6 +2233,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))] pub struct T(pub Atom); } @@ -2269,6 +2290,7 @@ https://drafts.csswg.org/css-fonts-4/#low-level-font-variation-settings-control- 0 } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Copy, Debug, PartialEq)] pub enum SpecifiedValue { Relative(i32), @@ -2358,6 +2380,7 @@ ${helpers.single_keyword("-moz-math-variant", use values::computed::Length; use values::specified::length::{AU_PER_PT, AU_PER_PX, FontBaseSize, NoCalcLength}; + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq, ToCss)] pub struct SpecifiedValue(pub NoCalcLength); @@ -2416,6 +2439,7 @@ ${helpers.single_keyword("-moz-math-variant", } #[derive(Clone, Debug, PartialEq, ToComputedValue)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// text-zoom. Enable if true, disable if false pub struct T(pub bool); @@ -2470,7 +2494,7 @@ ${helpers.single_keyword("-moz-math-variant", kw_cast = """font_style font_variant_caps font_stretch font_kerning font_variant_position""".split() %> - #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, ToCss)] + #[derive(Clone, Copy, Debug, Eq, Hash, MallocSizeOf, PartialEq, ToCss)] pub enum SystemFont { % for font in system_fonts: ${to_camel_case(font)}, diff --git a/components/style/properties/longhand/inherited_box.mako.rs b/components/style/properties/longhand/inherited_box.mako.rs index 23a621309f2..87471ccdae7 100644 --- a/components/style/properties/longhand/inherited_box.mako.rs +++ b/components/style/properties/longhand/inherited_box.mako.rs @@ -71,6 +71,7 @@ ${helpers.single_keyword("image-rendering", const TWO_PI: f64 = 2.0 * PI; #[derive(Clone, Copy, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct SpecifiedValue { pub angle: Option<Angle>, @@ -102,6 +103,7 @@ ${helpers.single_keyword("image-rendering", use values::specified::Angle; #[derive(Clone, Copy, Debug, Eq, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum Orientation { Angle0 = 0, @@ -134,6 +136,7 @@ ${helpers.single_keyword("image-rendering", } #[derive(Clone, Copy, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum T { FromImage, @@ -257,6 +260,7 @@ ${helpers.single_keyword("image-rendering", use std::fmt; use style_traits::ToCss; + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))] #[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)] pub struct SpecifiedValue(pub bool); diff --git a/components/style/properties/longhand/inherited_svg.mako.rs b/components/style/properties/longhand/inherited_svg.mako.rs index 41039b2954b..5a98f464d11 100644 --- a/components/style/properties/longhand/inherited_svg.mako.rs +++ b/components/style/properties/longhand/inherited_svg.mako.rs @@ -162,6 +162,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)] pub struct SpecifiedValue(pub u8); diff --git a/components/style/properties/longhand/inherited_table.mako.rs b/components/style/properties/longhand/inherited_table.mako.rs index f234d7f1a60..13a6e7c45d6 100644 --- a/components/style/properties/longhand/inherited_table.mako.rs +++ b/components/style/properties/longhand/inherited_table.mako.rs @@ -29,6 +29,7 @@ ${helpers.single_keyword("caption-side", "top bottom", use values::animated::{ToAnimatedValue, ToAnimatedZero}; use values::computed::NonNegativeLength; + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, PartialEq, ToCss)] pub struct T { @@ -59,6 +60,7 @@ ${helpers.single_keyword("caption-side", "top bottom", } } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[derive(Clone, Debug, PartialEq, ToCss)] pub struct SpecifiedValue { diff --git a/components/style/properties/longhand/inherited_text.mako.rs b/components/style/properties/longhand/inherited_text.mako.rs index 82967ee2440..bcbe35287ce 100644 --- a/components/style/properties/longhand/inherited_text.mako.rs +++ b/components/style/properties/longhand/inherited_text.mako.rs @@ -175,6 +175,7 @@ ${helpers.single_keyword("text-align-last", use std::fmt; use style_traits::ToCss; + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum SpecifiedValue { Keyword(computed_value::T), @@ -288,6 +289,7 @@ ${helpers.predefined_type("word-spacing", use style_traits::ToCss; #[derive(Clone, Copy, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct SpecifiedValue { pub underline: Option<RGBA>, @@ -430,6 +432,7 @@ ${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))] pub enum T { Keyword(KeywordValue), @@ -438,6 +441,7 @@ ${helpers.predefined_type( } #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct KeywordValue { pub fill: bool, @@ -446,6 +450,7 @@ ${helpers.predefined_type( } #[derive(Clone, Debug, PartialEq, ToCss)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum SpecifiedValue { Keyword(KeywordValue), @@ -454,6 +459,7 @@ ${helpers.predefined_type( } #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum KeywordValue { Fill(bool), @@ -621,6 +627,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)] pub struct SpecifiedValue(pub HorizontalWritingModeValue, pub VerticalWritingModeValue); diff --git a/components/style/properties/longhand/list.mako.rs b/components/style/properties/longhand/list.mako.rs index 92167fdf91d..4554f308221 100644 --- a/components/style/properties/longhand/list.mako.rs +++ b/components/style/properties/longhand/list.mako.rs @@ -41,7 +41,7 @@ ${helpers.single_keyword("list-style-position", "outside inside", animation_valu use values::generics::CounterStyleOrNone; /// <counter-style> | <string> | none - #[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)] + #[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue, ToCss)] pub enum T { CounterStyle(CounterStyleOrNone), String(String), @@ -104,6 +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)] pub struct T(pub UrlOrNone); @@ -145,6 +146,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)] pub struct T(pub Vec<(String, String)>); diff --git a/components/style/properties/longhand/pointing.mako.rs b/components/style/properties/longhand/pointing.mako.rs index 0965640482e..09f9e114609 100644 --- a/components/style/properties/longhand/pointing.mako.rs +++ b/components/style/properties/longhand/pointing.mako.rs @@ -21,6 +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)] pub enum Keyword { @@ -32,14 +33,14 @@ pub type T = Keyword; #[cfg(feature = "gecko")] - #[derive(Clone, Debug, PartialEq, ToComputedValue)] + #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)] pub struct Image { pub url: SpecifiedUrl, pub hotspot: Option<(f32, f32)>, } #[cfg(feature = "gecko")] - #[derive(Clone, Debug, PartialEq, ToComputedValue)] + #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)] pub struct T { pub images: Vec<Image>, pub keyword: Keyword, diff --git a/components/style/properties/longhand/position.mako.rs b/components/style/properties/longhand/position.mako.rs index d3989dc90ed..b1904aae146 100644 --- a/components/style/properties/longhand/position.mako.rs +++ b/components/style/properties/longhand/position.mako.rs @@ -296,6 +296,7 @@ ${helpers.predefined_type("object-position", pub mod computed_value { #[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum AutoFlow { Row, @@ -303,6 +304,7 @@ ${helpers.predefined_type("object-position", } #[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T { pub autoflow: AutoFlow, @@ -435,6 +437,7 @@ ${helpers.predefined_type("object-position", SpecifiedValue::parse(context, input) } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq)] pub struct TemplateAreas { pub areas: Box<[NamedArea]>, @@ -442,6 +445,7 @@ ${helpers.predefined_type("object-position", pub width: u32, } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq)] pub struct NamedArea { pub name: Box<str>, diff --git a/components/style/properties/longhand/table.mako.rs b/components/style/properties/longhand/table.mako.rs index 5cc753b38ab..7d6c7aacea8 100644 --- a/components/style/properties/longhand/table.mako.rs +++ b/components/style/properties/longhand/table.mako.rs @@ -20,6 +20,7 @@ ${helpers.single_keyword("table-layout", "auto fixed", use style_traits::ToCss; #[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T(pub i32); diff --git a/components/style/properties/longhand/text.mako.rs b/components/style/properties/longhand/text.mako.rs index 78d98d63791..242ddde4988 100644 --- a/components/style/properties/longhand/text.mako.rs +++ b/components/style/properties/longhand/text.mako.rs @@ -19,6 +19,7 @@ use style_traits::ToCss; + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[derive(Clone, Debug, Eq, PartialEq, ToCss)] pub enum Side { @@ -27,6 +28,7 @@ String(Box<str>), } + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[derive(Clone, Debug, Eq, PartialEq, ToCss)] pub struct SpecifiedValue { @@ -38,6 +40,7 @@ pub use super::Side; #[derive(Clone, Debug, PartialEq)] + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub struct T { // When the specified value only has one side, that's the "second" @@ -148,6 +151,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)] pub flags SpecifiedValue: u8 { diff --git a/components/style/properties/longhand/ui.mako.rs b/components/style/properties/longhand/ui.mako.rs index 2e3f52d12be..492cd8ca3f4 100644 --- a/components/style/properties/longhand/ui.mako.rs +++ b/components/style/properties/longhand/ui.mako.rs @@ -51,6 +51,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)] pub struct T(pub bool); diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index 91429401b6c..e700d69e6ea 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -29,7 +29,6 @@ use font_metrics::FontMetricsProvider; #[cfg(feature = "gecko")] use gecko_bindings::structs::{self, nsCSSPropertyID}; #[cfg(feature = "servo")] use logical_geometry::{LogicalMargin, PhysicalSide}; use logical_geometry::WritingMode; -#[cfg(feature = "gecko")] use malloc_size_of::{MallocShallowSizeOf, MallocSizeOf, MallocSizeOfOps}; use media_queries::Device; use parser::ParserContext; use properties::animated_properties::AnimatableLonghand; @@ -380,6 +379,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)] pub enum CSSWideKeyword { @@ -445,6 +445,7 @@ bitflags! { /// An identifier for a given longhand property. #[derive(Clone, Copy, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum LonghandId { % for i, property in enumerate(data.longhands): @@ -783,12 +784,16 @@ pub enum DeclaredValue<'a, T: 'a> { /// that PropertyDeclaration can avoid embedding a DeclaredValue (and its /// extra discriminant word) and synthesize dependent DeclaredValues for /// PropertyDeclaration instances as needed. +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, Eq, PartialEq)] pub enum DeclaredValueOwned<T> { /// A known specified value from the stylesheet. Value(T), /// An unparsed value that contains `var()` functions. - WithVariables(Arc<UnparsedValue>), + WithVariables( + #[cfg_attr(feature = "gecko", ignore_malloc_size_of = "XXX: how to handle this?")] + Arc<UnparsedValue> + ), /// An CSS-wide keyword. CSSWideKeyword(CSSWideKeyword), } @@ -1267,6 +1272,7 @@ impl PropertyParserContext { } /// Servo's representation for a property declaration. +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, PartialEq)] pub enum PropertyDeclaration { % for property in data.longhands: @@ -1280,7 +1286,11 @@ pub enum PropertyDeclaration { /// A css-wide keyword. CSSWideKeyword(LonghandId, CSSWideKeyword), /// An unparsed value that contains `var()` functions. - WithVariables(LonghandId, Arc<UnparsedValue>), + WithVariables( + LonghandId, + #[cfg_attr(feature = "gecko", ignore_malloc_size_of = "XXX: how to handle this?")] + Arc<UnparsedValue> + ), /// A custom property declaration, with the property name and the declared /// value. Custom(::custom_properties::Name, DeclaredValueOwned<Box<::custom_properties::SpecifiedValue>>), @@ -1327,31 +1337,6 @@ impl ToCss for PropertyDeclaration { } } -#[cfg(feature = "gecko")] -impl MallocSizeOf for PropertyDeclaration { - fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize { - match *self { - % for property in data.longhands: - % if property.boxed and property.is_vector: - <% raise Exception("this should not happen! not smart to box a vector here") %> - % elif property.boxed: - PropertyDeclaration::${property.camel_case}(ref sv_box) => { - <Box<_> as MallocShallowSizeOf>::shallow_size_of(sv_box, ops) - } - % elif property.is_vector: - PropertyDeclaration::${property.camel_case}(ref sv_vec) => { - sv_vec.0.shallow_size_of(ops) - } - % endif - % endfor - PropertyDeclaration::CSSWideKeyword(..) => 0, - PropertyDeclaration::WithVariables(..) => 0, - PropertyDeclaration::Custom(..) => 0, - _ => 0, - } - } -} - impl PropertyDeclaration { /// Given a property declaration, return the property declaration id. pub fn id(&self) -> PropertyDeclarationId { @@ -1711,6 +1696,7 @@ pub mod style_structs { % else: #[derive(Clone, Debug, 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} { diff --git a/components/style/values/computed/angle.rs b/components/style/values/computed/angle.rs index b26c8ccc02b..4704d8c6bba 100644 --- a/components/style/values/computed/angle.rs +++ b/components/style/values/computed/angle.rs @@ -14,6 +14,7 @@ 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)] #[derive(PartialOrd, ToAnimatedZero)] diff --git a/components/style/values/computed/color.rs b/components/style/values/computed/color.rs index c28bd88eddd..7adfa646d7e 100644 --- a/components/style/values/computed/color.rs +++ b/components/style/values/computed/color.rs @@ -15,10 +15,12 @@ use values::animated::color::{Color as AnimatedColor, RGBA as AnimatedRGBA}; /// 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))] pub struct Color { /// RGBA color. pub color: RGBA, + /// The ratio of currentcolor in complex color. pub foreground_ratio: u8, } diff --git a/components/style/values/computed/image.rs b/components/style/values/computed/image.rs index 99821683744..b2604324f76 100644 --- a/components/style/values/computed/image.rs +++ b/components/style/values/computed/image.rs @@ -50,6 +50,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))] pub enum LineDirection { /// An angle. diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index a83e86bd1e6..344bf4ca68e 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -66,6 +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)] pub struct CalcLengthOrPercentage { @@ -293,6 +294,7 @@ 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)] @@ -450,6 +452,7 @@ 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)] @@ -681,6 +684,7 @@ 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)] #[derive(ToAnimatedValue, ToAnimatedZero)] diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index cad3db03aa7..407a839e5cf 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -379,6 +379,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)] pub enum NumberOrPercentage { diff --git a/components/style/values/computed/percentage.rs b/components/style/values/computed/percentage.rs index 994d4fbbff9..6b54c6722c3 100644 --- a/components/style/values/computed/percentage.rs +++ b/components/style/values/computed/percentage.rs @@ -9,6 +9,7 @@ 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)] #[derive(PartialEq, PartialOrd, ToAnimatedZero)] diff --git a/components/style/values/computed/time.rs b/components/style/values/computed/time.rs index 5b5af99fc7c..02da4f5a681 100644 --- a/components/style/values/computed/time.rs +++ b/components/style/values/computed/time.rs @@ -10,6 +10,7 @@ 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))] pub struct Time { seconds: CSSFloat, diff --git a/components/style/values/generics/background.rs b/components/style/values/generics/background.rs index f9050469c74..09db669ad4f 100644 --- a/components/style/values/generics/background.rs +++ b/components/style/values/generics/background.rs @@ -5,6 +5,7 @@ //! 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)] diff --git a/components/style/values/generics/basic_shape.rs b/components/style/values/generics/basic_shape.rs index 348e5c2a3ef..44aa71431db 100644 --- a/components/style/values/generics/basic_shape.rs +++ b/components/style/values/generics/basic_shape.rs @@ -18,6 +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)] pub enum GeometryBox { @@ -41,6 +42,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)] pub enum ShapeSource<BasicShape, ReferenceBox, Url> { @@ -58,6 +60,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(ToComputedValue, ToCss)] @@ -70,6 +73,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)] pub struct InsetRect<LengthOrPercentage> { @@ -79,6 +83,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)] pub struct Circle<H, V, LengthOrPercentage> { @@ -88,6 +93,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)] pub struct Ellipse<H, V, LengthOrPercentage> { @@ -98,6 +104,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(ToComputedValue, ToCss)] @@ -109,6 +116,7 @@ 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 diff --git a/components/style/values/generics/border.rs b/components/style/values/generics/border.rs index 53d813f459b..33f9cd8b8a6 100644 --- a/components/style/values/generics/border.rs +++ b/components/style/values/generics/border.rs @@ -10,6 +10,7 @@ use style_traits::ToCss; use values::generics::rect::Rect; /// 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)] pub enum BorderImageSideWidth<LengthOrPercentage, Number> { @@ -23,6 +24,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))] pub struct BorderImageSlice<NumberOrPercentage> { /// The offsets. @@ -34,6 +36,7 @@ pub struct BorderImageSlice<NumberOrPercentage> { /// 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)] @@ -49,6 +52,7 @@ pub struct BorderRadius<LengthOrPercentage> { } /// A generic value for `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)] diff --git a/components/style/values/generics/box.rs b/components/style/values/generics/box.rs index 2d08592d072..a604596e94a 100644 --- a/components/style/values/generics/box.rs +++ b/components/style/values/generics/box.rs @@ -7,6 +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(ToComputedValue, ToCss)] diff --git a/components/style/values/generics/effects.rs b/components/style/values/generics/effects.rs index b0f061e874e..28b7105f7a8 100644 --- a/components/style/values/generics/effects.rs +++ b/components/style/values/generics/effects.rs @@ -10,6 +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(ToAnimatedValue, ToAnimatedZero)] @@ -24,6 +25,7 @@ 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)] pub enum Filter<Angle, Factor, Length, DropShadow> { @@ -66,6 +68,7 @@ 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)] diff --git a/components/style/values/generics/gecko.rs b/components/style/values/generics/gecko.rs index d450b138e38..238ad755ea8 100644 --- a/components/style/values/generics/gecko.rs +++ b/components/style/values/generics/gecko.rs @@ -6,6 +6,7 @@ //! unshipped at some point in the future. /// A generic value for scroll snap points. +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Copy, Debug, PartialEq, ToComputedValue, ToCss)] pub enum ScrollSnapPoint<LengthOrPercentage> { /// `none` diff --git a/components/style/values/generics/grid.rs b/components/style/values/generics/grid.rs index cd828c28a00..a8814a6f825 100644 --- a/components/style/values/generics/grid.rs +++ b/components/style/values/generics/grid.rs @@ -14,11 +14,12 @@ use values::computed::{Context, ToComputedValue}; use values::specified; use values::specified::grid::parse_line_names; -#[derive(Clone, Debug, Default, PartialEq, ToComputedValue)] -#[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// 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)] pub struct GridLine<Integer> { /// Flag to check whether it's a `span` keyword. pub is_span: bool, @@ -143,6 +144,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)] pub enum TrackBreadth<L> { @@ -181,6 +183,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)] pub enum TrackSize<L> { @@ -344,6 +347,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)] pub enum RepeatCount<Integer> { @@ -377,6 +381,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)] pub struct TrackRepeat<L, I> { @@ -460,6 +465,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))] pub enum TrackListValue<LengthOrPercentage, Integer> { /// A <track-size> value. @@ -472,6 +478,7 @@ pub enum TrackListValue<LengthOrPercentage, Integer> { /// /// 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))] pub enum TrackListType { /// [`<auto-track-list>`](https://drafts.csswg.org/css-grid/#typedef-auto-track-list) @@ -494,6 +501,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)] pub struct TrackList<LengthOrPercentage, Integer> { @@ -563,6 +571,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))] pub struct LineNameList { /// The optional `<line-name-list>` @@ -658,6 +667,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)] pub enum GridTemplateComponent<L, I> { diff --git a/components/style/values/generics/image.rs b/components/style/values/generics/image.rs index 578eb1cf055..0d9cb81ebce 100644 --- a/components/style/values/generics/image.rs +++ b/components/style/values/generics/image.rs @@ -15,6 +15,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)] pub enum Image<Gradient, MozImageRect, ImageUrl> { @@ -35,6 +36,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)] pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color, Angle> { @@ -51,6 +53,7 @@ pub struct Gradient<LineDirection, Length, LengthOrPercentage, Position, Color, } #[derive(Clone, Copy, Debug, PartialEq, ToComputedValue)] +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes. pub enum CompatMode { @@ -63,6 +66,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)] pub enum GradientKind<LineDirection, Length, LengthOrPercentage, Position, Angle> { @@ -74,6 +78,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))] pub enum EndingShape<Length, LengthOrPercentage> { /// A circular gradient. @@ -84,6 +89,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))] pub enum Circle<Length> { /// A circle radius. @@ -94,6 +100,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))] pub enum Ellipse<LengthOrPercentage> { /// An ellipse pair of radii. @@ -115,6 +122,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)] pub enum GradientItem<Color, LengthOrPercentage> { @@ -127,6 +135,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))] pub struct ColorStop<Color, LengthOrPercentage> { /// The color of this stop. @@ -165,6 +174,7 @@ 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)] diff --git a/components/style/values/generics/mod.rs b/components/style/values/generics/mod.rs index 34feefb04a7..b28147da3d5 100644 --- a/components/style/values/generics/mod.rs +++ b/components/style/values/generics/mod.rs @@ -71,6 +71,7 @@ impl SymbolsType { /// /// Since wherever <counter-style> is used, 'none' is a valid value as /// well, we combine them into one type to make code simpler. +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss)] pub enum CounterStyleOrNone { /// `none` @@ -129,6 +130,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)] pub struct FontSettingTag<T> { @@ -186,6 +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)] pub enum FontSettings<T> { @@ -210,6 +213,7 @@ 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)] pub struct FontSettingTagInt(pub u32); @@ -218,7 +222,7 @@ pub struct FontSettingTagInt(pub u32); /// /// Do not use this type anywhere except within FontSettings /// because it serializes with the preceding space -#[cfg_attr(feature = "gecko", derive(Animate, ComputeSquaredDistance))] +#[cfg_attr(feature = "gecko", derive(Animate, ComputeSquaredDistance, MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[derive(Clone, Debug, PartialEq, ToComputedValue)] pub struct FontSettingTagFloat(pub f32); @@ -273,12 +277,14 @@ 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)] #[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)] #[derive(PartialEq, PartialOrd, ToAnimatedZero, ToComputedValue, ToCss)] diff --git a/components/style/values/generics/position.rs b/components/style/values/generics/position.rs index 5c1b2333559..5a63f88a241 100644 --- a/components/style/values/generics/position.rs +++ b/components/style/values/generics/position.rs @@ -6,6 +6,7 @@ //! [`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)] diff --git a/components/style/values/generics/rect.rs b/components/style/values/generics/rect.rs index 3b98fc664ec..5d45a9acfbe 100644 --- a/components/style/values/generics/rect.rs +++ b/components/style/values/generics/rect.rs @@ -11,6 +11,7 @@ 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)] diff --git a/components/style/values/generics/svg.rs b/components/style/values/generics/svg.rs index b48455ab182..24444da8894 100644 --- a/components/style/values/generics/svg.rs +++ b/components/style/values/generics/svg.rs @@ -16,6 +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(ToAnimatedValue, ToComputedValue, ToCss)] @@ -31,6 +32,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(ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)] @@ -109,6 +111,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(ToAnimatedZero, ToComputedValue, ToCss)] @@ -191,6 +194,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(ToAnimatedValue, ToAnimatedZero)] @@ -203,6 +207,7 @@ 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)] pub enum SVGStrokeDashArray<LengthType> { @@ -237,6 +242,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(PartialEq, ToAnimatedZero, ToComputedValue, ToCss)] diff --git a/components/style/values/generics/text.rs b/components/style/values/generics/text.rs index ca14885d6c0..ff52988fa67 100644 --- a/components/style/values/generics/text.rs +++ b/components/style/values/generics/text.rs @@ -12,6 +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)] pub enum InitialLetter<Number, Integer> { @@ -30,6 +31,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)] pub enum Spacing<Value> { @@ -109,6 +111,7 @@ 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)] diff --git a/components/style/values/generics/transform.rs b/components/style/values/generics/transform.rs index bcd57510e1a..934aa7853be 100644 --- a/components/style/values/generics/transform.rs +++ b/components/style/values/generics/transform.rs @@ -10,6 +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)] #[css(comma, function)] @@ -23,6 +24,7 @@ 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)] @@ -38,6 +40,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)] pub enum TimingFunction<Integer, Number> { diff --git a/components/style/values/mod.rs b/components/style/values/mod.rs index c1f533dd5d4..2a0483ca630 100644 --- a/components/style/values/mod.rs +++ b/components/style/values/mod.rs @@ -67,6 +67,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(PartialEq, ToAnimatedValue, ToAnimatedZero, ToComputedValue, ToCss)] @@ -99,6 +100,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))] pub struct CustomIdent(pub Atom); @@ -128,6 +130,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))] pub enum KeyframesName { /// <custom-ident> diff --git a/components/style/values/specified/align.rs b/components/style/values/specified/align.rs index 424f0042d10..9e2281bba43 100644 --- a/components/style/values/specified/align.rs +++ b/components/style/values/specified/align.rs @@ -18,6 +18,7 @@ bitflags! { /// Constants shared by multiple CSS Box Alignment properties /// /// These constants match Gecko's `NS_STYLE_ALIGN_*` constants. + #[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(ToComputedValue)] pub flags AlignFlags: u8 { // Enumeration stored in the lower 5 bits: @@ -115,6 +116,7 @@ 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))] pub struct AlignJustifyContent(u16); @@ -206,6 +208,7 @@ impl Parse for AlignJustifyContent { /// Value of the `align-self` or `justify-self` property. /// /// https://drafts.csswg.org/css-align/#self-alignment +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue, ToCss)] pub struct AlignJustifySelf(pub AlignFlags); @@ -243,6 +246,7 @@ impl Parse for AlignJustifySelf { /// Value of the `align-items` property /// /// https://drafts.csswg.org/css-align/#self-alignment +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Copy, Debug, Eq, PartialEq, ToComputedValue, ToCss)] pub struct AlignItems(pub AlignFlags); @@ -280,6 +284,7 @@ impl Parse for AlignItems { /// Value of the `justify-items` property /// /// https://drafts.csswg.org/css-align/#justify-items-property +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Copy, Debug, Eq, PartialEq, ToCss)] pub struct JustifyItems(pub AlignFlags); diff --git a/components/style/values/specified/angle.rs b/components/style/values/specified/angle.rs index 3990d6b3b0a..c1cb7505bf1 100644 --- a/components/style/values/specified/angle.rs +++ b/components/style/values/specified/angle.rs @@ -19,6 +19,7 @@ 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)] pub struct Angle { diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index a857d66000b..918f822dc41 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -17,6 +17,7 @@ use values::specified::{AllowQuirks, Number, NumberOrPercentage}; use values::specified::length::{Length, LengthOrPercentage}; /// 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)] pub enum BorderSideWidth { diff --git a/components/style/values/specified/calc.rs b/components/style/values/specified/calc.rs index 32fcadf7d6f..3ac81d5903c 100644 --- a/components/style/values/specified/calc.rs +++ b/components/style/values/specified/calc.rs @@ -64,6 +64,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))] #[allow(missing_docs)] pub struct CalcLengthOrPercentage { diff --git a/components/style/values/specified/color.rs b/components/style/values/specified/color.rs index df7b75ad117..2f2ace7f6e2 100644 --- a/components/style/values/specified/color.rs +++ b/components/style/values/specified/color.rs @@ -19,6 +19,7 @@ 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))] pub enum Color { /// The 'currentColor' keyword @@ -301,6 +302,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))] pub struct RGBAColor(pub Color); @@ -332,6 +334,7 @@ impl From<Color> for RGBAColor { /// Specified value for the "color" property, which resolves the `currentcolor` /// keyword to the parent color instead of self's color. +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[derive(Clone, Debug, PartialEq, ToCss)] pub struct ColorPropertyValue(pub Color); diff --git a/components/style/values/specified/effects.rs b/components/style/values/specified/effects.rs index 7b9ea0c7bb9..9e96194b00e 100644 --- a/components/style/values/specified/effects.rs +++ b/components/style/values/specified/effects.rs @@ -36,6 +36,7 @@ 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))] pub struct Factor(NumberOrPercentage); diff --git a/components/style/values/specified/image.rs b/components/style/values/specified/image.rs index 851700257ba..77368acc2a6 100644 --- a/components/style/values/specified/image.rs +++ b/components/style/values/specified/image.rs @@ -86,6 +86,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))] pub enum LineDirection { /// An angular direction. @@ -105,7 +106,7 @@ pub enum LineDirection { } /// A binary enum to hold either Position or LegacyPosition. -#[derive(Clone, Debug, PartialEq, ToCss)] +#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)] #[cfg(feature = "gecko")] pub enum GradientPosition { /// 1, 2, 3, 4-valued <position>. diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index 33bad5d90cc..1ca4839904e 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -53,6 +53,7 @@ pub fn au_to_int_px(au: f32) -> i32 { } #[derive(Clone, Copy, Debug, PartialEq)] +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// A font relative length. pub enum FontRelativeLength { @@ -194,6 +195,7 @@ impl FontRelativeLength { } #[derive(Clone, Copy, Debug, PartialEq)] +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// A viewport-relative length. /// @@ -244,6 +246,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))] pub struct CharacterWidth(pub i32); @@ -263,6 +266,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))] pub enum AbsoluteLength { /// An absolute length in pixels (px) @@ -376,6 +380,7 @@ impl Add<AbsoluteLength> for AbsoluteLength { /// Represents a physical length (mozmm) based on DPI #[derive(Clone, Copy, Debug, PartialEq)] #[cfg(feature = "gecko")] +#[derive(MallocSizeOf)] pub struct PhysicalLength(pub CSSFloat); #[cfg(feature = "gecko")] @@ -423,6 +428,7 @@ impl Mul<CSSFloat> for PhysicalLength { /// /// https://drafts.csswg.org/css-values/#lengths #[derive(Clone, Copy, Debug, PartialEq)] +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] pub enum NoCalcLength { /// An absolute length @@ -568,6 +574,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)] pub enum Length { @@ -782,6 +789,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)] pub enum LengthOrPercentage { @@ -952,6 +960,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)] pub enum LengthOrPercentageOrAuto { @@ -1068,6 +1077,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)] #[allow(missing_docs)] @@ -1216,6 +1226,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)] pub enum MozLength { @@ -1242,6 +1253,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)] pub enum MaxLength { diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 2b08912f73e..7dd63970567 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -174,6 +174,7 @@ impl BorderStyle { } #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)] +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] #[allow(missing_docs)] pub struct Number { @@ -281,6 +282,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)] pub enum NumberOrPercentage { @@ -316,6 +318,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)] pub struct Opacity(Number); @@ -352,6 +355,7 @@ impl ToComputedValue for Opacity { /// /// 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))] pub struct Integer { value: CSSInteger, @@ -504,6 +508,7 @@ pub type LengthOrPercentageOrNumber = Either<Number, LengthOrPercentage>; pub type NonNegativeLengthOrPercentageOrNumber = Either<NonNegativeNumber, NonNegativeLengthOrPercentage>; #[derive(Clone, Debug, PartialEq)] +#[cfg_attr(feature = "gecko", derive(MallocSizeOf))] #[cfg_attr(feature = "servo", derive(HeapSizeOf))] /// rect(<top>, <left>, <bottom>, <right>) used by clip and image-region pub struct ClipRect { @@ -674,6 +679,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)] pub struct Attr { diff --git a/components/style/values/specified/percentage.rs b/components/style/values/specified/percentage.rs index 0373d29016e..ff67193da9a 100644 --- a/components/style/values/specified/percentage.rs +++ b/components/style/values/specified/percentage.rs @@ -17,6 +17,7 @@ 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))] pub struct Percentage { /// The percentage value as a float. diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index a39b6715dd1..6cfc6987975 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -27,6 +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)] pub enum PositionComponent<S> { diff --git a/components/style/values/specified/time.rs b/components/style/values/specified/time.rs index 28820158af8..dbbe0b0436b 100644 --- a/components/style/values/specified/time.rs +++ b/components/style/values/specified/time.rs @@ -17,6 +17,7 @@ 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))] pub struct Time { seconds: CSSFloat, @@ -26,6 +27,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))] pub enum TimeUnit { /// `s` diff --git a/components/style/values/specified/transform.rs b/components/style/values/specified/transform.rs index b40dc58b0a2..56519399980 100644 --- a/components/style/values/specified/transform.rs +++ b/components/style/values/specified/transform.rs @@ -21,6 +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)] pub enum OriginComponent<S> { |