diff options
Diffstat (limited to 'components/style/values/generics/image.rs')
-rw-r--r-- | components/style/values/generics/image.rs | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/components/style/values/generics/image.rs b/components/style/values/generics/image.rs index a90e6dbca75..f7329cf4def 100644 --- a/components/style/values/generics/image.rs +++ b/components/style/values/generics/image.rs @@ -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, |