mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
style: Add derived ToShmem implementations.
Differential Revision: https://phabricator.services.mozilla.com/D17197
This commit is contained in:
parent
128c6ae94a
commit
40248ae5fd
93 changed files with 649 additions and 267 deletions
|
@ -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>?`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue