style: Derive ToResolvedValue.

Differential Revision: https://phabricator.services.mozilla.com/D26783
This commit is contained in:
Emilio Cobos Álvarez 2019-04-10 12:10:26 +00:00
parent 6ac777ebf2
commit a47dcb5707
53 changed files with 359 additions and 108 deletions

View file

@ -19,7 +19,15 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
///
/// <https://drafts.csswg.org/css-grid/#typedef-grid-row-start-grid-line>
#[derive(
Clone, Debug, Default, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToShmem,
Clone,
Debug,
Default,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
ToShmem,
)]
pub struct GridLine<Integer> {
/// Flag to check whether it's a `span` keyword.
@ -164,6 +172,7 @@ impl Parse for GridLine<specified::Integer> {
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
pub enum TrackKeyword {
@ -185,6 +194,7 @@ pub enum TrackKeyword {
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
pub enum TrackBreadth<L> {
@ -211,7 +221,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, ToShmem)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToResolvedValue, ToShmem)]
pub enum TrackSize<L> {
/// A flexible `<track-breadth>`
Breadth(TrackBreadth<L>),
@ -369,7 +379,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, ToShmem)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToCss, ToResolvedValue, ToShmem)]
pub enum RepeatCount<Integer> {
/// A positive integer. This is allowed only for `<track-repeat>` and `<fixed-repeat>`
Number(Integer),
@ -404,7 +414,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, ToShmem)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToComputedValue, ToResolvedValue, 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`)
@ -501,6 +511,7 @@ impl<L: Clone> TrackRepeat<L, specified::Integer> {
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
pub enum TrackListValue<LengthPercentage, Integer> {
@ -513,7 +524,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, ToShmem)]
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToComputedValue, ToResolvedValue, ToShmem)]
pub enum TrackListType {
/// [`<auto-track-list>`](https://drafts.csswg.org/css-grid/#typedef-auto-track-list)
///
@ -535,7 +546,7 @@ pub enum TrackListType {
/// A grid `<track-list>` type.
///
/// <https://drafts.csswg.org/css-grid/#typedef-track-list>
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem)]
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToShmem, ToResolvedValue)]
pub struct TrackList<LengthPercentage, Integer> {
/// The type of this `<track-list>` (auto, explicit or general).
///
@ -609,7 +620,15 @@ 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, ToShmem,
Clone,
Debug,
Default,
MallocSizeOf,
PartialEq,
SpecifiedValueInfo,
ToComputedValue,
ToResolvedValue,
ToShmem,
)]
pub struct LineNameList {
/// The optional `<line-name-list>`
@ -724,6 +743,7 @@ impl ToCss for LineNameList {
SpecifiedValueInfo,
ToComputedValue,
ToCss,
ToResolvedValue,
ToShmem,
)]
pub enum GridTemplateComponent<L, I> {
@ -733,6 +753,7 @@ pub enum GridTemplateComponent<L, I> {
TrackList(
#[animation(field_bound)]
#[compute(field_bound)]
#[resolve(field_bound)]
#[shmem(field_bound)]
TrackList<L, I>,
),