Skip to main content

float_pigment_css/
typing.rs

1//! CSS value types for each CSS property.
2//!
3//! The possible CSS values are different for each CSS property. This module lists all of them.
4//!
5//! For example, enum `BoxSizing` list out all possible values of the `box-sizing` property.
6
7use alloc::{
8    boxed::Box,
9    string::{String, ToString},
10};
11
12use float_pigment_css_macro::{property_value_type, ResolveFontSize};
13
14#[cfg(debug_assertions)]
15use float_pigment_css_macro::{CompatibilityEnumCheck, CompatibilityStructCheck};
16
17use serde::{Deserialize, Serialize};
18
19use crate::length_num::LengthNum;
20use crate::property::PropertyValueWithGlobal;
21use crate::query::MediaQueryStatus;
22use crate::resolve_font_size::ResolveFontSize;
23use crate::sheet::{borrow::Array, str_store::StrRef};
24
25/// A bitset for representing `!important`.
26///
27/// It is used in the binary format for better size.
28/// Not suitable for common cases.
29#[allow(missing_docs)]
30#[repr(C)]
31#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
32#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
33pub enum ImportantBitSet {
34    None,
35    Array(Array<u8>),
36}
37
38/// An expression inside `calc(...)`.
39#[repr(C)]
40#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
41#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
42pub enum CalcExpr {
43    /// A length, e.g. `2px`.
44    Length(Box<Length>),
45    /// A number, e.g. `0.1`.
46    Number(Box<Number>),
47    /// An angle, e.g. `45deg`.
48    Angle(Box<Angle>),
49    /// `+` expression.
50    Plus(Box<CalcExpr>, Box<CalcExpr>),
51    /// `-` expression.
52    Sub(Box<CalcExpr>, Box<CalcExpr>),
53    /// `*` expression.
54    Mul(Box<CalcExpr>, Box<CalcExpr>),
55    /// `/` expression.
56    Div(Box<CalcExpr>, Box<CalcExpr>),
57}
58
59impl Default for CalcExpr {
60    fn default() -> Self {
61        Self::Length(Box::new(Length::Undefined))
62    }
63}
64
65/// A number or an expression that evaluates to a number.
66#[allow(missing_docs)]
67#[repr(C)]
68#[property_value_type(PropertyValueWithGlobal for NumberType)]
69#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
70#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
71pub enum Number {
72    F32(f32),
73    I32(i32),
74    Calc(Box<CalcExpr>),
75}
76
77impl Default for Number {
78    fn default() -> Self {
79        Self::I32(0)
80    }
81}
82
83impl From<f32> for NumberType {
84    fn from(x: f32) -> Self {
85        NumberType::F32(x)
86    }
87}
88
89impl From<i32> for NumberType {
90    fn from(x: i32) -> Self {
91        NumberType::I32(x)
92    }
93}
94
95impl Number {
96    /// Convert the number to `f32`.
97    ///
98    /// Panics if it is an expression.
99    pub fn to_f32(&self) -> f32 {
100        match self {
101            Number::F32(x) => *x,
102            Number::I32(x) => *x as f32,
103            _ => panic!("cannot convert an expression to a number"),
104        }
105    }
106
107    /// Convert the number to `i32`.
108    ///
109    /// Panics if it is an expression.
110    pub fn to_i32(&self) -> i32 {
111        match self {
112            Number::I32(x) => *x,
113            Number::F32(x) => *x as i32,
114            _ => panic!("cannot convert an expression to a number"),
115        }
116    }
117}
118
119impl ResolveFontSize for Number {
120    fn resolve_font_size(&mut self, _: f32) {
121        // empty
122    }
123}
124
125/// A color value or `current-color`.
126#[allow(missing_docs)]
127#[repr(C)]
128#[property_value_type(PropertyValueWithGlobal for ColorType)]
129#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
130#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
131pub enum Color {
132    Undefined,
133    CurrentColor,
134    Specified(u8, u8, u8, u8),
135}
136
137/// A length value or an expression that evaluates to a length value.
138#[allow(missing_docs)]
139#[repr(C)]
140#[property_value_type(PropertyValueWithGlobal for LengthType)]
141#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
142#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
143pub enum Length {
144    Undefined,
145    Auto,
146    Px(f32),
147    Vw(f32),
148    Vh(f32),
149    Rem(f32),
150    Rpx(f32),
151    Em(f32),
152    Ratio(f32),
153    Expr(LengthExpr),
154    Vmin(f32),
155    Vmax(f32),
156}
157
158#[allow(clippy::derivable_impls)]
159impl Default for Length {
160    fn default() -> Self {
161        Length::Undefined
162    }
163}
164
165impl Length {
166    pub(crate) fn ratio_to_f32(&self) -> Option<f32> {
167        match self {
168            Length::Ratio(x) => Some(*x),
169            _ => None,
170        }
171    }
172
173    pub(crate) fn resolve_set(&mut self, font_size: f32) {
174        *self = Self::Px(font_size);
175    }
176
177    pub(crate) fn resolve_em(&mut self, font_size: f32) {
178        if let Self::Em(x) = *self {
179            *self = Self::Px(x * font_size);
180        }
181    }
182
183    pub(crate) fn resolve_em_and_ratio(&mut self, font_size: f32) {
184        if let Self::Em(x) = *self {
185            *self = Self::Px(x * font_size);
186        } else if let Self::Ratio(x) = *self {
187            *self = Self::Px(x * font_size);
188        }
189    }
190
191    /// Resolve the length value to `f32`.
192    ///
193    /// The `relative_length` is used to calculate `...%` length.
194    /// If `length_as_parent_font_size` is set, the `relative_length` is used for `em` length;
195    /// otherwise the base font size in `media_query_status` is used.
196    pub fn resolve_to_f32<L: LengthNum>(
197        &self,
198        media_query_status: &MediaQueryStatus<L>,
199        relative_length: f32,
200        length_as_parent_font_size: bool,
201    ) -> Option<f32> {
202        let r = match self {
203            Length::Undefined | Length::Auto => None?,
204            Length::Px(x) => *x,
205            Length::Vw(x) => media_query_status.width.to_f32() / 100. * *x,
206            Length::Vh(x) => media_query_status.height.to_f32() / 100. * *x,
207            Length::Rem(x) => media_query_status.base_font_size.to_f32() * *x,
208            Length::Rpx(x) => media_query_status.width.to_f32() / 750. * *x,
209            Length::Em(x) => {
210                if length_as_parent_font_size {
211                    relative_length * *x
212                } else {
213                    media_query_status.base_font_size.to_f32() * *x
214                }
215            }
216            Length::Ratio(x) => relative_length * *x,
217            Length::Expr(x) => match x {
218                LengthExpr::Invalid => None?,
219                LengthExpr::Env(name, default_value) => match name.as_str() {
220                    "safe-area-inset-left" => media_query_status.env.safe_area_inset_left.to_f32(),
221                    "safe-area-inset-top" => media_query_status.env.safe_area_inset_top.to_f32(),
222                    "safe-area-inset-right" => {
223                        media_query_status.env.safe_area_inset_right.to_f32()
224                    }
225                    "safe-area-inset-bottom" => {
226                        media_query_status.env.safe_area_inset_bottom.to_f32()
227                    }
228                    _ => default_value.resolve_to_f32(
229                        media_query_status,
230                        relative_length,
231                        length_as_parent_font_size,
232                    )?,
233                },
234                LengthExpr::Calc(x) => x.resolve_to_f32(
235                    media_query_status,
236                    relative_length,
237                    length_as_parent_font_size,
238                )?,
239            },
240            Length::Vmin(x) => {
241                media_query_status
242                    .width
243                    .upper_bound(media_query_status.height)
244                    .to_f32()
245                    / 100.
246                    * *x
247            }
248            Length::Vmax(x) => {
249                media_query_status
250                    .width
251                    .lower_bound(media_query_status.height)
252                    .to_f32()
253                    / 100.
254                    * *x
255            }
256        };
257        Some(r)
258    }
259
260    /// Resolve the length value to `L`.
261    ///
262    /// The `relative_length` is used to calculate `...%` length.
263    /// The base font size in `media_query_status` is used for `em` length.
264    pub fn resolve_length<L: LengthNum>(
265        &self,
266        media_query_status: &MediaQueryStatus<L>,
267        relative_length: L,
268    ) -> Option<L> {
269        let r = match self {
270            Length::Undefined | Length::Auto => None?,
271            Length::Expr(x) => match x {
272                LengthExpr::Invalid => None?,
273                LengthExpr::Env(name, default_value) => match name.as_str() {
274                    "safe-area-inset-left" => media_query_status.env.safe_area_inset_left,
275                    "safe-area-inset-top" => media_query_status.env.safe_area_inset_top,
276                    "safe-area-inset-right" => media_query_status.env.safe_area_inset_right,
277                    "safe-area-inset-bottom" => media_query_status.env.safe_area_inset_bottom,
278                    _ => default_value.resolve_length(media_query_status, relative_length)?,
279                },
280                LengthExpr::Calc(x) => L::from_f32(x.resolve_to_f32(
281                    media_query_status,
282                    relative_length.to_f32(),
283                    false,
284                )?),
285            },
286            _ => L::from_f32(self.resolve_to_f32(
287                media_query_status,
288                relative_length.to_f32(),
289                false,
290            )?),
291        };
292        Some(r)
293    }
294}
295
296/// An expression for a length value.
297#[allow(missing_docs)]
298#[repr(C)]
299#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
300#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
301pub enum LengthExpr {
302    Invalid,
303    Env(StrRef, Box<Length>),
304    Calc(Box<CalcExpr>),
305}
306
307impl Default for LengthExpr {
308    fn default() -> Self {
309        Self::Invalid
310    }
311}
312
313impl CalcExpr {
314    fn resolve_to_f32<L: LengthNum>(
315        &self,
316        media_query_status: &MediaQueryStatus<L>,
317        relative_length: f32,
318        length_as_parent_font_size: bool,
319    ) -> Option<f32> {
320        let ret = match self {
321            CalcExpr::Length(x) => x.resolve_to_f32(
322                media_query_status,
323                relative_length,
324                length_as_parent_font_size,
325            )?,
326            CalcExpr::Number(_) => None?,
327            CalcExpr::Angle(_) => None?,
328            CalcExpr::Plus(x, y) => {
329                let x = x.resolve_to_f32(
330                    media_query_status,
331                    relative_length,
332                    length_as_parent_font_size,
333                )?;
334                let y = y.resolve_to_f32(
335                    media_query_status,
336                    relative_length,
337                    length_as_parent_font_size,
338                )?;
339                x + y
340            }
341            CalcExpr::Sub(x, y) => {
342                let x = x.resolve_to_f32(
343                    media_query_status,
344                    relative_length,
345                    length_as_parent_font_size,
346                )?;
347                let y = y.resolve_to_f32(
348                    media_query_status,
349                    relative_length,
350                    length_as_parent_font_size,
351                )?;
352                x - y
353            }
354            CalcExpr::Mul(x, y) => {
355                let x = x.resolve_to_f32(
356                    media_query_status,
357                    relative_length,
358                    length_as_parent_font_size,
359                )?;
360                let y = y.resolve_to_f32(
361                    media_query_status,
362                    relative_length,
363                    length_as_parent_font_size,
364                )?;
365                x * y
366            }
367            CalcExpr::Div(x, y) => {
368                let x = x.resolve_to_f32(
369                    media_query_status,
370                    relative_length,
371                    length_as_parent_font_size,
372                )?;
373                let y = y.resolve_to_f32(
374                    media_query_status,
375                    relative_length,
376                    length_as_parent_font_size,
377                )?;
378                x / y
379            }
380        };
381        Some(ret)
382    }
383
384    /// Resolve the length value to `L`.
385    ///
386    /// The `relative_length` is used to calculate `...%` length.
387    /// The base font size in `media_query_status` is used for `em` length.
388    pub fn resolve_length<L: LengthNum>(
389        &self,
390        media_query_status: &MediaQueryStatus<L>,
391        relative_length: L,
392    ) -> Option<L> {
393        self.resolve_to_f32(media_query_status, relative_length.to_f32(), false)
394            .map(|x| L::from_f32(x))
395    }
396}
397
398/// An angle value or an expression that evaluates to an angle.
399#[allow(missing_docs)]
400#[repr(C)]
401#[property_value_type(PropertyValueWithGlobal for AngleType)]
402#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
403#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
404pub enum Angle {
405    Deg(f32),
406    Grad(f32),
407    Rad(f32),
408    Turn(f32),
409    Calc(Box<CalcExpr>),
410}
411
412impl Default for Angle {
413    fn default() -> Self {
414        Self::Deg(0.)
415    }
416}
417
418impl ResolveFontSize for Angle {
419    fn resolve_font_size(&mut self, _: f32) {
420        // empty
421    }
422}
423
424/// An angle value or a percentage value.
425#[allow(missing_docs)]
426#[repr(C)]
427#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
428#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
429pub enum AngleOrPercentage {
430    Angle(Angle),
431    Percentage(f32),
432}
433
434#[allow(missing_docs)]
435#[repr(C)]
436#[property_value_type(PropertyValueWithGlobal for DisplayType)]
437#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
438#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
439pub enum Display {
440    None,
441    Block,
442    Flex,
443    Inline,
444    InlineBlock,
445    Grid,
446    FlowRoot,
447    InlineFlex,
448    InlineGrid,
449}
450
451#[allow(missing_docs)]
452#[repr(C)]
453#[property_value_type(PropertyValueWithGlobal for PositionType)]
454#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
455#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
456pub enum Position {
457    Static,
458    Relative,
459    Absolute,
460    Fixed,
461    Sticky,
462}
463
464#[allow(missing_docs)]
465#[repr(C)]
466#[property_value_type(PropertyValueWithGlobal for OverflowType)]
467#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
468#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
469pub enum Overflow {
470    Visible,
471    Hidden,
472    Auto,
473    Scroll,
474}
475
476#[allow(missing_docs)]
477#[repr(C)]
478#[property_value_type(PropertyValueWithGlobal for OverflowWrapType)]
479#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
480#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
481pub enum OverflowWrap {
482    Normal,
483    BreakWord,
484}
485
486#[allow(missing_docs)]
487#[repr(C)]
488#[property_value_type(PropertyValueWithGlobal for PointerEventsType)]
489#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
490#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
491pub enum PointerEvents {
492    Auto,
493    None,
494    /// A `wx` specific pointer-events type.
495    WxRoot,
496}
497
498/// `wx` specific touch handling strategy.
499#[allow(missing_docs)]
500#[repr(C)]
501#[property_value_type(PropertyValueWithGlobal for WxEngineTouchEventType)]
502#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
503#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
504pub enum WxEngineTouchEvent {
505    Gesture,
506    Click,
507    None,
508}
509
510#[allow(missing_docs)]
511#[repr(C)]
512#[property_value_type(PropertyValueWithGlobal for VisibilityType)]
513#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
514#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
515pub enum Visibility {
516    Visible,
517    Hidden,
518    Collapse,
519}
520
521#[allow(missing_docs)]
522#[repr(C)]
523#[property_value_type(PropertyValueWithGlobal for FlexWrapType)]
524#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
525#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
526pub enum FlexWrap {
527    NoWrap,
528    Wrap,
529    WrapReverse,
530}
531
532#[allow(missing_docs)]
533#[repr(C)]
534#[property_value_type(PropertyValueWithGlobal for FlexDirectionType)]
535#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
536#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
537pub enum FlexDirection {
538    Row,
539    RowReverse,
540    Column,
541    ColumnReverse,
542}
543
544#[allow(missing_docs)]
545#[repr(C)]
546#[property_value_type(PropertyValueWithGlobal for DirectionType)]
547#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
548#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
549pub enum Direction {
550    Auto,
551    LTR,
552    RTL,
553}
554
555#[allow(missing_docs)]
556#[repr(C)]
557#[property_value_type(PropertyValueWithGlobal for WritingModeType)]
558#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
559#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
560pub enum WritingMode {
561    HorizontalTb,
562    VerticalLr,
563    VerticalRl,
564}
565
566#[allow(missing_docs)]
567#[repr(C)]
568#[property_value_type(PropertyValueWithGlobal for AlignItemsType)]
569#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
570#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
571pub enum AlignItems {
572    Stretch,
573    Normal,
574    Center,
575    Start,
576    End,
577    FlexStart,
578    FlexEnd,
579    SelfStart,
580    SelfEnd,
581    Baseline,
582}
583
584#[allow(missing_docs)]
585#[repr(C)]
586#[property_value_type(PropertyValueWithGlobal for AlignSelfType)]
587#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
588#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
589pub enum AlignSelf {
590    Auto,
591    Normal,
592    Stretch,
593    Center,
594    Start,
595    End,
596    SelfStart,
597    SelfEnd,
598    FlexStart,
599    FlexEnd,
600    Baseline,
601}
602
603#[allow(missing_docs)]
604#[repr(C)]
605#[property_value_type(PropertyValueWithGlobal for AlignContentType)]
606#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
607#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
608pub enum AlignContent {
609    Normal,
610    Start,
611    End,
612    Stretch,
613    Center,
614    FlexStart,
615    FlexEnd,
616    SpaceBetween,
617    SpaceAround,
618    SpaceEvenly,
619    Baseline,
620}
621
622#[allow(missing_docs)]
623#[repr(C)]
624#[property_value_type(PropertyValueWithGlobal for JustifyContentType)]
625#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
626#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
627pub enum JustifyContent {
628    Center,
629    FlexStart,
630    FlexEnd,
631    SpaceBetween,
632    SpaceAround,
633    SpaceEvenly,
634    Start,
635    End,
636    Left,
637    Right,
638    Stretch,
639    Baseline,
640    Normal,
641}
642
643#[allow(missing_docs)]
644#[repr(C)]
645#[property_value_type(PropertyValueWithGlobal for JustifyItemsType)]
646#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
647#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
648pub enum JustifyItems {
649    Stretch,
650    Center,
651    Start,
652    End,
653    FlexStart,
654    FlexEnd,
655    SelfStart,
656    SelfEnd,
657    Left,
658    Right,
659    Normal,
660}
661
662#[allow(missing_docs)]
663#[repr(C)]
664#[property_value_type(PropertyValueWithGlobal for JustifySelfType)]
665#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
666#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
667pub enum JustifySelf {
668    Auto,
669    Normal,
670    Stretch,
671    Center,
672    Start,
673    End,
674    FlexStart,
675    FlexEnd,
676    SelfStart,
677    SelfEnd,
678    Left,
679    Right,
680}
681
682#[allow(missing_docs)]
683#[repr(C)]
684#[property_value_type(PropertyValueWithGlobal for TextAlignType)]
685#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
686#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
687pub enum TextAlign {
688    Left,
689    Center,
690    Right,
691    Justify,
692    JustifyAll,
693    Start,
694    End,
695    MatchParent,
696}
697
698#[allow(missing_docs)]
699#[repr(C)]
700#[property_value_type(PropertyValueWithGlobal for FontWeightType)]
701#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
702#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
703pub enum FontWeight {
704    Normal,
705    Bold,
706    Bolder,
707    Lighter,
708    Num(Number),
709}
710
711#[allow(missing_docs)]
712#[repr(C)]
713#[property_value_type(PropertyValueWithGlobal for WordBreakType)]
714#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
715#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
716pub enum WordBreak {
717    BreakWord,
718    BreakAll,
719    KeepAll,
720}
721
722#[allow(missing_docs)]
723#[repr(C)]
724#[property_value_type(PropertyValueWithGlobal for WhiteSpaceType)]
725#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
726#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
727pub enum WhiteSpace {
728    Normal,
729    NoWrap,
730    Pre,
731    PreWrap,
732    PreLine,
733    WxPreEdit,
734}
735
736#[allow(missing_docs)]
737#[repr(C)]
738#[property_value_type(PropertyValueWithGlobal for TextOverflowType)]
739#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
740#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
741pub enum TextOverflow {
742    Clip,
743    Ellipsis,
744}
745
746#[allow(missing_docs)]
747#[repr(C)]
748#[property_value_type(PropertyValueWithGlobal for VerticalAlignType)]
749#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
750#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
751pub enum VerticalAlign {
752    Baseline,
753    Top,
754    Middle,
755    Bottom,
756    TextTop,
757    TextBottom,
758}
759
760#[allow(missing_docs)]
761#[repr(C)]
762#[property_value_type(PropertyValueWithGlobal for LineHeightType)]
763#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
764#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
765pub enum LineHeight {
766    Normal,
767    #[resolve_font_size(Length::resolve_em_and_ratio)]
768    Length(Length),
769    Num(Number),
770}
771
772#[allow(missing_docs)]
773#[repr(C)]
774#[property_value_type(PropertyValueWithGlobal for FontFamilyType)]
775#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
776#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
777pub enum FontFamily {
778    Names(Array<FontFamilyName>),
779}
780
781#[allow(missing_docs)]
782#[repr(C)]
783#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
784#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
785pub enum FontFamilyName {
786    Serif,
787    SansSerif,
788    Monospace,
789    Cursive,
790    Fantasy,
791    Title(StrRef),
792    SystemUi,
793}
794
795#[allow(missing_docs)]
796#[repr(C)]
797#[property_value_type(PropertyValueWithGlobal for BoxSizingType)]
798#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
799#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
800pub enum BoxSizing {
801    ContentBox,
802    PaddingBox,
803    BorderBox,
804}
805
806#[allow(missing_docs)]
807#[repr(C)]
808#[property_value_type(PropertyValueWithGlobal for BorderStyleType)]
809#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
810#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
811pub enum BorderStyle {
812    None,
813    Solid,
814    Dotted,
815    Dashed,
816    Hidden,
817    Double,
818    Groove,
819    Ridge,
820    Inset,
821    Outset,
822}
823
824/// The CSS `transform` item series.
825#[allow(missing_docs)]
826#[repr(C)]
827#[property_value_type(PropertyValueWithGlobal for TransformType)]
828#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
829#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
830pub enum Transform {
831    Series(Array<TransformItem>),
832}
833
834/// A `transform` item.
835#[allow(missing_docs)]
836#[repr(C)]
837#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
838#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
839pub enum TransformItem {
840    None,
841    Matrix([f32; 6]),
842    Matrix3D([f32; 16]),
843    #[resolve_font_size(Length::resolve_em)]
844    Translate2D(Length, Length),
845    #[resolve_font_size(Length::resolve_em)]
846    Translate3D(Length, Length, Length),
847    Scale2D(f32, f32),
848    Scale3D(f32, f32, f32),
849    Rotate2D(Angle),
850    Rotate3D(f32, f32, f32, Angle),
851    Skew(Angle, Angle),
852    #[resolve_font_size(Length::resolve_em)]
853    Perspective(Length),
854}
855
856#[allow(missing_docs)]
857#[repr(C)]
858#[property_value_type(PropertyValueWithGlobal for TransitionPropertyType)]
859#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
860#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
861pub enum TransitionProperty {
862    List(Array<TransitionPropertyItem>),
863}
864
865/// The property name allowed in CSS `transition-property`.
866#[allow(missing_docs)]
867#[repr(C)]
868#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
869#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
870pub enum TransitionPropertyItem {
871    None,
872    Transform,
873    TransformOrigin,
874    LineHeight,
875    Opacity,
876    All,
877    Height,
878    Width,
879    MinHeight,
880    MaxHeight,
881    MinWidth,
882    MaxWidth,
883    MarginTop,
884    MarginRight,
885    MarginLeft,
886    MarginBottom,
887    Margin,
888    PaddingTop,
889    PaddingRight,
890    PaddingBottom,
891    PaddingLeft,
892    Padding,
893    Top,
894    Right,
895    Bottom,
896    Left,
897    FlexGrow,
898    FlexShrink,
899    FlexBasis,
900    Flex,
901    BorderTopWidth,
902    BorderRightWidth,
903    BorderBottomWidth,
904    BorderLeftWidth,
905    BorderTopColor,
906    BorderRightColor,
907    BorderBottomColor,
908    BorderLeftColor,
909    BorderTopLeftRadius,
910    BorderTopRightRadius,
911    BorderBottomLeftRadius,
912    BorderBottomRightRadius,
913    Border,
914    BorderWidth,
915    BorderColor,
916    BorderRadius,
917    BorderLeft,
918    BorderTop,
919    BorderRight,
920    BorderBottom,
921    Font,
922    ZIndex,
923    BoxShadow,
924    BackdropFilter,
925    Filter,
926    Color,
927    TextDecorationColor,
928    TextDecorationThickness,
929    FontSize,
930    FontWeight,
931    LetterSpacing,
932    WordSpacing,
933    BackgroundColor,
934    BackgroundPosition,
935    BackgroundSize,
936    Background,
937    BackgroundPositionX,
938    BackgroundPositionY,
939    Mask,
940    MaskSize,
941    MaskPositionX,
942    MaskPositionY,
943    MaskPosition,
944}
945
946/// A helper type for `transition-timing-function`.
947#[allow(missing_docs)]
948#[repr(C)]
949#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
950#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
951pub enum StepPosition {
952    End,
953    JumpStart,
954    JumpEnd,
955    JumpNone,
956    JumpBoth,
957    Start,
958}
959
960#[allow(missing_docs)]
961#[repr(C)]
962#[property_value_type(PropertyValueWithGlobal for TransitionTimeType)]
963#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
964#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
965pub enum TransitionTime {
966    List(Array<u32>),
967    ListI32(Array<i32>),
968}
969
970/// The CSS `transition-timing-funcction`.
971#[allow(missing_docs)]
972#[repr(C)]
973#[property_value_type(PropertyValueWithGlobal for TransitionTimingFnType)]
974#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
975#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
976pub enum TransitionTimingFn {
977    List(Array<TransitionTimingFnItem>),
978}
979
980#[allow(missing_docs)]
981#[repr(C)]
982#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
983#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
984pub enum TransitionTimingFnItem {
985    Linear,
986    Ease,
987    EaseIn,
988    EaseOut,
989    EaseInOut,
990    StepStart,
991    StepEnd,
992    Steps(i32, StepPosition),
993    CubicBezier(f32, f32, f32, f32),
994}
995
996/// The scroll bar options.
997#[allow(missing_docs)]
998#[repr(C)]
999#[property_value_type(PropertyValueWithGlobal for ScrollbarType)]
1000#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1001#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1002pub enum Scrollbar {
1003    /// Show the scroll bar when needed.
1004    Auto,
1005    /// Always hide the scroll bar.
1006    Hidden,
1007    /// Hide the scroll bar when not scrolling.
1008    AutoHide,
1009    /// Always show the scroll bar.
1010    AlwaysShow,
1011}
1012
1013#[allow(missing_docs)]
1014#[repr(C)]
1015#[property_value_type(PropertyValueWithGlobal for BackgroundRepeatType)]
1016#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1017#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1018pub enum BackgroundRepeat {
1019    List(Array<BackgroundRepeatItem>),
1020}
1021
1022/// An item in `background-repeat`.
1023#[repr(C)]
1024#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1025#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1026pub enum BackgroundRepeatItem {
1027    /// The two-value form of `background-repeat`.
1028    Pos(BackgroundRepeatValue, BackgroundRepeatValue),
1029}
1030
1031/// A `background-repeat` value.
1032#[allow(missing_docs)]
1033#[repr(C)]
1034#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1035#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1036pub enum BackgroundRepeatValue {
1037    Repeat,
1038    NoRepeat,
1039    Space,
1040    Round,
1041}
1042
1043#[allow(missing_docs)]
1044#[repr(C)]
1045#[property_value_type(PropertyValueWithGlobal for BackgroundSizeType)]
1046#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1047#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1048pub enum BackgroundSize {
1049    List(Array<BackgroundSizeItem>),
1050}
1051
1052/// An item in `background-size`.
1053#[allow(missing_docs)]
1054#[repr(C)]
1055#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1056#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1057pub enum BackgroundSizeItem {
1058    Auto,
1059    #[resolve_font_size(Length::resolve_em)]
1060    Length(Length, Length),
1061    Cover,
1062    Contain,
1063}
1064
1065#[allow(missing_docs)]
1066#[repr(C)]
1067#[property_value_type(PropertyValueWithGlobal for BackgroundImageType)]
1068#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1069#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1070pub enum BackgroundImage {
1071    List(Array<BackgroundImageItem>),
1072}
1073
1074/// An image tag in image description.
1075#[allow(missing_docs)]
1076#[repr(C)]
1077#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1078#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1079pub enum ImageTags {
1080    LTR,
1081    RTL,
1082}
1083
1084/// An image source in image description.
1085#[allow(missing_docs)]
1086#[repr(C)]
1087#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1088#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1089pub enum ImageSource {
1090    None,
1091    Url(StrRef),
1092}
1093
1094/// An item in `background-image`.
1095#[allow(missing_docs)]
1096#[repr(C)]
1097#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1098#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1099pub enum BackgroundImageItem {
1100    None,
1101    Url(StrRef),
1102    Gradient(BackgroundImageGradientItem),
1103    Image(ImageTags, ImageSource, Color),
1104    Element(StrRef),
1105}
1106
1107/// Gradient types in image description.
1108#[allow(missing_docs)]
1109#[repr(C)]
1110#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1111#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1112pub enum BackgroundImageGradientItem {
1113    LinearGradient(Angle, Array<GradientColorItem>),
1114    RadialGradient(
1115        GradientShape,
1116        GradientSize,
1117        GradientPosition,
1118        Array<GradientColorItem>,
1119    ),
1120    ConicGradient(ConicGradientItem),
1121}
1122
1123/// Gradient size types in image description.
1124#[allow(missing_docs)]
1125#[repr(C)]
1126#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1127#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1128pub enum GradientSize {
1129    FarthestCorner,
1130    ClosestSide,
1131    ClosestCorner,
1132    FarthestSide,
1133    #[resolve_font_size(Length::resolve_em)]
1134    Len(Length, Length),
1135}
1136
1137/// Gradient position types in image description.
1138#[allow(missing_docs)]
1139#[repr(C)]
1140#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1141#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1142pub enum GradientPosition {
1143    #[resolve_font_size(Length::resolve_em)]
1144    Pos(Length, Length),
1145    SpecifiedPos(GradientSpecifiedPos, GradientSpecifiedPos),
1146}
1147
1148#[allow(missing_docs)]
1149#[repr(C)]
1150#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1151#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1152pub enum GradientSpecifiedPos {
1153    #[resolve_font_size(Length::resolve_em)]
1154    Left(Length),
1155    #[resolve_font_size(Length::resolve_em)]
1156    Right(Length),
1157    #[resolve_font_size(Length::resolve_em)]
1158    Top(Length),
1159    #[resolve_font_size(Length::resolve_em)]
1160    Bottom(Length),
1161    // TODO: Support x/y-start/end, block-start/end, inline-start/end, start, end
1162}
1163
1164/// Gradient shape types in image description.
1165#[allow(missing_docs)]
1166#[repr(C)]
1167#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1168#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1169pub enum GradientShape {
1170    Ellipse,
1171    Circle,
1172}
1173
1174/// Gradient color types in image description.
1175#[allow(missing_docs)]
1176#[repr(C)]
1177#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1178#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1179pub enum GradientColorItem {
1180    ColorHint(Color, #[resolve_font_size(Length::resolve_em)] Length),
1181    SimpleColorHint(Color),
1182    AngleOrPercentageColorHint(Color, AngleOrPercentage),
1183}
1184
1185/// A conic-gradient item.
1186#[allow(missing_docs)]
1187#[repr(C)]
1188#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1189#[cfg_attr(debug_assertions, derive(CompatibilityStructCheck))]
1190pub struct ConicGradientItem {
1191    pub angle: Angle,
1192    pub position: GradientPosition,
1193    pub items: Array<GradientColorItem>,
1194}
1195
1196impl<T: ResolveFontSize> ResolveFontSize for Option<T> {
1197    fn resolve_font_size(&mut self, font_size: f32) {
1198        if let Some(value) = self {
1199            value.resolve_font_size(font_size)
1200        }
1201    }
1202}
1203
1204#[allow(missing_docs)]
1205#[repr(C)]
1206#[property_value_type(PropertyValueWithGlobal for BackgroundPositionType)]
1207#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1208#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1209pub enum BackgroundPosition {
1210    List(Array<BackgroundPositionItem>),
1211}
1212
1213/// An item in `background-position`.
1214#[allow(missing_docs)]
1215#[repr(C)]
1216#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1217#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1218pub enum BackgroundPositionItem {
1219    Pos(BackgroundPositionValue, BackgroundPositionValue),
1220    Value(BackgroundPositionValue),
1221}
1222
1223/// A `background-position` value.
1224#[allow(missing_docs)]
1225#[repr(C)]
1226#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1227#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1228pub enum BackgroundPositionValue {
1229    #[resolve_font_size(Length::resolve_em)]
1230    Top(Length),
1231    #[resolve_font_size(Length::resolve_em)]
1232    Bottom(Length),
1233    #[resolve_font_size(Length::resolve_em)]
1234    Left(Length),
1235    #[resolve_font_size(Length::resolve_em)]
1236    Right(Length),
1237}
1238
1239#[allow(missing_docs)]
1240#[repr(C)]
1241#[property_value_type(PropertyValueWithGlobal for FontStyleType)]
1242#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1243#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1244pub enum FontStyle {
1245    Normal,
1246    Italic,
1247    Oblique(Angle),
1248}
1249
1250#[allow(missing_docs)]
1251#[repr(C)]
1252#[property_value_type(PropertyValueWithGlobal for BackgroundClipType)]
1253#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1254#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1255pub enum BackgroundClip {
1256    List(Array<BackgroundClipItem>),
1257}
1258
1259/// An item in `background-clip`.
1260#[allow(missing_docs)]
1261#[repr(C)]
1262#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1263#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1264pub enum BackgroundClipItem {
1265    BorderBox,
1266    PaddingBox,
1267    ContentBox,
1268    Text,
1269}
1270
1271#[allow(missing_docs)]
1272#[repr(C)]
1273#[property_value_type(PropertyValueWithGlobal for BackgroundOriginType)]
1274#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1275#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1276pub enum BackgroundOrigin {
1277    List(Array<BackgroundOriginItem>),
1278}
1279
1280/// An item in `background-origin`.
1281#[allow(missing_docs)]
1282#[repr(C)]
1283#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1284#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1285pub enum BackgroundOriginItem {
1286    BorderBox,
1287    PaddingBox,
1288    ContentBox,
1289}
1290
1291/// An item in `background-attachment`.
1292#[allow(missing_docs)]
1293#[repr(C)]
1294#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1295#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1296pub enum BackgroundAttachmentItem {
1297    Scroll,
1298    Fixed,
1299    Local,
1300}
1301
1302#[allow(missing_docs)]
1303#[repr(C)]
1304#[property_value_type(PropertyValueWithGlobal for BackgroundAttachmentType)]
1305#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1306#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1307pub enum BackgroundAttachment {
1308    List(Array<BackgroundAttachmentItem>),
1309}
1310
1311#[allow(missing_docs)]
1312#[repr(C)]
1313#[property_value_type(PropertyValueWithGlobal for FloatType)]
1314#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1315#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1316pub enum Float {
1317    None,
1318    Left,
1319    Right,
1320    InlineStart,
1321    InlineEnd,
1322}
1323
1324#[allow(missing_docs)]
1325#[repr(C)]
1326#[property_value_type(PropertyValueWithGlobal for ListStyleTypeType)]
1327#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1328#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1329pub enum ListStyleType {
1330    Disc,
1331    None,
1332    Circle,
1333    Square,
1334    Decimal,
1335    CjkDecimal,
1336    DecimalLeadingZero,
1337    LowerRoman,
1338    UpperRoman,
1339    LowerGreek,
1340    LowerAlpha,
1341    LowerLatin,
1342    UpperAlpha,
1343    UpperLatin,
1344    Armenian,
1345    Georgian,
1346    CustomIdent(StrRef),
1347}
1348
1349#[allow(missing_docs)]
1350#[repr(C)]
1351#[property_value_type(PropertyValueWithGlobal for ListStyleImageType)]
1352#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1353#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1354pub enum ListStyleImage {
1355    None,
1356    Url(StrRef),
1357}
1358
1359#[allow(missing_docs)]
1360#[repr(C)]
1361#[property_value_type(PropertyValueWithGlobal for ListStylePositionType)]
1362#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1363#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1364pub enum ListStylePosition {
1365    Outside,
1366    Inside,
1367}
1368
1369#[allow(missing_docs)]
1370#[repr(C)]
1371#[property_value_type(PropertyValueWithGlobal for ResizeType)]
1372#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1373#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1374pub enum Resize {
1375    None,
1376    Both,
1377    Horizontal,
1378    Vertical,
1379    Block,
1380    Inline,
1381}
1382
1383#[allow(missing_docs)]
1384#[repr(C)]
1385#[property_value_type(PropertyValueWithGlobal for ZIndexType)]
1386#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1387#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1388pub enum ZIndex {
1389    Auto,
1390    Num(Number),
1391}
1392
1393#[allow(missing_docs)]
1394#[repr(C)]
1395#[property_value_type(PropertyValueWithGlobal for TextShadowType)]
1396#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1397#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1398pub enum TextShadow {
1399    None,
1400    List(Array<TextShadowItem>),
1401}
1402
1403/// An item in `text-shadow`.
1404#[repr(C)]
1405#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1406#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1407pub enum TextShadowItem {
1408    /// A value of offset-y, offset-x, blur-radius, and color.
1409    TextShadowValue(
1410        #[resolve_font_size(Length::resolve_em_and_ratio)] Length,
1411        #[resolve_font_size(Length::resolve_em_and_ratio)] Length,
1412        #[resolve_font_size(Length::resolve_em_and_ratio)] Length,
1413        Color,
1414    ),
1415}
1416
1417#[allow(missing_docs)]
1418#[repr(C)]
1419#[property_value_type(PropertyValueWithGlobal for TextDecorationLineType)]
1420#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1421#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1422pub enum TextDecorationLine {
1423    None,
1424    SpellingError,
1425    GrammarError,
1426    List(Array<TextDecorationLineItem>),
1427}
1428
1429/// An item in `text-decoration-line`.
1430#[allow(missing_docs)]
1431#[repr(C)]
1432#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1433#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1434pub enum TextDecorationLineItem {
1435    Overline,
1436    LineThrough,
1437    Underline,
1438    Blink,
1439}
1440
1441#[allow(missing_docs)]
1442#[repr(C)]
1443#[property_value_type(PropertyValueWithGlobal for TextDecorationStyleType)]
1444#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1445#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1446pub enum TextDecorationStyle {
1447    Solid,
1448    Double,
1449    Dotted,
1450    Dashed,
1451    Wavy,
1452}
1453
1454#[allow(missing_docs)]
1455#[repr(C)]
1456#[property_value_type(PropertyValueWithGlobal for TextDecorationThicknessType)]
1457#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1458#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1459pub enum TextDecorationThickness {
1460    Auto,
1461    FromFont,
1462    #[resolve_font_size(Length::resolve_em_and_ratio)]
1463    Length(Length),
1464}
1465
1466#[allow(missing_docs)]
1467#[repr(C)]
1468#[property_value_type(PropertyValueWithGlobal for LetterSpacingType)]
1469#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1470#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1471pub enum LetterSpacing {
1472    Normal,
1473    #[resolve_font_size(Length::resolve_em_and_ratio)]
1474    Length(Length),
1475}
1476
1477#[allow(missing_docs)]
1478#[repr(C)]
1479#[property_value_type(PropertyValueWithGlobal for WordSpacingType)]
1480#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1481#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1482pub enum WordSpacing {
1483    Normal,
1484    #[resolve_font_size(Length::resolve_em_and_ratio)]
1485    Length(Length),
1486}
1487
1488#[allow(missing_docs)]
1489#[repr(C)]
1490#[property_value_type(PropertyValueWithGlobal for BorderRadiusType)]
1491#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1492#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1493pub enum BorderRadius {
1494    #[resolve_font_size(Length::resolve_em)]
1495    Pos(Length, Length),
1496}
1497
1498#[allow(missing_docs)]
1499#[repr(C)]
1500#[property_value_type(PropertyValueWithGlobal for BoxShadowType)]
1501#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1502#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1503pub enum BoxShadow {
1504    None,
1505    List(Array<BoxShadowItem>),
1506}
1507
1508/// An item in `box-shadow`.
1509#[allow(missing_docs)]
1510#[repr(C)]
1511#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1512#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1513pub enum BoxShadowItem {
1514    List(Array<ShadowItemType>),
1515}
1516
1517/// A shadow type in `box-shadow`.
1518#[allow(missing_docs)]
1519#[repr(C)]
1520#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1521#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1522pub enum ShadowItemType {
1523    Inset,
1524    #[resolve_font_size(Length::resolve_em)]
1525    OffsetX(Length),
1526    #[resolve_font_size(Length::resolve_em)]
1527    OffsetY(Length),
1528    #[resolve_font_size(Length::resolve_em)]
1529    BlurRadius(Length),
1530    #[resolve_font_size(Length::resolve_em)]
1531    SpreadRadius(Length),
1532    Color(Color),
1533}
1534
1535#[allow(missing_docs)]
1536#[repr(C)]
1537#[property_value_type(PropertyValueWithGlobal for BackdropFilterType)]
1538#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1539#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1540pub enum BackdropFilter {
1541    None,
1542    List(Array<FilterFunc>),
1543}
1544
1545#[allow(missing_docs)]
1546#[repr(C)]
1547#[property_value_type(PropertyValueWithGlobal for FilterType)]
1548#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1549#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1550pub enum Filter {
1551    None,
1552    List(Array<FilterFunc>),
1553}
1554
1555/// A filter function for `filter` and `backdrop-filter`.
1556#[allow(missing_docs)]
1557#[repr(C)]
1558#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1559#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1560pub enum FilterFunc {
1561    Url(StrRef),
1562    #[resolve_font_size(Length::resolve_em)]
1563    Blur(Length),
1564    #[resolve_font_size(Length::resolve_em)]
1565    Brightness(Length),
1566    #[resolve_font_size(Length::resolve_em)]
1567    Contrast(Length),
1568    DropShadow(DropShadow),
1569    #[resolve_font_size(Length::resolve_em)]
1570    Grayscale(Length),
1571    HueRotate(Angle),
1572    #[resolve_font_size(Length::resolve_em)]
1573    Invert(Length),
1574    #[resolve_font_size(Length::resolve_em)]
1575    Opacity(Length),
1576    #[resolve_font_size(Length::resolve_em)]
1577    Saturate(Length),
1578    #[resolve_font_size(Length::resolve_em)]
1579    Sepia(Length),
1580}
1581
1582/// A drop shadow in filter function for `filter` and `backdrop-filter`.
1583#[allow(missing_docs)]
1584#[repr(C)]
1585#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1586#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1587pub enum DropShadow {
1588    List(Array<ShadowItemType>),
1589}
1590
1591#[allow(missing_docs)]
1592#[repr(C)]
1593#[property_value_type(PropertyValueWithGlobal for TransformOriginType)]
1594#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1595#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1596pub enum TransformOrigin {
1597    #[resolve_font_size(Length::resolve_em)]
1598    LengthTuple(Length, Length, Length),
1599    Left,
1600    Right,
1601    Center,
1602    Bottom,
1603    Top,
1604    #[resolve_font_size(Length::resolve_em)]
1605    Length(Length),
1606}
1607
1608#[allow(missing_docs)]
1609#[repr(C)]
1610#[property_value_type(PropertyValueWithGlobal for MaskModeType)]
1611#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1612#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1613pub enum MaskMode {
1614    List(Array<MaskModeItem>),
1615}
1616
1617/// An item in mask-mode.
1618#[allow(missing_docs)]
1619#[repr(C)]
1620#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1621#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1622pub enum MaskModeItem {
1623    MatchSource,
1624    Alpha,
1625    Luminance,
1626}
1627
1628#[allow(missing_docs)]
1629#[repr(C)]
1630#[property_value_type(PropertyValueWithGlobal for AspectRatioType)]
1631#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1632#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1633pub enum AspectRatio {
1634    Auto,
1635    Ratio(Number, Number),
1636}
1637
1638#[allow(missing_docs)]
1639#[repr(C)]
1640#[property_value_type(PropertyValueWithGlobal for ContainType)]
1641#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1642#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1643pub enum Contain {
1644    None,
1645    Strict,
1646    Content,
1647    Multiple(Array<ContainKeyword>),
1648}
1649
1650/// An item in multi-value form of `contain`.
1651#[allow(missing_docs)]
1652#[repr(C)]
1653#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1654#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1655pub enum ContainKeyword {
1656    Size,
1657    Layout,
1658    Style,
1659    Paint,
1660}
1661
1662#[allow(missing_docs)]
1663#[repr(C)]
1664#[property_value_type(PropertyValueWithGlobal for ContentType)]
1665#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1666#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1667pub enum Content {
1668    None,
1669    Normal,
1670    Str(StrRef),
1671    Url(StrRef),
1672}
1673
1674/// A unknown property.
1675#[allow(missing_docs)]
1676#[repr(C)]
1677#[property_value_type(PropertyValueWithGlobal for CustomPropertyType)]
1678#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1679#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1680pub enum CustomProperty {
1681    None,
1682    Expr(StrRef, StrRef),
1683}
1684
1685#[allow(missing_docs)]
1686#[repr(C)]
1687#[property_value_type(PropertyValueWithGlobal for AnimationIterationCountType)]
1688#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1689#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1690pub enum AnimationIterationCount {
1691    List(Array<AnimationIterationCountItem>),
1692}
1693
1694/// An item in `animation-iteration-count`.
1695#[allow(missing_docs)]
1696#[repr(C)]
1697#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1698#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1699pub enum AnimationIterationCountItem {
1700    Number(f32),
1701    Infinite,
1702}
1703
1704#[allow(missing_docs)]
1705#[repr(C)]
1706#[property_value_type(PropertyValueWithGlobal for AnimationDirectionType)]
1707#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1708#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1709pub enum AnimationDirection {
1710    List(Array<AnimationDirectionItem>),
1711}
1712
1713/// An item in `animation-direction`.
1714#[allow(missing_docs)]
1715#[repr(C)]
1716#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1717#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1718pub enum AnimationDirectionItem {
1719    Normal,
1720    Reverse,
1721    Alternate,
1722    AlternateReverse,
1723}
1724
1725#[allow(missing_docs)]
1726#[repr(C)]
1727#[property_value_type(PropertyValueWithGlobal for AnimationFillModeType)]
1728#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1729#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1730pub enum AnimationFillMode {
1731    List(Array<AnimationFillModeItem>),
1732}
1733
1734/// An item in `animation-fill-mode`.
1735#[allow(missing_docs)]
1736#[repr(C)]
1737#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1738#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1739pub enum AnimationFillModeItem {
1740    None,
1741    Forwards,
1742    Backwards,
1743    Both,
1744}
1745
1746#[allow(missing_docs)]
1747#[repr(C)]
1748#[property_value_type(PropertyValueWithGlobal for AnimationPlayStateType)]
1749#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1750#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1751pub enum AnimationPlayState {
1752    List(Array<AnimationPlayStateItem>),
1753}
1754
1755/// An item in `animation-play-state`.
1756#[allow(missing_docs)]
1757#[repr(C)]
1758#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1759#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1760pub enum AnimationPlayStateItem {
1761    Running,
1762    Paused,
1763}
1764
1765#[allow(missing_docs)]
1766#[repr(C)]
1767#[property_value_type(PropertyValueWithGlobal for AnimationNameType)]
1768#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1769#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1770pub enum AnimationName {
1771    List(Array<AnimationNameItem>),
1772}
1773
1774/// An item in `animation-name`.
1775#[allow(missing_docs)]
1776#[repr(C)]
1777#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1778#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1779pub enum AnimationNameItem {
1780    None,
1781    CustomIdent(StrRef),
1782}
1783
1784#[allow(missing_docs)]
1785#[repr(C)]
1786#[property_value_type(PropertyValueWithGlobal for WillChangeType)]
1787#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1788#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1789pub enum WillChange {
1790    Auto,
1791    List(Array<AnimateableFeature>),
1792}
1793
1794/// An animation kind for `will-change`.
1795#[allow(missing_docs)]
1796#[repr(C)]
1797#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1798#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1799pub enum AnimateableFeature {
1800    /// The content of the element is likely to be animated.
1801    Contents,
1802    /// The content of the element is scrollable.
1803    ScrollPosition,
1804    /// An unknown kind.
1805    CustomIdent(StrRef),
1806}
1807
1808#[allow(missing_docs)]
1809#[repr(C)]
1810#[property_value_type(PropertyValueWithGlobal for FontFeatureSettingsType)]
1811#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1812#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1813pub enum FontFeatureSettings {
1814    Normal,
1815    FeatureTags(Array<FeatureTag>),
1816}
1817
1818/// A font feature tag for `font-feature-settings`.
1819#[repr(C)]
1820#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1821#[cfg_attr(debug_assertions, derive(CompatibilityStructCheck))]
1822pub struct FeatureTag {
1823    /// The four-letter OpenType tag, e.g. `liga`.
1824    pub opentype_tag: StrRef,
1825    /// The optional number value in `font-feature-settings`.
1826    pub value: Number,
1827}
1828
1829#[allow(missing_docs)]
1830#[repr(C)]
1831#[property_value_type(PropertyValueWithGlobal for GapType)]
1832#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1833#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1834pub enum Gap {
1835    Normal,
1836    #[resolve_font_size(Length::resolve_em)]
1837    Length(Length),
1838}
1839
1840/// The `grid-template-rows` property defines the line names and track sizing functions of the grid rows.
1841#[allow(missing_docs)]
1842#[repr(C)]
1843#[property_value_type(PropertyValueWithGlobal for GridTemplateType)]
1844#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1845#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1846pub enum GridTemplate {
1847    /// A keyword meaning that there is no explicit grid
1848    None,
1849    TrackList(Array<TrackListItem>),
1850}
1851
1852#[allow(missing_docs)]
1853#[repr(C)]
1854#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1855#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1856pub enum TrackListItem {
1857    LineNames(Array<StrRef>),
1858    TrackSize(TrackSize),
1859}
1860
1861#[allow(missing_docs)]
1862#[repr(C)]
1863#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1864#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1865pub enum TrackSize {
1866    MinContent,
1867    MaxContent,
1868    Fr(f32),
1869    #[resolve_font_size(Length::resolve_em)]
1870    Length(Length),
1871}
1872
1873#[allow(missing_docs)]
1874#[repr(C)]
1875#[property_value_type(PropertyValueWithGlobal for GridAutoFlowType)]
1876#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1877#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1878pub enum GridAutoFlow {
1879    Row,
1880    Column,
1881    RowDense,
1882    ColumnDense,
1883}
1884
1885#[allow(missing_docs)]
1886#[repr(C)]
1887#[property_value_type(PropertyValueWithGlobal for GridAutoType)]
1888#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1889#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1890pub enum GridAuto {
1891    List(Array<TrackSize>),
1892}