css_ast/values/sizing/mod.rs
1#![allow(warnings)]
2//! CSS Box Sizing Module Level 4
3//! https://drafts.csswg.org/css-sizing-4/
4
5mod impls;
6use impls::*;
7
8/// Represents the style value for `width` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#width).
9///
10/// The width and height CSS properties set the preferred physical size of an element.
11///
12/// The grammar is defined as:
13///
14/// ```text,ignore
15/// auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain
16/// ```
17///
18// https://drafts.csswg.org/css-sizing-4/#width
19#[syntax(
20 " auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain "
21)]
22#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
23#[style_value(
24 initial = "auto",
25 applies_to = "all elements except non-replaced inlines",
26 inherited = "no",
27 percentages = "relative to width/height of containing block",
28 canonical_order = "per grammar",
29 animation_type = "by computed value type, recursing into fit-content()"
30)]
31#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
32#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.width"))]
33#[visit]
34pub enum WidthStyleValue {}
35
36/// Represents the style value for `height` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#height).
37///
38/// The width and height CSS properties set the preferred physical size of an element.
39///
40/// The grammar is defined as:
41///
42/// ```text,ignore
43/// auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain
44/// ```
45///
46// https://drafts.csswg.org/css-sizing-4/#height
47#[syntax(
48 " auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain "
49)]
50#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
51#[style_value(
52 initial = "auto",
53 applies_to = "all elements except non-replaced inlines",
54 inherited = "no",
55 percentages = "relative to width/height of containing block",
56 canonical_order = "per grammar",
57 animation_type = "by computed value type, recursing into fit-content()"
58)]
59#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
60#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.height"))]
61#[visit]
62pub enum HeightStyleValue {}
63
64/// Represents the style value for `min-width` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#min-width).
65///
66/// The min-width, min-height, max-width, and max-height CSS properties set the minimum and maximum size of an element.
67///
68/// The grammar is defined as:
69///
70/// ```text,ignore
71/// auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain
72/// ```
73///
74// https://drafts.csswg.org/css-sizing-4/#min-width
75#[syntax(
76 " auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain "
77)]
78#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
79#[style_value(
80 initial = "auto",
81 applies_to = "all elements that accept width or height",
82 inherited = "no",
83 percentages = "relative to width/height of containing block",
84 canonical_order = "per grammar",
85 animation_type = "by computed value, recursing into fit-content()"
86)]
87#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
88#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.min-width"))]
89#[visit]
90pub enum MinWidthStyleValue {}
91
92/// Represents the style value for `min-height` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#min-height).
93///
94/// The min-width, min-height, max-width, and max-height CSS properties set the minimum and maximum size of an element.
95///
96/// The grammar is defined as:
97///
98/// ```text,ignore
99/// auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain
100/// ```
101///
102// https://drafts.csswg.org/css-sizing-4/#min-height
103#[syntax(
104 " auto | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain "
105)]
106#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
107#[style_value(
108 initial = "auto",
109 applies_to = "all elements that accept width or height",
110 inherited = "no",
111 percentages = "relative to width/height of containing block",
112 canonical_order = "per grammar",
113 animation_type = "by computed value, recursing into fit-content()"
114)]
115#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
116#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.min-height"))]
117#[visit]
118pub enum MinHeightStyleValue {}
119
120/// Represents the style value for `max-width` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#max-width).
121///
122/// The min-width, min-height, max-width, and max-height CSS properties set the minimum and maximum size of an element.
123///
124/// The grammar is defined as:
125///
126/// ```text,ignore
127/// none | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain
128/// ```
129///
130// https://drafts.csswg.org/css-sizing-4/#max-width
131#[syntax(
132 " none | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain "
133)]
134#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
135#[style_value(
136 initial = "none",
137 applies_to = "all elements that accept width or height",
138 inherited = "no",
139 percentages = "relative to width/height of containing block",
140 canonical_order = "per grammar",
141 animation_type = "by computed value, recursing into fit-content()"
142)]
143#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
144#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.max-width"))]
145#[visit]
146pub enum MaxWidthStyleValue {}
147
148/// Represents the style value for `max-height` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#max-height).
149///
150/// The min-width, min-height, max-width, and max-height CSS properties set the minimum and maximum size of an element.
151///
152/// The grammar is defined as:
153///
154/// ```text,ignore
155/// none | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain
156/// ```
157///
158// https://drafts.csswg.org/css-sizing-4/#max-height
159#[syntax(
160 " none | <length-percentage [0,∞]> | min-content | max-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | stretch | fit-content | contain "
161)]
162#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
163#[style_value(
164 initial = "none",
165 applies_to = "all elements that accept width or height",
166 inherited = "no",
167 percentages = "relative to width/height of containing block",
168 canonical_order = "per grammar",
169 animation_type = "by computed value, recursing into fit-content()"
170)]
171#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
172#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.max-height"))]
173#[visit]
174pub enum MaxHeightStyleValue {}
175
176/// Represents the style value for `box-sizing` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#box-sizing).
177///
178/// The box-sizing CSS property sets whether an element's width and height are calculated based on the content-box, which does not count the size of borders or padding, or border-box, which does count them.
179///
180/// The grammar is defined as:
181///
182/// ```text,ignore
183/// content-box | border-box
184/// ```
185///
186// https://drafts.csswg.org/css-sizing-4/#box-sizing
187#[syntax(" content-box | border-box ")]
188#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
189#[style_value(
190 initial = "content-box",
191 applies_to = "all elements that accept width or height",
192 inherited = "no",
193 percentages = "n/a",
194 canonical_order = "per grammar",
195 animation_type = "discrete"
196)]
197#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
198#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.box-sizing"))]
199#[visit]
200pub enum BoxSizingStyleValue {}
201
202/// Represents the style value for `aspect-ratio` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#aspect-ratio).
203///
204/// The aspect-ratio CSS property controls the width-to-height ratio of elements. For <img> and <video> elements, the width and height attributes used together with height: auto control the aspect ratio while the image/video is loading.
205///
206/// The grammar is defined as:
207///
208/// ```text,ignore
209/// auto || <ratio>
210/// ```
211///
212// https://drafts.csswg.org/css-sizing-4/#aspect-ratio
213#[syntax(" auto || <ratio> ")]
214#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
215#[style_value(
216 initial = "auto",
217 applies_to = "all elements except inline boxes and internal ruby or table boxes",
218 inherited = "no",
219 percentages = "n/a",
220 canonical_order = "per grammar",
221 animation_type = "by computed value"
222)]
223#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
224#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.aspect-ratio"))]
225#[visit]
226pub struct AspectRatioStyleValue;
227
228// /// Represents the style value for `contain-intrinsic-width` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-width).
229// ///
230// /// The contain-intrinsic-size CSS property sets the intrinsic size of an element. When using size containment, the browser will lay out the element as if it had a single child of this size.
231// ///
232// /// The grammar is defined as:
233// ///
234// /// ```text,ignore
235// /// auto? [ none | <length [0,∞]> ]
236// /// ```
237// ///
238// // https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-width
239// #[syntax(" auto? [ none | <length [0,∞]> ] ")]
240// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
241// #[style_value(
242// initial = "none",
243// applies_to = "elements with size containment",
244// inherited = "no",
245// percentages = "n/a",
246// canonical_order = "per grammar",
247// animation_type = "by computed value type",
248// )]
249// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
250// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.contain-intrinsic-width"))]
251// #[visit]
252// pub struct ContainIntrinsicWidthStyleValue;
253
254// /// Represents the style value for `contain-intrinsic-height` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-height).
255// ///
256// /// The contain-intrinsic-size CSS property sets the intrinsic size of an element. When using size containment, the browser will lay out the element as if it had a single child of this size.
257// ///
258// /// The grammar is defined as:
259// ///
260// /// ```text,ignore
261// /// auto? [ none | <length [0,∞]> ]
262// /// ```
263// ///
264// // https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-height
265// #[syntax(" auto? [ none | <length [0,∞]> ] ")]
266// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
267// #[style_value(
268// initial = "none",
269// applies_to = "elements with size containment",
270// inherited = "no",
271// percentages = "n/a",
272// canonical_order = "per grammar",
273// animation_type = "by computed value type",
274// )]
275// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
276// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.contain-intrinsic-height"))]
277// #[visit]
278// pub struct ContainIntrinsicHeightStyleValue;
279
280// /// Represents the style value for `contain-intrinsic-block-size` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-block-size).
281// ///
282// /// The contain-intrinsic-size CSS property sets the intrinsic size of an element. When using size containment, the browser will lay out the element as if it had a single child of this size.
283// ///
284// /// The grammar is defined as:
285// ///
286// /// ```text,ignore
287// /// auto? [ none | <length [0,∞]> ]
288// /// ```
289// ///
290// // https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-block-size
291// #[syntax(" auto? [ none | <length [0,∞]> ] ")]
292// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
293// #[style_value(
294// initial = "none",
295// applies_to = "elements with size containment",
296// inherited = "no",
297// percentages = "n/a",
298// canonical_order = "per grammar",
299// animation_type = "by computed value type",
300// )]
301// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
302// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.contain-intrinsic-block-size"))]
303// #[visit]
304// pub struct ContainIntrinsicBlockSizeStyleValue;
305
306// /// Represents the style value for `contain-intrinsic-inline-size` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-inline-size).
307// ///
308// /// The contain-intrinsic-size CSS property sets the intrinsic size of an element. When using size containment, the browser will lay out the element as if it had a single child of this size.
309// ///
310// /// The grammar is defined as:
311// ///
312// /// ```text,ignore
313// /// auto? [ none | <length [0,∞]> ]
314// /// ```
315// ///
316// // https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-inline-size
317// #[syntax(" auto? [ none | <length [0,∞]> ] ")]
318// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
319// #[style_value(
320// initial = "none",
321// applies_to = "elements with size containment",
322// inherited = "no",
323// percentages = "n/a",
324// canonical_order = "per grammar",
325// animation_type = "by computed value type",
326// )]
327// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
328// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.contain-intrinsic-inline-size"))]
329// #[visit]
330// pub struct ContainIntrinsicInlineSizeStyleValue;
331
332// /// Represents the style value for `contain-intrinsic-size` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-size).
333// ///
334// /// The contain-intrinsic-size CSS property sets the intrinsic size of an element. When using size containment, the browser will lay out the element as if it had a single child of this size.
335// ///
336// /// The grammar is defined as:
337// ///
338// /// ```text,ignore
339// /// [ auto? [ none | <length> ] ]{1,2}
340// /// ```
341// ///
342// // https://drafts.csswg.org/css-sizing-4/#contain-intrinsic-size
343// #[syntax(" [ auto? [ none | <length> ] ]{1,2} ")]
344// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
345// #[style_value(
346// initial = "see individual properties",
347// applies_to = "see individual properties",
348// inherited = "see individual properties",
349// percentages = "see individual properties",
350// canonical_order = "per grammar",
351// animation_type = "see individual properties",
352// )]
353// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
354// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.contain-intrinsic-size"))]
355// #[visit]
356// pub struct ContainIntrinsicSizeStyleValue;
357
358// /// Represents the style value for `min-intrinsic-sizing` as defined in [css-sizing-4](https://drafts.csswg.org/css-sizing-4/#min-intrinsic-sizing).
359// ///
360// /// The grammar is defined as:
361// ///
362// /// ```text,ignore
363// /// legacy | zero-if-scroll || zero-if-extrinsic
364// /// ```
365// ///
366// // https://drafts.csswg.org/css-sizing-4/#min-intrinsic-sizing
367// #[syntax(" legacy | zero-if-scroll || zero-if-extrinsic ")]
368// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
369// #[style_value(
370// initial = "legacy",
371// applies_to = "all elements except inline boxes",
372// inherited = "no",
373// percentages = "n/a",
374// canonical_order = "per grammar",
375// animation_type = "discrete",
376// )]
377// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
378// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.min-intrinsic-sizing"))]
379// #[visit]
380// pub enum MinIntrinsicSizingStyleValue {}