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 langth 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}
449
450#[allow(missing_docs)]
451#[repr(C)]
452#[property_value_type(PropertyValueWithGlobal for PositionType)]
453#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
454#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
455pub enum Position {
456    Static,
457    Relative,
458    Absolute,
459    Fixed,
460    Sticky,
461}
462
463#[allow(missing_docs)]
464#[repr(C)]
465#[property_value_type(PropertyValueWithGlobal for OverflowType)]
466#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
467#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
468pub enum Overflow {
469    Visible,
470    Hidden,
471    Auto,
472    Scroll,
473}
474
475#[allow(missing_docs)]
476#[repr(C)]
477#[property_value_type(PropertyValueWithGlobal for OverflowWrapType)]
478#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
479#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
480pub enum OverflowWrap {
481    Normal,
482    BreakWord,
483}
484
485#[allow(missing_docs)]
486#[repr(C)]
487#[property_value_type(PropertyValueWithGlobal for PointerEventsType)]
488#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
489#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
490pub enum PointerEvents {
491    Auto,
492    None,
493    /// A `wx` specific pointer-events type.
494    WxRoot,
495}
496
497/// `wx` specific touch handling strategy.
498#[allow(missing_docs)]
499#[repr(C)]
500#[property_value_type(PropertyValueWithGlobal for WxEngineTouchEventType)]
501#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
502#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
503pub enum WxEngineTouchEvent {
504    Gesture,
505    Click,
506    None,
507}
508
509#[allow(missing_docs)]
510#[repr(C)]
511#[property_value_type(PropertyValueWithGlobal for VisibilityType)]
512#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
513#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
514pub enum Visibility {
515    Visible,
516    Hidden,
517    Collapse,
518}
519
520#[allow(missing_docs)]
521#[repr(C)]
522#[property_value_type(PropertyValueWithGlobal for FlexWrapType)]
523#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
524#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
525pub enum FlexWrap {
526    NoWrap,
527    Wrap,
528    WrapReverse,
529}
530
531#[allow(missing_docs)]
532#[repr(C)]
533#[property_value_type(PropertyValueWithGlobal for FlexDirectionType)]
534#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
535#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
536pub enum FlexDirection {
537    Row,
538    RowReverse,
539    Column,
540    ColumnReverse,
541}
542
543#[allow(missing_docs)]
544#[repr(C)]
545#[property_value_type(PropertyValueWithGlobal for DirectionType)]
546#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
547#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
548pub enum Direction {
549    Auto,
550    LTR,
551    RTL,
552}
553
554#[allow(missing_docs)]
555#[repr(C)]
556#[property_value_type(PropertyValueWithGlobal for WritingModeType)]
557#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
558#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
559pub enum WritingMode {
560    HorizontalTb,
561    VerticalLr,
562    VerticalRl,
563}
564
565#[allow(missing_docs)]
566#[repr(C)]
567#[property_value_type(PropertyValueWithGlobal for AlignItemsType)]
568#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
569#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
570pub enum AlignItems {
571    Stretch,
572    Normal,
573    Center,
574    Start,
575    End,
576    FlexStart,
577    FlexEnd,
578    SelfStart,
579    SelfEnd,
580    Baseline,
581}
582
583#[allow(missing_docs)]
584#[repr(C)]
585#[property_value_type(PropertyValueWithGlobal for AlignSelfType)]
586#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
587#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
588pub enum AlignSelf {
589    Auto,
590    Normal,
591    Stretch,
592    Center,
593    Start,
594    End,
595    SelfStart,
596    SelfEnd,
597    FlexStart,
598    FlexEnd,
599    Baseline,
600}
601
602#[allow(missing_docs)]
603#[repr(C)]
604#[property_value_type(PropertyValueWithGlobal for AlignContentType)]
605#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
606#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
607pub enum AlignContent {
608    Normal,
609    Start,
610    End,
611    Stretch,
612    Center,
613    FlexStart,
614    FlexEnd,
615    SpaceBetween,
616    SpaceAround,
617    SpaceEvenly,
618    Baseline,
619}
620
621#[allow(missing_docs)]
622#[repr(C)]
623#[property_value_type(PropertyValueWithGlobal for JustifyContentType)]
624#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
625#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
626pub enum JustifyContent {
627    Center,
628    FlexStart,
629    FlexEnd,
630    SpaceBetween,
631    SpaceAround,
632    SpaceEvenly,
633    Start,
634    End,
635    Left,
636    Right,
637    Stretch,
638    Baseline,
639}
640
641#[allow(missing_docs)]
642#[repr(C)]
643#[property_value_type(PropertyValueWithGlobal for JustifyItemsType)]
644#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
645#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
646pub enum JustifyItems {
647    Stretch,
648    Center,
649    Start,
650    End,
651    FlexStart,
652    FlexEnd,
653    SelfStart,
654    SelfEnd,
655    Left,
656    Right,
657}
658
659#[allow(missing_docs)]
660#[repr(C)]
661#[property_value_type(PropertyValueWithGlobal for TextAlignType)]
662#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
663#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
664pub enum TextAlign {
665    Left,
666    Center,
667    Right,
668    Justify,
669    JustifyAll,
670    Start,
671    End,
672    MatchParent,
673}
674
675#[allow(missing_docs)]
676#[repr(C)]
677#[property_value_type(PropertyValueWithGlobal for FontWeightType)]
678#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
679#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
680pub enum FontWeight {
681    Normal,
682    Bold,
683    Bolder,
684    Lighter,
685    Num(Number),
686}
687
688#[allow(missing_docs)]
689#[repr(C)]
690#[property_value_type(PropertyValueWithGlobal for WordBreakType)]
691#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
692#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
693pub enum WordBreak {
694    BreakWord,
695    BreakAll,
696    KeepAll,
697}
698
699#[allow(missing_docs)]
700#[repr(C)]
701#[property_value_type(PropertyValueWithGlobal for WhiteSpaceType)]
702#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
703#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
704pub enum WhiteSpace {
705    Normal,
706    NoWrap,
707    Pre,
708    PreWrap,
709    PreLine,
710    WxPreEdit,
711}
712
713#[allow(missing_docs)]
714#[repr(C)]
715#[property_value_type(PropertyValueWithGlobal for TextOverflowType)]
716#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
717#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
718pub enum TextOverflow {
719    Clip,
720    Ellipsis,
721}
722
723#[allow(missing_docs)]
724#[repr(C)]
725#[property_value_type(PropertyValueWithGlobal for VerticalAlignType)]
726#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
727#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
728pub enum VerticalAlign {
729    Baseline,
730    Top,
731    Middle,
732    Bottom,
733    TextTop,
734    TextBottom,
735}
736
737#[allow(missing_docs)]
738#[repr(C)]
739#[property_value_type(PropertyValueWithGlobal for LineHeightType)]
740#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
741#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
742pub enum LineHeight {
743    Normal,
744    #[resolve_font_size(Length::resolve_em_and_ratio)]
745    Length(Length),
746    Num(Number),
747}
748
749#[allow(missing_docs)]
750#[repr(C)]
751#[property_value_type(PropertyValueWithGlobal for FontFamilyType)]
752#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
753#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
754pub enum FontFamily {
755    Names(Array<FontFamilyName>),
756}
757
758#[allow(missing_docs)]
759#[repr(C)]
760#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
761#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
762pub enum FontFamilyName {
763    Serif,
764    SansSerif,
765    Monospace,
766    Cursive,
767    Fantasy,
768    Title(StrRef),
769    SystemUi,
770}
771
772#[allow(missing_docs)]
773#[repr(C)]
774#[property_value_type(PropertyValueWithGlobal for BoxSizingType)]
775#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
776#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
777pub enum BoxSizing {
778    ContentBox,
779    PaddingBox,
780    BorderBox,
781}
782
783#[allow(missing_docs)]
784#[repr(C)]
785#[property_value_type(PropertyValueWithGlobal for BorderStyleType)]
786#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
787#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
788pub enum BorderStyle {
789    None,
790    Solid,
791    Dotted,
792    Dashed,
793    Hidden,
794    Double,
795    Groove,
796    Ridge,
797    Inset,
798    Outset,
799}
800
801/// The CSS `transform` item series.
802#[allow(missing_docs)]
803#[repr(C)]
804#[property_value_type(PropertyValueWithGlobal for TransformType)]
805#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
806#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
807pub enum Transform {
808    Series(Array<TransformItem>),
809}
810
811/// A `transform` item.
812#[allow(missing_docs)]
813#[repr(C)]
814#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
815#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
816pub enum TransformItem {
817    None,
818    Matrix([f32; 6]),
819    Matrix3D([f32; 16]),
820    #[resolve_font_size(Length::resolve_em)]
821    Translate2D(Length, Length),
822    #[resolve_font_size(Length::resolve_em)]
823    Translate3D(Length, Length, Length),
824    Scale2D(f32, f32),
825    Scale3D(f32, f32, f32),
826    Rotate2D(Angle),
827    Rotate3D(f32, f32, f32, Angle),
828    Skew(Angle, Angle),
829    #[resolve_font_size(Length::resolve_em)]
830    Perspective(Length),
831}
832
833#[allow(missing_docs)]
834#[repr(C)]
835#[property_value_type(PropertyValueWithGlobal for TransitionPropertyType)]
836#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
837#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
838pub enum TransitionProperty {
839    List(Array<TransitionPropertyItem>),
840}
841
842/// The property name allowed in CSS `transition-property`.
843#[allow(missing_docs)]
844#[repr(C)]
845#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
846#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
847pub enum TransitionPropertyItem {
848    None,
849    Transform,
850    TransformOrigin,
851    LineHeight,
852    Opacity,
853    All,
854    Height,
855    Width,
856    MinHeight,
857    MaxHeight,
858    MinWidth,
859    MaxWidth,
860    MarginTop,
861    MarginRight,
862    MarginLeft,
863    MarginBottom,
864    Margin,
865    PaddingTop,
866    PaddingRight,
867    PaddingBottom,
868    PaddingLeft,
869    Padding,
870    Top,
871    Right,
872    Bottom,
873    Left,
874    FlexGrow,
875    FlexShrink,
876    FlexBasis,
877    Flex,
878    BorderTopWidth,
879    BorderRightWidth,
880    BorderBottomWidth,
881    BorderLeftWidth,
882    BorderTopColor,
883    BorderRightColor,
884    BorderBottomColor,
885    BorderLeftColor,
886    BorderTopLeftRadius,
887    BorderTopRightRadius,
888    BorderBottomLeftRadius,
889    BorderBottomRightRadius,
890    Border,
891    BorderWidth,
892    BorderColor,
893    BorderRadius,
894    BorderLeft,
895    BorderTop,
896    BorderRight,
897    BorderBottom,
898    Font,
899    ZIndex,
900    BoxShadow,
901    BackdropFilter,
902    Filter,
903    Color,
904    TextDecorationColor,
905    TextDecorationThickness,
906    FontSize,
907    FontWeight,
908    LetterSpacing,
909    WordSpacing,
910    BackgroundColor,
911    BackgroundPosition,
912    BackgroundSize,
913    Background,
914    BackgroundPositionX,
915    BackgroundPositionY,
916    Mask,
917    MaskSize,
918    MaskPositionX,
919    MaskPositionY,
920    MaskPosition,
921}
922
923/// A helper type for `transition-timing-function`.
924#[allow(missing_docs)]
925#[repr(C)]
926#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
927#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
928pub enum StepPosition {
929    End,
930    JumpStart,
931    JumpEnd,
932    JumpNone,
933    JumpBoth,
934    Start,
935}
936
937#[allow(missing_docs)]
938#[repr(C)]
939#[property_value_type(PropertyValueWithGlobal for TransitionTimeType)]
940#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
941#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
942pub enum TransitionTime {
943    List(Array<u32>),
944    ListI32(Array<i32>),
945}
946
947/// The CSS `transition-timing-funcction`.
948#[allow(missing_docs)]
949#[repr(C)]
950#[property_value_type(PropertyValueWithGlobal for TransitionTimingFnType)]
951#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
952#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
953pub enum TransitionTimingFn {
954    List(Array<TransitionTimingFnItem>),
955}
956
957#[allow(missing_docs)]
958#[repr(C)]
959#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
960#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
961pub enum TransitionTimingFnItem {
962    Linear,
963    Ease,
964    EaseIn,
965    EaseOut,
966    EaseInOut,
967    StepStart,
968    StepEnd,
969    Steps(i32, StepPosition),
970    CubicBezier(f32, f32, f32, f32),
971}
972
973/// The scroll bar options.
974#[allow(missing_docs)]
975#[repr(C)]
976#[property_value_type(PropertyValueWithGlobal for ScrollbarType)]
977#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
978#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
979pub enum Scrollbar {
980    /// Show the scroll bar when needed.
981    Auto,
982    /// Always hide the scroll bar.
983    Hidden,
984    /// Hide the scroll bar when not scrolling.
985    AutoHide,
986    /// Always show the scroll bar.
987    AlwaysShow,
988}
989
990#[allow(missing_docs)]
991#[repr(C)]
992#[property_value_type(PropertyValueWithGlobal for BackgroundRepeatType)]
993#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
994#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
995pub enum BackgroundRepeat {
996    List(Array<BackgroundRepeatItem>),
997}
998
999/// An item in `background-repeat`.
1000#[repr(C)]
1001#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1002#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1003pub enum BackgroundRepeatItem {
1004    /// The two-value form of `background-repeat`.
1005    Pos(BackgroundRepeatValue, BackgroundRepeatValue),
1006}
1007
1008/// A `background-repeat` value.
1009#[allow(missing_docs)]
1010#[repr(C)]
1011#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1012#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1013pub enum BackgroundRepeatValue {
1014    Repeat,
1015    NoRepeat,
1016    Space,
1017    Round,
1018}
1019
1020#[allow(missing_docs)]
1021#[repr(C)]
1022#[property_value_type(PropertyValueWithGlobal for BackgroundSizeType)]
1023#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1024#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1025pub enum BackgroundSize {
1026    List(Array<BackgroundSizeItem>),
1027}
1028
1029/// An item in `background-size`.
1030#[allow(missing_docs)]
1031#[repr(C)]
1032#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1033#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1034pub enum BackgroundSizeItem {
1035    Auto,
1036    #[resolve_font_size(Length::resolve_em)]
1037    Length(Length, Length),
1038    Cover,
1039    Contain,
1040}
1041
1042#[allow(missing_docs)]
1043#[repr(C)]
1044#[property_value_type(PropertyValueWithGlobal for BackgroundImageType)]
1045#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1046#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1047pub enum BackgroundImage {
1048    List(Array<BackgroundImageItem>),
1049}
1050
1051/// An image tag in image description.
1052#[allow(missing_docs)]
1053#[repr(C)]
1054#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1055#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1056pub enum ImageTags {
1057    LTR,
1058    RTL,
1059}
1060
1061/// An image source in image description.
1062#[allow(missing_docs)]
1063#[repr(C)]
1064#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1065#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1066pub enum ImageSource {
1067    None,
1068    Url(StrRef),
1069}
1070
1071/// An item in `background-image`.
1072#[allow(missing_docs)]
1073#[repr(C)]
1074#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1075#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1076pub enum BackgroundImageItem {
1077    None,
1078    Url(StrRef),
1079    Gradient(BackgroundImageGradientItem),
1080    Image(ImageTags, ImageSource, Color),
1081    Element(StrRef),
1082}
1083
1084/// Gradient types 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 BackgroundImageGradientItem {
1090    LinearGradient(Angle, Array<GradientColorItem>),
1091    RadialGradient(
1092        GradientShape,
1093        GradientSize,
1094        GradientPosition,
1095        Array<GradientColorItem>,
1096    ),
1097    ConicGradient(ConicGradientItem),
1098}
1099
1100/// Gradient size types in image description.
1101#[allow(missing_docs)]
1102#[repr(C)]
1103#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1104#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1105pub enum GradientSize {
1106    FarthestCorner,
1107    ClosestSide,
1108    ClosestCorner,
1109    FarthestSide,
1110    #[resolve_font_size(Length::resolve_em)]
1111    Len(Length, Length),
1112}
1113
1114/// Gradient position types in image description.
1115#[allow(missing_docs)]
1116#[repr(C)]
1117#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1118#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1119pub enum GradientPosition {
1120    #[resolve_font_size(Length::resolve_em)]
1121    Pos(Length, Length),
1122}
1123
1124/// Gradient shape types in image description.
1125#[allow(missing_docs)]
1126#[repr(C)]
1127#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1128#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1129pub enum GradientShape {
1130    Ellipse,
1131    Circle,
1132}
1133
1134/// Gradient color types in image description.
1135#[allow(missing_docs)]
1136#[repr(C)]
1137#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1138#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1139pub enum GradientColorItem {
1140    ColorHint(Color, #[resolve_font_size(Length::resolve_em)] Length),
1141    SimpleColorHint(Color),
1142    AngleOrPercentageColorHint(Color, AngleOrPercentage),
1143}
1144
1145/// A conic-gradient item.
1146#[allow(missing_docs)]
1147#[repr(C)]
1148#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1149#[cfg_attr(debug_assertions, derive(CompatibilityStructCheck))]
1150pub struct ConicGradientItem {
1151    pub angle: Angle,
1152    pub position: GradientPosition,
1153    pub items: Array<GradientColorItem>,
1154}
1155
1156impl<T: ResolveFontSize> ResolveFontSize for Option<T> {
1157    fn resolve_font_size(&mut self, font_size: f32) {
1158        if let Some(value) = self {
1159            value.resolve_font_size(font_size)
1160        }
1161    }
1162}
1163
1164#[allow(missing_docs)]
1165#[repr(C)]
1166#[property_value_type(PropertyValueWithGlobal for BackgroundPositionType)]
1167#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1168#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1169pub enum BackgroundPosition {
1170    List(Array<BackgroundPositionItem>),
1171}
1172
1173/// An item in `background-position`.
1174#[allow(missing_docs)]
1175#[repr(C)]
1176#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1177#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1178pub enum BackgroundPositionItem {
1179    Pos(BackgroundPositionValue, BackgroundPositionValue),
1180    Value(BackgroundPositionValue),
1181}
1182
1183/// A `background-position` value.
1184#[allow(missing_docs)]
1185#[repr(C)]
1186#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1187#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1188pub enum BackgroundPositionValue {
1189    #[resolve_font_size(Length::resolve_em)]
1190    Top(Length),
1191    #[resolve_font_size(Length::resolve_em)]
1192    Bottom(Length),
1193    #[resolve_font_size(Length::resolve_em)]
1194    Left(Length),
1195    #[resolve_font_size(Length::resolve_em)]
1196    Right(Length),
1197}
1198
1199#[allow(missing_docs)]
1200#[repr(C)]
1201#[property_value_type(PropertyValueWithGlobal for FontStyleType)]
1202#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1203#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1204pub enum FontStyle {
1205    Normal,
1206    Italic,
1207    Oblique(Angle),
1208}
1209
1210#[allow(missing_docs)]
1211#[repr(C)]
1212#[property_value_type(PropertyValueWithGlobal for BackgroundClipType)]
1213#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1214#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1215pub enum BackgroundClip {
1216    List(Array<BackgroundClipItem>),
1217}
1218
1219/// An item in `background-clip`.
1220#[allow(missing_docs)]
1221#[repr(C)]
1222#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1223#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1224pub enum BackgroundClipItem {
1225    BorderBox,
1226    PaddingBox,
1227    ContentBox,
1228    Text,
1229}
1230
1231#[allow(missing_docs)]
1232#[repr(C)]
1233#[property_value_type(PropertyValueWithGlobal for BackgroundOriginType)]
1234#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1235#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1236pub enum BackgroundOrigin {
1237    List(Array<BackgroundOriginItem>),
1238}
1239
1240/// An item in `background-origin`.
1241#[allow(missing_docs)]
1242#[repr(C)]
1243#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1244#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1245pub enum BackgroundOriginItem {
1246    BorderBox,
1247    PaddingBox,
1248    ContentBox,
1249}
1250
1251/// An item in `background-attachment`.
1252#[allow(missing_docs)]
1253#[repr(C)]
1254#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1255#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1256pub enum BackgroundAttachmentItem {
1257    Scroll,
1258    Fixed,
1259    Local,
1260}
1261
1262#[allow(missing_docs)]
1263#[repr(C)]
1264#[property_value_type(PropertyValueWithGlobal for BackgroundAttachmentType)]
1265#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1266#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1267pub enum BackgroundAttachment {
1268    List(Array<BackgroundAttachmentItem>),
1269}
1270
1271#[allow(missing_docs)]
1272#[repr(C)]
1273#[property_value_type(PropertyValueWithGlobal for FloatType)]
1274#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1275#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1276pub enum Float {
1277    None,
1278    Left,
1279    Right,
1280    InlineStart,
1281    InlineEnd,
1282}
1283
1284#[allow(missing_docs)]
1285#[repr(C)]
1286#[property_value_type(PropertyValueWithGlobal for ListStyleTypeType)]
1287#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1288#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1289pub enum ListStyleType {
1290    Disc,
1291    None,
1292    Circle,
1293    Square,
1294    Decimal,
1295    CjkDecimal,
1296    DecimalLeadingZero,
1297    LowerRoman,
1298    UpperRoman,
1299    LowerGreek,
1300    LowerAlpha,
1301    LowerLatin,
1302    UpperAlpha,
1303    UpperLatin,
1304    Armenian,
1305    Georgian,
1306    CustomIdent(StrRef),
1307}
1308
1309#[allow(missing_docs)]
1310#[repr(C)]
1311#[property_value_type(PropertyValueWithGlobal for ListStyleImageType)]
1312#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1313#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1314pub enum ListStyleImage {
1315    None,
1316    Url(StrRef),
1317}
1318
1319#[allow(missing_docs)]
1320#[repr(C)]
1321#[property_value_type(PropertyValueWithGlobal for ListStylePositionType)]
1322#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1323#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1324pub enum ListStylePosition {
1325    Outside,
1326    Inside,
1327}
1328
1329#[allow(missing_docs)]
1330#[repr(C)]
1331#[property_value_type(PropertyValueWithGlobal for ResizeType)]
1332#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1333#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1334pub enum Resize {
1335    None,
1336    Both,
1337    Horizontal,
1338    Vertical,
1339    Block,
1340    Inline,
1341}
1342
1343#[allow(missing_docs)]
1344#[repr(C)]
1345#[property_value_type(PropertyValueWithGlobal for ZIndexType)]
1346#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1347#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1348pub enum ZIndex {
1349    Auto,
1350    Num(Number),
1351}
1352
1353#[allow(missing_docs)]
1354#[repr(C)]
1355#[property_value_type(PropertyValueWithGlobal for TextShadowType)]
1356#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1357#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1358pub enum TextShadow {
1359    None,
1360    List(Array<TextShadowItem>),
1361}
1362
1363/// An item in `text-shadow`.
1364#[repr(C)]
1365#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1366#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1367pub enum TextShadowItem {
1368    /// A value of offset-y, offset-x, blur-radius, and color.
1369    TextShadowValue(
1370        #[resolve_font_size(Length::resolve_em_and_ratio)] Length,
1371        #[resolve_font_size(Length::resolve_em_and_ratio)] Length,
1372        #[resolve_font_size(Length::resolve_em_and_ratio)] Length,
1373        Color,
1374    ),
1375}
1376
1377#[allow(missing_docs)]
1378#[repr(C)]
1379#[property_value_type(PropertyValueWithGlobal for TextDecorationLineType)]
1380#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1381#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1382pub enum TextDecorationLine {
1383    None,
1384    SpellingError,
1385    GrammarError,
1386    List(Array<TextDecorationLineItem>),
1387}
1388
1389/// An item in `text-decoration-line`.
1390#[allow(missing_docs)]
1391#[repr(C)]
1392#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1393#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1394pub enum TextDecorationLineItem {
1395    Overline,
1396    LineThrough,
1397    Underline,
1398    Blink,
1399}
1400
1401#[allow(missing_docs)]
1402#[repr(C)]
1403#[property_value_type(PropertyValueWithGlobal for TextDecorationStyleType)]
1404#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1405#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1406pub enum TextDecorationStyle {
1407    Solid,
1408    Double,
1409    Dotted,
1410    Dashed,
1411    Wavy,
1412}
1413
1414#[allow(missing_docs)]
1415#[repr(C)]
1416#[property_value_type(PropertyValueWithGlobal for TextDecorationThicknessType)]
1417#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1418#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1419pub enum TextDecorationThickness {
1420    Auto,
1421    FromFont,
1422    #[resolve_font_size(Length::resolve_em_and_ratio)]
1423    Length(Length),
1424}
1425
1426#[allow(missing_docs)]
1427#[repr(C)]
1428#[property_value_type(PropertyValueWithGlobal for LetterSpacingType)]
1429#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1430#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1431pub enum LetterSpacing {
1432    Normal,
1433    #[resolve_font_size(Length::resolve_em_and_ratio)]
1434    Length(Length),
1435}
1436
1437#[allow(missing_docs)]
1438#[repr(C)]
1439#[property_value_type(PropertyValueWithGlobal for WordSpacingType)]
1440#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1441#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1442pub enum WordSpacing {
1443    Normal,
1444    #[resolve_font_size(Length::resolve_em_and_ratio)]
1445    Length(Length),
1446}
1447
1448#[allow(missing_docs)]
1449#[repr(C)]
1450#[property_value_type(PropertyValueWithGlobal for BorderRadiusType)]
1451#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1452#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1453pub enum BorderRadius {
1454    #[resolve_font_size(Length::resolve_em)]
1455    Pos(Length, Length),
1456}
1457
1458#[allow(missing_docs)]
1459#[repr(C)]
1460#[property_value_type(PropertyValueWithGlobal for BoxShadowType)]
1461#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1462#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1463pub enum BoxShadow {
1464    None,
1465    List(Array<BoxShadowItem>),
1466}
1467
1468/// An item in `box-shadow`.
1469#[allow(missing_docs)]
1470#[repr(C)]
1471#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1472#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1473pub enum BoxShadowItem {
1474    List(Array<ShadowItemType>),
1475}
1476
1477/// A shadow type in `box-shadow`.
1478#[allow(missing_docs)]
1479#[repr(C)]
1480#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1481#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1482pub enum ShadowItemType {
1483    Inset,
1484    #[resolve_font_size(Length::resolve_em)]
1485    OffsetX(Length),
1486    #[resolve_font_size(Length::resolve_em)]
1487    OffsetY(Length),
1488    #[resolve_font_size(Length::resolve_em)]
1489    BlurRadius(Length),
1490    #[resolve_font_size(Length::resolve_em)]
1491    SpreadRadius(Length),
1492    Color(Color),
1493}
1494
1495#[allow(missing_docs)]
1496#[repr(C)]
1497#[property_value_type(PropertyValueWithGlobal for BackdropFilterType)]
1498#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1499#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1500pub enum BackdropFilter {
1501    None,
1502    List(Array<FilterFunc>),
1503}
1504
1505#[allow(missing_docs)]
1506#[repr(C)]
1507#[property_value_type(PropertyValueWithGlobal for FilterType)]
1508#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1509#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1510pub enum Filter {
1511    None,
1512    List(Array<FilterFunc>),
1513}
1514
1515/// A filter function for `filter` and `backdrop-filter`.
1516#[allow(missing_docs)]
1517#[repr(C)]
1518#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1519#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1520pub enum FilterFunc {
1521    Url(StrRef),
1522    #[resolve_font_size(Length::resolve_em)]
1523    Blur(Length),
1524    #[resolve_font_size(Length::resolve_em)]
1525    Brightness(Length),
1526    #[resolve_font_size(Length::resolve_em)]
1527    Contrast(Length),
1528    DropShadow(DropShadow),
1529    #[resolve_font_size(Length::resolve_em)]
1530    Grayscale(Length),
1531    HueRotate(Angle),
1532    #[resolve_font_size(Length::resolve_em)]
1533    Invert(Length),
1534    #[resolve_font_size(Length::resolve_em)]
1535    Opacity(Length),
1536    #[resolve_font_size(Length::resolve_em)]
1537    Saturate(Length),
1538    #[resolve_font_size(Length::resolve_em)]
1539    Sepia(Length),
1540}
1541
1542/// A drop shadow in filter function for `filter` and `backdrop-filter`.
1543#[allow(missing_docs)]
1544#[repr(C)]
1545#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1546#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1547pub enum DropShadow {
1548    List(Array<ShadowItemType>),
1549}
1550
1551#[allow(missing_docs)]
1552#[repr(C)]
1553#[property_value_type(PropertyValueWithGlobal for TransformOriginType)]
1554#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1555#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1556pub enum TransformOrigin {
1557    #[resolve_font_size(Length::resolve_em)]
1558    LengthTuple(Length, Length, Length),
1559    Left,
1560    Right,
1561    Center,
1562    Bottom,
1563    Top,
1564    #[resolve_font_size(Length::resolve_em)]
1565    Length(Length),
1566}
1567
1568#[allow(missing_docs)]
1569#[repr(C)]
1570#[property_value_type(PropertyValueWithGlobal for MaskModeType)]
1571#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1572#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1573pub enum MaskMode {
1574    List(Array<MaskModeItem>),
1575}
1576
1577/// An item in mask-mode.
1578#[allow(missing_docs)]
1579#[repr(C)]
1580#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1581#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1582pub enum MaskModeItem {
1583    MatchSource,
1584    Alpha,
1585    Luminance,
1586}
1587
1588#[allow(missing_docs)]
1589#[repr(C)]
1590#[property_value_type(PropertyValueWithGlobal for AspectRatioType)]
1591#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1592#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1593pub enum AspectRatio {
1594    Auto,
1595    Ratio(Number, Number),
1596}
1597
1598#[allow(missing_docs)]
1599#[repr(C)]
1600#[property_value_type(PropertyValueWithGlobal for ContainType)]
1601#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1602#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1603pub enum Contain {
1604    None,
1605    Strict,
1606    Content,
1607    Multiple(Array<ContainKeyword>),
1608}
1609
1610/// An item in multi-value form of `contain`.
1611#[allow(missing_docs)]
1612#[repr(C)]
1613#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1614#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1615pub enum ContainKeyword {
1616    Size,
1617    Layout,
1618    Style,
1619    Paint,
1620}
1621
1622#[allow(missing_docs)]
1623#[repr(C)]
1624#[property_value_type(PropertyValueWithGlobal for ContentType)]
1625#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1626#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1627pub enum Content {
1628    None,
1629    Normal,
1630    Str(StrRef),
1631    Url(StrRef),
1632}
1633
1634/// A unknown property.
1635#[allow(missing_docs)]
1636#[repr(C)]
1637#[property_value_type(PropertyValueWithGlobal for CustomPropertyType)]
1638#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1639#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1640pub enum CustomProperty {
1641    None,
1642    Expr(StrRef, StrRef),
1643}
1644
1645#[allow(missing_docs)]
1646#[repr(C)]
1647#[property_value_type(PropertyValueWithGlobal for AnimationIterationCountType)]
1648#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1649#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1650pub enum AnimationIterationCount {
1651    List(Array<AnimationIterationCountItem>),
1652}
1653
1654/// An item in `animation-iteration-count`.
1655#[allow(missing_docs)]
1656#[repr(C)]
1657#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1658#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1659pub enum AnimationIterationCountItem {
1660    Number(f32),
1661    Infinite,
1662}
1663
1664#[allow(missing_docs)]
1665#[repr(C)]
1666#[property_value_type(PropertyValueWithGlobal for AnimationDirectionType)]
1667#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1668#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1669pub enum AnimationDirection {
1670    List(Array<AnimationDirectionItem>),
1671}
1672
1673/// An item in `animation-direction`.
1674#[allow(missing_docs)]
1675#[repr(C)]
1676#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1677#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1678pub enum AnimationDirectionItem {
1679    Normal,
1680    Reverse,
1681    Alternate,
1682    AlternateReverse,
1683}
1684
1685#[allow(missing_docs)]
1686#[repr(C)]
1687#[property_value_type(PropertyValueWithGlobal for AnimationFillModeType)]
1688#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1689#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1690pub enum AnimationFillMode {
1691    List(Array<AnimationFillModeItem>),
1692}
1693
1694/// An item in `animation-fill-mode`.
1695#[allow(missing_docs)]
1696#[repr(C)]
1697#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1698#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1699pub enum AnimationFillModeItem {
1700    None,
1701    Forwards,
1702    Backwards,
1703    Both,
1704}
1705
1706#[allow(missing_docs)]
1707#[repr(C)]
1708#[property_value_type(PropertyValueWithGlobal for AnimationPlayStateType)]
1709#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1710#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1711pub enum AnimationPlayState {
1712    List(Array<AnimationPlayStateItem>),
1713}
1714
1715/// An item in `animation-play-state`.
1716#[allow(missing_docs)]
1717#[repr(C)]
1718#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1719#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1720pub enum AnimationPlayStateItem {
1721    Running,
1722    Paused,
1723}
1724
1725#[allow(missing_docs)]
1726#[repr(C)]
1727#[property_value_type(PropertyValueWithGlobal for AnimationNameType)]
1728#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1729#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1730pub enum AnimationName {
1731    List(Array<AnimationNameItem>),
1732}
1733
1734/// An item in `animation-name`.
1735#[allow(missing_docs)]
1736#[repr(C)]
1737#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1738#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1739pub enum AnimationNameItem {
1740    None,
1741    CustomIdent(StrRef),
1742}
1743
1744#[allow(missing_docs)]
1745#[repr(C)]
1746#[property_value_type(PropertyValueWithGlobal for WillChangeType)]
1747#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1748#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1749pub enum WillChange {
1750    Auto,
1751    List(Array<AnimateableFeature>),
1752}
1753
1754/// An animation kind for `will-change`.
1755#[allow(missing_docs)]
1756#[repr(C)]
1757#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1758#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1759pub enum AnimateableFeature {
1760    /// The content of the element is likely to be animated.
1761    Contents,
1762    /// The content of the element is scrollable.
1763    ScrollPosition,
1764    /// An unknown kind.
1765    CustomIdent(StrRef),
1766}
1767
1768#[allow(missing_docs)]
1769#[repr(C)]
1770#[property_value_type(PropertyValueWithGlobal for FontFeatureSettingsType)]
1771#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1772#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1773pub enum FontFeatureSettings {
1774    Normal,
1775    FeatureTags(Array<FeatureTag>),
1776}
1777
1778/// A font feature tag for `font-feature-settings`.
1779#[repr(C)]
1780#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1781#[cfg_attr(debug_assertions, derive(CompatibilityStructCheck))]
1782pub struct FeatureTag {
1783    /// The four-letter OpenType tag, e.g. `liga`.
1784    pub opentype_tag: StrRef,
1785    /// The optional number value in `font-feature-settings`.
1786    pub value: Number,
1787}
1788
1789#[allow(missing_docs)]
1790#[repr(C)]
1791#[property_value_type(PropertyValueWithGlobal for GapType)]
1792#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, ResolveFontSize)]
1793#[cfg_attr(debug_assertions, derive(CompatibilityEnumCheck))]
1794pub enum Gap {
1795    Normal,
1796    #[resolve_font_size(Length::resolve_em_and_ratio)]
1797    Length(Length),
1798}