css_ast/values/images/
mod.rs

1#![allow(warnings)]
2//! CSS Images Module Level 5
3//! https://drafts.csswg.org/css-images-5/
4
5mod impls;
6use impls::*;
7
8// /// Represents the style value for `object-fit` as defined in [css-images-5](https://drafts.csswg.org/css-images-5/#object-fit).
9// ///
10// /// The object-fit CSS property sets how images, videos, and other replaced elements are scaled within their container.
11// ///
12// /// The grammar is defined as:
13// ///
14// /// ```text,ignore
15// /// fill | none | [contain | cover] || scale-down
16// /// ```
17// ///
18// // https://drafts.csswg.org/css-images-5/#object-fit
19// #[syntax(" fill | none | [contain | cover] || scale-down ")]
20// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
21// #[style_value(
22// 	initial = "fill",
23//   applies_to = "replaced elements",
24// 	inherited = "no",
25// 	percentages = "n/a",
26// 	canonical_order = "per grammar",
27// 	animation_type = "discrete",
28// )]
29// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
30// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.object-fit"))]
31// #[visit]
32// pub enum ObjectFitStyleValue {}
33
34/// Represents the style value for `object-position` as defined in [css-images-5](https://drafts.csswg.org/css-images-5/#object-position).
35///
36/// The object-position CSS property places images, videos, and other replaced elements within their boxes.
37///
38/// The grammar is defined as:
39///
40/// ```text,ignore
41/// <position>
42/// ```
43///
44// https://drafts.csswg.org/css-images-5/#object-position
45#[syntax(" <position> ")]
46#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
47#[style_value(
48	initial = "50% 50%",
49	applies_to = "replaced elements",
50	inherited = "no",
51	percentages = "refer to width and height of element itself",
52	canonical_order = "the horizontal component of the <position>, followed by the vertical component",
53	animation_type = "as for background-position"
54)]
55#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
56#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.object-position"))]
57#[visit]
58pub struct ObjectPositionStyleValue;
59
60// /// Represents the style value for `image-orientation` as defined in [css-images-5](https://drafts.csswg.org/css-images-5/#image-orientation).
61// ///
62// /// The image-orientation CSS property corrects the rotation of an image using the image's metadata, such as EXIF.
63// ///
64// /// The grammar is defined as:
65// ///
66// /// ```text,ignore
67// /// from-image | none | [ <angle> || flip ]
68// /// ```
69// ///
70// // https://drafts.csswg.org/css-images-5/#image-orientation
71// #[syntax(" from-image | none | [ <angle> || flip ] ")]
72// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
73// #[style_value(
74// 	initial = "from-image",
75//   applies_to = "all elements",
76// 	inherited = "yes",
77// 	percentages = "n/a",
78// 	canonical_order = "per grammar",
79// 	animation_type = "discrete",
80// )]
81// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
82// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.image-orientation"))]
83// #[visit]
84// pub enum ImageOrientationStyleValue {}
85
86/// Represents the style value for `image-rendering` as defined in [css-images-5](https://drafts.csswg.org/css-images-5/#image-rendering).
87///
88/// The image-rendering CSS property sets how images are scaled, retaining smoothness for photos, or hard edges for pixel art and QR codes.
89///
90/// The grammar is defined as:
91///
92/// ```text,ignore
93/// auto | smooth | high-quality | pixelated | crisp-edges
94/// ```
95///
96// https://drafts.csswg.org/css-images-5/#image-rendering
97#[syntax(" auto | smooth | high-quality | pixelated | crisp-edges ")]
98#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
99#[style_value(
100	initial = "auto",
101	applies_to = "all elements",
102	inherited = "yes",
103	percentages = "n/a",
104	canonical_order = "per grammar",
105	animation_type = "discrete"
106)]
107#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
108#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.image-rendering"))]
109#[visit]
110pub enum ImageRenderingStyleValue {}
111
112// /// Represents the style value for `image-resolution` as defined in [css-images-5](https://drafts.csswg.org/css-images-5/#image-resolution).
113// ///
114// /// The grammar is defined as:
115// ///
116// /// ```text,ignore
117// /// [ from-image || <resolution> ] && snap?
118// /// ```
119// ///
120// // https://drafts.csswg.org/css-images-5/#image-resolution
121// #[syntax(" [ from-image || <resolution> ] && snap? ")]
122// #[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
123// #[style_value(
124// 	initial = "1dppx",
125//   applies_to = "all elements",
126// 	inherited = "yes",
127// 	percentages = "n/a",
128// 	canonical_order = "per grammar",
129// 	animation_type = "discrete",
130// )]
131// #[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
132// #[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.image-resolution"))]
133// #[visit]
134// pub struct ImageResolutionStyleValue;
135
136/// Represents the style value for `object-view-box` as defined in [css-images-5](https://drafts.csswg.org/css-images-5/#object-view-box).
137///
138/// The object-view-box CSS property crops and zooms to an inset area of an image.
139///
140/// The grammar is defined as:
141///
142/// ```text,ignore
143/// none | <basic-shape-rect>
144/// ```
145///
146// https://drafts.csswg.org/css-images-5/#object-view-box
147#[syntax(" none | <basic-shape-rect> ")]
148#[derive(Parse, Peek, ToSpan, ToCursors, StyleValue, Visitable, Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
149#[style_value(
150	initial = "none",
151	applies_to = "replaced elements",
152	inherited = "no",
153	percentages = "n/a",
154	canonical_order = "per grammar",
155	animation_type = "as  if possible, otherwise discrete"
156)]
157#[cfg_attr(feature = "serde", derive(serde::Serialize), serde())]
158#[cfg_attr(feature = "css_feature_data", derive(ToCSSFeature), css_feature("css.properties.object-view-box"))]
159#[visit]
160pub struct ObjectViewBoxStyleValue;