mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
style: Add some attributes for SpecifiedValueInfo to help deriving more from types.
Bug: 1434130 Reviewed-by: emilio MozReview-Commit-ID: IyohSTbUO31
This commit is contained in:
parent
0021c70c08
commit
0f7f9eebc0
17 changed files with 137 additions and 36 deletions
|
@ -69,6 +69,7 @@ pub enum BasicShape<H, V, LengthOrPercentage> {
|
|||
|
||||
/// <https://drafts.csswg.org/css-shapes/#funcdef-inset>
|
||||
#[allow(missing_docs)]
|
||||
#[css(function = "inset")]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq,
|
||||
SpecifiedValueInfo, ToComputedValue)]
|
||||
pub struct InsetRect<LengthOrPercentage> {
|
||||
|
@ -78,6 +79,7 @@ pub struct InsetRect<LengthOrPercentage> {
|
|||
|
||||
/// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
|
||||
#[allow(missing_docs)]
|
||||
#[css(function)]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf,
|
||||
PartialEq, SpecifiedValueInfo, ToComputedValue)]
|
||||
pub struct Circle<H, V, LengthOrPercentage> {
|
||||
|
@ -87,6 +89,7 @@ pub struct Circle<H, V, LengthOrPercentage> {
|
|||
|
||||
/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
|
||||
#[allow(missing_docs)]
|
||||
#[css(function)]
|
||||
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf,
|
||||
PartialEq, SpecifiedValueInfo, ToComputedValue)]
|
||||
pub struct Ellipse<H, V, LengthOrPercentage> {
|
||||
|
@ -110,6 +113,7 @@ pub enum ShapeRadius<LengthOrPercentage> {
|
|||
/// A generic type for representing the `polygon()` function
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-shapes/#funcdef-polygon>
|
||||
#[css(function)]
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
pub struct Polygon<LengthOrPercentage> {
|
||||
|
|
|
@ -28,6 +28,7 @@ pub struct BorderImageSlice<NumberOrPercentage> {
|
|||
/// The offsets.
|
||||
pub offsets: Rect<NumberOrPercentage>,
|
||||
/// Whether to fill the middle part.
|
||||
#[value_info(represents_keyword)]
|
||||
pub fill: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ impl<I> Deref for CounterReset<I> {
|
|||
/// Keyword `none` is represented by an empty vector.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
pub struct Counters<I>(Box<[(CustomIdent, I)]>);
|
||||
pub struct Counters<I>(#[css(if_empty = "none")] Box<[(CustomIdent, I)]>);
|
||||
|
||||
impl<I> Default for Counters<I> {
|
||||
#[inline]
|
||||
|
|
|
@ -19,6 +19,7 @@ pub struct BoxShadow<Color, SizeLength, BlurShapeLength, ShapeLength> {
|
|||
pub spread: ShapeLength,
|
||||
/// Whether this is an inset box shadow.
|
||||
#[animation(constant)]
|
||||
#[value_info(represents_keyword)]
|
||||
pub inset: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -198,10 +198,12 @@ pub enum TrackSize<L> {
|
|||
/// and a flexible `<track-breadth>`
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-minmax>
|
||||
#[css(function)]
|
||||
Minmax(TrackBreadth<L>, TrackBreadth<L>),
|
||||
/// A `fit-content` function.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-fit-content>
|
||||
#[css(function)]
|
||||
FitContent(L),
|
||||
}
|
||||
|
||||
|
@ -346,8 +348,7 @@ where
|
|||
/// The initial argument of the `repeat` function.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-repeat>
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss)]
|
||||
pub enum RepeatCount<Integer> {
|
||||
/// A positive integer. This is allowed only for `<track-repeat>` and `<fixed-repeat>`
|
||||
Number(Integer),
|
||||
|
@ -384,6 +385,7 @@ impl Parse for RepeatCount<specified::Integer> {
|
|||
/// values in its computed form.
|
||||
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
#[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`)
|
||||
pub count: RepeatCount<I>,
|
||||
|
@ -481,8 +483,7 @@ pub enum TrackListValue<LengthOrPercentage, Integer> {
|
|||
/// The type of a `<track-list>` as determined during parsing.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToComputedValue)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||
pub enum TrackListType {
|
||||
/// [`<auto-track-list>`](https://drafts.csswg.org/css-grid/#typedef-auto-track-list)
|
||||
///
|
||||
|
@ -510,6 +511,7 @@ pub struct TrackList<LengthOrPercentage, Integer> {
|
|||
///
|
||||
/// In order to avoid parsing the same value multiple times, this does a single traversal
|
||||
/// and arrives at the type of value it has parsed (or bails out gracefully with an error).
|
||||
#[css(skip)]
|
||||
pub list_type: TrackListType,
|
||||
/// A vector of `<track-size> | <track-repeat>` values.
|
||||
pub values: Vec<TrackListValue<LengthOrPercentage, Integer>>,
|
||||
|
|
|
@ -26,6 +26,7 @@ pub enum Image<Gradient, MozImageRect, ImageUrl> {
|
|||
/// A `-moz-image-rect` image. Also fairly large and rare.
|
||||
Rect(Box<MozImageRect>),
|
||||
/// A `-moz-element(# <element-id>)`
|
||||
#[css(function = "-moz-element")]
|
||||
Element(Atom),
|
||||
/// A paint worklet image.
|
||||
/// <https://drafts.css-houdini.org/css-paint-api/>
|
||||
|
|
|
@ -80,7 +80,9 @@ pub struct TransformOrigin<H, V, Depth> {
|
|||
/// A generic timing function.
|
||||
///
|
||||
/// <https://drafts.csswg.org/css-timing-1/#single-timing-function-production>
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo,
|
||||
ToCss)]
|
||||
#[value_info(ty = "TIMING_FUNCTION")]
|
||||
pub enum TimingFunction<Integer, Number> {
|
||||
/// `linear | ease | ease-in | ease-out | ease-in-out`
|
||||
Keyword(TimingKeyword),
|
||||
|
@ -95,6 +97,7 @@ pub enum TimingFunction<Integer, Number> {
|
|||
},
|
||||
/// `step-start | step-end | steps(<integer>, [ start | end ]?)`
|
||||
#[css(comma, function)]
|
||||
#[value_info(other_values = "step-start,step-end")]
|
||||
Steps(Integer, #[css(skip_if = "is_end")] StepPosition),
|
||||
/// `frames(<integer>)`
|
||||
#[css(comma, function)]
|
||||
|
@ -103,7 +106,8 @@ pub enum TimingFunction<Integer, Number> {
|
|||
|
||||
#[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,
|
||||
SpecifiedValueInfo, ToComputedValue, ToCss)]
|
||||
pub enum TimingKeyword {
|
||||
Linear,
|
||||
Ease,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue