style: Add derived ToShmem implementations.

Differential Revision: https://phabricator.services.mozilla.com/D17197
This commit is contained in:
Cameron McCormack 2019-03-30 00:16:25 +00:00 committed by Emilio Cobos Álvarez
parent 128c6ae94a
commit 40248ae5fd
93 changed files with 649 additions and 267 deletions

View file

@ -27,6 +27,7 @@ fn width_and_height_are_auto<L>(
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericBackgroundSize<LengthPercent> {

View file

@ -31,6 +31,7 @@ pub type ClippingShape<BasicShape, Url> = ShapeSource<BasicShape, GeometryBox, U
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum GeometryBox {
FillBox,
@ -58,6 +59,7 @@ pub type FloatAreaShape<BasicShape, Image> = ShapeSource<BasicShape, ShapeBox, I
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ShapeBox {
MarginBox,
@ -79,6 +81,7 @@ pub enum ShapeBox {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> {
#[animation(error)]
@ -104,11 +107,24 @@ pub enum ShapeSource<BasicShape, ReferenceBox, ImageOrUrl> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum BasicShape<H, V, LengthPercentage, NonNegativeLengthPercentage> {
Inset(#[css(field_bound)] InsetRect<LengthPercentage, NonNegativeLengthPercentage>),
Circle(#[css(field_bound)] Circle<H, V, NonNegativeLengthPercentage>),
Ellipse(#[css(field_bound)] Ellipse<H, V, NonNegativeLengthPercentage>),
Inset(
#[css(field_bound)]
#[shmem(field_bound)]
InsetRect<LengthPercentage, NonNegativeLengthPercentage>,
),
Circle(
#[css(field_bound)]
#[shmem(field_bound)]
Circle<H, V, NonNegativeLengthPercentage>,
),
Ellipse(
#[css(field_bound)]
#[shmem(field_bound)]
Ellipse<H, V, NonNegativeLengthPercentage>,
),
Polygon(Polygon<LengthPercentage>),
}
@ -125,9 +141,11 @@ pub enum BasicShape<H, V, LengthPercentage, NonNegativeLengthPercentage> {
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
pub rect: Rect<LengthPercentage>,
#[shmem(field_bound)]
pub round: BorderRadius<NonNegativeLengthPercentage>,
}
@ -145,6 +163,7 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
pub struct Circle<H, V, NonNegativeLengthPercentage> {
pub position: Position<H, V>,
@ -165,6 +184,7 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
pub struct Ellipse<H, V, NonNegativeLengthPercentage> {
pub position: Position<H, V>,
@ -186,6 +206,7 @@ pub struct Ellipse<H, V, NonNegativeLengthPercentage> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ShapeRadius<NonNegativeLengthPercentage> {
Length(NonNegativeLengthPercentage),
@ -208,6 +229,7 @@ pub enum ShapeRadius<NonNegativeLengthPercentage> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct Polygon<LengthPercentage> {
/// The filling rule for a polygon.
@ -228,6 +250,7 @@ pub struct Polygon<LengthPercentage> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct PolygonCoord<LengthPercentage>(pub LengthPercentage, pub LengthPercentage);
@ -249,6 +272,7 @@ pub struct PolygonCoord<LengthPercentage>(pub LengthPercentage, pub LengthPercen
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(u8)]
pub enum FillRule {
@ -270,6 +294,7 @@ pub enum FillRule {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct Path {
/// The filling rule for the svg path.

View file

@ -12,7 +12,15 @@ use style_traits::{CssWriter, ToCss};
/// A generic value for a single side of a `border-image-width` property.
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum BorderImageSideWidth<LengthPercentage, Number> {
/// `<length-or-percentage>`
@ -25,7 +33,15 @@ pub enum BorderImageSideWidth<LengthPercentage, Number> {
/// A generic value for the `border-image-slice` property.
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C)]
pub struct GenericBorderImageSlice<NumberOrPercentage> {
@ -53,9 +69,10 @@ pub use self::GenericBorderImageSlice as BorderImageSlice;
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C)]
pub struct GenericBorderCornerRadius<L>(#[css(field_bound)] pub Size2D<L>);
pub struct GenericBorderCornerRadius<L>(#[css(field_bound)] #[shmem(field_bound)] pub Size2D<L>);
pub use self::GenericBorderCornerRadius as BorderCornerRadius;
@ -90,9 +107,10 @@ impl<L: Zero> Zero for BorderCornerRadius<L> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(transparent)]
pub struct BorderSpacing<L>(#[css(field_bound)] pub Size2D<L>);
pub struct BorderSpacing<L>(#[css(field_bound)] #[shmem(field_bound)] pub Size2D<L>);
impl<L> BorderSpacing<L> {
/// Trivially create a `BorderCornerRadius`.
@ -115,10 +133,12 @@ impl<L> BorderSpacing<L> {
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
#[repr(C)]
pub struct GenericBorderRadius<LengthPercentage> {
/// The top left radius.
#[shmem(field_bound)]
pub top_left: GenericBorderCornerRadius<LengthPercentage>,
/// The top right radius.
pub top_right: GenericBorderCornerRadius<LengthPercentage>,

View file

@ -18,6 +18,7 @@ use crate::values::animated::ToAnimatedZero;
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum VerticalAlign<LengthPercentage> {
/// `baseline`
@ -58,7 +59,9 @@ impl<L> ToAnimatedZero for VerticalAlign<L> {
}
/// https://drafts.csswg.org/css-animations/#animation-iteration-count
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
pub enum AnimationIterationCount<Number> {
/// A `<number>` value.
Number(Number),
@ -81,6 +84,7 @@ pub enum AnimationIterationCount<Number> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericPerspective<NonNegativeLength> {

View file

@ -6,7 +6,7 @@
/// Ratios representing the contribution of color and currentcolor to
/// the final color value.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue, ToShmem)]
pub struct ComplexColorRatios {
/// Numeric color contribution.
pub bg: f32,
@ -23,7 +23,7 @@ impl ComplexColorRatios {
/// This enum represents a combined color from a numeric color and
/// the current foreground color (currentcolor keyword).
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToAnimatedValue, ToShmem)]
pub enum Color<RGBA> {
/// Numeric RGBA color.
Numeric(RGBA),
@ -90,6 +90,7 @@ impl<RGBA> From<RGBA> for Color<RGBA> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ColorOrAuto<C> {
/// A `<color>

View file

@ -19,6 +19,7 @@
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ColumnCount<PositiveInteger> {
/// A positive integer.

View file

@ -14,7 +14,9 @@ use crate::values::CustomIdent;
use std::ops::Deref;
/// A name / value pair for counters.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
pub struct CounterPair<Integer> {
/// The name of the counter.
pub name: CustomIdent,
@ -24,7 +26,15 @@ pub struct CounterPair<Integer> {
/// A generic value for the `counter-increment` property.
#[derive(
Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Debug,
Default,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct CounterIncrement<I>(Counters<I>);
@ -47,7 +57,15 @@ impl<I> Deref for CounterIncrement<I> {
/// A generic value for the `counter-set` and `counter-reset` properties.
#[derive(
Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Debug,
Default,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct CounterSetOrReset<I>(Counters<I>);
@ -71,7 +89,9 @@ impl<I> Deref for CounterSetOrReset<I> {
/// A generic value for lists of counters.
///
/// Keyword `none` is represented by an empty vector.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
pub struct Counters<I>(#[css(iterable, if_empty = "none")] Box<[CounterPair<I>]>);
impl<I> Default for Counters<I> {
@ -102,7 +122,9 @@ fn is_decimal(counter_type: &CounterStyleType) -> bool {
/// The specified value for the `content` property.
///
/// https://drafts.csswg.org/css-content/#propdef-content
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
pub enum Content<ImageUrl> {
/// `normal` reserved keyword.
Normal,
@ -124,7 +146,9 @@ impl<ImageUrl> Content<ImageUrl> {
}
/// Items for the `content` property.
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
pub enum ContentItem<ImageUrl> {
/// Literal string content.
String(Box<str>),

View file

@ -10,7 +10,15 @@ use crate::values::CSSFloat;
/// A generic easing function.
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
#[value_info(ty = "TIMING_FUNCTION")]
#[repr(u8, C)]
@ -46,6 +54,7 @@ pub enum TimingFunction<Integer, Number> {
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(u8)]
pub enum TimingKeyword {
@ -69,7 +78,9 @@ fn step_position_jump_enabled(_context: &ParserContext) -> bool {
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
#[derive(
Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToShmem,
)]
#[repr(u8)]
pub enum StepPosition {
#[parse(condition = "step_position_jump_enabled")]

View file

@ -16,6 +16,7 @@
ToAnimatedValue,
ToAnimatedZero,
ToCss,
ToShmem,
)]
pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
/// The base shadow.
@ -41,6 +42,7 @@ pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum Filter<Angle, Factor, Length, DropShadow, Url> {
/// `blur(<length>)`
@ -93,6 +95,7 @@ pub enum Filter<Angle, Factor, Length, DropShadow, Url> {
ToAnimatedValue,
ToAnimatedZero,
ToCss,
ToShmem,
)]
pub struct SimpleShadow<Color, SizeLength, ShapeLength> {
/// Color.

View file

@ -19,6 +19,7 @@
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C)]
pub enum GenericFlexBasis<S> {

View file

@ -15,7 +15,9 @@ use style_traits::{CssWriter, KeywordsCollectFn, ParseError};
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind, ToCss};
/// https://drafts.csswg.org/css-fonts-4/#feature-tag-value
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(
Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem,
)]
pub struct FeatureTagValue<Integer> {
/// A four-character tag, packed into a u32 (one byte per character).
pub tag: FontTag,
@ -56,6 +58,7 @@ where
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct VariationValue<Number> {
/// A four-character tag, packed into a u32 (one byte per character).
@ -67,7 +70,9 @@ pub struct VariationValue<Number> {
/// A value both for font-variation-settings and font-feature-settings.
#[css(comma)]
#[derive(Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
pub struct FontSettings<T>(#[css(if_empty = "normal", iterable)] pub Box<[T]>);
impl<T> FontSettings<T> {
@ -103,7 +108,9 @@ impl<T: Parse> Parse for FontSettings<T> {
/// https://drafts.csswg.org/css-fonts-4/#font-variation-settings-def
/// https://drafts.csswg.org/css-fonts-4/#descdef-font-face-font-feature-settings
///
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(
Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem,
)]
pub struct FontTag(pub u32);
impl ToCss for FontTag {
@ -149,6 +156,7 @@ impl Parse for FontTag {
ToAnimatedValue,
ToAnimatedZero,
ToCss,
ToShmem,
)]
/// Additional information for keyword-derived font sizes.
pub struct KeywordInfo<Length> {
@ -205,6 +213,7 @@ impl<L> SpecifiedValueInfo for KeywordInfo<L> {
ToAnimatedValue,
ToAnimatedZero,
ToCss,
ToShmem,
)]
#[allow(missing_docs)]
pub enum KeywordSize {
@ -254,6 +263,7 @@ impl Default for KeywordSize {
SpecifiedValueInfo,
ToAnimatedValue,
ToAnimatedZero,
ToShmem,
)]
pub enum FontStyle<Angle> {
#[animation(error)]

View file

@ -7,7 +7,7 @@
/// A generic value for scroll snap points.
#[cfg_attr(feature = "gecko", derive(MallocSizeOf))]
#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem)]
pub enum ScrollSnapPoint<LengthPercentage> {
/// `none`
None,

View file

@ -18,7 +18,9 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
/// A `<grid-line>` type.
///
/// <https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line>
#[derive(Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(
Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem,
)]
pub struct GridLine<Integer> {
/// Flag to check whether it's a `span` keyword.
pub is_span: bool,
@ -162,6 +164,7 @@ impl Parse for GridLine<specified::Integer> {
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum TrackKeyword {
Auto,
@ -174,7 +177,15 @@ pub enum TrackKeyword {
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-breadth>
#[derive(
Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Animate,
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum TrackBreadth<L> {
/// The generic type is almost always a non-negative `<length-percentage>`
@ -200,7 +211,7 @@ impl<L> TrackBreadth<L> {
/// generic only to avoid code bloat. It only takes `<length-percentage>`
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-size>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)]
pub enum TrackSize<L> {
/// A flexible `<track-breadth>`
Breadth(TrackBreadth<L>),
@ -358,7 +369,7 @@ where
/// The initial argument of the `repeat` function.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub enum RepeatCount<Integer> {
/// A positive integer. This is allowed only for `<track-repeat>` and `<fixed-repeat>`
Number(Integer),
@ -393,7 +404,7 @@ impl Parse for RepeatCount<specified::Integer> {
///
/// It can also hold `repeat()` function parameters, which expands into the respective
/// values in its computed form.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)]
#[css(function = "repeat")]
pub struct TrackRepeat<L, I> {
/// The number of times for the value to be repeated (could also be `auto-fit` or `auto-fill`)
@ -482,7 +493,15 @@ impl<L: Clone> TrackRepeat<L, specified::Integer> {
/// Track list values. Can be <track-size> or <track-repeat>
#[derive(
Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Animate,
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum TrackListValue<LengthPercentage, Integer> {
/// A <track-size> value.
@ -494,7 +513,7 @@ pub enum TrackListValue<LengthPercentage, Integer> {
/// The type of a `<track-list>` as determined during parsing.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
pub enum TrackListType {
/// [`<auto-track-list>`](https://drafts.csswg.org/css-grid/#typedef-auto-track-list)
///
@ -516,7 +535,7 @@ pub enum TrackListType {
/// A grid `<track-list>` type.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)]
pub struct TrackList<LengthPercentage, Integer> {
/// The type of this `<track-list>` (auto, explicit or general).
///
@ -589,7 +608,9 @@ 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, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(
Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem,
)]
pub struct LineNameList {
/// The optional `<line-name-list>`
pub names: Box<[Box<[CustomIdent]>]>,
@ -695,7 +716,15 @@ impl ToCss for LineNameList {
/// Subgrid deferred to Level 2 spec due to lack of implementation.
/// But it's implemented in gecko, so we have to as well.
#[derive(
Animate, Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Animate,
Clone,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum GridTemplateComponent<L, I> {
/// `none` value.
@ -704,6 +733,7 @@ pub enum GridTemplateComponent<L, I> {
TrackList(
#[animation(field_bound)]
#[compute(field_bound)]
#[shmem(field_bound)]
TrackList<L, I>,
),
/// A `subgrid <line-name-list>?`

View file

@ -16,7 +16,7 @@ use style_traits::{CssWriter, ToCss};
/// An [image].
///
/// [image]: https://drafts.csswg.org/css-images/#image-values
#[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(Clone, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)]
pub enum Image<Gradient, MozImageRect, ImageUrl> {
/// A `<url()>` image.
Url(ImageUrl),
@ -36,7 +36,7 @@ pub enum Image<Gradient, MozImageRect, ImageUrl> {
/// A CSS gradient.
/// <https://drafts.csswg.org/css-images/#gradients>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
pub struct Gradient<LineDirection, Length, LengthPercentage, Position, Color, Angle> {
/// Gradients can be linear or radial.
pub kind: GradientKind<LineDirection, Length, LengthPercentage, Position, Angle>,
@ -48,7 +48,7 @@ pub struct Gradient<LineDirection, Length, LengthPercentage, Position, Color, An
pub compat_mode: CompatMode,
}
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
/// Whether we used the modern notation or the compatibility `-webkit`, `-moz` prefixes.
pub enum CompatMode {
/// Modern syntax.
@ -60,7 +60,7 @@ pub enum CompatMode {
}
/// A gradient kind.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
pub enum GradientKind<LineDirection, Length, LengthPercentage, Position, Angle> {
/// A linear gradient.
Linear(LineDirection),
@ -73,7 +73,7 @@ pub enum GradientKind<LineDirection, Length, LengthPercentage, Position, Angle>
}
/// A radial gradient's ending shape.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub enum EndingShape<Length, LengthPercentage> {
/// A circular gradient.
Circle(Circle<Length>),
@ -82,7 +82,7 @@ pub enum EndingShape<Length, LengthPercentage> {
}
/// A circle shape.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToShmem)]
pub enum Circle<Length> {
/// A circle radius.
Radius(Length),
@ -91,7 +91,7 @@ pub enum Circle<Length> {
}
/// An ellipse shape.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub enum Ellipse<LengthPercentage> {
/// An ellipse pair of radii.
Radii(LengthPercentage, LengthPercentage),
@ -102,7 +102,9 @@ pub enum Ellipse<LengthPercentage> {
/// <https://drafts.csswg.org/css-images/#typedef-extent-keyword>
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
#[derive(
Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToShmem,
)]
pub enum ShapeExtent {
ClosestSide,
FarthestSide,
@ -114,7 +116,7 @@ pub enum ShapeExtent {
/// A gradient item.
/// <https://drafts.csswg.org/css-images-4/#color-stop-syntax>
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub enum GradientItem<Color, LengthPercentage> {
/// A color stop.
ColorStop(ColorStop<Color, LengthPercentage>),
@ -124,7 +126,7 @@ pub enum GradientItem<Color, LengthPercentage> {
/// A color stop.
/// <https://drafts.csswg.org/css-images/#typedef-color-stop-list>
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub struct ColorStop<Color, LengthPercentage> {
/// The color of this stop.
pub color: Color,
@ -167,7 +169,9 @@ impl ToCss for PaintWorklet {
/// `-moz-image-rect(<uri>, top, right, bottom, left);`
#[allow(missing_docs)]
#[css(comma, function)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
pub struct MozImageRect<NumberOrPercentage, MozImageRectUrl> {
pub url: MozImageRectUrl,
pub top: NumberOrPercentage,

View file

@ -26,6 +26,7 @@ use style_traits::ParseError;
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericLengthPercentageOrAuto<LengthPercent> {
@ -109,6 +110,7 @@ impl<LengthPercentage: Parse> Parse for LengthPercentageOrAuto<LengthPercentage>
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericSize<LengthPercent> {
@ -150,6 +152,7 @@ impl<LengthPercentage> Size<LengthPercentage> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericMaxSize<LengthPercent> {
@ -185,6 +188,7 @@ impl<LengthPercentage> MaxSize<LengthPercentage> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericLengthOrNumber<L, N> {

View file

@ -43,7 +43,9 @@ pub mod url;
// https://drafts.csswg.org/css-counter-styles/#typedef-symbols-type
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss)]
#[derive(
Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToComputedValue, ToCss, ToShmem,
)]
pub enum SymbolsType {
Cyclic,
Numeric,
@ -85,7 +87,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)]
#[derive(Clone, Debug, Eq, PartialEq, ToComputedValue, ToCss, ToShmem)]
pub enum CounterStyleOrNone {
/// `none`
None,
@ -173,6 +175,7 @@ impl SpecifiedValueInfo for CounterStyleOrNone {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(transparent)]
pub struct NonNegative<T>(pub T);
@ -210,6 +213,7 @@ impl<T: Zero> Zero for NonNegative<T> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct GreaterThanOrEqualToOne<T>(pub T);
@ -227,6 +231,7 @@ pub struct GreaterThanOrEqualToOne<T>(pub T);
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[css(function = "rect", comma)]
pub struct ClipRect<LengthOrAuto> {

View file

@ -18,6 +18,7 @@
ToAnimatedValue,
ToAnimatedZero,
ToComputedValue,
ToShmem,
)]
#[repr(C)]
pub struct GenericPosition<H, V> {
@ -53,6 +54,7 @@ impl<H, V> Position<H, V> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C, u8)]
pub enum GenericZIndex<I> {

View file

@ -22,6 +22,7 @@ use style_traits::{CssWriter, ParseError, ToCss};
SpecifiedValueInfo,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
#[repr(C)]
pub struct Rect<T>(pub T, pub T, pub T, pub T);

View file

@ -24,6 +24,7 @@ use style_traits::{CssWriter, ParseError, ToCss};
ToAnimatedZero,
ToAnimatedValue,
ToComputedValue,
ToShmem,
)]
#[allow(missing_docs)]
#[repr(C)]

View file

@ -24,6 +24,7 @@ use style_traits::{ParseError, StyleParseErrorKind};
ToAnimatedValue,
ToComputedValue,
ToCss,
ToShmem,
)]
pub struct SVGPaint<ColorType, UrlPaintServer> {
/// The paint source
@ -50,6 +51,7 @@ pub struct SVGPaint<ColorType, UrlPaintServer> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum SVGPaintKind<ColorType, UrlPaintServer> {
/// `none`
@ -142,6 +144,7 @@ impl<ColorType: Parse, UrlPaintServer: Parse> Parse for SVGPaint<ColorType, UrlP
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum SVGLength<L> {
/// `<length> | <percentage> | <number>`
@ -162,6 +165,7 @@ pub enum SVGLength<L> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum SVGStrokeDashArray<L> {
/// `[ <length> | <percentage> | <number> ]#`
@ -186,6 +190,7 @@ pub enum SVGStrokeDashArray<L> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum SVGOpacity<OpacityType> {
/// `<opacity-value>`

View file

@ -11,7 +11,15 @@ use style_traits::ParseError;
/// A generic value for the `initial-letter` property.
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum InitialLetter<Number, Integer> {
/// `normal`
@ -29,7 +37,9 @@ impl<N, I> InitialLetter<N, I> {
}
/// A generic spacing value for the `letter-spacing` and `word-spacing` properties.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)]
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem,
)]
pub enum Spacing<Value> {
/// `normal`
Normal,
@ -81,6 +91,7 @@ fn line_height_moz_block_height_enabled(context: &ParserContext) -> bool {
SpecifiedValueInfo,
ToAnimatedValue,
ToCss,
ToShmem,
Parse,
)]
#[repr(C, u8)]

View file

@ -19,7 +19,15 @@ use style_traits::{CssWriter, ToCss};
/// A generic 2D transformation matrix.
#[allow(missing_docs)]
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
#[css(comma, function)]
pub struct Matrix<T> {
@ -35,7 +43,7 @@ pub struct Matrix<T> {
#[cfg_attr(rustfmt, rustfmt_skip)]
#[css(comma, function = "matrix3d")]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
ToComputedValue, ToCss)]
ToComputedValue, ToCss, ToShmem)]
pub struct Matrix3D<T> {
pub m11: T, pub m12: T, pub m13: T, pub m14: T,
pub m21: T, pub m22: T, pub m23: T, pub m24: T,
@ -82,6 +90,7 @@ impl<T: Into<f64>> From<Matrix3D<T>> for Transform3D<f64> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
#[repr(C)]
pub struct GenericTransformOrigin<H, V, Depth> {
@ -110,7 +119,9 @@ fn is_same<N: PartialEq>(x: &N, y: &N) -> bool {
x == y
}
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
/// A single operation in the list of a `transform` value
pub enum TransformOperation<Angle, Number, Length, Integer, LengthPercentage>
where
@ -215,7 +226,9 @@ where
},
}
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
#[derive(
Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss, ToShmem,
)]
/// A value of the `transform` property
pub struct Transform<T>(#[css(if_empty = "none", iterable)] pub Vec<T>);
@ -537,7 +550,15 @@ pub fn get_normalized_vector_and_angle<T: Zero>(
}
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
ToShmem,
)]
/// A value of the `Rotate` property
///
@ -599,7 +620,15 @@ where
}
#[derive(
Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToAnimatedZero, ToComputedValue,
Clone,
Copy,
Debug,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToAnimatedZero,
ToComputedValue,
ToShmem,
)]
/// A value of the `Scale` property
///
@ -648,6 +677,7 @@ impl<Number: ToCss + PartialEq> ToCss for Scale<Number> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
/// A value of the `translate` property
///
@ -680,7 +710,16 @@ where
#[allow(missing_docs)]
#[derive(
Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss,
Clone,
Copy,
Debug,
MallocSizeOf,
Parse,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum TransformStyle {
#[cfg(feature = "servo")]

View file

@ -11,7 +11,7 @@ use values::specified::ui::CursorKind;
/// A generic value for the `cursor` property.
///
/// https://drafts.csswg.org/css-ui/#cursor
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)]
pub struct Cursor<Image> {
/// The parsed images for the cursor.
pub images: Box<[Image]>,
@ -44,7 +44,7 @@ impl<Image: ToCss> ToCss for Cursor<Image> {
}
/// A generic value for item of `image cursors`.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem)]
pub struct CursorImage<ImageUrl, Number> {
/// The url to parse images from.
pub url: ImageUrl,
@ -84,6 +84,7 @@ impl<ImageUrl: ToCss, Number: ToCss> ToCss for CursorImage<ImageUrl, Number> {
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum ScrollbarColor<Color> {
/// `auto`

View file

@ -18,6 +18,7 @@
ToAnimatedZero,
ToComputedValue,
ToCss,
ToShmem,
)]
pub enum UrlOrNone<Url> {
/// `none`