1use alloc::{
5 boxed::Box,
6 collections::btree_map::BTreeMap,
7 string::{String, ToString},
8 vec::Vec,
9};
10use core::fmt;
11
12use crate::{
13 corety::AzString,
14 css::{BoxOrStatic, CssPropertyValue},
15 props::basic::{error::InvalidValueErr, pixel::PixelValueWithAuto},
16};
17#[allow(clippy::wildcard_imports)]
22use crate::{
23 codegen::format::FormatAsRustCode,
24 props::{
25 basic::{
26 color::{parse_css_color, ColorU, CssColorParseError, CssColorParseErrorOwned},
27 font::{
28 parse_style_font_family, CssStyleFontFamilyParseError,
29 CssStyleFontFamilyParseErrorOwned, StyleFontFamilyVec, *,
30 },
31 length::{parse_float_value, parse_percentage_value, FloatValue, PercentageValue},
32 pixel::{
33 parse_pixel_value, CssPixelValueParseError, CssPixelValueParseErrorOwned,
34 PixelValue,
35 },
36 DurationParseError, DurationParseErrorOwned, InterpolateResolver, InvalidValueErrOwned,
37 PercentageParseError,
38 },
39 formatter::PrintAsCssValue,
40 layout::{
41 column::*, dimensions::*, display::*, flex::*, flow::*, fragmentation::*, grid::*,
42 overflow::*, position::*, shape::*, spacing::*, table::*, text::*, wrapping::*,
43 },
44 style::{
45 background::*, border::*, border_radius::*, box_shadow::*, content::*, effects::*,
46 exclusion::*, filter::*, lists::*, scrollbar::*, text::*, transform::*,
47 SelectionBackgroundColor, SelectionColor, SelectionRadius,
48 },
49 },
50};
51
52const COMBINED_CSS_PROPERTIES_KEY_MAP: [(CombinedCssPropertyType, &str); 27] = [
53 (CombinedCssPropertyType::BorderRadius, "border-radius"),
54 (CombinedCssPropertyType::Overflow, "overflow"),
55 (CombinedCssPropertyType::Padding, "padding"),
56 (CombinedCssPropertyType::Margin, "margin"),
57 (CombinedCssPropertyType::Border, "border"),
58 (CombinedCssPropertyType::BorderLeft, "border-left"),
59 (CombinedCssPropertyType::BorderRight, "border-right"),
60 (CombinedCssPropertyType::BorderTop, "border-top"),
61 (CombinedCssPropertyType::BorderBottom, "border-bottom"),
62 (CombinedCssPropertyType::BorderColor, "border-color"),
63 (CombinedCssPropertyType::BorderStyle, "border-style"),
64 (CombinedCssPropertyType::BorderWidth, "border-width"),
65 (CombinedCssPropertyType::BoxShadow, "box-shadow"),
66 (CombinedCssPropertyType::BackgroundColor, "background-color"),
67 (CombinedCssPropertyType::BackgroundImage, "background-image"),
68 (CombinedCssPropertyType::Background, "background"),
69 (CombinedCssPropertyType::Flex, "flex"),
70 (CombinedCssPropertyType::Grid, "grid"),
71 (CombinedCssPropertyType::Gap, "gap"),
72 (CombinedCssPropertyType::GridGap, "grid-gap"),
73 (CombinedCssPropertyType::Font, "font"),
74 (CombinedCssPropertyType::Columns, "columns"),
75 (CombinedCssPropertyType::GridArea, "grid-area"),
76 (CombinedCssPropertyType::ColumnRule, "column-rule"),
77 (CombinedCssPropertyType::TextBox, "text-box"),
78 (CombinedCssPropertyType::InsetBlock, "inset-block"),
80 (CombinedCssPropertyType::InsetInline, "inset-inline"),
81];
82
83const CSS_PROPERTY_KEY_MAP: [(CssPropertyType, &str); 179] = [
84 (CssPropertyType::Display, "display"),
85 (CssPropertyType::Float, "float"),
86 (CssPropertyType::BoxSizing, "box-sizing"),
87 (CssPropertyType::TextColor, "color"),
88 (CssPropertyType::FontSize, "font-size"),
89 (CssPropertyType::FontFamily, "font-family"),
90 (CssPropertyType::FontWeight, "font-weight"),
91 (CssPropertyType::FontStyle, "font-style"),
92 (CssPropertyType::TextAlign, "text-align"),
93 (CssPropertyType::TextJustify, "text-justify"),
94 (CssPropertyType::VerticalAlign, "vertical-align"),
95 (CssPropertyType::LetterSpacing, "letter-spacing"),
96 (CssPropertyType::LineHeight, "line-height"),
97 (CssPropertyType::WordSpacing, "word-spacing"),
98 (CssPropertyType::TabSize, "tab-size"),
99 (CssPropertyType::WhiteSpace, "white-space"),
100 (CssPropertyType::Hyphens, "hyphens"),
101 (CssPropertyType::WordBreak, "word-break"),
102 (CssPropertyType::OverflowWrap, "overflow-wrap"),
103 (CssPropertyType::OverflowWrap, "word-wrap"), (CssPropertyType::LineBreak, "line-break"),
105 (CssPropertyType::ObjectFit, "object-fit"),
106 (CssPropertyType::ObjectPosition, "object-position"),
107 (CssPropertyType::AspectRatio, "aspect-ratio"),
108 (CssPropertyType::TextOrientation, "text-orientation"),
109 (CssPropertyType::TextAlignLast, "text-align-last"),
110 (CssPropertyType::TextTransform, "text-transform"),
111 (CssPropertyType::Direction, "direction"),
112 (CssPropertyType::UserSelect, "user-select"),
113 (CssPropertyType::TextDecoration, "text-decoration"),
114 (CssPropertyType::TextIndent, "text-indent"),
115 (CssPropertyType::InitialLetter, "initial-letter"),
116 (CssPropertyType::LineClamp, "line-clamp"),
117 (CssPropertyType::HangingPunctuation, "hanging-punctuation"),
118 (CssPropertyType::TextCombineUpright, "text-combine-upright"),
119 (CssPropertyType::UnicodeBidi, "unicode-bidi"),
120 (CssPropertyType::TextBoxTrim, "text-box-trim"),
121 (CssPropertyType::TextBoxEdge, "text-box-edge"),
122 (CssPropertyType::DominantBaseline, "dominant-baseline"),
123 (CssPropertyType::AlignmentBaseline, "alignment-baseline"),
124 (CssPropertyType::InitialLetterAlign, "initial-letter-align"),
125 (CssPropertyType::InitialLetterWrap, "initial-letter-wrap"),
126 (CssPropertyType::ScrollbarGutter, "scrollbar-gutter"),
127 (CssPropertyType::OverflowClipMargin, "overflow-clip-margin"),
128 (CssPropertyType::Clip, "clip"),
130 (CssPropertyType::ExclusionMargin, "-azul-exclusion-margin"),
131 (
132 CssPropertyType::HyphenationLanguage,
133 "-azul-hyphenation-language",
134 ),
135 (CssPropertyType::Cursor, "cursor"),
136 (CssPropertyType::Width, "width"),
137 (CssPropertyType::Height, "height"),
138 (CssPropertyType::MinWidth, "min-width"),
139 (CssPropertyType::MinHeight, "min-height"),
140 (CssPropertyType::MaxWidth, "max-width"),
141 (CssPropertyType::MaxHeight, "max-height"),
142 (CssPropertyType::Position, "position"),
143 (CssPropertyType::Top, "top"),
144 (CssPropertyType::Right, "right"),
145 (CssPropertyType::Left, "left"),
146 (CssPropertyType::Bottom, "bottom"),
147 (CssPropertyType::ZIndex, "z-index"),
148 (CssPropertyType::FlexWrap, "flex-wrap"),
149 (CssPropertyType::FlexDirection, "flex-direction"),
150 (CssPropertyType::FlexGrow, "flex-grow"),
151 (CssPropertyType::FlexShrink, "flex-shrink"),
152 (CssPropertyType::FlexBasis, "flex-basis"),
153 (CssPropertyType::JustifyContent, "justify-content"),
154 (CssPropertyType::AlignItems, "align-items"),
155 (CssPropertyType::AlignContent, "align-content"),
156 (CssPropertyType::ColumnGap, "column-gap"),
157 (CssPropertyType::RowGap, "row-gap"),
158 (
159 CssPropertyType::GridTemplateColumns,
160 "grid-template-columns",
161 ),
162 (CssPropertyType::GridTemplateRows, "grid-template-rows"),
163 (CssPropertyType::GridAutoColumns, "grid-auto-columns"),
164 (CssPropertyType::GridAutoRows, "grid-auto-rows"),
165 (CssPropertyType::GridColumn, "grid-column"),
166 (CssPropertyType::GridRow, "grid-row"),
167 (CssPropertyType::GridTemplateAreas, "grid-template-areas"),
168 (CssPropertyType::WritingMode, "writing-mode"),
169 (CssPropertyType::Clear, "clear"),
170 (CssPropertyType::OverflowX, "overflow-x"),
171 (CssPropertyType::OverflowY, "overflow-y"),
172 (CssPropertyType::OverflowBlock, "overflow-block"),
174 (CssPropertyType::OverflowInline, "overflow-inline"),
175 (CssPropertyType::PaddingTop, "padding-top"),
176 (CssPropertyType::PaddingLeft, "padding-left"),
177 (CssPropertyType::PaddingRight, "padding-right"),
178 (CssPropertyType::PaddingBottom, "padding-bottom"),
179 (CssPropertyType::PaddingInlineStart, "padding-inline-start"),
180 (CssPropertyType::PaddingInlineEnd, "padding-inline-end"),
181 (CssPropertyType::MarginTop, "margin-top"),
182 (CssPropertyType::MarginLeft, "margin-left"),
183 (CssPropertyType::MarginRight, "margin-right"),
184 (CssPropertyType::MarginBottom, "margin-bottom"),
185 (CssPropertyType::BackgroundContent, "background"),
186 (CssPropertyType::BackgroundPosition, "background-position"),
187 (CssPropertyType::BackgroundSize, "background-size"),
188 (CssPropertyType::BackgroundRepeat, "background-repeat"),
189 (
190 CssPropertyType::BorderTopLeftRadius,
191 "border-top-left-radius",
192 ),
193 (
194 CssPropertyType::BorderTopRightRadius,
195 "border-top-right-radius",
196 ),
197 (
198 CssPropertyType::BorderBottomLeftRadius,
199 "border-bottom-left-radius",
200 ),
201 (
202 CssPropertyType::BorderBottomRightRadius,
203 "border-bottom-right-radius",
204 ),
205 (CssPropertyType::BorderTopColor, "border-top-color"),
206 (CssPropertyType::BorderRightColor, "border-right-color"),
207 (CssPropertyType::BorderLeftColor, "border-left-color"),
208 (CssPropertyType::BorderBottomColor, "border-bottom-color"),
209 (CssPropertyType::BorderTopStyle, "border-top-style"),
210 (CssPropertyType::BorderRightStyle, "border-right-style"),
211 (CssPropertyType::BorderLeftStyle, "border-left-style"),
212 (CssPropertyType::BorderBottomStyle, "border-bottom-style"),
213 (CssPropertyType::BorderTopWidth, "border-top-width"),
214 (CssPropertyType::BorderRightWidth, "border-right-width"),
215 (CssPropertyType::BorderLeftWidth, "border-left-width"),
216 (CssPropertyType::BorderBottomWidth, "border-bottom-width"),
217 (CssPropertyType::BoxShadowTop, "-azul-box-shadow-top"),
218 (CssPropertyType::BoxShadowRight, "-azul-box-shadow-right"),
219 (CssPropertyType::BoxShadowLeft, "-azul-box-shadow-left"),
220 (CssPropertyType::BoxShadowBottom, "-azul-box-shadow-bottom"),
221 (CssPropertyType::ScrollbarTrack, "-azul-scrollbar-track"),
222 (CssPropertyType::ScrollbarThumb, "-azul-scrollbar-thumb"),
223 (CssPropertyType::ScrollbarButton, "-azul-scrollbar-button"),
224 (CssPropertyType::ScrollbarCorner, "-azul-scrollbar-corner"),
225 (CssPropertyType::ScrollbarResizer, "-azul-scrollbar-resizer"),
226 (CssPropertyType::CaretColor, "caret-color"),
227 (
228 CssPropertyType::CaretAnimationDuration,
229 "caret-animation-duration",
230 ),
231 (CssPropertyType::CaretWidth, "-azul-caret-width"),
232 (
233 CssPropertyType::SelectionBackgroundColor,
234 "-azul-selection-background-color",
235 ),
236 (CssPropertyType::SelectionColor, "-azul-selection-color"),
237 (CssPropertyType::SelectionRadius, "-azul-selection-radius"),
238 (CssPropertyType::ScrollbarWidth, "scrollbar-width"),
239 (CssPropertyType::ScrollbarColor, "scrollbar-color"),
240 (
241 CssPropertyType::ScrollbarVisibility,
242 "-azul-scrollbar-visibility",
243 ),
244 (
245 CssPropertyType::ScrollbarFadeDelay,
246 "-azul-scrollbar-fade-delay",
247 ),
248 (
249 CssPropertyType::ScrollbarFadeDuration,
250 "-azul-scrollbar-fade-duration",
251 ),
252 (CssPropertyType::Opacity, "opacity"),
253 (CssPropertyType::Visibility, "visibility"),
254 (CssPropertyType::Transform, "transform"),
255 (CssPropertyType::PerspectiveOrigin, "perspective-origin"),
256 (CssPropertyType::TransformOrigin, "transform-origin"),
257 (CssPropertyType::BackfaceVisibility, "backface-visibility"),
258 (CssPropertyType::MixBlendMode, "mix-blend-mode"),
259 (CssPropertyType::Filter, "filter"),
260 (CssPropertyType::BackdropFilter, "backdrop-filter"),
261 (CssPropertyType::TextShadow, "text-shadow"),
262 (CssPropertyType::GridAutoFlow, "grid-auto-flow"),
263 (CssPropertyType::JustifySelf, "justify-self"),
264 (CssPropertyType::JustifyItems, "justify-items"),
265 (CssPropertyType::Gap, "gap"),
266 (CssPropertyType::GridGap, "grid-gap"),
267 (CssPropertyType::AlignSelf, "align-self"),
268 (CssPropertyType::Font, "font"),
269 (CssPropertyType::BreakBefore, "break-before"),
270 (CssPropertyType::BreakAfter, "break-after"),
271 (CssPropertyType::BreakInside, "break-inside"),
272 (CssPropertyType::BreakBefore, "page-break-before"),
274 (CssPropertyType::BreakAfter, "page-break-after"),
275 (CssPropertyType::BreakInside, "page-break-inside"),
276 (CssPropertyType::Orphans, "orphans"),
277 (CssPropertyType::Widows, "widows"),
278 (CssPropertyType::BoxDecorationBreak, "box-decoration-break"),
279 (CssPropertyType::ColumnCount, "column-count"),
280 (CssPropertyType::ColumnWidth, "column-width"),
281 (CssPropertyType::ColumnSpan, "column-span"),
282 (CssPropertyType::ColumnFill, "column-fill"),
283 (CssPropertyType::ColumnRuleWidth, "column-rule-width"),
284 (CssPropertyType::ColumnRuleStyle, "column-rule-style"),
285 (CssPropertyType::ColumnRuleColor, "column-rule-color"),
286 (CssPropertyType::FlowInto, "flow-into"),
287 (CssPropertyType::FlowFrom, "flow-from"),
288 (CssPropertyType::ShapeOutside, "shape-outside"),
289 (CssPropertyType::ShapeInside, "shape-inside"),
290 (CssPropertyType::ClipPath, "clip-path"),
291 (CssPropertyType::ShapeMargin, "shape-margin"),
292 (
293 CssPropertyType::ShapeImageThreshold,
294 "shape-image-threshold",
295 ),
296 (CssPropertyType::Content, "content"),
297 (CssPropertyType::CounterReset, "counter-reset"),
298 (CssPropertyType::CounterIncrement, "counter-increment"),
299 (CssPropertyType::ListStyleType, "list-style-type"),
300 (CssPropertyType::ListStylePosition, "list-style-position"),
301 (CssPropertyType::StringSet, "string-set"),
302];
303
304pub type CaretColorValue = CssPropertyValue<CaretColor>;
306pub type CaretAnimationDurationValue = CssPropertyValue<CaretAnimationDuration>;
307pub type CaretWidthValue = CssPropertyValue<CaretWidth>;
308pub type SelectionBackgroundColorValue = CssPropertyValue<SelectionBackgroundColor>;
309pub type SelectionColorValue = CssPropertyValue<SelectionColor>;
310pub type SelectionRadiusValue = CssPropertyValue<SelectionRadius>;
311pub type StyleBackgroundContentVecValue = CssPropertyValue<StyleBackgroundContentVec>;
312pub type StyleBackgroundPositionVecValue = CssPropertyValue<StyleBackgroundPositionVec>;
313pub type StyleBackgroundSizeVecValue = CssPropertyValue<StyleBackgroundSizeVec>;
314pub type StyleBackgroundRepeatVecValue = CssPropertyValue<StyleBackgroundRepeatVec>;
315pub type StyleFontSizeValue = CssPropertyValue<StyleFontSize>;
316pub type StyleFontFamilyVecValue = CssPropertyValue<StyleFontFamilyVec>;
317pub type StyleFontWeightValue = CssPropertyValue<StyleFontWeight>;
318pub type StyleFontStyleValue = CssPropertyValue<StyleFontStyle>;
319pub type StyleTextColorValue = CssPropertyValue<StyleTextColor>;
320pub type StyleTextAlignValue = CssPropertyValue<StyleTextAlign>;
321pub type StyleVerticalAlignValue = CssPropertyValue<StyleVerticalAlign>;
322pub type StyleLineHeightValue = CssPropertyValue<StyleLineHeight>;
323pub type StyleLetterSpacingValue = CssPropertyValue<StyleLetterSpacing>;
324pub type StyleTextIndentValue = CssPropertyValue<StyleTextIndent>;
325pub type StyleInitialLetterValue = CssPropertyValue<StyleInitialLetter>;
326pub type StyleLineClampValue = CssPropertyValue<StyleLineClamp>;
327pub type StyleHangingPunctuationValue = CssPropertyValue<StyleHangingPunctuation>;
328pub type StyleTextCombineUprightValue = CssPropertyValue<StyleTextCombineUpright>;
329pub type StyleUnicodeBidiValue = CssPropertyValue<StyleUnicodeBidi>;
330pub type StyleTextBoxTrimValue = CssPropertyValue<StyleTextBoxTrim>;
331pub type StyleTextBoxEdgeValue = CssPropertyValue<StyleTextBoxEdge>;
332pub type StyleDominantBaselineValue = CssPropertyValue<StyleDominantBaseline>;
333pub type StyleAlignmentBaselineValue = CssPropertyValue<StyleAlignmentBaseline>;
334pub type StyleInitialLetterAlignValue = CssPropertyValue<StyleInitialLetterAlign>;
335pub type StyleInitialLetterWrapValue = CssPropertyValue<StyleInitialLetterWrap>;
336pub type StyleScrollbarGutterValue = CssPropertyValue<StyleScrollbarGutter>;
337pub type StyleOverflowClipMarginValue = CssPropertyValue<StyleOverflowClipMargin>;
338pub type StyleClipRectValue = CssPropertyValue<StyleClipRect>;
339pub type StyleExclusionMarginValue = CssPropertyValue<StyleExclusionMargin>;
340pub type StyleHyphenationLanguageValue = CssPropertyValue<StyleHyphenationLanguage>;
341pub type StyleWordSpacingValue = CssPropertyValue<StyleWordSpacing>;
342pub type StyleTabSizeValue = CssPropertyValue<StyleTabSize>;
343pub type StyleCursorValue = CssPropertyValue<StyleCursor>;
344pub type StyleBoxShadowValue = CssPropertyValue<crate::css::BoxOrStaticStyleBoxShadow>;
345pub type StyleBorderTopColorValue = CssPropertyValue<StyleBorderTopColor>;
346pub type StyleBorderLeftColorValue = CssPropertyValue<StyleBorderLeftColor>;
347pub type StyleBorderRightColorValue = CssPropertyValue<StyleBorderRightColor>;
348pub type StyleBorderBottomColorValue = CssPropertyValue<StyleBorderBottomColor>;
349pub type StyleBorderTopStyleValue = CssPropertyValue<StyleBorderTopStyle>;
350pub type StyleBorderLeftStyleValue = CssPropertyValue<StyleBorderLeftStyle>;
351pub type StyleBorderRightStyleValue = CssPropertyValue<StyleBorderRightStyle>;
352pub type StyleBorderBottomStyleValue = CssPropertyValue<StyleBorderBottomStyle>;
353pub type StyleBorderTopLeftRadiusValue = CssPropertyValue<StyleBorderTopLeftRadius>;
354pub type StyleBorderTopRightRadiusValue = CssPropertyValue<StyleBorderTopRightRadius>;
355pub type StyleBorderBottomLeftRadiusValue = CssPropertyValue<StyleBorderBottomLeftRadius>;
356pub type StyleBorderBottomRightRadiusValue = CssPropertyValue<StyleBorderBottomRightRadius>;
357pub type StyleOpacityValue = CssPropertyValue<StyleOpacity>;
358pub type StyleVisibilityValue = CssPropertyValue<StyleVisibility>;
359pub type StyleTransformVecValue = CssPropertyValue<StyleTransformVec>;
360pub type StyleTransformOriginValue = CssPropertyValue<StyleTransformOrigin>;
361pub type StylePerspectiveOriginValue = CssPropertyValue<StylePerspectiveOrigin>;
362pub type StyleBackfaceVisibilityValue = CssPropertyValue<StyleBackfaceVisibility>;
363pub type StyleMixBlendModeValue = CssPropertyValue<StyleMixBlendMode>;
364pub type StyleFilterVecValue = CssPropertyValue<StyleFilterVec>;
365pub type StyleBackgroundContentValue = CssPropertyValue<StyleBackgroundContent>;
366pub type LayoutScrollbarWidthValue = CssPropertyValue<LayoutScrollbarWidth>;
367pub type StyleScrollbarColorValue = CssPropertyValue<StyleScrollbarColor>;
368pub type ScrollbarVisibilityModeValue = CssPropertyValue<ScrollbarVisibilityMode>;
369pub type ScrollbarFadeDelayValue = CssPropertyValue<ScrollbarFadeDelay>;
370pub type ScrollbarFadeDurationValue = CssPropertyValue<ScrollbarFadeDuration>;
371pub type LayoutDisplayValue = CssPropertyValue<LayoutDisplay>;
372pub type StyleHyphensValue = CssPropertyValue<StyleHyphens>;
373pub type StyleWordBreakValue = CssPropertyValue<StyleWordBreak>;
374pub type StyleOverflowWrapValue = CssPropertyValue<StyleOverflowWrap>;
375pub type StyleLineBreakValue = CssPropertyValue<StyleLineBreak>;
376pub type StyleObjectFitValue = CssPropertyValue<StyleObjectFit>;
377pub type StyleObjectPositionValue = CssPropertyValue<StyleObjectPosition>;
378pub type StyleAspectRatioValue = CssPropertyValue<StyleAspectRatio>;
379pub type StyleTextOrientationValue = CssPropertyValue<StyleTextOrientation>;
380pub type StyleTextAlignLastValue = CssPropertyValue<StyleTextAlignLast>;
381pub type StyleTextTransformValue = CssPropertyValue<StyleTextTransform>;
382pub type StyleDirectionValue = CssPropertyValue<StyleDirection>;
383pub type StyleUserSelectValue = CssPropertyValue<StyleUserSelect>;
384pub type StyleTextDecorationValue = CssPropertyValue<StyleTextDecoration>;
385pub type StyleWhiteSpaceValue = CssPropertyValue<StyleWhiteSpace>;
386pub type LayoutFloatValue = CssPropertyValue<LayoutFloat>;
387pub type LayoutBoxSizingValue = CssPropertyValue<LayoutBoxSizing>;
388pub type LayoutWidthValue = CssPropertyValue<LayoutWidth>;
389pub type LayoutHeightValue = CssPropertyValue<LayoutHeight>;
390pub type LayoutMinWidthValue = CssPropertyValue<LayoutMinWidth>;
391pub type LayoutMinHeightValue = CssPropertyValue<LayoutMinHeight>;
392pub type LayoutMaxWidthValue = CssPropertyValue<LayoutMaxWidth>;
393pub type LayoutMaxHeightValue = CssPropertyValue<LayoutMaxHeight>;
394pub type LayoutPositionValue = CssPropertyValue<LayoutPosition>;
395pub type LayoutTopValue = CssPropertyValue<LayoutTop>;
396pub type LayoutInsetBottomValue = CssPropertyValue<LayoutInsetBottom>;
397pub type LayoutRightValue = CssPropertyValue<LayoutRight>;
398pub type LayoutLeftValue = CssPropertyValue<LayoutLeft>;
399pub type LayoutZIndexValue = CssPropertyValue<LayoutZIndex>;
400pub type LayoutPaddingTopValue = CssPropertyValue<LayoutPaddingTop>;
401pub type LayoutPaddingBottomValue = CssPropertyValue<LayoutPaddingBottom>;
402pub type LayoutPaddingLeftValue = CssPropertyValue<LayoutPaddingLeft>;
403pub type LayoutPaddingRightValue = CssPropertyValue<LayoutPaddingRight>;
404pub type LayoutPaddingInlineStartValue = CssPropertyValue<LayoutPaddingInlineStart>;
405pub type LayoutPaddingInlineEndValue = CssPropertyValue<LayoutPaddingInlineEnd>;
406pub type LayoutMarginTopValue = CssPropertyValue<LayoutMarginTop>;
407pub type LayoutMarginBottomValue = CssPropertyValue<LayoutMarginBottom>;
408pub type LayoutTextJustifyValue = CssPropertyValue<LayoutTextJustify>;
409pub type LayoutMarginLeftValue = CssPropertyValue<LayoutMarginLeft>;
410pub type LayoutMarginRightValue = CssPropertyValue<LayoutMarginRight>;
411pub type LayoutBorderTopWidthValue = CssPropertyValue<LayoutBorderTopWidth>;
412pub type LayoutBorderLeftWidthValue = CssPropertyValue<LayoutBorderLeftWidth>;
413pub type LayoutBorderRightWidthValue = CssPropertyValue<LayoutBorderRightWidth>;
414pub type LayoutBorderBottomWidthValue = CssPropertyValue<LayoutBorderBottomWidth>;
415pub type LayoutOverflowValue = CssPropertyValue<LayoutOverflow>;
416pub type LayoutFlexDirectionValue = CssPropertyValue<LayoutFlexDirection>;
417pub type LayoutFlexWrapValue = CssPropertyValue<LayoutFlexWrap>;
418pub type LayoutFlexGrowValue = CssPropertyValue<LayoutFlexGrow>;
419pub type LayoutFlexShrinkValue = CssPropertyValue<LayoutFlexShrink>;
420pub type LayoutFlexBasisValue = CssPropertyValue<LayoutFlexBasis>;
421pub type LayoutJustifyContentValue = CssPropertyValue<LayoutJustifyContent>;
422pub type LayoutAlignItemsValue = CssPropertyValue<LayoutAlignItems>;
423pub type LayoutAlignContentValue = CssPropertyValue<LayoutAlignContent>;
424pub type LayoutColumnGapValue = CssPropertyValue<LayoutColumnGap>;
425pub type LayoutRowGapValue = CssPropertyValue<LayoutRowGap>;
426pub type LayoutGridTemplateColumnsValue = CssPropertyValue<GridTemplate>;
427pub type LayoutGridTemplateRowsValue = CssPropertyValue<GridTemplate>;
428pub type LayoutGridAutoColumnsValue = CssPropertyValue<GridAutoTracks>;
429pub type LayoutGridAutoRowsValue = CssPropertyValue<GridAutoTracks>;
430pub type LayoutGridColumnValue = CssPropertyValue<GridPlacement>;
431pub type LayoutGridRowValue = CssPropertyValue<GridPlacement>;
432pub type LayoutGridTemplateAreasValue =
433 CssPropertyValue<GridTemplateAreas>;
434pub type LayoutWritingModeValue = CssPropertyValue<LayoutWritingMode>;
435pub type LayoutClearValue = CssPropertyValue<LayoutClear>;
436pub type LayoutGridAutoFlowValue = CssPropertyValue<LayoutGridAutoFlow>;
437pub type LayoutJustifySelfValue = CssPropertyValue<LayoutJustifySelf>;
438pub type LayoutJustifyItemsValue = CssPropertyValue<LayoutJustifyItems>;
439pub type LayoutGapValue = CssPropertyValue<LayoutGap>;
440pub type LayoutAlignSelfValue = CssPropertyValue<LayoutAlignSelf>;
441pub type StyleFontValue = CssPropertyValue<StyleFontFamilyVec>;
442pub type PageBreakValue = CssPropertyValue<PageBreak>;
443pub type BreakInsideValue = CssPropertyValue<BreakInside>;
444pub type WidowsValue = CssPropertyValue<Widows>;
445pub type OrphansValue = CssPropertyValue<Orphans>;
446pub type BoxDecorationBreakValue = CssPropertyValue<BoxDecorationBreak>;
447pub type ColumnCountValue = CssPropertyValue<ColumnCount>;
448pub type ColumnWidthValue = CssPropertyValue<ColumnWidth>;
449pub type ColumnSpanValue = CssPropertyValue<ColumnSpan>;
450pub type ColumnFillValue = CssPropertyValue<ColumnFill>;
451pub type ColumnRuleWidthValue = CssPropertyValue<ColumnRuleWidth>;
452pub type ColumnRuleStyleValue = CssPropertyValue<ColumnRuleStyle>;
453pub type ColumnRuleColorValue = CssPropertyValue<ColumnRuleColor>;
454pub type FlowIntoValue = CssPropertyValue<FlowInto>;
455pub type FlowFromValue = CssPropertyValue<FlowFrom>;
456pub type ShapeOutsideValue = CssPropertyValue<ShapeOutside>;
457pub type ShapeInsideValue = CssPropertyValue<ShapeInside>;
458pub type ClipPathValue = CssPropertyValue<ClipPath>;
459pub type ShapeMarginValue = CssPropertyValue<ShapeMargin>;
460pub type ShapeImageThresholdValue = CssPropertyValue<ShapeImageThreshold>;
461pub type LayoutTableLayoutValue = CssPropertyValue<LayoutTableLayout>;
462pub type StyleBorderCollapseValue = CssPropertyValue<StyleBorderCollapse>;
463pub type LayoutBorderSpacingValue = CssPropertyValue<LayoutBorderSpacing>;
464pub type StyleCaptionSideValue = CssPropertyValue<StyleCaptionSide>;
465pub type StyleEmptyCellsValue = CssPropertyValue<StyleEmptyCells>;
466pub type ContentValue = CssPropertyValue<Content>;
467pub type CounterResetValue = CssPropertyValue<CounterReset>;
468pub type CounterIncrementValue = CssPropertyValue<CounterIncrement>;
469pub type StyleListStyleTypeValue = CssPropertyValue<StyleListStyleType>;
470pub type StyleListStylePositionValue = CssPropertyValue<StyleListStylePosition>;
471pub type StringSetValue = CssPropertyValue<StringSet>;
472
473#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
474pub struct CssKeyMap {
475 pub non_shorthands: BTreeMap<&'static str, CssPropertyType>,
477 pub shorthands: BTreeMap<&'static str, CombinedCssPropertyType>,
479}
480
481impl CssKeyMap {
482 #[must_use] pub fn get() -> Self {
483 get_css_key_map()
484 }
485}
486
487#[must_use] pub fn get_css_key_map() -> CssKeyMap {
489 CssKeyMap {
490 non_shorthands: CSS_PROPERTY_KEY_MAP.iter().map(|(v, k)| (*k, *v)).collect(),
491 shorthands: COMBINED_CSS_PROPERTIES_KEY_MAP
492 .iter()
493 .map(|(v, k)| (*k, *v))
494 .collect(),
495 }
496}
497
498#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
499#[repr(C)]
500pub enum CombinedCssPropertyType {
501 BorderRadius,
502 Overflow,
503 Margin,
504 Border,
505 BorderLeft,
506 BorderRight,
507 BorderTop,
508 BorderBottom,
509 BorderColor,
510 BorderStyle,
511 BorderWidth,
512 Padding,
513 BoxShadow,
514 BackgroundColor, BackgroundImage, Background,
517 Flex,
518 Grid,
519 Gap,
520 GridGap,
521 Font,
522 Columns,
523 ColumnRule,
524 GridArea,
525 TextBox,
526 InsetBlock,
529 InsetInline,
532}
533
534impl fmt::Display for CombinedCssPropertyType {
535 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
536 let key = COMBINED_CSS_PROPERTIES_KEY_MAP
537 .iter()
538 .find(|(v, _)| *v == *self)
539 .map(|(k, _)| k)
540 .unwrap();
541 write!(f, "{key}")
542 }
543}
544
545impl CombinedCssPropertyType {
546 #[must_use] pub fn from_str(input: &str, map: &CssKeyMap) -> Option<Self> {
559 let input = input.trim();
560 map.shorthands.get(input).copied()
561 }
562
563 #[must_use] pub fn to_str(&self, map: &CssKeyMap) -> &'static str {
570 map.shorthands
571 .iter()
572 .find(|(_, v)| *v == self)
573 .map(|(k, _)| k)
574 .unwrap()
575 }
576}
577
578#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
581#[repr(C, u8)]
582pub enum CssProperty {
583 CaretColor(CaretColorValue),
584 CaretAnimationDuration(CaretAnimationDurationValue),
585 CaretWidth(CaretWidthValue),
586 SelectionBackgroundColor(SelectionBackgroundColorValue),
587 SelectionColor(SelectionColorValue),
588 SelectionRadius(SelectionRadiusValue),
589 TextColor(StyleTextColorValue),
590 FontSize(StyleFontSizeValue),
591 FontFamily(StyleFontFamilyVecValue),
592 FontWeight(StyleFontWeightValue),
593 FontStyle(StyleFontStyleValue),
594 TextAlign(StyleTextAlignValue),
595 TextJustify(LayoutTextJustifyValue),
596 VerticalAlign(StyleVerticalAlignValue),
597 LetterSpacing(StyleLetterSpacingValue),
598 TextIndent(StyleTextIndentValue),
599 InitialLetter(StyleInitialLetterValue),
600 LineClamp(StyleLineClampValue),
601 HangingPunctuation(StyleHangingPunctuationValue),
602 TextCombineUpright(StyleTextCombineUprightValue),
603 UnicodeBidi(StyleUnicodeBidiValue),
604 TextBoxTrim(StyleTextBoxTrimValue),
605 TextBoxEdge(StyleTextBoxEdgeValue),
606 DominantBaseline(StyleDominantBaselineValue),
607 AlignmentBaseline(StyleAlignmentBaselineValue),
608 InitialLetterAlign(StyleInitialLetterAlignValue),
609 InitialLetterWrap(StyleInitialLetterWrapValue),
610 ScrollbarGutter(StyleScrollbarGutterValue),
611 OverflowClipMargin(StyleOverflowClipMarginValue),
612 Clip(StyleClipRectValue),
613 ExclusionMargin(StyleExclusionMarginValue),
614 HyphenationLanguage(StyleHyphenationLanguageValue),
615 LineHeight(StyleLineHeightValue),
616 WordSpacing(StyleWordSpacingValue),
617 TabSize(StyleTabSizeValue),
618 WhiteSpace(StyleWhiteSpaceValue),
619 Hyphens(StyleHyphensValue),
620 WordBreak(StyleWordBreakValue),
621 OverflowWrap(StyleOverflowWrapValue),
622 LineBreak(StyleLineBreakValue),
623 ObjectFit(StyleObjectFitValue),
624 ObjectPosition(StyleObjectPositionValue),
625 AspectRatio(StyleAspectRatioValue),
626 TextOrientation(StyleTextOrientationValue),
627 TextAlignLast(StyleTextAlignLastValue),
628 TextTransform(StyleTextTransformValue),
629 Direction(StyleDirectionValue),
630 UserSelect(StyleUserSelectValue),
631 TextDecoration(StyleTextDecorationValue),
632 Cursor(StyleCursorValue),
633 Display(LayoutDisplayValue),
634 Float(LayoutFloatValue),
635 BoxSizing(LayoutBoxSizingValue),
636 Width(LayoutWidthValue),
637 Height(LayoutHeightValue),
638 MinWidth(LayoutMinWidthValue),
639 MinHeight(LayoutMinHeightValue),
640 MaxWidth(LayoutMaxWidthValue),
641 MaxHeight(LayoutMaxHeightValue),
642 Position(LayoutPositionValue),
643 Top(LayoutTopValue),
644 Right(LayoutRightValue),
645 Left(LayoutLeftValue),
646 Bottom(LayoutInsetBottomValue),
647 ZIndex(LayoutZIndexValue),
648 FlexWrap(LayoutFlexWrapValue),
649 FlexDirection(LayoutFlexDirectionValue),
650 FlexGrow(LayoutFlexGrowValue),
651 FlexShrink(LayoutFlexShrinkValue),
652 FlexBasis(LayoutFlexBasisValue),
653 JustifyContent(LayoutJustifyContentValue),
654 AlignItems(LayoutAlignItemsValue),
655 AlignContent(LayoutAlignContentValue),
656 ColumnGap(LayoutColumnGapValue),
657 RowGap(LayoutRowGapValue),
658 GridTemplateColumns(LayoutGridTemplateColumnsValue),
659 GridTemplateRows(LayoutGridTemplateRowsValue),
660 GridAutoColumns(LayoutGridAutoColumnsValue),
661 GridAutoRows(LayoutGridAutoRowsValue),
662 GridColumn(LayoutGridColumnValue),
663 GridRow(LayoutGridRowValue),
664 GridTemplateAreas(LayoutGridTemplateAreasValue),
665 WritingMode(LayoutWritingModeValue),
666 Clear(LayoutClearValue),
667 BackgroundContent(StyleBackgroundContentVecValue),
668 BackgroundPosition(StyleBackgroundPositionVecValue),
669 BackgroundSize(StyleBackgroundSizeVecValue),
670 BackgroundRepeat(StyleBackgroundRepeatVecValue),
671 OverflowX(LayoutOverflowValue),
672 OverflowY(LayoutOverflowValue),
673 OverflowBlock(LayoutOverflowValue),
674 OverflowInline(LayoutOverflowValue),
675 GridAutoFlow(LayoutGridAutoFlowValue),
676 JustifySelf(LayoutJustifySelfValue),
677 JustifyItems(LayoutJustifyItemsValue),
678 Gap(LayoutGapValue),
679 GridGap(LayoutGapValue),
680 AlignSelf(LayoutAlignSelfValue),
681 Font(StyleFontValue),
682 PaddingTop(LayoutPaddingTopValue),
683 PaddingLeft(LayoutPaddingLeftValue),
684 PaddingRight(LayoutPaddingRightValue),
685 PaddingBottom(LayoutPaddingBottomValue),
686 PaddingInlineStart(LayoutPaddingInlineStartValue),
687 PaddingInlineEnd(LayoutPaddingInlineEndValue),
688 MarginTop(LayoutMarginTopValue),
689 MarginLeft(LayoutMarginLeftValue),
690 MarginRight(LayoutMarginRightValue),
691 MarginBottom(LayoutMarginBottomValue),
692 BorderTopLeftRadius(StyleBorderTopLeftRadiusValue),
693 BorderTopRightRadius(StyleBorderTopRightRadiusValue),
694 BorderBottomLeftRadius(StyleBorderBottomLeftRadiusValue),
695 BorderBottomRightRadius(StyleBorderBottomRightRadiusValue),
696 BorderTopColor(StyleBorderTopColorValue),
697 BorderRightColor(StyleBorderRightColorValue),
698 BorderLeftColor(StyleBorderLeftColorValue),
699 BorderBottomColor(StyleBorderBottomColorValue),
700 BorderTopStyle(StyleBorderTopStyleValue),
701 BorderRightStyle(StyleBorderRightStyleValue),
702 BorderLeftStyle(StyleBorderLeftStyleValue),
703 BorderBottomStyle(StyleBorderBottomStyleValue),
704 BorderTopWidth(LayoutBorderTopWidthValue),
705 BorderRightWidth(LayoutBorderRightWidthValue),
706 BorderLeftWidth(LayoutBorderLeftWidthValue),
707 BorderBottomWidth(LayoutBorderBottomWidthValue),
708 BoxShadowLeft(StyleBoxShadowValue),
709 BoxShadowRight(StyleBoxShadowValue),
710 BoxShadowTop(StyleBoxShadowValue),
711 BoxShadowBottom(StyleBoxShadowValue),
712 ScrollbarTrack(StyleBackgroundContentValue),
713 ScrollbarThumb(StyleBackgroundContentValue),
714 ScrollbarButton(StyleBackgroundContentValue),
715 ScrollbarCorner(StyleBackgroundContentValue),
716 ScrollbarResizer(StyleBackgroundContentValue),
717 ScrollbarWidth(LayoutScrollbarWidthValue),
718 ScrollbarColor(StyleScrollbarColorValue),
719 ScrollbarVisibility(ScrollbarVisibilityModeValue),
720 ScrollbarFadeDelay(ScrollbarFadeDelayValue),
721 ScrollbarFadeDuration(ScrollbarFadeDurationValue),
722 Opacity(StyleOpacityValue),
723 Visibility(StyleVisibilityValue),
724 Transform(StyleTransformVecValue),
725 TransformOrigin(StyleTransformOriginValue),
726 PerspectiveOrigin(StylePerspectiveOriginValue),
727 BackfaceVisibility(StyleBackfaceVisibilityValue),
728 MixBlendMode(StyleMixBlendModeValue),
729 Filter(StyleFilterVecValue),
730 BackdropFilter(StyleFilterVecValue),
731 TextShadow(StyleBoxShadowValue),
732 BreakBefore(PageBreakValue),
733 BreakAfter(PageBreakValue),
734 BreakInside(BreakInsideValue),
735 Orphans(OrphansValue),
736 Widows(WidowsValue),
737 BoxDecorationBreak(BoxDecorationBreakValue),
738 ColumnCount(ColumnCountValue),
739 ColumnWidth(ColumnWidthValue),
740 ColumnSpan(ColumnSpanValue),
741 ColumnFill(ColumnFillValue),
742 ColumnRuleWidth(ColumnRuleWidthValue),
743 ColumnRuleStyle(ColumnRuleStyleValue),
744 ColumnRuleColor(ColumnRuleColorValue),
745 FlowInto(FlowIntoValue),
746 FlowFrom(FlowFromValue),
747 ShapeOutside(ShapeOutsideValue),
748 ShapeInside(ShapeInsideValue),
749 ClipPath(ClipPathValue),
750 ShapeMargin(ShapeMarginValue),
751 ShapeImageThreshold(ShapeImageThresholdValue),
752 TableLayout(LayoutTableLayoutValue),
753 BorderCollapse(StyleBorderCollapseValue),
754 BorderSpacing(LayoutBorderSpacingValue),
755 CaptionSide(StyleCaptionSideValue),
756 EmptyCells(StyleEmptyCellsValue),
757 Content(ContentValue),
758 CounterReset(CounterResetValue),
759 CounterIncrement(CounterIncrementValue),
760 ListStyleType(StyleListStyleTypeValue),
761 ListStylePosition(StyleListStylePositionValue),
762 StringSet(StringSetValue),
763}
764
765impl_option!(
766 CssProperty,
767 OptionCssProperty,
768 copy = false,
769 [Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord]
770);
771
772crate::impl_vec!(
773 CssProperty,
774 CssPropertyVec,
775 CssPropertyVecDestructor,
776 CssPropertyVecDestructorType,
777 CssPropertyVecSlice,
778 OptionCssProperty
779);
780crate::impl_vec_clone!(CssProperty, CssPropertyVec, CssPropertyVecDestructor);
781crate::impl_vec_debug!(CssProperty, CssPropertyVec);
782crate::impl_vec_partialeq!(CssProperty, CssPropertyVec);
783crate::impl_vec_eq!(CssProperty, CssPropertyVec);
784crate::impl_vec_partialord!(CssProperty, CssPropertyVec);
785crate::impl_vec_ord!(CssProperty, CssPropertyVec);
786crate::impl_vec_hash!(CssProperty, CssPropertyVec);
787
788#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
790pub enum CssPropertyCategory {
791 GpuOnly,
792 Layout,
794 Paint,
796 InheritedLayout,
798 InheritedPaint,
800}
801
802#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
812#[repr(C)]
813#[derive(Default)]
814pub enum RelayoutScope {
815 #[default]
818 None,
819 IfcOnly,
823 SizingOnly,
826 Full,
828}
829
830#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
833#[repr(C)]
834pub enum CssPropertyType {
835 CaretColor,
836 CaretAnimationDuration,
837 CaretWidth,
838 SelectionBackgroundColor,
839 SelectionColor,
840 SelectionRadius,
841 TextColor,
842 FontSize,
843 FontFamily,
844 FontWeight,
845 FontStyle,
846 TextAlign,
847 TextJustify,
848 VerticalAlign,
849 LetterSpacing,
850 TextIndent,
851 InitialLetter,
852 LineClamp,
853 HangingPunctuation,
854 TextCombineUpright,
855 UnicodeBidi,
856 TextBoxTrim,
857 TextBoxEdge,
858 DominantBaseline,
859 AlignmentBaseline,
860 InitialLetterAlign,
861 InitialLetterWrap,
862 ScrollbarGutter,
863 OverflowClipMargin,
864 Clip,
865 ExclusionMargin,
866 HyphenationLanguage,
867 LineHeight,
868 WordSpacing,
869 TabSize,
870 WhiteSpace,
871 Hyphens,
872 WordBreak,
873 OverflowWrap,
874 LineBreak,
875 ObjectFit,
876 ObjectPosition,
877 AspectRatio,
878 TextOrientation,
879 TextAlignLast,
880 TextTransform,
881 Direction,
882 UserSelect,
883 TextDecoration,
884 Cursor,
885 Display,
886 Float,
887 BoxSizing,
888 Width,
889 Height,
890 MinWidth,
891 MinHeight,
892 MaxWidth,
893 MaxHeight,
894 Position,
895 Top,
896 Right,
897 Left,
898 Bottom,
899 ZIndex,
900 FlexWrap,
901 FlexDirection,
902 FlexGrow,
903 FlexShrink,
904 FlexBasis,
905 JustifyContent,
906 AlignItems,
907 AlignContent,
908 ColumnGap,
909 RowGap,
910 GridTemplateColumns,
911 GridTemplateRows,
912 GridAutoColumns,
913 GridAutoRows,
914 GridColumn,
915 GridRow,
916 GridTemplateAreas,
917 GridAutoFlow,
918 JustifySelf,
919 JustifyItems,
920 Gap,
921 GridGap,
922 AlignSelf,
923 Font,
924 WritingMode,
925 Clear,
926 BackgroundContent,
927 BackgroundPosition,
928 BackgroundSize,
929 BackgroundRepeat,
930 OverflowX,
931 OverflowY,
932 OverflowBlock,
933 OverflowInline,
934 PaddingTop,
935 PaddingLeft,
936 PaddingRight,
937 PaddingBottom,
938 PaddingInlineStart,
939 PaddingInlineEnd,
940 MarginTop,
941 MarginLeft,
942 MarginRight,
943 MarginBottom,
944 BorderTopLeftRadius,
945 BorderTopRightRadius,
946 BorderBottomLeftRadius,
947 BorderBottomRightRadius,
948 BorderTopColor,
949 BorderRightColor,
950 BorderLeftColor,
951 BorderBottomColor,
952 BorderTopStyle,
953 BorderRightStyle,
954 BorderLeftStyle,
955 BorderBottomStyle,
956 BorderTopWidth,
957 BorderRightWidth,
958 BorderLeftWidth,
959 BorderBottomWidth,
960 BoxShadowLeft,
961 BoxShadowRight,
962 BoxShadowTop,
963 BoxShadowBottom,
964 ScrollbarTrack,
965 ScrollbarThumb,
966 ScrollbarButton,
967 ScrollbarCorner,
968 ScrollbarResizer,
969 ScrollbarWidth,
970 ScrollbarColor,
971 ScrollbarVisibility,
972 ScrollbarFadeDelay,
973 ScrollbarFadeDuration,
974 Opacity,
975 Visibility,
976 Transform,
977 TransformOrigin,
978 PerspectiveOrigin,
979 BackfaceVisibility,
980 MixBlendMode,
981 Filter,
982 BackdropFilter,
983 TextShadow,
984 BreakBefore,
985 BreakAfter,
986 BreakInside,
987 Orphans,
988 Widows,
989 BoxDecorationBreak,
990 ColumnCount,
991 ColumnWidth,
992 ColumnSpan,
993 ColumnFill,
994 ColumnRuleWidth,
995 ColumnRuleStyle,
996 ColumnRuleColor,
997 FlowInto,
998 FlowFrom,
999 ShapeOutside,
1000 ShapeInside,
1001 ClipPath,
1002 ShapeMargin,
1003 ShapeImageThreshold,
1004 TableLayout,
1005 BorderCollapse,
1006 BorderSpacing,
1007 CaptionSide,
1008 EmptyCells,
1009 Content,
1010 CounterReset,
1011 CounterIncrement,
1012 ListStyleType,
1013 ListStylePosition,
1014 StringSet,
1015}
1016
1017impl CssPropertyType {
1018 pub const ALL: &[Self] = &[
1023 Self::CaretColor,
1024 Self::CaretAnimationDuration,
1025 Self::CaretWidth,
1026 Self::SelectionBackgroundColor,
1027 Self::SelectionColor,
1028 Self::SelectionRadius,
1029 Self::TextColor,
1030 Self::FontSize,
1031 Self::FontFamily,
1032 Self::FontWeight,
1033 Self::FontStyle,
1034 Self::TextAlign,
1035 Self::TextJustify,
1036 Self::VerticalAlign,
1037 Self::LetterSpacing,
1038 Self::TextIndent,
1039 Self::InitialLetter,
1040 Self::LineClamp,
1041 Self::HangingPunctuation,
1042 Self::TextCombineUpright,
1043 Self::UnicodeBidi,
1044 Self::TextBoxTrim,
1045 Self::TextBoxEdge,
1046 Self::DominantBaseline,
1047 Self::AlignmentBaseline,
1048 Self::InitialLetterAlign,
1049 Self::InitialLetterWrap,
1050 Self::ScrollbarGutter,
1051 Self::OverflowClipMargin,
1052 Self::Clip,
1053 Self::ExclusionMargin,
1054 Self::HyphenationLanguage,
1055 Self::LineHeight,
1056 Self::WordSpacing,
1057 Self::TabSize,
1058 Self::WhiteSpace,
1059 Self::Hyphens,
1060 Self::WordBreak,
1061 Self::OverflowWrap,
1062 Self::LineBreak,
1063 Self::ObjectFit,
1064 Self::ObjectPosition,
1065 Self::AspectRatio,
1066 Self::TextOrientation,
1067 Self::TextAlignLast,
1068 Self::TextTransform,
1069 Self::Direction,
1070 Self::UserSelect,
1071 Self::TextDecoration,
1072 Self::Cursor,
1073 Self::Display,
1074 Self::Float,
1075 Self::BoxSizing,
1076 Self::Width,
1077 Self::Height,
1078 Self::MinWidth,
1079 Self::MinHeight,
1080 Self::MaxWidth,
1081 Self::MaxHeight,
1082 Self::Position,
1083 Self::Top,
1084 Self::Right,
1085 Self::Left,
1086 Self::Bottom,
1087 Self::ZIndex,
1088 Self::FlexWrap,
1089 Self::FlexDirection,
1090 Self::FlexGrow,
1091 Self::FlexShrink,
1092 Self::FlexBasis,
1093 Self::JustifyContent,
1094 Self::AlignItems,
1095 Self::AlignContent,
1096 Self::ColumnGap,
1097 Self::RowGap,
1098 Self::GridTemplateColumns,
1099 Self::GridTemplateRows,
1100 Self::GridAutoColumns,
1101 Self::GridAutoRows,
1102 Self::GridColumn,
1103 Self::GridRow,
1104 Self::GridTemplateAreas,
1105 Self::GridAutoFlow,
1106 Self::JustifySelf,
1107 Self::JustifyItems,
1108 Self::Gap,
1109 Self::GridGap,
1110 Self::AlignSelf,
1111 Self::Font,
1112 Self::WritingMode,
1113 Self::Clear,
1114 Self::BackgroundContent,
1115 Self::BackgroundPosition,
1116 Self::BackgroundSize,
1117 Self::BackgroundRepeat,
1118 Self::OverflowX,
1119 Self::OverflowY,
1120 Self::OverflowBlock,
1121 Self::OverflowInline,
1122 Self::PaddingTop,
1123 Self::PaddingLeft,
1124 Self::PaddingRight,
1125 Self::PaddingBottom,
1126 Self::PaddingInlineStart,
1127 Self::PaddingInlineEnd,
1128 Self::MarginTop,
1129 Self::MarginLeft,
1130 Self::MarginRight,
1131 Self::MarginBottom,
1132 Self::BorderTopLeftRadius,
1133 Self::BorderTopRightRadius,
1134 Self::BorderBottomLeftRadius,
1135 Self::BorderBottomRightRadius,
1136 Self::BorderTopColor,
1137 Self::BorderRightColor,
1138 Self::BorderLeftColor,
1139 Self::BorderBottomColor,
1140 Self::BorderTopStyle,
1141 Self::BorderRightStyle,
1142 Self::BorderLeftStyle,
1143 Self::BorderBottomStyle,
1144 Self::BorderTopWidth,
1145 Self::BorderRightWidth,
1146 Self::BorderLeftWidth,
1147 Self::BorderBottomWidth,
1148 Self::BoxShadowLeft,
1149 Self::BoxShadowRight,
1150 Self::BoxShadowTop,
1151 Self::BoxShadowBottom,
1152 Self::ScrollbarTrack,
1153 Self::ScrollbarThumb,
1154 Self::ScrollbarButton,
1155 Self::ScrollbarCorner,
1156 Self::ScrollbarResizer,
1157 Self::ScrollbarWidth,
1158 Self::ScrollbarColor,
1159 Self::ScrollbarVisibility,
1160 Self::ScrollbarFadeDelay,
1161 Self::ScrollbarFadeDuration,
1162 Self::Opacity,
1163 Self::Visibility,
1164 Self::Transform,
1165 Self::TransformOrigin,
1166 Self::PerspectiveOrigin,
1167 Self::BackfaceVisibility,
1168 Self::MixBlendMode,
1169 Self::Filter,
1170 Self::BackdropFilter,
1171 Self::TextShadow,
1172 Self::BreakBefore,
1173 Self::BreakAfter,
1174 Self::BreakInside,
1175 Self::Orphans,
1176 Self::Widows,
1177 Self::BoxDecorationBreak,
1178 Self::ColumnCount,
1179 Self::ColumnWidth,
1180 Self::ColumnSpan,
1181 Self::ColumnFill,
1182 Self::ColumnRuleWidth,
1183 Self::ColumnRuleStyle,
1184 Self::ColumnRuleColor,
1185 Self::FlowInto,
1186 Self::FlowFrom,
1187 Self::ShapeOutside,
1188 Self::ShapeInside,
1189 Self::ClipPath,
1190 Self::ShapeMargin,
1191 Self::ShapeImageThreshold,
1192 Self::TableLayout,
1193 Self::BorderCollapse,
1194 Self::BorderSpacing,
1195 Self::CaptionSide,
1196 Self::EmptyCells,
1197 Self::Content,
1198 Self::CounterReset,
1199 Self::CounterIncrement,
1200 Self::ListStyleType,
1201 Self::ListStylePosition,
1202 Self::StringSet,
1203 ];
1204
1205 pub fn iter() -> impl Iterator<Item = Self> {
1207 Self::ALL.iter().copied()
1208 }
1209}
1210
1211impl fmt::Debug for CssPropertyType {
1212 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1213 write!(f, "{}", self.to_str())
1214 }
1215}
1216
1217impl fmt::Display for CssPropertyType {
1218 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1219 write!(f, "{}", self.to_str())
1220 }
1221}
1222
1223impl CssPropertyType {
1224 #[must_use] pub fn from_str(input: &str, map: &CssKeyMap) -> Option<Self> {
1242 let input = input.trim();
1243 map.non_shorthands.get(input).copied()
1244 }
1245
1246 #[allow(clippy::too_many_lines)] #[must_use] pub const fn to_str(&self) -> &'static str {
1249 match self {
1250 Self::CaretColor => "caret-color",
1251 Self::CaretAnimationDuration => "caret-animation-duration",
1252 Self::CaretWidth => "-azul-caret-width",
1253 Self::SelectionBackgroundColor => "-azul-selection-background-color",
1254 Self::SelectionColor => "-azul-selection-color",
1255 Self::SelectionRadius => "-azul-selection-radius",
1256 Self::TextColor => "color",
1257 Self::FontSize => "font-size",
1258 Self::FontFamily => "font-family",
1259 Self::FontWeight => "font-weight",
1260 Self::FontStyle => "font-style",
1261 Self::TextAlign => "text-align",
1262 Self::TextJustify => "text-justify",
1263 Self::VerticalAlign => "vertical-align",
1264 Self::LetterSpacing => "letter-spacing",
1265 Self::TextIndent => "text-indent",
1266 Self::InitialLetter => "initial-letter",
1267 Self::LineClamp => "line-clamp",
1268 Self::HangingPunctuation => "hanging-punctuation",
1269 Self::TextCombineUpright => "text-combine-upright",
1270 Self::UnicodeBidi => "unicode-bidi",
1271 Self::TextBoxTrim => "text-box-trim",
1272 Self::TextBoxEdge => "text-box-edge",
1273 Self::DominantBaseline => "dominant-baseline",
1274 Self::AlignmentBaseline => "alignment-baseline",
1275 Self::InitialLetterAlign => "initial-letter-align",
1276 Self::InitialLetterWrap => "initial-letter-wrap",
1277 Self::ScrollbarGutter => "scrollbar-gutter",
1278 Self::OverflowClipMargin => "overflow-clip-margin",
1279 Self::Clip => "clip",
1280 Self::ExclusionMargin => "-azul-exclusion-margin",
1281 Self::HyphenationLanguage => "-azul-hyphenation-language",
1282 Self::LineHeight => "line-height",
1283 Self::WordSpacing => "word-spacing",
1284 Self::TabSize => "tab-size",
1285 Self::Cursor => "cursor",
1286 Self::Display => "display",
1287 Self::Float => "float",
1288 Self::BoxSizing => "box-sizing",
1289 Self::Width => "width",
1290 Self::Height => "height",
1291 Self::MinWidth => "min-width",
1292 Self::MinHeight => "min-height",
1293 Self::MaxWidth => "max-width",
1294 Self::MaxHeight => "max-height",
1295 Self::Position => "position",
1296 Self::Top => "top",
1297 Self::Right => "right",
1298 Self::Left => "left",
1299 Self::Bottom => "bottom",
1300 Self::ZIndex => "z-index",
1301 Self::FlexWrap => "flex-wrap",
1302 Self::FlexDirection => "flex-direction",
1303 Self::FlexGrow => "flex-grow",
1304 Self::FlexShrink => "flex-shrink",
1305 Self::FlexBasis => "flex-basis",
1306 Self::JustifyContent => "justify-content",
1307 Self::AlignItems => "align-items",
1308 Self::AlignContent => "align-content",
1309 Self::ColumnGap => "column-gap",
1310 Self::RowGap => "row-gap",
1311 Self::GridTemplateColumns => "grid-template-columns",
1312 Self::GridTemplateRows => "grid-template-rows",
1313 Self::GridAutoFlow => "grid-auto-flow",
1314 Self::JustifySelf => "justify-self",
1315 Self::JustifyItems => "justify-items",
1316 Self::Gap => "gap",
1317 Self::GridGap => "grid-gap",
1318 Self::AlignSelf => "align-self",
1319 Self::Font => "font",
1320 Self::GridAutoColumns => "grid-auto-columns",
1321 Self::GridAutoRows => "grid-auto-rows",
1322 Self::GridColumn => "grid-column",
1323 Self::GridRow => "grid-row",
1324 Self::GridTemplateAreas => "grid-template-areas",
1325 Self::WritingMode => "writing-mode",
1326 Self::Clear => "clear",
1327 Self::BackgroundContent => "background",
1328 Self::BackgroundPosition => "background-position",
1329 Self::BackgroundSize => "background-size",
1330 Self::BackgroundRepeat => "background-repeat",
1331 Self::OverflowX => "overflow-x",
1332 Self::OverflowY => "overflow-y",
1333 Self::OverflowBlock => "overflow-block",
1334 Self::OverflowInline => "overflow-inline",
1335 Self::PaddingTop => "padding-top",
1336 Self::PaddingLeft => "padding-left",
1337 Self::PaddingRight => "padding-right",
1338 Self::PaddingBottom => "padding-bottom",
1339 Self::PaddingInlineStart => "padding-inline-start",
1340 Self::PaddingInlineEnd => "padding-inline-end",
1341 Self::MarginTop => "margin-top",
1342 Self::MarginLeft => "margin-left",
1343 Self::MarginRight => "margin-right",
1344 Self::MarginBottom => "margin-bottom",
1345 Self::BorderTopLeftRadius => "border-top-left-radius",
1346 Self::BorderTopRightRadius => "border-top-right-radius",
1347 Self::BorderBottomLeftRadius => "border-bottom-left-radius",
1348 Self::BorderBottomRightRadius => "border-bottom-right-radius",
1349 Self::BorderTopColor => "border-top-color",
1350 Self::BorderRightColor => "border-right-color",
1351 Self::BorderLeftColor => "border-left-color",
1352 Self::BorderBottomColor => "border-bottom-color",
1353 Self::BorderTopStyle => "border-top-style",
1354 Self::BorderRightStyle => "border-right-style",
1355 Self::BorderLeftStyle => "border-left-style",
1356 Self::BorderBottomStyle => "border-bottom-style",
1357 Self::BorderTopWidth => "border-top-width",
1358 Self::BorderRightWidth => "border-right-width",
1359 Self::BorderLeftWidth => "border-left-width",
1360 Self::BorderBottomWidth => "border-bottom-width",
1361 Self::BoxShadowLeft => "-azul-box-shadow-left",
1362 Self::BoxShadowRight => "-azul-box-shadow-right",
1363 Self::BoxShadowTop => "-azul-box-shadow-top",
1364 Self::BoxShadowBottom => "-azul-box-shadow-bottom",
1365 Self::ScrollbarTrack => "-azul-scrollbar-track",
1366 Self::ScrollbarThumb => "-azul-scrollbar-thumb",
1367 Self::ScrollbarButton => "-azul-scrollbar-button",
1368 Self::ScrollbarCorner => "-azul-scrollbar-corner",
1369 Self::ScrollbarResizer => "-azul-scrollbar-resizer",
1370 Self::ScrollbarWidth => "scrollbar-width",
1371 Self::ScrollbarColor => "scrollbar-color",
1372 Self::ScrollbarVisibility => "-azul-scrollbar-visibility",
1373 Self::ScrollbarFadeDelay => "-azul-scrollbar-fade-delay",
1374 Self::ScrollbarFadeDuration => "-azul-scrollbar-fade-duration",
1375 Self::Opacity => "opacity",
1376 Self::Visibility => "visibility",
1377 Self::Transform => "transform",
1378 Self::TransformOrigin => "transform-origin",
1379 Self::PerspectiveOrigin => "perspective-origin",
1380 Self::BackfaceVisibility => "backface-visibility",
1381 Self::MixBlendMode => "mix-blend-mode",
1382 Self::Filter => "filter",
1383 Self::BackdropFilter => "backdrop-filter",
1384 Self::TextShadow => "text-shadow",
1385 Self::WhiteSpace => "white-space",
1386 Self::Hyphens => "hyphens",
1387 Self::WordBreak => "word-break",
1388 Self::OverflowWrap => "overflow-wrap",
1389 Self::LineBreak => "line-break",
1390 Self::ObjectFit => "object-fit",
1391 Self::ObjectPosition => "object-position",
1392 Self::AspectRatio => "aspect-ratio",
1393 Self::TextOrientation => "text-orientation",
1394 Self::TextAlignLast => "text-align-last",
1395 Self::TextTransform => "text-transform",
1396 Self::Direction => "direction",
1397 Self::UserSelect => "user-select",
1398 Self::TextDecoration => "text-decoration",
1399 Self::BreakBefore => "break-before",
1400 Self::BreakAfter => "break-after",
1401 Self::BreakInside => "break-inside",
1402 Self::Orphans => "orphans",
1403 Self::Widows => "widows",
1404 Self::BoxDecorationBreak => "box-decoration-break",
1405 Self::ColumnCount => "column-count",
1406 Self::ColumnWidth => "column-width",
1407 Self::ColumnSpan => "column-span",
1408 Self::ColumnFill => "column-fill",
1409 Self::ColumnRuleWidth => "column-rule-width",
1410 Self::ColumnRuleStyle => "column-rule-style",
1411 Self::ColumnRuleColor => "column-rule-color",
1412 Self::FlowInto => "flow-into",
1413 Self::FlowFrom => "flow-from",
1414 Self::ShapeOutside => "shape-outside",
1415 Self::ShapeInside => "shape-inside",
1416 Self::ClipPath => "clip-path",
1417 Self::ShapeMargin => "shape-margin",
1418 Self::ShapeImageThreshold => "shape-image-threshold",
1419 Self::TableLayout => "table-layout",
1420 Self::BorderCollapse => "border-collapse",
1421 Self::BorderSpacing => "border-spacing",
1422 Self::CaptionSide => "caption-side",
1423 Self::EmptyCells => "empty-cells",
1424 Self::Content => "content",
1425 Self::CounterReset => "counter-reset",
1426 Self::CounterIncrement => "counter-increment",
1427 Self::ListStyleType => "list-style-type",
1428 Self::ListStylePosition => "list-style-position",
1429 Self::StringSet => "string-set",
1430 }
1431 }
1432
1433 #[must_use] pub const fn is_inheritable(&self) -> bool {
1439 use self::CssPropertyType::{FontFamily, FontSize, FontWeight, FontStyle, LineHeight, LetterSpacing, WordSpacing, TextIndent, TextColor, TextAlign, TextJustify, TextDecoration, WhiteSpace, Direction, Hyphens, TabSize, WordBreak, OverflowWrap, LineBreak, TextAlignLast, TextTransform, TextOrientation, HangingPunctuation, TextCombineUpright, HyphenationLanguage, ListStyleType, ListStylePosition, BorderCollapse, BorderSpacing, CaptionSide, EmptyCells, Visibility, Cursor, Widows, Orphans, WritingMode, UserSelect};
1440 match self {
1441 FontFamily | FontSize | FontWeight | FontStyle | LineHeight | LetterSpacing | WordSpacing | TextIndent |
1443
1444 TextColor | TextAlign | TextJustify | TextDecoration | WhiteSpace | Direction | Hyphens | TabSize |
1446 WordBreak | OverflowWrap | LineBreak | TextAlignLast | TextTransform |
1447 TextOrientation |
1448 HangingPunctuation | TextCombineUpright | HyphenationLanguage |
1449
1450 ListStyleType | ListStylePosition |
1452
1453 BorderCollapse | BorderSpacing | CaptionSide | EmptyCells |
1455
1456 Visibility | Cursor | Widows | Orphans |
1462
1463 WritingMode |
1465
1466 UserSelect
1468 => true,
1469
1470 _ => false,
1471 }
1472 }
1473
1474 #[must_use] pub const fn has_compact_encoding(&self) -> bool {
1475 use self::CssPropertyType::{Display, Position, Float, OverflowX, OverflowY, BoxSizing, FlexDirection, FlexWrap, JustifyContent, AlignItems, AlignContent, WritingMode, Clear, FontWeight, FontStyle, TextAlign, Visibility, WhiteSpace, Direction, VerticalAlign, BorderCollapse, Width, Height, MinWidth, MaxWidth, MinHeight, MaxHeight, FlexBasis, FontSize, PaddingTop, PaddingRight, PaddingBottom, PaddingLeft, MarginTop, MarginRight, MarginBottom, MarginLeft, BorderTopWidth, BorderRightWidth, BorderBottomWidth, BorderLeftWidth, Top, Right, Bottom, Left, FlexGrow, FlexShrink, ZIndex, BorderTopStyle, BorderRightStyle, BorderBottomStyle, BorderLeftStyle, BorderTopColor, BorderRightColor, BorderBottomColor, BorderLeftColor, BorderSpacing, TabSize, TextColor, FontFamily, LineHeight, LetterSpacing, WordSpacing, TextIndent, AlignSelf, JustifySelf, GridAutoFlow, JustifyItems, ColumnGap, RowGap, Gap, GridColumn, GridRow};
1476 matches!(
1477 self,
1478 Display | Position | Float | OverflowX | OverflowY | BoxSizing |
1480 FlexDirection | FlexWrap | JustifyContent | AlignItems | AlignContent |
1481 WritingMode | Clear | FontWeight | FontStyle | TextAlign |
1482 Visibility | WhiteSpace | Direction | VerticalAlign | BorderCollapse |
1483 Width | Height | MinWidth | MaxWidth | MinHeight | MaxHeight |
1485 FlexBasis | FontSize |
1486 PaddingTop | PaddingRight | PaddingBottom | PaddingLeft |
1487 MarginTop | MarginRight | MarginBottom | MarginLeft |
1488 BorderTopWidth | BorderRightWidth | BorderBottomWidth | BorderLeftWidth |
1489 Top | Right | Bottom | Left |
1490 FlexGrow | FlexShrink |
1491 ZIndex |
1493 BorderTopStyle | BorderRightStyle | BorderBottomStyle | BorderLeftStyle |
1494 BorderTopColor | BorderRightColor | BorderBottomColor | BorderLeftColor |
1495 BorderSpacing | TabSize |
1496 TextColor | FontFamily | LineHeight | LetterSpacing | WordSpacing | TextIndent |
1498 AlignSelf | JustifySelf | GridAutoFlow | JustifyItems |
1500 ColumnGap | RowGap | Gap |
1502 GridColumn | GridRow
1504 )
1505 }
1506
1507 #[must_use] pub const fn get_category(&self) -> CssPropertyCategory {
1508 if self.is_gpu_only_property() {
1509 CssPropertyCategory::GpuOnly
1510 } else {
1511 let is_inheritable = self.is_inheritable();
1512 let can_trigger_layout = self.can_trigger_relayout();
1513 match (is_inheritable, can_trigger_layout) {
1514 (true, true) => CssPropertyCategory::InheritedLayout,
1515 (true, false) => CssPropertyCategory::InheritedPaint,
1516 (false, true) => CssPropertyCategory::Layout,
1517 (false, false) => CssPropertyCategory::Paint,
1518 }
1519 }
1520 }
1521
1522 #[must_use] pub const fn can_trigger_relayout(&self) -> bool {
1525 use self::CssPropertyType::{TextColor, Cursor, BackgroundContent, BackgroundPosition, BackgroundSize, BackgroundRepeat, BorderTopLeftRadius, BorderTopRightRadius, BorderBottomLeftRadius, BorderBottomRightRadius, BorderTopColor, BorderRightColor, BorderLeftColor, BorderBottomColor, BorderTopStyle, BorderRightStyle, BorderLeftStyle, BorderBottomStyle, ColumnRuleColor, ColumnRuleStyle, BoxShadowLeft, BoxShadowRight, BoxShadowTop, BoxShadowBottom, BoxDecorationBreak, ScrollbarTrack, ScrollbarThumb, ScrollbarButton, ScrollbarCorner, ScrollbarResizer, Opacity, Transform, TransformOrigin, PerspectiveOrigin, BackfaceVisibility, MixBlendMode, Filter, BackdropFilter, TextShadow, Clip};
1526
1527 !matches!(
1534 self,
1535 TextColor
1536 | Cursor
1537 | BackgroundContent
1538 | BackgroundPosition
1539 | BackgroundSize
1540 | BackgroundRepeat
1541 | BorderTopLeftRadius
1542 | BorderTopRightRadius
1543 | BorderBottomLeftRadius
1544 | BorderBottomRightRadius
1545 | BorderTopColor
1546 | BorderRightColor
1547 | BorderLeftColor
1548 | BorderBottomColor
1549 | BorderTopStyle
1550 | BorderRightStyle
1551 | BorderLeftStyle
1552 | BorderBottomStyle
1553 | ColumnRuleColor
1554 | ColumnRuleStyle
1555 | BoxShadowLeft
1556 | BoxShadowRight
1557 | BoxShadowTop
1558 | BoxShadowBottom
1559 | BoxDecorationBreak
1560 | ScrollbarTrack
1561 | ScrollbarThumb
1562 | ScrollbarButton
1563 | ScrollbarCorner
1564 | ScrollbarResizer
1565 | Opacity
1566 | Transform
1567 | TransformOrigin
1568 | PerspectiveOrigin
1569 | BackfaceVisibility
1570 | MixBlendMode
1571 | Filter
1572 | BackdropFilter
1573 | TextShadow
1574 | Clip
1575 )
1576 }
1577
1578 #[must_use] pub const fn is_gpu_only_property(&self) -> bool {
1580 match self {
1581 Self::Opacity |
1582 Self::Transform => true,
1583 _ => false
1584 }
1585 }
1586
1587 #[must_use] pub const fn relayout_scope(&self, node_is_ifc_member: bool) -> RelayoutScope {
1601 use CssPropertyType::{TextColor, Cursor, BackgroundContent, BackgroundPosition, BackgroundSize, BackgroundRepeat, BorderTopColor, BorderRightColor, BorderLeftColor, BorderBottomColor, BorderTopStyle, BorderRightStyle, BorderLeftStyle, BorderBottomStyle, BorderTopLeftRadius, BorderTopRightRadius, BorderBottomLeftRadius, BorderBottomRightRadius, ColumnRuleColor, ColumnRuleStyle, BoxShadowLeft, BoxShadowRight, BoxShadowTop, BoxShadowBottom, BoxDecorationBreak, ScrollbarTrack, ScrollbarThumb, ScrollbarButton, ScrollbarCorner, ScrollbarResizer, Opacity, Transform, TransformOrigin, PerspectiveOrigin, BackfaceVisibility, MixBlendMode, Filter, BackdropFilter, TextShadow, SelectionBackgroundColor, SelectionColor, SelectionRadius, CaretColor, CaretAnimationDuration, CaretWidth, ObjectFit, ObjectPosition, Clip, FontFamily, FontSize, FontWeight, FontStyle, LetterSpacing, WordSpacing, LineHeight, TextAlign, TextJustify, TextIndent, WhiteSpace, TabSize, Hyphens, WordBreak, OverflowWrap, LineBreak, TextAlignLast, TextOrientation, HyphenationLanguage, TextCombineUpright, TextDecoration, HangingPunctuation, InitialLetter, LineClamp, Direction, VerticalAlign, UnicodeBidi, TextBoxTrim, TextBoxEdge, DominantBaseline, AlignmentBaseline, InitialLetterAlign, InitialLetterWrap, Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight, PaddingTop, PaddingRight, PaddingBottom, PaddingLeft, PaddingInlineStart, PaddingInlineEnd, BorderTopWidth, BorderRightWidth, BorderBottomWidth, BorderLeftWidth, BoxSizing, ScrollbarWidth, ScrollbarVisibility, ScrollbarGutter, OverflowClipMargin};
1602 match self {
1603 TextColor
1605 | Cursor
1606 | BackgroundContent
1607 | BackgroundPosition
1608 | BackgroundSize
1609 | BackgroundRepeat
1610 | BorderTopColor
1611 | BorderRightColor
1612 | BorderLeftColor
1613 | BorderBottomColor
1614 | BorderTopStyle
1615 | BorderRightStyle
1616 | BorderLeftStyle
1617 | BorderBottomStyle
1618 | BorderTopLeftRadius
1619 | BorderTopRightRadius
1620 | BorderBottomLeftRadius
1621 | BorderBottomRightRadius
1622 | ColumnRuleColor
1623 | ColumnRuleStyle
1624 | BoxShadowLeft
1625 | BoxShadowRight
1626 | BoxShadowTop
1627 | BoxShadowBottom
1628 | BoxDecorationBreak
1629 | ScrollbarTrack
1630 | ScrollbarThumb
1631 | ScrollbarButton
1632 | ScrollbarCorner
1633 | ScrollbarResizer
1634 | Opacity
1635 | Transform
1636 | TransformOrigin
1637 | PerspectiveOrigin
1638 | BackfaceVisibility
1639 | MixBlendMode
1640 | Filter
1641 | BackdropFilter
1642 | TextShadow
1643 | SelectionBackgroundColor
1644 | SelectionColor
1645 | SelectionRadius
1646 | CaretColor
1647 | CaretAnimationDuration
1648 | CaretWidth
1649 | ObjectFit
1650 | ObjectPosition
1651 | Clip => RelayoutScope::None,
1652
1653 FontFamily | FontSize | FontWeight | FontStyle | LetterSpacing | WordSpacing
1657 | LineHeight | TextAlign | TextJustify | TextIndent | WhiteSpace | TabSize
1658 | Hyphens | WordBreak | OverflowWrap | LineBreak | TextAlignLast | TextOrientation
1659 | HyphenationLanguage | TextCombineUpright | TextDecoration | HangingPunctuation
1660 | InitialLetter | LineClamp | Direction | VerticalAlign | UnicodeBidi | TextBoxTrim
1661 | TextBoxEdge | DominantBaseline | AlignmentBaseline | InitialLetterAlign
1662 | InitialLetterWrap => {
1663 if node_is_ifc_member {
1664 RelayoutScope::IfcOnly
1665 } else {
1666 RelayoutScope::None
1671 }
1672 }
1673
1674 Width | Height | MinWidth | MinHeight | MaxWidth | MaxHeight | PaddingTop
1678 | PaddingRight | PaddingBottom | PaddingLeft | PaddingInlineStart
1679 | PaddingInlineEnd | BorderTopWidth | BorderRightWidth | BorderBottomWidth
1680 | BorderLeftWidth | BoxSizing | ScrollbarWidth | ScrollbarVisibility
1681 | ScrollbarGutter | OverflowClipMargin => RelayoutScope::SizingOnly,
1682
1683 _ => RelayoutScope::Full,
1686 }
1687 }
1688}
1689
1690#[derive(Clone, PartialEq)]
1694pub enum CssParsingError<'a> {
1695 Border(CssBorderParseError<'a>),
1697 BorderRadius(CssBorderRadiusParseError<'a>),
1698 Padding(LayoutPaddingParseError<'a>),
1699 Margin(LayoutMarginParseError<'a>),
1700 Overflow(InvalidValueErr<'a>),
1701 BoxShadow(CssShadowParseError<'a>),
1702
1703 Color(CssColorParseError<'a>),
1705 PixelValue(CssPixelValueParseError<'a>),
1706 Percentage(PercentageParseError),
1707 FontFamily(CssStyleFontFamilyParseError<'a>),
1708 InvalidValue(InvalidValueErr<'a>),
1709 FlexGrow(FlexGrowParseError<'a>),
1710 FlexShrink(FlexShrinkParseError<'a>),
1711 Background(CssBackgroundParseError<'a>),
1712 BackgroundPosition(CssBackgroundPositionParseError<'a>),
1713 Opacity(OpacityParseError<'a>),
1714 Visibility(StyleVisibilityParseError<'a>),
1715 LayoutScrollbarWidth(LayoutScrollbarWidthParseError<'a>),
1716 StyleScrollbarColor(StyleScrollbarColorParseError<'a>),
1717 ScrollbarVisibilityMode(ScrollbarVisibilityModeParseError<'a>),
1718 ScrollbarFadeDelay(ScrollbarFadeDelayParseError<'a>),
1719 ScrollbarFadeDuration(ScrollbarFadeDurationParseError<'a>),
1720 Transform(CssStyleTransformParseError<'a>),
1721 TransformOrigin(CssStyleTransformOriginParseError<'a>),
1722 PerspectiveOrigin(CssStylePerspectiveOriginParseError<'a>),
1723 Filter(CssStyleFilterParseError<'a>),
1724
1725 TextColor(StyleTextColorParseError<'a>),
1727 FontSize(CssStyleFontSizeParseError<'a>),
1728 FontWeight(CssFontWeightParseError<'a>),
1729 FontStyle(CssFontStyleParseError<'a>),
1730 TextAlign(StyleTextAlignParseError<'a>),
1731 TextJustify(TextJustifyParseError<'a>),
1732 VerticalAlign(StyleVerticalAlignParseError<'a>),
1733 LetterSpacing(StyleLetterSpacingParseError<'a>),
1734 TextIndent(StyleTextIndentParseError<'a>),
1735 InitialLetter(StyleInitialLetterParseError<'a>),
1736 LineClamp(StyleLineClampParseError<'a>),
1737 HangingPunctuation(StyleHangingPunctuationParseError<'a>),
1738 TextCombineUpright(StyleTextCombineUprightParseError<'a>),
1739 UnicodeBidi(StyleUnicodeBidiParseError<'a>),
1740 TextBoxTrim(StyleTextBoxTrimParseError<'a>),
1741 TextBoxEdge(StyleTextBoxEdgeParseError<'a>),
1742 DominantBaseline(StyleDominantBaselineParseError<'a>),
1743 AlignmentBaseline(StyleAlignmentBaselineParseError<'a>),
1744 InitialLetterAlign(StyleInitialLetterAlignParseError<'a>),
1745 InitialLetterWrap(StyleInitialLetterWrapParseError<'a>),
1746 ScrollbarGutter(StyleScrollbarGutterParseError<'a>),
1747 OverflowClipMargin(StyleOverflowClipMarginParseError<'a>),
1748 Clip(StyleClipRectParseError<'a>),
1749 ExclusionMargin(StyleExclusionMarginParseError),
1750 HyphenationLanguage(StyleHyphenationLanguageParseError),
1751 LineHeight(StyleLineHeightParseError),
1752 WordSpacing(StyleWordSpacingParseError<'a>),
1753 TabSize(StyleTabSizeParseError<'a>),
1754 WhiteSpace(StyleWhiteSpaceParseError<'a>),
1755 Hyphens(StyleHyphensParseError<'a>),
1756 WordBreak(StyleWordBreakParseError<'a>),
1757 OverflowWrap(StyleOverflowWrapParseError<'a>),
1758 LineBreak(StyleLineBreakParseError<'a>),
1759 ObjectFit(StyleObjectFitParseError<'a>),
1760 ObjectPosition(StyleObjectPositionParseError<'a>),
1761 AspectRatio(StyleAspectRatioParseError<'a>),
1762 TextOrientation(StyleTextOrientationParseError<'a>),
1763 TextAlignLast(StyleTextAlignLastParseError<'a>),
1764 TextTransform(StyleTextTransformParseError<'a>),
1765 Direction(StyleDirectionParseError<'a>),
1766 UserSelect(StyleUserSelectParseError<'a>),
1767 TextDecoration(StyleTextDecorationParseError<'a>),
1768 Cursor(CursorParseError<'a>),
1769 CaretColor(CssColorParseError<'a>),
1770 CaretAnimationDuration(DurationParseError<'a>),
1771 CaretWidth(CssPixelValueParseError<'a>),
1772 SelectionBackgroundColor(CssColorParseError<'a>),
1773 SelectionColor(CssColorParseError<'a>),
1774 SelectionRadius(CssPixelValueParseError<'a>),
1775
1776 LayoutDisplay(LayoutDisplayParseError<'a>),
1778 LayoutFloat(LayoutFloatParseError<'a>),
1779 LayoutBoxSizing(LayoutBoxSizingParseError<'a>),
1780
1781 LayoutWidth(LayoutWidthParseError<'a>),
1783 LayoutHeight(LayoutHeightParseError<'a>),
1784 LayoutMinWidth(LayoutMinWidthParseError<'a>),
1785 LayoutMinHeight(LayoutMinHeightParseError<'a>),
1786 LayoutMaxWidth(LayoutMaxWidthParseError<'a>),
1787 LayoutMaxHeight(LayoutMaxHeightParseError<'a>),
1788
1789 LayoutPosition(LayoutPositionParseError<'a>),
1791 LayoutTop(LayoutTopParseError<'a>),
1792 LayoutRight(LayoutRightParseError<'a>),
1793 LayoutLeft(LayoutLeftParseError<'a>),
1794 LayoutInsetBottom(LayoutInsetBottomParseError<'a>),
1795 LayoutZIndex(LayoutZIndexParseError<'a>),
1796
1797 FlexWrap(FlexWrapParseError<'a>),
1799 FlexDirection(FlexDirectionParseError<'a>),
1800 FlexBasis(FlexBasisParseError<'a>),
1801 JustifyContent(JustifyContentParseError<'a>),
1802 AlignItems(AlignItemsParseError<'a>),
1803 AlignContent(AlignContentParseError<'a>),
1804
1805 Grid(GridParseError<'a>),
1807 GridAutoFlow(GridAutoFlowParseError<'a>),
1808 JustifySelf(JustifySelfParseError<'a>),
1809 JustifyItems(JustifyItemsParseError<'a>),
1810 AlignSelf(AlignSelfParseError<'a>),
1811
1812 LayoutWritingMode(LayoutWritingModeParseError<'a>),
1814 LayoutClear(LayoutClearParseError<'a>),
1815
1816 LayoutOverflow(LayoutOverflowParseError<'a>),
1818
1819 BorderTopLeftRadius(StyleBorderTopLeftRadiusParseError<'a>),
1821 BorderTopRightRadius(StyleBorderTopRightRadiusParseError<'a>),
1822 BorderBottomLeftRadius(StyleBorderBottomLeftRadiusParseError<'a>),
1823 BorderBottomRightRadius(StyleBorderBottomRightRadiusParseError<'a>),
1824
1825 BorderStyle(CssBorderStyleParseError<'a>),
1827
1828 BackfaceVisibility(CssBackfaceVisibilityParseError<'a>),
1830 MixBlendMode(MixBlendModeParseError<'a>),
1831
1832 PageBreak(PageBreakParseError<'a>),
1834 BreakInside(BreakInsideParseError<'a>),
1835 Widows(WidowsParseError<'a>),
1836 Orphans(OrphansParseError<'a>),
1837 BoxDecorationBreak(BoxDecorationBreakParseError<'a>),
1838
1839 ColumnCount(ColumnCountParseError<'a>),
1841 ColumnWidth(ColumnWidthParseError<'a>),
1842 ColumnSpan(ColumnSpanParseError<'a>),
1843 ColumnFill(ColumnFillParseError<'a>),
1844 ColumnRuleWidth(ColumnRuleWidthParseError<'a>),
1845 ColumnRuleStyle(ColumnRuleStyleParseError<'a>),
1846 ColumnRuleColor(ColumnRuleColorParseError<'a>),
1847
1848 FlowInto(FlowIntoParseError<'a>),
1850 FlowFrom(FlowFromParseError<'a>),
1851 GenericParseError,
1852
1853 Content, Counter,
1856 ListStyleType(StyleListStyleTypeParseError<'a>),
1857 ListStylePosition(StyleListStylePositionParseError<'a>),
1858 StringSet,
1859}
1860
1861#[derive(Debug, Clone, PartialEq)]
1863#[repr(C, u8)]
1864pub enum CssParsingErrorOwned {
1865 Border(CssBorderParseErrorOwned),
1867 BorderRadius(CssStyleBorderRadiusParseErrorOwned),
1868 Padding(LayoutPaddingParseErrorOwned),
1869 Margin(LayoutMarginParseErrorOwned),
1870 Overflow(InvalidValueErrOwned),
1871 BoxShadow(CssShadowParseErrorOwned),
1872
1873 Color(CssColorParseErrorOwned),
1875 PixelValue(CssPixelValueParseErrorOwned),
1876 Percentage(PercentageParseError),
1877 FontFamily(CssStyleFontFamilyParseErrorOwned),
1878 InvalidValue(InvalidValueErrOwned),
1879 FlexGrow(FlexGrowParseErrorOwned),
1880 FlexShrink(FlexShrinkParseErrorOwned),
1881 Background(CssBackgroundParseErrorOwned),
1882 BackgroundPosition(CssBackgroundPositionParseErrorOwned),
1883 Opacity(OpacityParseErrorOwned),
1884 Visibility(StyleVisibilityParseErrorOwned),
1885 LayoutScrollbarWidth(LayoutScrollbarWidthParseErrorOwned),
1886 StyleScrollbarColor(StyleScrollbarColorParseErrorOwned),
1887 ScrollbarVisibilityMode(ScrollbarVisibilityModeParseErrorOwned),
1888 ScrollbarFadeDelay(ScrollbarFadeDelayParseErrorOwned),
1889 ScrollbarFadeDuration(ScrollbarFadeDurationParseErrorOwned),
1890 Transform(CssStyleTransformParseErrorOwned),
1891 TransformOrigin(CssStyleTransformOriginParseErrorOwned),
1892 PerspectiveOrigin(CssStylePerspectiveOriginParseErrorOwned),
1893 Filter(CssStyleFilterParseErrorOwned),
1894
1895 TextColor(StyleTextColorParseErrorOwned),
1897 FontSize(CssStyleFontSizeParseErrorOwned),
1898 FontWeight(CssFontWeightParseErrorOwned),
1899 FontStyle(CssFontStyleParseErrorOwned),
1900 TextAlign(StyleTextAlignParseErrorOwned),
1901 TextJustify(TextJustifyParseErrorOwned),
1902 VerticalAlign(StyleVerticalAlignParseErrorOwned),
1903 LetterSpacing(StyleLetterSpacingParseErrorOwned),
1904 TextIndent(StyleTextIndentParseErrorOwned),
1905 InitialLetter(StyleInitialLetterParseErrorOwned),
1906 LineClamp(StyleLineClampParseErrorOwned),
1907 HangingPunctuation(StyleHangingPunctuationParseErrorOwned),
1908 TextCombineUpright(StyleTextCombineUprightParseErrorOwned),
1909 UnicodeBidi(StyleUnicodeBidiParseErrorOwned),
1910 TextBoxTrim(StyleTextBoxTrimParseErrorOwned),
1911 TextBoxEdge(StyleTextBoxEdgeParseErrorOwned),
1912 DominantBaseline(StyleDominantBaselineParseErrorOwned),
1913 AlignmentBaseline(StyleAlignmentBaselineParseErrorOwned),
1914 InitialLetterAlign(StyleInitialLetterAlignParseErrorOwned),
1915 InitialLetterWrap(StyleInitialLetterWrapParseErrorOwned),
1916 ScrollbarGutter(StyleScrollbarGutterParseErrorOwned),
1917 OverflowClipMargin(StyleOverflowClipMarginParseErrorOwned),
1918 Clip(StyleClipRectParseErrorOwned),
1919 ExclusionMargin(StyleExclusionMarginParseErrorOwned),
1920 HyphenationLanguage(StyleHyphenationLanguageParseErrorOwned),
1921 LineHeight(StyleLineHeightParseError),
1922 WordSpacing(StyleWordSpacingParseErrorOwned),
1923 TabSize(StyleTabSizeParseErrorOwned),
1924 WhiteSpace(StyleWhiteSpaceParseErrorOwned),
1925 Hyphens(StyleHyphensParseErrorOwned),
1926 WordBreak(StyleWordBreakParseErrorOwned),
1927 OverflowWrap(StyleOverflowWrapParseErrorOwned),
1928 LineBreak(StyleLineBreakParseErrorOwned),
1929 ObjectFit(StyleObjectFitParseErrorOwned),
1930 ObjectPosition(StyleObjectPositionParseErrorOwned),
1931 AspectRatio(StyleAspectRatioParseErrorOwned),
1932 TextOrientation(StyleTextOrientationParseErrorOwned),
1933 TextAlignLast(StyleTextAlignLastParseErrorOwned),
1934 TextTransform(StyleTextTransformParseErrorOwned),
1935 Direction(StyleDirectionParseErrorOwned),
1936 UserSelect(StyleUserSelectParseErrorOwned),
1937 TextDecoration(StyleTextDecorationParseErrorOwned),
1938 Cursor(CursorParseErrorOwned),
1939 CaretColor(CssColorParseErrorOwned),
1940 CaretAnimationDuration(DurationParseErrorOwned),
1941 CaretWidth(CssPixelValueParseErrorOwned),
1942 SelectionBackgroundColor(CssColorParseErrorOwned),
1943 SelectionColor(CssColorParseErrorOwned),
1944 SelectionRadius(CssPixelValueParseErrorOwned),
1945
1946 LayoutDisplay(LayoutDisplayParseErrorOwned),
1948 LayoutFloat(LayoutFloatParseErrorOwned),
1949 LayoutBoxSizing(LayoutBoxSizingParseErrorOwned),
1950
1951 LayoutWidth(LayoutWidthParseErrorOwned),
1953 LayoutHeight(LayoutHeightParseErrorOwned),
1954 LayoutMinWidth(LayoutMinWidthParseErrorOwned),
1955 LayoutMinHeight(LayoutMinHeightParseErrorOwned),
1956 LayoutMaxWidth(LayoutMaxWidthParseErrorOwned),
1957 LayoutMaxHeight(LayoutMaxHeightParseErrorOwned),
1958
1959 LayoutPosition(LayoutPositionParseErrorOwned),
1961 LayoutTop(LayoutTopParseErrorOwned),
1962 LayoutRight(LayoutRightParseErrorOwned),
1963 LayoutLeft(LayoutLeftParseErrorOwned),
1964 LayoutInsetBottom(LayoutInsetBottomParseErrorOwned),
1965 LayoutZIndex(LayoutZIndexParseErrorOwned),
1966
1967 FlexWrap(FlexWrapParseErrorOwned),
1969 FlexDirection(FlexDirectionParseErrorOwned),
1970 FlexBasis(FlexBasisParseErrorOwned),
1971 JustifyContent(JustifyContentParseErrorOwned),
1972 AlignItems(AlignItemsParseErrorOwned),
1973 AlignContent(AlignContentParseErrorOwned),
1974
1975 Grid(GridParseErrorOwned),
1977 GridAutoFlow(GridAutoFlowParseErrorOwned),
1978 JustifySelf(JustifySelfParseErrorOwned),
1979 JustifyItems(JustifyItemsParseErrorOwned),
1980 AlignSelf(AlignSelfParseErrorOwned),
1981
1982 LayoutWritingMode(LayoutWritingModeParseErrorOwned),
1984 LayoutClear(LayoutClearParseErrorOwned),
1985
1986 LayoutOverflow(LayoutOverflowParseErrorOwned),
1988
1989 BorderTopLeftRadius(StyleBorderTopLeftRadiusParseErrorOwned),
1991 BorderTopRightRadius(StyleBorderTopRightRadiusParseErrorOwned),
1992 BorderBottomLeftRadius(StyleBorderBottomLeftRadiusParseErrorOwned),
1993 BorderBottomRightRadius(StyleBorderBottomRightRadiusParseErrorOwned),
1994
1995 BorderStyle(CssBorderStyleParseErrorOwned),
1997
1998 BackfaceVisibility(CssBackfaceVisibilityParseErrorOwned),
2000 MixBlendMode(MixBlendModeParseErrorOwned),
2001
2002 PageBreak(PageBreakParseErrorOwned),
2004 BreakInside(BreakInsideParseErrorOwned),
2005 Widows(WidowsParseErrorOwned),
2006 Orphans(OrphansParseErrorOwned),
2007 BoxDecorationBreak(BoxDecorationBreakParseErrorOwned),
2008
2009 ColumnCount(ColumnCountParseErrorOwned),
2011 ColumnWidth(ColumnWidthParseErrorOwned),
2012 ColumnSpan(ColumnSpanParseErrorOwned),
2013 ColumnFill(ColumnFillParseErrorOwned),
2014 ColumnRuleWidth(ColumnRuleWidthParseErrorOwned),
2015 ColumnRuleStyle(ColumnRuleStyleParseErrorOwned),
2016 ColumnRuleColor(ColumnRuleColorParseErrorOwned),
2017
2018 FlowInto(FlowIntoParseErrorOwned),
2020 FlowFrom(FlowFromParseErrorOwned),
2021 GenericParseError,
2022
2023 Content,
2025 Counter,
2026 ListStyleType(StyleListStyleTypeParseErrorOwned),
2027 ListStylePosition(StyleListStylePositionParseErrorOwned),
2028 StringSet,
2029}
2030
2031impl_debug_as_display!(CssParsingError<'a>);
2034impl_display! { CssParsingError<'a>, {
2035 CaretColor(e) => format!("Invalid caret-color: {}", e),
2036 CaretAnimationDuration(e) => format!("Invalid caret-animation-duration: {}", e),
2037 CaretWidth(e) => format!("Invalid -azul-caret-width: {}", e),
2038 SelectionBackgroundColor(e) => format!("Invalid -azul-selection-background-color: {}", e),
2039 SelectionColor(e) => format!("Invalid -azul-selection-color: {}", e),
2040 SelectionRadius(e) => format!("Invalid -azul-selection-radius: {}", e),
2041 Border(e) => format!("Invalid border property: {}", e),
2042 BorderRadius(e) => format!("Invalid border-radius: {}", e),
2043 Padding(e) => format!("Invalid padding property: {}", e),
2044 Margin(e) => format!("Invalid margin property: {}", e),
2045 Overflow(e) => format!("Invalid overflow property: \"{}\"", e.0),
2046 BoxShadow(e) => format!("Invalid shadow property: {}", e),
2047 Color(e) => format!("Invalid color value: {}", e),
2048 PixelValue(e) => format!("Invalid pixel value: {}", e),
2049 Percentage(e) => format!("Invalid percentage value: {}", e),
2050 FontFamily(e) => format!("Invalid font-family value: {}", e),
2051 InvalidValue(e) => format!("Invalid value: \"{}\"", e.0),
2052 FlexGrow(e) => format!("Invalid flex-grow value: {}", e),
2053 FlexShrink(e) => format!("Invalid flex-shrink value: {}", e),
2054 Background(e) => format!("Invalid background property: {}", e),
2055 BackgroundPosition(e) => format!("Invalid background-position: {}", e),
2056 Opacity(e) => format!("Invalid opacity value: {}", e),
2057 Visibility(e) => format!("Invalid visibility value: {}", e),
2058 LayoutScrollbarWidth(e) => format!("Invalid scrollbar-width: {}", e),
2059 StyleScrollbarColor(e) => format!("Invalid scrollbar-color: {}", e),
2060 ScrollbarVisibilityMode(e) => format!("Invalid scrollbar-visibility: {}", e),
2061 ScrollbarFadeDelay(e) => format!("Invalid scrollbar-fade-delay: {}", e),
2062 ScrollbarFadeDuration(e) => format!("Invalid scrollbar-fade-duration: {}", e),
2063 Transform(e) => format!("Invalid transform property: {}", e),
2064 TransformOrigin(e) => format!("Invalid transform-origin: {}", e),
2065 PerspectiveOrigin(e) => format!("Invalid perspective-origin: {}", e),
2066 Filter(e) => format!("Invalid filter property: {}", e),
2067 LayoutWidth(e) => format!("Invalid width value: {}", e),
2068 LayoutHeight(e) => format!("Invalid height value: {}", e),
2069 LayoutMinWidth(e) => format!("Invalid min-width value: {}", e),
2070 LayoutMinHeight(e) => format!("Invalid min-height value: {}", e),
2071 LayoutMaxWidth(e) => format!("Invalid max-width value: {}", e),
2072 LayoutMaxHeight(e) => format!("Invalid max-height value: {}", e),
2073 LayoutPosition(e) => format!("Invalid position value: {}", e),
2074 LayoutTop(e) => format!("Invalid top value: {}", e),
2075 LayoutRight(e) => format!("Invalid right value: {}", e),
2076 LayoutLeft(e) => format!("Invalid left value: {}", e),
2077 LayoutInsetBottom(e) => format!("Invalid bottom value: {}", e),
2078 LayoutZIndex(e) => format!("Invalid z-index value: {}", e),
2079 FlexWrap(e) => format!("Invalid flex-wrap value: {}", e),
2080 FlexDirection(e) => format!("Invalid flex-direction value: {}", e),
2081 FlexBasis(e) => format!("Invalid flex-basis value: {}", e),
2082 JustifyContent(e) => format!("Invalid justify-content value: {}", e),
2083 AlignItems(e) => format!("Invalid align-items value: {}", e),
2084 AlignContent(e) => format!("Invalid align-content value: {}", e),
2085 GridAutoFlow(e) => format!("Invalid grid-auto-flow value: {}", e),
2086 JustifySelf(e) => format!("Invalid justify-self value: {}", e),
2087 JustifyItems(e) => format!("Invalid justify-items value: {}", e),
2088 AlignSelf(e) => format!("Invalid align-self value: {}", e),
2089 Grid(e) => format!("Invalid grid value: {}", e),
2090 LayoutWritingMode(e) => format!("Invalid writing-mode value: {}", e),
2091 LayoutClear(e) => format!("Invalid clear value: {}", e),
2092 LayoutOverflow(e) => format!("Invalid overflow value: {}", e),
2093 BorderTopLeftRadius(e) => format!("Invalid border-top-left-radius: {}", e),
2094 BorderTopRightRadius(e) => format!("Invalid border-top-right-radius: {}", e),
2095 BorderBottomLeftRadius(e) => format!("Invalid border-bottom-left-radius: {}", e),
2096 BorderBottomRightRadius(e) => format!("Invalid border-bottom-right-radius: {}", e),
2097 BorderStyle(e) => format!("Invalid border style: {}", e),
2098 BackfaceVisibility(e) => format!("Invalid backface-visibility: {}", e),
2099 MixBlendMode(e) => format!("Invalid mix-blend-mode: {}", e),
2100 TextColor(e) => format!("Invalid text color: {}", e),
2101 FontSize(e) => format!("Invalid font-size: {}", e),
2102 FontWeight(e) => format!("Invalid font-weight: {}", e),
2103 FontStyle(e) => format!("Invalid font-style: {}", e),
2104 TextAlign(e) => format!("Invalid text-align: {}", e),
2105 TextJustify(e) => format!("Invalid text-justify: {}", e),
2106 VerticalAlign(e) => format!("Invalid vertical-align: {}", e),
2107 LetterSpacing(e) => format!("Invalid letter-spacing: {}", e),
2108 TextIndent(e) => format!("Invalid text-indent: {}", e),
2109 InitialLetter(e) => format!("Invalid initial-letter: {}", e),
2110 LineClamp(e) => format!("Invalid line-clamp: {}", e),
2111 HangingPunctuation(e) => format!("Invalid hanging-punctuation: {}", e),
2112 TextCombineUpright(e) => format!("Invalid text-combine-upright: {}", e),
2113 UnicodeBidi(e) => format!("Invalid unicode-bidi: {}", e),
2114 TextBoxTrim(e) => format!("Invalid text-box-trim: {}", e),
2115 TextBoxEdge(e) => format!("Invalid text-box-edge: {}", e),
2116 DominantBaseline(e) => format!("Invalid dominant-baseline: {}", e),
2117 AlignmentBaseline(e) => format!("Invalid alignment-baseline: {}", e),
2118 InitialLetterAlign(e) => format!("Invalid initial-letter-align: {}", e),
2119 InitialLetterWrap(e) => format!("Invalid initial-letter-wrap: {}", e),
2120 ScrollbarGutter(e) => format!("Invalid scrollbar-gutter: {}", e),
2121 OverflowClipMargin(e) => format!("Invalid overflow-clip-margin: {}", e),
2122 Clip(e) => format!("Invalid clip: {}", e),
2123 ExclusionMargin(e) => format!("Invalid -azul-exclusion-margin: {}", e),
2124 HyphenationLanguage(e) => format!("Invalid -azul-hyphenation-language: {}", e),
2125 LineHeight(e) => format!("Invalid line-height: {}", e),
2126 WordSpacing(e) => format!("Invalid word-spacing: {}", e),
2127 TabSize(e) => format!("Invalid tab-size: {}", e),
2128 WhiteSpace(e) => format!("Invalid white-space: {}", e),
2129 Hyphens(e) => format!("Invalid hyphens: {}", e),
2130 WordBreak(e) => format!("Invalid word-break: {}", e),
2131 OverflowWrap(e) => format!("Invalid overflow-wrap: {}", e),
2132 LineBreak(e) => format!("Invalid line-break: {}", e),
2133 ObjectFit(e) => format!("Invalid object-fit: {}", e),
2134 ObjectPosition(e) => format!("Invalid object-position: {}", e),
2135 AspectRatio(e) => format!("Invalid aspect-ratio: {}", e),
2136 TextOrientation(e) => format!("Invalid text-orientation: {}", e),
2137 TextAlignLast(e) => format!("Invalid text-align-last: {}", e),
2138 TextTransform(e) => format!("Invalid text-transform: {}", e),
2139 Direction(e) => format!("Invalid direction: {}", e),
2140 UserSelect(e) => format!("Invalid user-select: {}", e),
2141 TextDecoration(e) => format!("Invalid text-decoration: {}", e),
2142 Cursor(e) => format!("Invalid cursor: {}", e),
2143 LayoutDisplay(e) => format!("Invalid display: {}", e),
2144 LayoutFloat(e) => format!("Invalid float: {}", e),
2145 LayoutBoxSizing(e) => format!("Invalid box-sizing: {}", e),
2146 PageBreak(e) => format!("Invalid break property: {}", e),
2147 BreakInside(e) => format!("Invalid break-inside property: {}", e),
2148 Widows(e) => format!("Invalid widows property: {}", e),
2149 Orphans(e) => format!("Invalid orphans property: {}", e),
2150 BoxDecorationBreak(e) => format!("Invalid box-decoration-break property: {}", e),
2151 ColumnCount(e) => format!("Invalid column-count: {}", e),
2152 ColumnWidth(e) => format!("Invalid column-width: {}", e),
2153 ColumnSpan(e) => format!("Invalid column-span: {}", e),
2154 ColumnFill(e) => format!("Invalid column-fill: {}", e),
2155 ColumnRuleWidth(e) => format!("Invalid column-rule-width: {}", e),
2156 ColumnRuleStyle(e) => format!("Invalid column-rule-style: {}", e),
2157 ColumnRuleColor(e) => format!("Invalid column-rule-color: {}", e),
2158 FlowInto(e) => format!("Invalid flow-into: {}", e),
2159 FlowFrom(e) => format!("Invalid flow-from: {}", e),
2160 GenericParseError => "Failed to parse value",
2161 Content => "Failed to parse content property",
2162 Counter => "Failed to parse counter property",
2163 ListStyleType(e) => format!("Invalid list-style-type: {}", e),
2164 ListStylePosition(e) => format!("Invalid list-style-position: {}", e),
2165 StringSet => "Failed to parse string-set property",
2166}}
2167
2168impl_from!(
2170 DurationParseError<'a>,
2171 CssParsingError::CaretAnimationDuration
2172);
2173impl_from!(CssBorderParseError<'a>, CssParsingError::Border);
2174impl_from!(CssBorderRadiusParseError<'a>, CssParsingError::BorderRadius);
2175impl_from!(LayoutPaddingParseError<'a>, CssParsingError::Padding);
2176impl_from!(LayoutMarginParseError<'a>, CssParsingError::Margin);
2177impl_from!(CssShadowParseError<'a>, CssParsingError::BoxShadow);
2178impl_from!(CssColorParseError<'a>, CssParsingError::Color);
2179impl_from!(CssPixelValueParseError<'a>, CssParsingError::PixelValue);
2180impl_from!(
2181 CssStyleFontFamilyParseError<'a>,
2182 CssParsingError::FontFamily
2183);
2184impl_from!(CssFontWeightParseError<'a>, CssParsingError::FontWeight);
2185impl_from!(CssFontStyleParseError<'a>, CssParsingError::FontStyle);
2186impl_from!(
2187 StyleInitialLetterParseError<'a>,
2188 CssParsingError::InitialLetter
2189);
2190impl_from!(StyleLineClampParseError<'a>, CssParsingError::LineClamp);
2191impl_from!(
2192 StyleHangingPunctuationParseError<'a>,
2193 CssParsingError::HangingPunctuation
2194);
2195impl_from!(
2196 StyleTextCombineUprightParseError<'a>,
2197 CssParsingError::TextCombineUpright
2198);
2199impl_from!(StyleUnicodeBidiParseError<'a>, CssParsingError::UnicodeBidi);
2200impl_from!(StyleTextBoxTrimParseError<'a>, CssParsingError::TextBoxTrim);
2201impl_from!(StyleTextBoxEdgeParseError<'a>, CssParsingError::TextBoxEdge);
2202impl_from!(
2203 StyleDominantBaselineParseError<'a>,
2204 CssParsingError::DominantBaseline
2205);
2206impl_from!(
2207 StyleAlignmentBaselineParseError<'a>,
2208 CssParsingError::AlignmentBaseline
2209);
2210impl_from!(
2211 StyleInitialLetterAlignParseError<'a>,
2212 CssParsingError::InitialLetterAlign
2213);
2214impl_from!(
2215 StyleInitialLetterWrapParseError<'a>,
2216 CssParsingError::InitialLetterWrap
2217);
2218impl_from!(
2219 StyleScrollbarGutterParseError<'a>,
2220 CssParsingError::ScrollbarGutter
2221);
2222impl_from!(
2223 StyleOverflowClipMarginParseError<'a>,
2224 CssParsingError::OverflowClipMargin
2225);
2226impl_from!(StyleClipRectParseError<'a>, CssParsingError::Clip);
2227
2228#[cfg(feature = "parser")]
2230impl From<StyleExclusionMarginParseError> for CssParsingError<'_> {
2231 fn from(e: StyleExclusionMarginParseError) -> Self {
2232 CssParsingError::ExclusionMargin(e)
2233 }
2234}
2235
2236#[cfg(feature = "parser")]
2238impl From<StyleHyphenationLanguageParseError> for CssParsingError<'_> {
2239 fn from(e: StyleHyphenationLanguageParseError) -> Self {
2240 CssParsingError::HyphenationLanguage(e)
2241 }
2242}
2243impl_from!(FlexGrowParseError<'a>, CssParsingError::FlexGrow);
2244impl_from!(FlexShrinkParseError<'a>, CssParsingError::FlexShrink);
2245impl_from!(CssBackgroundParseError<'a>, CssParsingError::Background);
2246impl_from!(
2247 CssBackgroundPositionParseError<'a>,
2248 CssParsingError::BackgroundPosition
2249);
2250impl_from!(OpacityParseError<'a>, CssParsingError::Opacity);
2251impl_from!(StyleVisibilityParseError<'a>, CssParsingError::Visibility);
2252impl_from!(
2253 LayoutScrollbarWidthParseError<'a>,
2254 CssParsingError::LayoutScrollbarWidth
2255);
2256impl_from!(
2257 StyleScrollbarColorParseError<'a>,
2258 CssParsingError::StyleScrollbarColor
2259);
2260impl_from!(
2261 ScrollbarVisibilityModeParseError<'a>,
2262 CssParsingError::ScrollbarVisibilityMode
2263);
2264impl_from!(
2265 ScrollbarFadeDelayParseError<'a>,
2266 CssParsingError::ScrollbarFadeDelay
2267);
2268impl_from!(
2269 ScrollbarFadeDurationParseError<'a>,
2270 CssParsingError::ScrollbarFadeDuration
2271);
2272impl_from!(CssStyleTransformParseError<'a>, CssParsingError::Transform);
2273impl_from!(
2274 CssStyleTransformOriginParseError<'a>,
2275 CssParsingError::TransformOrigin
2276);
2277impl_from!(
2278 CssStylePerspectiveOriginParseError<'a>,
2279 CssParsingError::PerspectiveOrigin
2280);
2281impl_from!(CssStyleFilterParseError<'a>, CssParsingError::Filter);
2282
2283impl_from!(LayoutWidthParseError<'a>, CssParsingError::LayoutWidth);
2285impl_from!(LayoutHeightParseError<'a>, CssParsingError::LayoutHeight);
2286impl_from!(
2287 LayoutMinWidthParseError<'a>,
2288 CssParsingError::LayoutMinWidth
2289);
2290impl_from!(
2291 LayoutMinHeightParseError<'a>,
2292 CssParsingError::LayoutMinHeight
2293);
2294impl_from!(
2295 LayoutMaxWidthParseError<'a>,
2296 CssParsingError::LayoutMaxWidth
2297);
2298impl_from!(
2299 LayoutMaxHeightParseError<'a>,
2300 CssParsingError::LayoutMaxHeight
2301);
2302
2303impl_from!(
2305 LayoutPositionParseError<'a>,
2306 CssParsingError::LayoutPosition
2307);
2308impl_from!(LayoutTopParseError<'a>, CssParsingError::LayoutTop);
2309impl_from!(LayoutRightParseError<'a>, CssParsingError::LayoutRight);
2310impl_from!(LayoutLeftParseError<'a>, CssParsingError::LayoutLeft);
2311impl_from!(
2312 LayoutInsetBottomParseError<'a>,
2313 CssParsingError::LayoutInsetBottom
2314);
2315impl_from!(LayoutZIndexParseError<'a>, CssParsingError::LayoutZIndex);
2316
2317impl_from!(FlexWrapParseError<'a>, CssParsingError::FlexWrap);
2319impl_from!(FlexDirectionParseError<'a>, CssParsingError::FlexDirection);
2320impl_from!(FlexBasisParseError<'a>, CssParsingError::FlexBasis);
2321impl_from!(
2322 JustifyContentParseError<'a>,
2323 CssParsingError::JustifyContent
2324);
2325impl_from!(AlignItemsParseError<'a>, CssParsingError::AlignItems);
2326impl_from!(AlignContentParseError<'a>, CssParsingError::AlignContent);
2327
2328impl_from!(GridParseError<'a>, CssParsingError::Grid);
2330impl_from!(GridAutoFlowParseError<'a>, CssParsingError::GridAutoFlow);
2331impl_from!(JustifySelfParseError<'a>, CssParsingError::JustifySelf);
2332impl_from!(JustifyItemsParseError<'a>, CssParsingError::JustifyItems);
2333impl_from!(AlignSelfParseError<'a>, CssParsingError::AlignSelf);
2336
2337impl_from!(
2339 LayoutWritingModeParseError<'a>,
2340 CssParsingError::LayoutWritingMode
2341);
2342impl_from!(LayoutClearParseError<'a>, CssParsingError::LayoutClear);
2343
2344impl_from!(
2346 LayoutOverflowParseError<'a>,
2347 CssParsingError::LayoutOverflow
2348);
2349
2350impl_from!(
2352 StyleBorderTopLeftRadiusParseError<'a>,
2353 CssParsingError::BorderTopLeftRadius
2354);
2355impl_from!(
2356 StyleBorderTopRightRadiusParseError<'a>,
2357 CssParsingError::BorderTopRightRadius
2358);
2359impl_from!(
2360 StyleBorderBottomLeftRadiusParseError<'a>,
2361 CssParsingError::BorderBottomLeftRadius
2362);
2363impl_from!(
2364 StyleBorderBottomRightRadiusParseError<'a>,
2365 CssParsingError::BorderBottomRightRadius
2366);
2367
2368impl_from!(CssBorderStyleParseError<'a>, CssParsingError::BorderStyle);
2370
2371impl_from!(
2373 CssBackfaceVisibilityParseError<'a>,
2374 CssParsingError::BackfaceVisibility
2375);
2376impl_from!(MixBlendModeParseError<'a>, CssParsingError::MixBlendMode);
2377
2378impl_from!(StyleTextColorParseError<'a>, CssParsingError::TextColor);
2380impl_from!(CssStyleFontSizeParseError<'a>, CssParsingError::FontSize);
2381impl_from!(StyleTextAlignParseError<'a>, CssParsingError::TextAlign);
2382impl_from!(TextJustifyParseError<'a>, CssParsingError::TextJustify);
2383impl_from!(
2384 StyleLetterSpacingParseError<'a>,
2385 CssParsingError::LetterSpacing
2386);
2387impl_from!(StyleWordSpacingParseError<'a>, CssParsingError::WordSpacing);
2388impl_from!(StyleTabSizeParseError<'a>, CssParsingError::TabSize);
2389impl_from!(StyleWhiteSpaceParseError<'a>, CssParsingError::WhiteSpace);
2390impl_from!(StyleHyphensParseError<'a>, CssParsingError::Hyphens);
2391impl_from!(StyleWordBreakParseError<'a>, CssParsingError::WordBreak);
2392impl_from!(
2393 StyleOverflowWrapParseError<'a>,
2394 CssParsingError::OverflowWrap
2395);
2396impl_from!(StyleLineBreakParseError<'a>, CssParsingError::LineBreak);
2397impl_from!(StyleObjectFitParseError<'a>, CssParsingError::ObjectFit);
2398impl_from!(
2399 StyleObjectPositionParseError<'a>,
2400 CssParsingError::ObjectPosition
2401);
2402impl_from!(StyleAspectRatioParseError<'a>, CssParsingError::AspectRatio);
2403impl_from!(
2404 StyleTextOrientationParseError<'a>,
2405 CssParsingError::TextOrientation
2406);
2407impl_from!(
2408 StyleTextAlignLastParseError<'a>,
2409 CssParsingError::TextAlignLast
2410);
2411impl_from!(
2412 StyleTextTransformParseError<'a>,
2413 CssParsingError::TextTransform
2414);
2415impl_from!(StyleDirectionParseError<'a>, CssParsingError::Direction);
2416impl_from!(StyleUserSelectParseError<'a>, CssParsingError::UserSelect);
2417impl_from!(
2418 StyleTextDecorationParseError<'a>,
2419 CssParsingError::TextDecoration
2420);
2421impl_from!(CursorParseError<'a>, CssParsingError::Cursor);
2422
2423impl_from!(LayoutDisplayParseError<'a>, CssParsingError::LayoutDisplay);
2425impl_from!(LayoutFloatParseError<'a>, CssParsingError::LayoutFloat);
2426impl_from!(
2427 LayoutBoxSizingParseError<'a>,
2428 CssParsingError::LayoutBoxSizing
2429);
2430
2431impl_from!(PageBreakParseError<'a>, CssParsingError::PageBreak);
2433impl_from!(BreakInsideParseError<'a>, CssParsingError::BreakInside);
2434impl_from!(WidowsParseError<'a>, CssParsingError::Widows);
2435impl_from!(OrphansParseError<'a>, CssParsingError::Orphans);
2436impl_from!(
2437 BoxDecorationBreakParseError<'a>,
2438 CssParsingError::BoxDecorationBreak
2439);
2440impl_from!(ColumnCountParseError<'a>, CssParsingError::ColumnCount);
2441impl_from!(ColumnWidthParseError<'a>, CssParsingError::ColumnWidth);
2442impl_from!(ColumnSpanParseError<'a>, CssParsingError::ColumnSpan);
2443impl_from!(ColumnFillParseError<'a>, CssParsingError::ColumnFill);
2444impl_from!(
2445 ColumnRuleWidthParseError<'a>,
2446 CssParsingError::ColumnRuleWidth
2447);
2448impl_from!(
2449 ColumnRuleStyleParseError<'a>,
2450 CssParsingError::ColumnRuleStyle
2451);
2452impl_from!(
2453 ColumnRuleColorParseError<'a>,
2454 CssParsingError::ColumnRuleColor
2455);
2456impl_from!(FlowIntoParseError<'a>, CssParsingError::FlowInto);
2457impl_from!(FlowFromParseError<'a>, CssParsingError::FlowFrom);
2458
2459impl<'a> From<InvalidValueErr<'a>> for CssParsingError<'a> {
2460 fn from(e: InvalidValueErr<'a>) -> Self {
2461 CssParsingError::InvalidValue(e)
2462 }
2463}
2464
2465impl From<PercentageParseError> for CssParsingError<'_> {
2466 fn from(e: PercentageParseError) -> Self {
2467 CssParsingError::Percentage(e)
2468 }
2469}
2470
2471impl From<StyleLineHeightParseError> for CssParsingError<'_> {
2472 fn from(e: StyleLineHeightParseError) -> Self {
2473 CssParsingError::LineHeight(e)
2474 }
2475}
2476
2477impl<'a> From<StyleTextIndentParseError<'a>> for CssParsingError<'a> {
2478 fn from(e: StyleTextIndentParseError<'a>) -> Self {
2479 CssParsingError::TextIndent(e)
2480 }
2481}
2482
2483impl<'a> From<StyleVerticalAlignParseError<'a>> for CssParsingError<'a> {
2484 fn from(e: StyleVerticalAlignParseError<'a>) -> Self {
2485 CssParsingError::VerticalAlign(e)
2486 }
2487}
2488
2489impl CssParsingError<'_> {
2490 #[allow(clippy::too_many_lines)] #[must_use] pub fn to_contained(&self) -> CssParsingErrorOwned {
2492 match self {
2493 CssParsingError::CaretColor(e) => CssParsingErrorOwned::CaretColor(e.to_contained()),
2494 CssParsingError::CaretWidth(e) => CssParsingErrorOwned::CaretWidth(e.to_contained()),
2495 CssParsingError::CaretAnimationDuration(e) => {
2496 CssParsingErrorOwned::CaretAnimationDuration(e.to_contained())
2497 }
2498 CssParsingError::SelectionBackgroundColor(e) => {
2499 CssParsingErrorOwned::SelectionBackgroundColor(e.to_contained())
2500 }
2501 CssParsingError::SelectionColor(e) => {
2502 CssParsingErrorOwned::SelectionColor(e.to_contained())
2503 }
2504 CssParsingError::SelectionRadius(e) => {
2505 CssParsingErrorOwned::SelectionRadius(e.to_contained())
2506 }
2507 CssParsingError::Border(e) => CssParsingErrorOwned::Border(e.to_contained().into()),
2508 CssParsingError::BorderRadius(e) => {
2509 CssParsingErrorOwned::BorderRadius(e.to_contained().into())
2510 }
2511 CssParsingError::Padding(e) => CssParsingErrorOwned::Padding(e.to_contained()),
2512 CssParsingError::Margin(e) => CssParsingErrorOwned::Margin(e.to_contained()),
2513 CssParsingError::Overflow(e) => CssParsingErrorOwned::Overflow(e.to_contained()),
2514 CssParsingError::BoxShadow(e) => CssParsingErrorOwned::BoxShadow(e.to_contained()),
2515 CssParsingError::Color(e) => CssParsingErrorOwned::Color(e.to_contained()),
2516 CssParsingError::PixelValue(e) => CssParsingErrorOwned::PixelValue(e.to_contained()),
2517 CssParsingError::Percentage(e) => CssParsingErrorOwned::Percentage(e.clone()),
2518 CssParsingError::FontFamily(e) => CssParsingErrorOwned::FontFamily(e.to_contained()),
2519 CssParsingError::InvalidValue(e) => {
2520 CssParsingErrorOwned::InvalidValue(e.to_contained())
2521 }
2522 CssParsingError::FlexGrow(e) => CssParsingErrorOwned::FlexGrow(e.to_contained()),
2523 CssParsingError::FlexShrink(e) => CssParsingErrorOwned::FlexShrink(e.to_contained()),
2524 CssParsingError::Background(e) => CssParsingErrorOwned::Background(e.to_contained()),
2525 CssParsingError::BackgroundPosition(e) => {
2526 CssParsingErrorOwned::BackgroundPosition(e.to_contained())
2527 }
2528 CssParsingError::GridAutoFlow(e) => {
2529 CssParsingErrorOwned::GridAutoFlow(e.to_contained())
2530 }
2531 CssParsingError::JustifySelf(e) => CssParsingErrorOwned::JustifySelf(e.to_contained()),
2532 CssParsingError::JustifyItems(e) => {
2533 CssParsingErrorOwned::JustifyItems(e.to_contained())
2534 }
2535 CssParsingError::AlignSelf(e) => CssParsingErrorOwned::AlignSelf(e.to_contained()),
2536 CssParsingError::Opacity(e) => CssParsingErrorOwned::Opacity(e.to_contained()),
2537 CssParsingError::Visibility(e) => CssParsingErrorOwned::Visibility(e.to_contained()),
2538 CssParsingError::LayoutScrollbarWidth(e) => {
2539 CssParsingErrorOwned::LayoutScrollbarWidth(e.to_contained())
2540 }
2541 CssParsingError::StyleScrollbarColor(e) => {
2542 CssParsingErrorOwned::StyleScrollbarColor(e.to_contained())
2543 }
2544 CssParsingError::ScrollbarVisibilityMode(e) => {
2545 CssParsingErrorOwned::ScrollbarVisibilityMode(e.to_contained())
2546 }
2547 CssParsingError::ScrollbarFadeDelay(e) => {
2548 CssParsingErrorOwned::ScrollbarFadeDelay(e.to_contained())
2549 }
2550 CssParsingError::ScrollbarFadeDuration(e) => {
2551 CssParsingErrorOwned::ScrollbarFadeDuration(e.to_contained())
2552 }
2553 CssParsingError::Transform(e) => CssParsingErrorOwned::Transform(e.to_contained()),
2554 CssParsingError::TransformOrigin(e) => {
2555 CssParsingErrorOwned::TransformOrigin(e.to_contained())
2556 }
2557 CssParsingError::PerspectiveOrigin(e) => {
2558 CssParsingErrorOwned::PerspectiveOrigin(e.to_contained())
2559 }
2560 CssParsingError::Filter(e) => CssParsingErrorOwned::Filter(e.to_contained()),
2561 CssParsingError::LayoutWidth(e) => CssParsingErrorOwned::LayoutWidth(e.to_contained()),
2562 CssParsingError::LayoutHeight(e) => {
2563 CssParsingErrorOwned::LayoutHeight(e.to_contained())
2564 }
2565 CssParsingError::LayoutMinWidth(e) => {
2566 CssParsingErrorOwned::LayoutMinWidth(e.to_contained())
2567 }
2568 CssParsingError::LayoutMinHeight(e) => {
2569 CssParsingErrorOwned::LayoutMinHeight(e.to_contained())
2570 }
2571 CssParsingError::LayoutMaxWidth(e) => {
2572 CssParsingErrorOwned::LayoutMaxWidth(e.to_contained())
2573 }
2574 CssParsingError::LayoutMaxHeight(e) => {
2575 CssParsingErrorOwned::LayoutMaxHeight(e.to_contained())
2576 }
2577 CssParsingError::LayoutPosition(e) => {
2578 CssParsingErrorOwned::LayoutPosition(e.to_contained())
2579 }
2580 CssParsingError::LayoutTop(e) => CssParsingErrorOwned::LayoutTop(e.to_contained()),
2581 CssParsingError::LayoutRight(e) => CssParsingErrorOwned::LayoutRight(e.to_contained()),
2582 CssParsingError::LayoutLeft(e) => CssParsingErrorOwned::LayoutLeft(e.to_contained()),
2583 CssParsingError::LayoutInsetBottom(e) => {
2584 CssParsingErrorOwned::LayoutInsetBottom(e.to_contained())
2585 }
2586 CssParsingError::LayoutZIndex(e) => {
2587 CssParsingErrorOwned::LayoutZIndex(e.to_contained())
2588 }
2589 CssParsingError::FlexWrap(e) => CssParsingErrorOwned::FlexWrap(e.to_contained()),
2590 CssParsingError::FlexDirection(e) => {
2591 CssParsingErrorOwned::FlexDirection(e.to_contained())
2592 }
2593 CssParsingError::FlexBasis(e) => CssParsingErrorOwned::FlexBasis(e.to_contained()),
2594 CssParsingError::JustifyContent(e) => {
2595 CssParsingErrorOwned::JustifyContent(e.to_contained())
2596 }
2597 CssParsingError::AlignItems(e) => CssParsingErrorOwned::AlignItems(e.to_contained()),
2598 CssParsingError::AlignContent(e) => {
2599 CssParsingErrorOwned::AlignContent(e.to_contained())
2600 }
2601 CssParsingError::Grid(e) => CssParsingErrorOwned::Grid(e.to_contained()),
2602 CssParsingError::LayoutWritingMode(e) => {
2603 CssParsingErrorOwned::LayoutWritingMode(e.to_contained())
2604 }
2605 CssParsingError::LayoutClear(e) => CssParsingErrorOwned::LayoutClear(e.to_contained()),
2606 CssParsingError::LayoutOverflow(e) => {
2607 CssParsingErrorOwned::LayoutOverflow(e.to_contained())
2608 }
2609 CssParsingError::BorderTopLeftRadius(e) => {
2610 CssParsingErrorOwned::BorderTopLeftRadius(e.to_contained())
2611 }
2612 CssParsingError::BorderTopRightRadius(e) => {
2613 CssParsingErrorOwned::BorderTopRightRadius(e.to_contained())
2614 }
2615 CssParsingError::BorderBottomLeftRadius(e) => {
2616 CssParsingErrorOwned::BorderBottomLeftRadius(e.to_contained())
2617 }
2618 CssParsingError::BorderBottomRightRadius(e) => {
2619 CssParsingErrorOwned::BorderBottomRightRadius(e.to_contained())
2620 }
2621 CssParsingError::BorderStyle(e) => CssParsingErrorOwned::BorderStyle(e.to_contained()),
2622 CssParsingError::BackfaceVisibility(e) => {
2623 CssParsingErrorOwned::BackfaceVisibility(e.to_contained())
2624 }
2625 CssParsingError::MixBlendMode(e) => {
2626 CssParsingErrorOwned::MixBlendMode(e.to_contained())
2627 }
2628 CssParsingError::TextColor(e) => CssParsingErrorOwned::TextColor(e.to_contained()),
2629 CssParsingError::FontSize(e) => CssParsingErrorOwned::FontSize(e.to_contained()),
2630 CssParsingError::TextAlign(e) => CssParsingErrorOwned::TextAlign(e.to_contained()),
2631 CssParsingError::TextJustify(e) => CssParsingErrorOwned::TextJustify(e.to_owned()),
2632 CssParsingError::VerticalAlign(e) => {
2633 CssParsingErrorOwned::VerticalAlign(e.to_contained())
2634 }
2635 CssParsingError::LetterSpacing(e) => {
2636 CssParsingErrorOwned::LetterSpacing(e.to_contained())
2637 }
2638 CssParsingError::TextIndent(e) => CssParsingErrorOwned::TextIndent(e.to_contained()),
2639 CssParsingError::InitialLetter(e) => {
2640 CssParsingErrorOwned::InitialLetter(e.to_contained())
2641 }
2642 CssParsingError::LineClamp(e) => CssParsingErrorOwned::LineClamp(e.to_contained()),
2643 CssParsingError::HangingPunctuation(e) => {
2644 CssParsingErrorOwned::HangingPunctuation(e.to_contained())
2645 }
2646 CssParsingError::TextCombineUpright(e) => {
2647 CssParsingErrorOwned::TextCombineUpright(e.to_contained())
2648 }
2649 CssParsingError::UnicodeBidi(e) => CssParsingErrorOwned::UnicodeBidi(e.to_contained()),
2650 CssParsingError::TextBoxTrim(e) => CssParsingErrorOwned::TextBoxTrim(e.to_contained()),
2651 CssParsingError::TextBoxEdge(e) => CssParsingErrorOwned::TextBoxEdge(e.to_contained()),
2652 CssParsingError::DominantBaseline(e) => {
2653 CssParsingErrorOwned::DominantBaseline(e.to_contained())
2654 }
2655 CssParsingError::AlignmentBaseline(e) => {
2656 CssParsingErrorOwned::AlignmentBaseline(e.to_contained())
2657 }
2658 CssParsingError::InitialLetterAlign(e) => {
2659 CssParsingErrorOwned::InitialLetterAlign(e.to_contained())
2660 }
2661 CssParsingError::InitialLetterWrap(e) => {
2662 CssParsingErrorOwned::InitialLetterWrap(e.to_contained())
2663 }
2664 CssParsingError::ScrollbarGutter(e) => {
2665 CssParsingErrorOwned::ScrollbarGutter(e.to_contained())
2666 }
2667 CssParsingError::OverflowClipMargin(e) => {
2668 CssParsingErrorOwned::OverflowClipMargin(e.to_contained())
2669 }
2670 CssParsingError::Clip(e) => CssParsingErrorOwned::Clip(e.to_contained()),
2671 CssParsingError::ExclusionMargin(e) => {
2672 CssParsingErrorOwned::ExclusionMargin(e.to_contained())
2673 }
2674 CssParsingError::HyphenationLanguage(e) => {
2675 CssParsingErrorOwned::HyphenationLanguage(e.to_contained())
2676 }
2677 CssParsingError::LineHeight(e) => CssParsingErrorOwned::LineHeight(e.clone()),
2678 CssParsingError::WordSpacing(e) => CssParsingErrorOwned::WordSpacing(e.to_contained()),
2679 CssParsingError::TabSize(e) => CssParsingErrorOwned::TabSize(e.to_contained()),
2680 CssParsingError::WhiteSpace(e) => CssParsingErrorOwned::WhiteSpace(e.to_contained()),
2681 CssParsingError::Hyphens(e) => CssParsingErrorOwned::Hyphens(e.to_contained()),
2682 CssParsingError::WordBreak(e) => CssParsingErrorOwned::WordBreak(e.to_contained()),
2683 CssParsingError::OverflowWrap(e) => {
2684 CssParsingErrorOwned::OverflowWrap(e.to_contained())
2685 }
2686 CssParsingError::LineBreak(e) => CssParsingErrorOwned::LineBreak(e.to_contained()),
2687 CssParsingError::ObjectFit(e) => CssParsingErrorOwned::ObjectFit(e.to_contained()),
2688 CssParsingError::ObjectPosition(e) => {
2689 CssParsingErrorOwned::ObjectPosition(e.to_contained())
2690 }
2691 CssParsingError::AspectRatio(e) => CssParsingErrorOwned::AspectRatio(e.to_contained()),
2692 CssParsingError::TextOrientation(e) => {
2693 CssParsingErrorOwned::TextOrientation(e.to_contained())
2694 }
2695 CssParsingError::TextAlignLast(e) => {
2696 CssParsingErrorOwned::TextAlignLast(e.to_contained())
2697 }
2698 CssParsingError::TextTransform(e) => {
2699 CssParsingErrorOwned::TextTransform(e.to_contained())
2700 }
2701 CssParsingError::Direction(e) => CssParsingErrorOwned::Direction(e.to_contained()),
2702 CssParsingError::UserSelect(e) => CssParsingErrorOwned::UserSelect(e.to_contained()),
2703 CssParsingError::TextDecoration(e) => {
2704 CssParsingErrorOwned::TextDecoration(e.to_contained())
2705 }
2706 CssParsingError::Cursor(e) => CssParsingErrorOwned::Cursor(e.to_contained()),
2707 CssParsingError::LayoutDisplay(e) => {
2708 CssParsingErrorOwned::LayoutDisplay(e.to_contained())
2709 }
2710 CssParsingError::LayoutFloat(e) => CssParsingErrorOwned::LayoutFloat(e.to_contained()),
2711 CssParsingError::LayoutBoxSizing(e) => {
2712 CssParsingErrorOwned::LayoutBoxSizing(e.to_contained())
2713 }
2714 CssParsingError::PageBreak(e) => CssParsingErrorOwned::PageBreak(e.to_contained()),
2716 CssParsingError::BreakInside(e) => CssParsingErrorOwned::BreakInside(e.to_contained()),
2717 CssParsingError::Widows(e) => CssParsingErrorOwned::Widows(e.to_contained()),
2718 CssParsingError::Orphans(e) => CssParsingErrorOwned::Orphans(e.to_contained()),
2719 CssParsingError::BoxDecorationBreak(e) => {
2720 CssParsingErrorOwned::BoxDecorationBreak(e.to_contained())
2721 }
2722 CssParsingError::ColumnCount(e) => CssParsingErrorOwned::ColumnCount(e.to_contained()),
2723 CssParsingError::ColumnWidth(e) => CssParsingErrorOwned::ColumnWidth(e.to_contained()),
2724 CssParsingError::ColumnSpan(e) => CssParsingErrorOwned::ColumnSpan(e.to_contained()),
2725 CssParsingError::ColumnFill(e) => CssParsingErrorOwned::ColumnFill(e.to_contained()),
2726 CssParsingError::ColumnRuleWidth(e) => {
2727 CssParsingErrorOwned::ColumnRuleWidth(e.to_contained())
2728 }
2729 CssParsingError::ColumnRuleStyle(e) => {
2730 CssParsingErrorOwned::ColumnRuleStyle(e.to_contained())
2731 }
2732 CssParsingError::ColumnRuleColor(e) => {
2733 CssParsingErrorOwned::ColumnRuleColor(e.to_contained())
2734 }
2735 CssParsingError::FlowInto(e) => CssParsingErrorOwned::FlowInto(e.to_contained()),
2736 CssParsingError::FlowFrom(e) => CssParsingErrorOwned::FlowFrom(e.to_contained()),
2737 CssParsingError::GenericParseError => CssParsingErrorOwned::GenericParseError,
2738 CssParsingError::Content => CssParsingErrorOwned::Content,
2739 CssParsingError::Counter => CssParsingErrorOwned::Counter,
2740 CssParsingError::ListStyleType(e) => {
2741 CssParsingErrorOwned::ListStyleType(e.to_contained())
2742 }
2743 CssParsingError::ListStylePosition(e) => {
2744 CssParsingErrorOwned::ListStylePosition(e.to_contained())
2745 }
2746 CssParsingError::StringSet => CssParsingErrorOwned::StringSet,
2747 CssParsingError::FontWeight(e) => CssParsingErrorOwned::FontWeight(e.to_contained()),
2748 CssParsingError::FontStyle(e) => CssParsingErrorOwned::FontStyle(e.to_contained()),
2749 }
2750 }
2751}
2752
2753impl CssParsingErrorOwned {
2754 #[allow(clippy::too_many_lines)] #[must_use] pub fn to_shared(&self) -> CssParsingError<'_> {
2756 match self {
2757 Self::CaretColor(e) => CssParsingError::CaretColor(e.to_shared()),
2758 Self::CaretWidth(e) => CssParsingError::CaretWidth(e.to_shared()),
2759 Self::CaretAnimationDuration(e) => {
2760 CssParsingError::CaretAnimationDuration(e.to_shared())
2761 }
2762 Self::SelectionBackgroundColor(e) => {
2763 CssParsingError::SelectionBackgroundColor(e.to_shared())
2764 }
2765 Self::SelectionColor(e) => {
2766 CssParsingError::SelectionColor(e.to_shared())
2767 }
2768 Self::SelectionRadius(e) => {
2769 CssParsingError::SelectionRadius(e.to_shared())
2770 }
2771 Self::Border(e) => CssParsingError::Border(e.inner.to_shared()),
2772 Self::BorderRadius(e) => {
2773 CssParsingError::BorderRadius(e.inner.to_shared())
2774 }
2775 Self::Padding(e) => CssParsingError::Padding(e.to_shared()),
2776 Self::Margin(e) => CssParsingError::Margin(e.to_shared()),
2777 Self::Overflow(e) => CssParsingError::Overflow(e.to_shared()),
2778 Self::BoxShadow(e) => CssParsingError::BoxShadow(e.to_shared()),
2779 Self::Color(e) => CssParsingError::Color(e.to_shared()),
2780 Self::PixelValue(e) => CssParsingError::PixelValue(e.to_shared()),
2781 Self::Percentage(e) => CssParsingError::Percentage(e.clone()),
2782 Self::FontFamily(e) => CssParsingError::FontFamily(e.to_shared()),
2783 Self::InvalidValue(e) => CssParsingError::InvalidValue(e.to_shared()),
2784 Self::FlexGrow(e) => CssParsingError::FlexGrow(e.to_shared()),
2785 Self::FlexShrink(e) => CssParsingError::FlexShrink(e.to_shared()),
2786 Self::Background(e) => CssParsingError::Background(e.to_shared()),
2787 Self::BackgroundPosition(e) => {
2788 CssParsingError::BackgroundPosition(e.to_shared())
2789 }
2790 Self::Opacity(e) => CssParsingError::Opacity(e.to_shared()),
2791 Self::Visibility(e) => CssParsingError::Visibility(e.to_shared()),
2792 Self::LayoutScrollbarWidth(e) => {
2793 CssParsingError::LayoutScrollbarWidth(e.to_shared())
2794 }
2795 Self::StyleScrollbarColor(e) => {
2796 CssParsingError::StyleScrollbarColor(e.to_shared())
2797 }
2798 Self::ScrollbarVisibilityMode(e) => {
2799 CssParsingError::ScrollbarVisibilityMode(e.to_shared())
2800 }
2801 Self::ScrollbarFadeDelay(e) => {
2802 CssParsingError::ScrollbarFadeDelay(e.to_shared())
2803 }
2804 Self::ScrollbarFadeDuration(e) => {
2805 CssParsingError::ScrollbarFadeDuration(e.to_shared())
2806 }
2807 Self::Transform(e) => CssParsingError::Transform(e.to_shared()),
2808 Self::TransformOrigin(e) => {
2809 CssParsingError::TransformOrigin(e.to_shared())
2810 }
2811 Self::PerspectiveOrigin(e) => {
2812 CssParsingError::PerspectiveOrigin(e.to_shared())
2813 }
2814 Self::Filter(e) => CssParsingError::Filter(e.to_shared()),
2815 Self::LayoutWidth(e) => CssParsingError::LayoutWidth(e.to_shared()),
2816 Self::LayoutHeight(e) => CssParsingError::LayoutHeight(e.to_shared()),
2817 Self::LayoutMinWidth(e) => {
2818 CssParsingError::LayoutMinWidth(e.to_shared())
2819 }
2820 Self::LayoutMinHeight(e) => {
2821 CssParsingError::LayoutMinHeight(e.to_shared())
2822 }
2823 Self::LayoutMaxWidth(e) => {
2824 CssParsingError::LayoutMaxWidth(e.to_shared())
2825 }
2826 Self::LayoutMaxHeight(e) => {
2827 CssParsingError::LayoutMaxHeight(e.to_shared())
2828 }
2829 Self::LayoutPosition(e) => {
2830 CssParsingError::LayoutPosition(e.to_shared())
2831 }
2832 Self::LayoutTop(e) => CssParsingError::LayoutTop(e.to_shared()),
2833 Self::LayoutRight(e) => CssParsingError::LayoutRight(e.to_shared()),
2834 Self::LayoutLeft(e) => CssParsingError::LayoutLeft(e.to_shared()),
2835 Self::LayoutInsetBottom(e) => {
2836 CssParsingError::LayoutInsetBottom(e.to_shared())
2837 }
2838 Self::LayoutZIndex(e) => CssParsingError::LayoutZIndex(e.to_shared()),
2839 Self::FlexWrap(e) => CssParsingError::FlexWrap(e.to_shared()),
2840 Self::FlexDirection(e) => CssParsingError::FlexDirection(e.to_shared()),
2841 Self::FlexBasis(e) => CssParsingError::FlexBasis(e.to_shared()),
2842 Self::JustifyContent(e) => {
2843 CssParsingError::JustifyContent(e.to_shared())
2844 }
2845 Self::AlignItems(e) => CssParsingError::AlignItems(e.to_shared()),
2846 Self::AlignContent(e) => CssParsingError::AlignContent(e.to_shared()),
2847 Self::Grid(e) => CssParsingError::Grid(e.to_shared()),
2848 Self::GridAutoFlow(e) => CssParsingError::GridAutoFlow(e.to_shared()),
2849 Self::JustifySelf(e) => CssParsingError::JustifySelf(e.to_shared()),
2850 Self::JustifyItems(e) => CssParsingError::JustifyItems(e.to_shared()),
2851 Self::AlignSelf(e) => CssParsingError::AlignSelf(e.to_shared()),
2852 Self::LayoutWritingMode(e) => {
2853 CssParsingError::LayoutWritingMode(e.to_shared())
2854 }
2855 Self::LayoutClear(e) => CssParsingError::LayoutClear(e.to_shared()),
2856 Self::LayoutOverflow(e) => {
2857 CssParsingError::LayoutOverflow(e.to_shared())
2858 }
2859 Self::BorderTopLeftRadius(e) => {
2860 CssParsingError::BorderTopLeftRadius(e.to_shared())
2861 }
2862 Self::BorderTopRightRadius(e) => {
2863 CssParsingError::BorderTopRightRadius(e.to_shared())
2864 }
2865 Self::BorderBottomLeftRadius(e) => {
2866 CssParsingError::BorderBottomLeftRadius(e.to_shared())
2867 }
2868 Self::BorderBottomRightRadius(e) => {
2869 CssParsingError::BorderBottomRightRadius(e.to_shared())
2870 }
2871 Self::BorderStyle(e) => CssParsingError::BorderStyle(e.to_shared()),
2872 Self::BackfaceVisibility(e) => {
2873 CssParsingError::BackfaceVisibility(e.to_shared())
2874 }
2875 Self::MixBlendMode(e) => CssParsingError::MixBlendMode(e.to_shared()),
2876 Self::TextColor(e) => CssParsingError::TextColor(e.to_shared()),
2877 Self::FontSize(e) => CssParsingError::FontSize(e.to_shared()),
2878 Self::TextAlign(e) => CssParsingError::TextAlign(e.to_shared()),
2879 Self::TextJustify(e) => CssParsingError::TextJustify(e.to_borrowed()),
2880 Self::LetterSpacing(e) => CssParsingError::LetterSpacing(e.to_shared()),
2881 Self::TextIndent(e) => CssParsingError::TextIndent(e.to_shared()),
2882 Self::InitialLetter(e) => CssParsingError::InitialLetter(e.to_shared()),
2883 Self::LineClamp(e) => CssParsingError::LineClamp(e.to_shared()),
2884 Self::HangingPunctuation(e) => {
2885 CssParsingError::HangingPunctuation(e.to_shared())
2886 }
2887 Self::TextCombineUpright(e) => {
2888 CssParsingError::TextCombineUpright(e.to_shared())
2889 }
2890 Self::UnicodeBidi(e) => CssParsingError::UnicodeBidi(e.to_shared()),
2891 Self::TextBoxTrim(e) => CssParsingError::TextBoxTrim(e.to_shared()),
2892 Self::TextBoxEdge(e) => CssParsingError::TextBoxEdge(e.to_shared()),
2893 Self::DominantBaseline(e) => {
2894 CssParsingError::DominantBaseline(e.to_shared())
2895 }
2896 Self::AlignmentBaseline(e) => {
2897 CssParsingError::AlignmentBaseline(e.to_shared())
2898 }
2899 Self::InitialLetterAlign(e) => {
2900 CssParsingError::InitialLetterAlign(e.to_shared())
2901 }
2902 Self::InitialLetterWrap(e) => {
2903 CssParsingError::InitialLetterWrap(e.to_shared())
2904 }
2905 Self::ScrollbarGutter(e) => {
2906 CssParsingError::ScrollbarGutter(e.to_shared())
2907 }
2908 Self::OverflowClipMargin(e) => {
2909 CssParsingError::OverflowClipMargin(e.to_shared())
2910 }
2911 Self::Clip(e) => CssParsingError::Clip(e.to_shared()),
2912 Self::ExclusionMargin(e) => {
2913 CssParsingError::ExclusionMargin(e.to_shared())
2914 }
2915 Self::HyphenationLanguage(e) => {
2916 CssParsingError::HyphenationLanguage(e.to_shared())
2917 }
2918 Self::LineHeight(e) => CssParsingError::LineHeight(e.clone()),
2919 Self::WordSpacing(e) => CssParsingError::WordSpacing(e.to_shared()),
2920 Self::TabSize(e) => CssParsingError::TabSize(e.to_shared()),
2921 Self::WhiteSpace(e) => CssParsingError::WhiteSpace(e.to_shared()),
2922 Self::Hyphens(e) => CssParsingError::Hyphens(e.to_shared()),
2923 Self::WordBreak(e) => CssParsingError::WordBreak(e.to_shared()),
2924 Self::OverflowWrap(e) => CssParsingError::OverflowWrap(e.to_shared()),
2925 Self::LineBreak(e) => CssParsingError::LineBreak(e.to_shared()),
2926 Self::ObjectFit(e) => CssParsingError::ObjectFit(e.to_shared()),
2927 Self::ObjectPosition(e) => {
2928 CssParsingError::ObjectPosition(e.to_shared())
2929 }
2930 Self::AspectRatio(e) => CssParsingError::AspectRatio(e.to_shared()),
2931 Self::TextOrientation(e) => {
2932 CssParsingError::TextOrientation(e.to_shared())
2933 }
2934 Self::TextAlignLast(e) => CssParsingError::TextAlignLast(e.to_shared()),
2935 Self::TextTransform(e) => CssParsingError::TextTransform(e.to_shared()),
2936 Self::Direction(e) => CssParsingError::Direction(e.to_shared()),
2937 Self::UserSelect(e) => CssParsingError::UserSelect(e.to_shared()),
2938 Self::TextDecoration(e) => {
2939 CssParsingError::TextDecoration(e.to_shared())
2940 }
2941 Self::Cursor(e) => CssParsingError::Cursor(e.to_shared()),
2942 Self::LayoutDisplay(e) => CssParsingError::LayoutDisplay(e.to_shared()),
2943 Self::LayoutFloat(e) => CssParsingError::LayoutFloat(e.to_shared()),
2944 Self::LayoutBoxSizing(e) => {
2945 CssParsingError::LayoutBoxSizing(e.to_shared())
2946 }
2947 Self::PageBreak(e) => CssParsingError::PageBreak(e.to_shared()),
2949 Self::BreakInside(e) => CssParsingError::BreakInside(e.to_shared()),
2950 Self::Widows(e) => CssParsingError::Widows(e.to_shared()),
2951 Self::Orphans(e) => CssParsingError::Orphans(e.to_shared()),
2952 Self::BoxDecorationBreak(e) => {
2953 CssParsingError::BoxDecorationBreak(e.to_shared())
2954 }
2955 Self::ColumnCount(e) => CssParsingError::ColumnCount(e.to_shared()),
2956 Self::ColumnWidth(e) => CssParsingError::ColumnWidth(e.to_shared()),
2957 Self::ColumnSpan(e) => CssParsingError::ColumnSpan(e.to_shared()),
2958 Self::ColumnFill(e) => CssParsingError::ColumnFill(e.to_shared()),
2959 Self::ColumnRuleWidth(e) => {
2960 CssParsingError::ColumnRuleWidth(e.to_shared())
2961 }
2962 Self::ColumnRuleStyle(e) => {
2963 CssParsingError::ColumnRuleStyle(e.to_shared())
2964 }
2965 Self::ColumnRuleColor(e) => {
2966 CssParsingError::ColumnRuleColor(e.to_shared())
2967 }
2968 Self::FlowInto(e) => CssParsingError::FlowInto(e.to_shared()),
2969 Self::FlowFrom(e) => CssParsingError::FlowFrom(e.to_shared()),
2970 Self::GenericParseError => CssParsingError::GenericParseError,
2971 Self::Content => CssParsingError::Content,
2972 Self::Counter => CssParsingError::Counter,
2973 Self::ListStyleType(e) => CssParsingError::ListStyleType(e.to_shared()),
2974 Self::ListStylePosition(e) => {
2975 CssParsingError::ListStylePosition(e.to_shared())
2976 }
2977 Self::StringSet => CssParsingError::StringSet,
2978 Self::FontWeight(e) => CssParsingError::FontWeight(e.to_shared()),
2979 Self::FontStyle(e) => CssParsingError::FontStyle(e.to_shared()),
2980 Self::VerticalAlign(e) => CssParsingError::VerticalAlign(e.to_shared()),
2981 }
2982 }
2983}
2984
2985#[cfg(feature = "parser")]
2986#[allow(clippy::too_many_lines)] pub fn parse_css_property(
2991 key: CssPropertyType,
2992 value: &str,
2993) -> Result<CssProperty, CssParsingError<'_>> {
2994 use crate::props::style::{
2995 parse_selection_background_color, parse_selection_color, parse_selection_radius,
2996 };
2997
2998 let value = value.trim();
2999
3000 let has_typed_auto = matches!(
3003 key,
3004 CssPropertyType::Hyphens | CssPropertyType::LineBreak | CssPropertyType::TextAlignLast | CssPropertyType::OverflowX |
3008 CssPropertyType::OverflowY |
3009 CssPropertyType::OverflowBlock |
3010 CssPropertyType::OverflowInline |
3011 CssPropertyType::UserSelect | CssPropertyType::AspectRatio );
3014
3015 let has_typed_none = matches!(
3016 key,
3017 CssPropertyType::Hyphens | CssPropertyType::Display | CssPropertyType::UserSelect |
3020 CssPropertyType::Float | CssPropertyType::TextDecoration | CssPropertyType::ObjectFit );
3024
3025 Ok(match value {
3026 "auto" if !has_typed_auto => CssProperty::auto(key),
3027 "none" if !has_typed_none => CssProperty::none(key),
3028 "initial" => CssProperty::initial(key),
3029 "inherit" => CssProperty::inherit(key),
3030 value => match key {
3031 CssPropertyType::CaretColor => parse_caret_color(value)?.into(),
3032 CssPropertyType::CaretWidth => parse_caret_width(value)?.into(),
3033 CssPropertyType::CaretAnimationDuration => {
3034 parse_caret_animation_duration(value)?.into()
3035 }
3036 CssPropertyType::SelectionBackgroundColor => {
3037 parse_selection_background_color(value)?.into()
3038 }
3039 CssPropertyType::SelectionColor => parse_selection_color(value)?.into(),
3040 CssPropertyType::SelectionRadius => parse_selection_radius(value)?.into(),
3041
3042 CssPropertyType::TextColor => parse_style_text_color(value)?.into(),
3043 CssPropertyType::FontSize => {
3044 CssProperty::FontSize(parse_style_font_size(value)?.into())
3045 }
3046 CssPropertyType::FontFamily => parse_style_font_family(value)?.into(),
3047 CssPropertyType::FontWeight => {
3048 CssProperty::FontWeight(parse_font_weight(value)?.into())
3049 }
3050 CssPropertyType::FontStyle => CssProperty::FontStyle(parse_font_style(value)?.into()),
3051 CssPropertyType::TextAlign => parse_style_text_align(value)?.into(),
3052 CssPropertyType::TextJustify => parse_layout_text_justify(value)?.into(),
3053 CssPropertyType::VerticalAlign => parse_style_vertical_align(value)?.into(),
3054 CssPropertyType::LetterSpacing => parse_style_letter_spacing(value)?.into(),
3055 CssPropertyType::TextIndent => parse_style_text_indent(value)?.into(),
3056 CssPropertyType::InitialLetter => parse_style_initial_letter(value)?.into(),
3057 CssPropertyType::LineClamp => parse_style_line_clamp(value)?.into(),
3058 CssPropertyType::HangingPunctuation => parse_style_hanging_punctuation(value)?.into(),
3059 CssPropertyType::TextCombineUpright => parse_style_text_combine_upright(value)?.into(),
3060 CssPropertyType::UnicodeBidi => parse_style_unicode_bidi(value)?.into(),
3061 CssPropertyType::TextBoxTrim => parse_style_text_box_trim(value)?.into(),
3062 CssPropertyType::TextBoxEdge => parse_style_text_box_edge(value)?.into(),
3063 CssPropertyType::DominantBaseline => parse_style_dominant_baseline(value)?.into(),
3064 CssPropertyType::AlignmentBaseline => parse_style_alignment_baseline(value)?.into(),
3065 CssPropertyType::InitialLetterAlign => parse_style_initial_letter_align(value)?.into(),
3066 CssPropertyType::InitialLetterWrap => parse_style_initial_letter_wrap(value)?.into(),
3067 CssPropertyType::ScrollbarGutter => parse_style_scrollbar_gutter(value)?.into(),
3068 CssPropertyType::OverflowClipMargin => parse_style_overflow_clip_margin(value)?.into(),
3069 CssPropertyType::Clip => parse_clip_rect(value)?.into(),
3070 CssPropertyType::ExclusionMargin => parse_style_exclusion_margin(value)?.into(),
3071 CssPropertyType::HyphenationLanguage => parse_style_hyphenation_language(value)?.into(),
3072 CssPropertyType::LineHeight => parse_style_line_height(value)?.into(),
3073 CssPropertyType::WordSpacing => parse_style_word_spacing(value)?.into(),
3074 CssPropertyType::TabSize => parse_style_tab_size(value)?.into(),
3075 CssPropertyType::WhiteSpace => parse_style_white_space(value)?.into(),
3076 CssPropertyType::Hyphens => parse_style_hyphens(value)?.into(),
3077 CssPropertyType::WordBreak => parse_style_word_break(value)?.into(),
3078 CssPropertyType::OverflowWrap => parse_style_overflow_wrap(value)?.into(),
3079 CssPropertyType::LineBreak => parse_style_line_break(value)?.into(),
3080 CssPropertyType::ObjectFit => parse_style_object_fit(value)?.into(),
3081 CssPropertyType::ObjectPosition => parse_style_object_position(value)?.into(),
3082 CssPropertyType::AspectRatio => parse_style_aspect_ratio(value)?.into(),
3083 CssPropertyType::TextOrientation => parse_style_text_orientation(value)?.into(),
3084 CssPropertyType::TextAlignLast => parse_style_text_align_last(value)?.into(),
3085 CssPropertyType::TextTransform => parse_style_text_transform(value)?.into(),
3086 CssPropertyType::Direction => parse_style_direction(value)?.into(),
3087 CssPropertyType::UserSelect => parse_style_user_select(value)?.into(),
3088 CssPropertyType::TextDecoration => parse_style_text_decoration(value)?.into(),
3089 CssPropertyType::Cursor => parse_style_cursor(value)?.into(),
3090
3091 CssPropertyType::Display => parse_layout_display(value)?.into(),
3092 CssPropertyType::Float => parse_layout_float(value)?.into(),
3093 CssPropertyType::BoxSizing => parse_layout_box_sizing(value)?.into(),
3094 CssPropertyType::Width => parse_layout_width(value)?.into(),
3095 CssPropertyType::Height => parse_layout_height(value)?.into(),
3096 CssPropertyType::MinWidth => parse_layout_min_width(value)?.into(),
3097 CssPropertyType::MinHeight => parse_layout_min_height(value)?.into(),
3098 CssPropertyType::MaxWidth => parse_layout_max_width(value)?.into(),
3099 CssPropertyType::MaxHeight => parse_layout_max_height(value)?.into(),
3100 CssPropertyType::Position => parse_layout_position(value)?.into(),
3101 CssPropertyType::Top => parse_layout_top(value)?.into(),
3102 CssPropertyType::Right => parse_layout_right(value)?.into(),
3103 CssPropertyType::Left => parse_layout_left(value)?.into(),
3104 CssPropertyType::Bottom => parse_layout_bottom(value)?.into(),
3105 CssPropertyType::ZIndex => CssProperty::ZIndex(parse_layout_z_index(value)?.into()),
3106
3107 CssPropertyType::FlexWrap => parse_layout_flex_wrap(value)?.into(),
3108 CssPropertyType::FlexDirection => parse_layout_flex_direction(value)?.into(),
3109 CssPropertyType::FlexGrow => parse_layout_flex_grow(value)?.into(),
3110 CssPropertyType::FlexShrink => parse_layout_flex_shrink(value)?.into(),
3111 CssPropertyType::FlexBasis => parse_layout_flex_basis(value)?.into(),
3112 CssPropertyType::JustifyContent => parse_layout_justify_content(value)?.into(),
3113 CssPropertyType::AlignItems => parse_layout_align_items(value)?.into(),
3114 CssPropertyType::AlignContent => parse_layout_align_content(value)?.into(),
3115 CssPropertyType::ColumnGap => parse_layout_column_gap(value)?.into(),
3116 CssPropertyType::RowGap => parse_layout_row_gap(value)?.into(),
3117 CssPropertyType::GridTemplateColumns => {
3118 CssProperty::GridTemplateColumns(parse_grid_template(value)?.into())
3119 }
3120 CssPropertyType::GridTemplateRows => {
3121 CssProperty::GridTemplateRows(parse_grid_template(value)?.into())
3122 }
3123 CssPropertyType::GridAutoColumns => {
3124 let template = parse_grid_template(value)?;
3125 CssProperty::GridAutoColumns(CssPropertyValue::Exact(GridAutoTracks::from(
3126 template,
3127 )))
3128 }
3129 CssPropertyType::GridAutoFlow => {
3130 CssProperty::GridAutoFlow(parse_layout_grid_auto_flow(value)?.into())
3131 }
3132 CssPropertyType::JustifySelf => {
3133 CssProperty::JustifySelf(parse_layout_justify_self(value)?.into())
3134 }
3135 CssPropertyType::JustifyItems => {
3136 CssProperty::JustifyItems(parse_layout_justify_items(value)?.into())
3137 }
3138 CssPropertyType::Gap => {
3139 CssProperty::Gap(parse_layout_gap(value)?.into())
3141 }
3142 CssPropertyType::GridGap => CssProperty::GridGap(parse_layout_gap(value)?.into()),
3143 CssPropertyType::AlignSelf => {
3144 CssProperty::AlignSelf(parse_layout_align_self(value)?.into())
3145 }
3146 CssPropertyType::Font => {
3147 let fam = parse_style_font_family(value)?;
3149 CssProperty::Font(fam.into())
3150 }
3151 CssPropertyType::GridAutoRows => {
3152 let template = parse_grid_template(value)?;
3153 CssProperty::GridAutoRows(CssPropertyValue::Exact(GridAutoTracks::from(template)))
3154 }
3155 CssPropertyType::GridColumn => {
3156 CssProperty::GridColumn(CssPropertyValue::Exact(parse_grid_placement(value)?))
3157 }
3158 CssPropertyType::GridRow => {
3159 CssProperty::GridRow(CssPropertyValue::Exact(parse_grid_placement(value)?))
3160 }
3161 CssPropertyType::GridTemplateAreas => {
3162 use crate::props::layout::grid::parse_grid_template_areas;
3163 let areas = parse_grid_template_areas(value)
3164 .map_err(|()| CssParsingError::InvalidValue(InvalidValueErr(value)))?;
3165 CssProperty::GridTemplateAreas(CssPropertyValue::Exact(areas))
3166 }
3167 CssPropertyType::WritingMode => parse_layout_writing_mode(value)?.into(),
3168 CssPropertyType::Clear => parse_layout_clear(value)?.into(),
3169
3170 CssPropertyType::BackgroundContent => {
3171 parse_style_background_content_multiple(value)?.into()
3172 }
3173 CssPropertyType::BackgroundPosition => {
3174 parse_style_background_position_multiple(value)?.into()
3175 }
3176 CssPropertyType::BackgroundSize => parse_style_background_size_multiple(value)?.into(),
3177 CssPropertyType::BackgroundRepeat => {
3178 parse_style_background_repeat_multiple(value)?.into()
3179 }
3180
3181 CssPropertyType::OverflowX => {
3182 CssProperty::OverflowX(parse_layout_overflow(value)?.into())
3183 }
3184 CssPropertyType::OverflowY => {
3185 CssProperty::OverflowY(parse_layout_overflow(value)?.into())
3186 }
3187 CssPropertyType::OverflowBlock => {
3188 CssProperty::OverflowBlock(parse_layout_overflow(value)?.into())
3189 }
3190 CssPropertyType::OverflowInline => {
3191 CssProperty::OverflowInline(parse_layout_overflow(value)?.into())
3192 }
3193
3194 CssPropertyType::PaddingTop => parse_layout_padding_top(value)?.into(),
3195 CssPropertyType::PaddingLeft => parse_layout_padding_left(value)?.into(),
3196 CssPropertyType::PaddingRight => parse_layout_padding_right(value)?.into(),
3197 CssPropertyType::PaddingBottom => parse_layout_padding_bottom(value)?.into(),
3198 CssPropertyType::PaddingInlineStart => parse_layout_padding_inline_start(value)?.into(),
3199 CssPropertyType::PaddingInlineEnd => parse_layout_padding_inline_end(value)?.into(),
3200
3201 CssPropertyType::MarginTop => parse_layout_margin_top(value)?.into(),
3202 CssPropertyType::MarginLeft => parse_layout_margin_left(value)?.into(),
3203 CssPropertyType::MarginRight => parse_layout_margin_right(value)?.into(),
3204 CssPropertyType::MarginBottom => parse_layout_margin_bottom(value)?.into(),
3205
3206 CssPropertyType::BorderTopLeftRadius => {
3207 parse_style_border_top_left_radius(value)?.into()
3208 }
3209 CssPropertyType::BorderTopRightRadius => {
3210 parse_style_border_top_right_radius(value)?.into()
3211 }
3212 CssPropertyType::BorderBottomLeftRadius => {
3213 parse_style_border_bottom_left_radius(value)?.into()
3214 }
3215 CssPropertyType::BorderBottomRightRadius => {
3216 parse_style_border_bottom_right_radius(value)?.into()
3217 }
3218
3219 CssPropertyType::BorderTopColor => parse_border_top_color(value)?.into(),
3220 CssPropertyType::BorderRightColor => parse_border_right_color(value)?.into(),
3221 CssPropertyType::BorderLeftColor => parse_border_left_color(value)?.into(),
3222 CssPropertyType::BorderBottomColor => parse_border_bottom_color(value)?.into(),
3223
3224 CssPropertyType::BorderTopStyle => parse_border_top_style(value)?.into(),
3225 CssPropertyType::BorderRightStyle => parse_border_right_style(value)?.into(),
3226 CssPropertyType::BorderLeftStyle => parse_border_left_style(value)?.into(),
3227 CssPropertyType::BorderBottomStyle => parse_border_bottom_style(value)?.into(),
3228
3229 CssPropertyType::BorderTopWidth => parse_border_top_width(value)?.into(),
3230 CssPropertyType::BorderRightWidth => parse_border_right_width(value)?.into(),
3231 CssPropertyType::BorderLeftWidth => parse_border_left_width(value)?.into(),
3232 CssPropertyType::BorderBottomWidth => parse_border_bottom_width(value)?.into(),
3233
3234 CssPropertyType::BoxShadowLeft => CssProperty::BoxShadowLeft(CssPropertyValue::Exact(
3235 BoxOrStatic::heap(parse_style_box_shadow(value)?),
3236 )),
3237 CssPropertyType::BoxShadowRight => CssProperty::BoxShadowRight(
3238 CssPropertyValue::Exact(BoxOrStatic::heap(parse_style_box_shadow(value)?)),
3239 ),
3240 CssPropertyType::BoxShadowTop => CssProperty::BoxShadowTop(CssPropertyValue::Exact(
3241 BoxOrStatic::heap(parse_style_box_shadow(value)?),
3242 )),
3243 CssPropertyType::BoxShadowBottom => CssProperty::BoxShadowBottom(
3244 CssPropertyValue::Exact(BoxOrStatic::heap(parse_style_box_shadow(value)?)),
3245 ),
3246
3247 CssPropertyType::ScrollbarTrack => CssProperty::ScrollbarTrack(
3248 CssPropertyValue::Exact(parse_style_background_content(value)?),
3249 ),
3250 CssPropertyType::ScrollbarThumb => CssProperty::ScrollbarThumb(
3251 CssPropertyValue::Exact(parse_style_background_content(value)?),
3252 ),
3253 CssPropertyType::ScrollbarButton => CssProperty::ScrollbarButton(
3254 CssPropertyValue::Exact(parse_style_background_content(value)?),
3255 ),
3256 CssPropertyType::ScrollbarCorner => CssProperty::ScrollbarCorner(
3257 CssPropertyValue::Exact(parse_style_background_content(value)?),
3258 ),
3259 CssPropertyType::ScrollbarResizer => CssProperty::ScrollbarResizer(
3260 CssPropertyValue::Exact(parse_style_background_content(value)?),
3261 ),
3262 CssPropertyType::ScrollbarWidth => parse_layout_scrollbar_width(value)?.into(),
3263 CssPropertyType::ScrollbarColor => parse_style_scrollbar_color(value)?.into(),
3264 CssPropertyType::ScrollbarVisibility => parse_scrollbar_visibility_mode(value)?.into(),
3265 CssPropertyType::ScrollbarFadeDelay => parse_scrollbar_fade_delay(value)?.into(),
3266 CssPropertyType::ScrollbarFadeDuration => parse_scrollbar_fade_duration(value)?.into(),
3267 CssPropertyType::Opacity => parse_style_opacity(value)?.into(),
3268 CssPropertyType::Visibility => parse_style_visibility(value)?.into(),
3269 CssPropertyType::Transform => parse_style_transform_vec(value)?.into(),
3270 CssPropertyType::TransformOrigin => parse_style_transform_origin(value)?.into(),
3271 CssPropertyType::PerspectiveOrigin => parse_style_perspective_origin(value)?.into(),
3272 CssPropertyType::BackfaceVisibility => parse_style_backface_visibility(value)?.into(),
3273
3274 CssPropertyType::MixBlendMode => parse_style_mix_blend_mode(value)?.into(),
3275 CssPropertyType::Filter => CssProperty::Filter(parse_style_filter_vec(value)?.into()),
3276 CssPropertyType::BackdropFilter => {
3277 CssProperty::BackdropFilter(parse_style_filter_vec(value)?.into())
3278 }
3279 CssPropertyType::TextShadow => CssProperty::TextShadow(CssPropertyValue::Exact(
3280 BoxOrStatic::heap(parse_style_box_shadow(value)?),
3281 )),
3282
3283 CssPropertyType::BreakBefore => {
3285 CssProperty::BreakBefore(parse_page_break(value)?.into())
3286 }
3287 CssPropertyType::BreakAfter => CssProperty::BreakAfter(parse_page_break(value)?.into()),
3288 CssPropertyType::BreakInside => {
3289 CssProperty::BreakInside(parse_break_inside(value)?.into())
3290 }
3291 CssPropertyType::Orphans => CssProperty::Orphans(parse_orphans(value)?.into()),
3292 CssPropertyType::Widows => CssProperty::Widows(parse_widows(value)?.into()),
3293 CssPropertyType::BoxDecorationBreak => {
3294 CssProperty::BoxDecorationBreak(parse_box_decoration_break(value)?.into())
3295 }
3296 CssPropertyType::ColumnCount => {
3297 CssProperty::ColumnCount(parse_column_count(value)?.into())
3298 }
3299 CssPropertyType::ColumnWidth => {
3300 CssProperty::ColumnWidth(parse_column_width(value)?.into())
3301 }
3302 CssPropertyType::ColumnSpan => {
3303 CssProperty::ColumnSpan(parse_column_span(value)?.into())
3304 }
3305 CssPropertyType::ColumnFill => {
3306 CssProperty::ColumnFill(parse_column_fill(value)?.into())
3307 }
3308 CssPropertyType::ColumnRuleWidth => {
3309 CssProperty::ColumnRuleWidth(parse_column_rule_width(value)?.into())
3310 }
3311 CssPropertyType::ColumnRuleStyle => {
3312 CssProperty::ColumnRuleStyle(parse_column_rule_style(value)?.into())
3313 }
3314 CssPropertyType::ColumnRuleColor => {
3315 CssProperty::ColumnRuleColor(parse_column_rule_color(value)?.into())
3316 }
3317 CssPropertyType::FlowInto => CssProperty::FlowInto(parse_flow_into(value)?.into()),
3318 CssPropertyType::FlowFrom => CssProperty::FlowFrom(parse_flow_from(value)?.into()),
3319 CssPropertyType::ShapeOutside => CssProperty::ShapeOutside(CssPropertyValue::Exact(
3320 parse_shape_outside(value).map_err(|_| CssParsingError::GenericParseError)?,
3321 )),
3322 CssPropertyType::ShapeInside => CssProperty::ShapeInside(CssPropertyValue::Exact(
3323 parse_shape_inside(value).map_err(|_| CssParsingError::GenericParseError)?,
3324 )),
3325 CssPropertyType::ClipPath => CssProperty::ClipPath(CssPropertyValue::Exact(
3326 parse_clip_path(value).map_err(|_| CssParsingError::GenericParseError)?,
3327 )),
3328 CssPropertyType::ShapeMargin => {
3329 CssProperty::ShapeMargin(parse_shape_margin(value)?.into())
3330 }
3331 CssPropertyType::ShapeImageThreshold => CssProperty::ShapeImageThreshold(
3332 parse_shape_image_threshold(value)
3333 .map_err(|_| CssParsingError::GenericParseError)?
3334 .into(),
3335 ),
3336 CssPropertyType::Content => CssProperty::Content(
3337 parse_content(value)
3338 .map_err(|()| CssParsingError::Content)?
3339 .into(),
3340 ),
3341 CssPropertyType::CounterReset => CssProperty::CounterReset(
3342 parse_counter_reset(value)
3343 .map_err(|()| CssParsingError::Counter)?
3344 .into(),
3345 ),
3346 CssPropertyType::CounterIncrement => CssProperty::CounterIncrement(
3347 parse_counter_increment(value)
3348 .map_err(|()| CssParsingError::Counter)?
3349 .into(),
3350 ),
3351 CssPropertyType::ListStyleType => CssProperty::ListStyleType(
3352 parse_style_list_style_type(value)
3353 .map_err(CssParsingError::ListStyleType)?
3354 .into(),
3355 ),
3356 CssPropertyType::ListStylePosition => CssProperty::ListStylePosition(
3357 parse_style_list_style_position(value)
3358 .map_err(CssParsingError::ListStylePosition)?
3359 .into(),
3360 ),
3361 CssPropertyType::StringSet => CssProperty::StringSet(
3362 parse_string_set(value)
3363 .map_err(|()| CssParsingError::StringSet)?
3364 .into(),
3365 ),
3366 CssPropertyType::TableLayout => CssProperty::TableLayout(
3367 parse_table_layout(value)
3368 .map_err(|_| CssParsingError::GenericParseError)?
3369 .into(),
3370 ),
3371 CssPropertyType::BorderCollapse => CssProperty::BorderCollapse(
3372 parse_border_collapse(value)
3373 .map_err(|_| CssParsingError::GenericParseError)?
3374 .into(),
3375 ),
3376 CssPropertyType::BorderSpacing => CssProperty::BorderSpacing(
3377 parse_border_spacing(value)
3378 .map_err(|_| CssParsingError::GenericParseError)?
3379 .into(),
3380 ),
3381 CssPropertyType::CaptionSide => CssProperty::CaptionSide(
3382 parse_caption_side(value)
3383 .map_err(|_| CssParsingError::GenericParseError)?
3384 .into(),
3385 ),
3386 CssPropertyType::EmptyCells => CssProperty::EmptyCells(
3387 parse_empty_cells(value)
3388 .map_err(|_| CssParsingError::GenericParseError)?
3389 .into(),
3390 ),
3391 },
3392 })
3393}
3394
3395#[cfg(feature = "parser")]
3424#[allow(clippy::too_many_lines)] pub fn parse_combined_css_property(
3429 key: CombinedCssPropertyType,
3430 value: &str,
3431) -> Result<Vec<CssProperty>, CssParsingError<'_>> {
3432 use self::CombinedCssPropertyType::{BorderRadius, Overflow, Padding, Margin, Border, BorderLeft, BorderRight, BorderTop, BorderBottom, BorderColor, BorderStyle, BorderWidth, BoxShadow, BackgroundColor, BackgroundImage, Background, Flex, Grid, Gap, GridGap, Font, Columns, GridArea, ColumnRule, TextBox, InsetBlock, InsetInline};
3433
3434 macro_rules! convert_value {
3435 ($thing:expr, $prop_type:ident, $wrapper:ident) => {
3436 match $thing {
3437 PixelValueWithAuto::None => CssProperty::none(CssPropertyType::$prop_type),
3438 PixelValueWithAuto::Initial => CssProperty::initial(CssPropertyType::$prop_type),
3439 PixelValueWithAuto::Inherit => CssProperty::inherit(CssPropertyType::$prop_type),
3440 PixelValueWithAuto::Auto => CssProperty::auto(CssPropertyType::$prop_type),
3441 PixelValueWithAuto::Exact(x) => {
3442 CssProperty::$prop_type($wrapper { inner: x }.into())
3443 }
3444 }
3445 };
3446 }
3447
3448 let keys = match key {
3449 BorderRadius => {
3450 vec![
3451 CssPropertyType::BorderTopLeftRadius,
3452 CssPropertyType::BorderTopRightRadius,
3453 CssPropertyType::BorderBottomLeftRadius,
3454 CssPropertyType::BorderBottomRightRadius,
3455 ]
3456 }
3457 Overflow => {
3458 vec![CssPropertyType::OverflowX, CssPropertyType::OverflowY]
3459 }
3460 Padding => {
3461 vec![
3462 CssPropertyType::PaddingTop,
3463 CssPropertyType::PaddingBottom,
3464 CssPropertyType::PaddingLeft,
3465 CssPropertyType::PaddingRight,
3466 ]
3467 }
3468 Margin => {
3469 vec![
3470 CssPropertyType::MarginTop,
3471 CssPropertyType::MarginBottom,
3472 CssPropertyType::MarginLeft,
3473 CssPropertyType::MarginRight,
3474 ]
3475 }
3476 Border => {
3477 vec![
3478 CssPropertyType::BorderTopColor,
3479 CssPropertyType::BorderRightColor,
3480 CssPropertyType::BorderLeftColor,
3481 CssPropertyType::BorderBottomColor,
3482 CssPropertyType::BorderTopStyle,
3483 CssPropertyType::BorderRightStyle,
3484 CssPropertyType::BorderLeftStyle,
3485 CssPropertyType::BorderBottomStyle,
3486 CssPropertyType::BorderTopWidth,
3487 CssPropertyType::BorderRightWidth,
3488 CssPropertyType::BorderLeftWidth,
3489 CssPropertyType::BorderBottomWidth,
3490 ]
3491 }
3492 BorderLeft => {
3493 vec![
3494 CssPropertyType::BorderLeftColor,
3495 CssPropertyType::BorderLeftStyle,
3496 CssPropertyType::BorderLeftWidth,
3497 ]
3498 }
3499 BorderRight => {
3500 vec![
3501 CssPropertyType::BorderRightColor,
3502 CssPropertyType::BorderRightStyle,
3503 CssPropertyType::BorderRightWidth,
3504 ]
3505 }
3506 BorderTop => {
3507 vec![
3508 CssPropertyType::BorderTopColor,
3509 CssPropertyType::BorderTopStyle,
3510 CssPropertyType::BorderTopWidth,
3511 ]
3512 }
3513 BorderBottom => {
3514 vec![
3515 CssPropertyType::BorderBottomColor,
3516 CssPropertyType::BorderBottomStyle,
3517 CssPropertyType::BorderBottomWidth,
3518 ]
3519 }
3520 BorderColor => {
3521 vec![
3522 CssPropertyType::BorderTopColor,
3523 CssPropertyType::BorderRightColor,
3524 CssPropertyType::BorderBottomColor,
3525 CssPropertyType::BorderLeftColor,
3526 ]
3527 }
3528 BorderStyle => {
3529 vec![
3530 CssPropertyType::BorderTopStyle,
3531 CssPropertyType::BorderRightStyle,
3532 CssPropertyType::BorderBottomStyle,
3533 CssPropertyType::BorderLeftStyle,
3534 ]
3535 }
3536 BorderWidth => {
3537 vec![
3538 CssPropertyType::BorderTopWidth,
3539 CssPropertyType::BorderRightWidth,
3540 CssPropertyType::BorderBottomWidth,
3541 CssPropertyType::BorderLeftWidth,
3542 ]
3543 }
3544 BoxShadow => {
3545 vec![
3546 CssPropertyType::BoxShadowLeft,
3547 CssPropertyType::BoxShadowRight,
3548 CssPropertyType::BoxShadowTop,
3549 CssPropertyType::BoxShadowBottom,
3550 ]
3551 }
3552 BackgroundColor | BackgroundImage | Background => {
3553 vec![CssPropertyType::BackgroundContent]
3554 }
3555 Flex => {
3556 vec![
3557 CssPropertyType::FlexGrow,
3558 CssPropertyType::FlexShrink,
3559 CssPropertyType::FlexBasis,
3560 ]
3561 }
3562 Grid => {
3563 vec![
3564 CssPropertyType::GridTemplateColumns,
3565 CssPropertyType::GridTemplateRows,
3566 ]
3567 }
3568 Gap | GridGap => {
3569 vec![CssPropertyType::RowGap, CssPropertyType::ColumnGap]
3570 }
3571 Font => {
3572 vec![CssPropertyType::Font]
3573 }
3574 Columns => {
3575 vec![CssPropertyType::ColumnWidth, CssPropertyType::ColumnCount]
3576 }
3577 GridArea => {
3578 vec![CssPropertyType::GridRow, CssPropertyType::GridColumn]
3579 }
3580 ColumnRule => {
3581 vec![
3582 CssPropertyType::ColumnRuleWidth,
3583 CssPropertyType::ColumnRuleStyle,
3584 CssPropertyType::ColumnRuleColor,
3585 ]
3586 }
3587 TextBox => {
3588 vec![CssPropertyType::TextBoxTrim, CssPropertyType::TextBoxEdge]
3589 }
3590 InsetBlock => {
3594 vec![CssPropertyType::Top, CssPropertyType::Bottom]
3595 }
3596 InsetInline => {
3597 vec![CssPropertyType::Left, CssPropertyType::Right]
3598 }
3599 };
3600
3601 let has_typed_auto = matches!(key, Overflow);
3604 let has_typed_none = false; match value {
3607 "auto" if !has_typed_auto => return Ok(keys.into_iter().map(CssProperty::auto).collect()),
3608 "none" if !has_typed_none => return Ok(keys.into_iter().map(CssProperty::none).collect()),
3609 "initial" => {
3610 return Ok(keys.into_iter().map(CssProperty::initial).collect());
3611 }
3612 "inherit" => {
3613 return Ok(keys.into_iter().map(CssProperty::inherit).collect());
3614 }
3615 _ => {}
3616 }
3617
3618 match key {
3619 BorderRadius => {
3620 let border_radius = parse_style_border_radius(value)?;
3621 Ok(vec![
3622 CssProperty::BorderTopLeftRadius(
3623 StyleBorderTopLeftRadius {
3624 inner: border_radius.top_left,
3625 }
3626 .into(),
3627 ),
3628 CssProperty::BorderTopRightRadius(
3629 StyleBorderTopRightRadius {
3630 inner: border_radius.top_right,
3631 }
3632 .into(),
3633 ),
3634 CssProperty::BorderBottomLeftRadius(
3635 StyleBorderBottomLeftRadius {
3636 inner: border_radius.bottom_left,
3637 }
3638 .into(),
3639 ),
3640 CssProperty::BorderBottomRightRadius(
3641 StyleBorderBottomRightRadius {
3642 inner: border_radius.bottom_right,
3643 }
3644 .into(),
3645 ),
3646 ])
3647 }
3648 Overflow => {
3650 let parts: Vec<&str> = value.split_whitespace().collect();
3651 match parts.len() {
3652 1 => {
3653 let overflow = parse_layout_overflow(value)?;
3654 Ok(vec![
3655 CssProperty::OverflowX(overflow.into()),
3656 CssProperty::OverflowY(overflow.into()),
3657 ])
3658 }
3659 2 => {
3660 let overflow_x = parse_layout_overflow(parts[0])?;
3661 let overflow_y = parse_layout_overflow(parts[1])?;
3662 Ok(vec![
3663 CssProperty::OverflowX(overflow_x.into()),
3664 CssProperty::OverflowY(overflow_y.into()),
3665 ])
3666 }
3667 _ => Err(CssParsingError::InvalidValue(InvalidValueErr(value))),
3668 }
3669 }
3670 Padding => {
3671 let padding = parse_layout_padding(value)?;
3672 Ok(vec![
3673 convert_value!(padding.top, PaddingTop, LayoutPaddingTop),
3674 convert_value!(padding.bottom, PaddingBottom, LayoutPaddingBottom),
3675 convert_value!(padding.left, PaddingLeft, LayoutPaddingLeft),
3676 convert_value!(padding.right, PaddingRight, LayoutPaddingRight),
3677 ])
3678 }
3679 Margin => {
3680 let margin = parse_layout_margin(value)?;
3681 Ok(vec![
3682 convert_value!(margin.top, MarginTop, LayoutMarginTop),
3683 convert_value!(margin.bottom, MarginBottom, LayoutMarginBottom),
3684 convert_value!(margin.left, MarginLeft, LayoutMarginLeft),
3685 convert_value!(margin.right, MarginRight, LayoutMarginRight),
3686 ])
3687 }
3688 Border => {
3689 let border = parse_style_border(value)?;
3690 Ok(vec![
3691 CssProperty::BorderTopColor(
3692 StyleBorderTopColor {
3693 inner: border.border_color,
3694 }
3695 .into(),
3696 ),
3697 CssProperty::BorderRightColor(
3698 StyleBorderRightColor {
3699 inner: border.border_color,
3700 }
3701 .into(),
3702 ),
3703 CssProperty::BorderLeftColor(
3704 StyleBorderLeftColor {
3705 inner: border.border_color,
3706 }
3707 .into(),
3708 ),
3709 CssProperty::BorderBottomColor(
3710 StyleBorderBottomColor {
3711 inner: border.border_color,
3712 }
3713 .into(),
3714 ),
3715 CssProperty::BorderTopStyle(
3716 StyleBorderTopStyle {
3717 inner: border.border_style,
3718 }
3719 .into(),
3720 ),
3721 CssProperty::BorderRightStyle(
3722 StyleBorderRightStyle {
3723 inner: border.border_style,
3724 }
3725 .into(),
3726 ),
3727 CssProperty::BorderLeftStyle(
3728 StyleBorderLeftStyle {
3729 inner: border.border_style,
3730 }
3731 .into(),
3732 ),
3733 CssProperty::BorderBottomStyle(
3734 StyleBorderBottomStyle {
3735 inner: border.border_style,
3736 }
3737 .into(),
3738 ),
3739 CssProperty::BorderTopWidth(
3740 LayoutBorderTopWidth {
3741 inner: border.border_width,
3742 }
3743 .into(),
3744 ),
3745 CssProperty::BorderRightWidth(
3746 LayoutBorderRightWidth {
3747 inner: border.border_width,
3748 }
3749 .into(),
3750 ),
3751 CssProperty::BorderLeftWidth(
3752 LayoutBorderLeftWidth {
3753 inner: border.border_width,
3754 }
3755 .into(),
3756 ),
3757 CssProperty::BorderBottomWidth(
3758 LayoutBorderBottomWidth {
3759 inner: border.border_width,
3760 }
3761 .into(),
3762 ),
3763 ])
3764 }
3765 BorderLeft => {
3766 let border = parse_style_border(value)?;
3767 Ok(vec![
3768 CssProperty::BorderLeftColor(
3769 StyleBorderLeftColor {
3770 inner: border.border_color,
3771 }
3772 .into(),
3773 ),
3774 CssProperty::BorderLeftStyle(
3775 StyleBorderLeftStyle {
3776 inner: border.border_style,
3777 }
3778 .into(),
3779 ),
3780 CssProperty::BorderLeftWidth(
3781 LayoutBorderLeftWidth {
3782 inner: border.border_width,
3783 }
3784 .into(),
3785 ),
3786 ])
3787 }
3788 BorderRight => {
3789 let border = parse_style_border(value)?;
3790 Ok(vec![
3791 CssProperty::BorderRightColor(
3792 StyleBorderRightColor {
3793 inner: border.border_color,
3794 }
3795 .into(),
3796 ),
3797 CssProperty::BorderRightStyle(
3798 StyleBorderRightStyle {
3799 inner: border.border_style,
3800 }
3801 .into(),
3802 ),
3803 CssProperty::BorderRightWidth(
3804 LayoutBorderRightWidth {
3805 inner: border.border_width,
3806 }
3807 .into(),
3808 ),
3809 ])
3810 }
3811 BorderTop => {
3812 let border = parse_style_border(value)?;
3813 Ok(vec![
3814 CssProperty::BorderTopColor(
3815 StyleBorderTopColor {
3816 inner: border.border_color,
3817 }
3818 .into(),
3819 ),
3820 CssProperty::BorderTopStyle(
3821 StyleBorderTopStyle {
3822 inner: border.border_style,
3823 }
3824 .into(),
3825 ),
3826 CssProperty::BorderTopWidth(
3827 LayoutBorderTopWidth {
3828 inner: border.border_width,
3829 }
3830 .into(),
3831 ),
3832 ])
3833 }
3834 BorderBottom => {
3835 let border = parse_style_border(value)?;
3836 Ok(vec![
3837 CssProperty::BorderBottomColor(
3838 StyleBorderBottomColor {
3839 inner: border.border_color,
3840 }
3841 .into(),
3842 ),
3843 CssProperty::BorderBottomStyle(
3844 StyleBorderBottomStyle {
3845 inner: border.border_style,
3846 }
3847 .into(),
3848 ),
3849 CssProperty::BorderBottomWidth(
3850 LayoutBorderBottomWidth {
3851 inner: border.border_width,
3852 }
3853 .into(),
3854 ),
3855 ])
3856 }
3857 BorderColor => {
3858 let colors = parse_style_border_color(value)?;
3859 Ok(vec![
3860 CssProperty::BorderTopColor(StyleBorderTopColor { inner: colors.top }.into()),
3861 CssProperty::BorderRightColor(
3862 StyleBorderRightColor {
3863 inner: colors.right,
3864 }
3865 .into(),
3866 ),
3867 CssProperty::BorderBottomColor(
3868 StyleBorderBottomColor {
3869 inner: colors.bottom,
3870 }
3871 .into(),
3872 ),
3873 CssProperty::BorderLeftColor(StyleBorderLeftColor { inner: colors.left }.into()),
3874 ])
3875 }
3876 BorderStyle => {
3877 let styles = parse_style_border_style(value)?;
3878 Ok(vec![
3879 CssProperty::BorderTopStyle(StyleBorderTopStyle { inner: styles.top }.into()),
3880 CssProperty::BorderRightStyle(
3881 StyleBorderRightStyle {
3882 inner: styles.right,
3883 }
3884 .into(),
3885 ),
3886 CssProperty::BorderBottomStyle(
3887 StyleBorderBottomStyle {
3888 inner: styles.bottom,
3889 }
3890 .into(),
3891 ),
3892 CssProperty::BorderLeftStyle(StyleBorderLeftStyle { inner: styles.left }.into()),
3893 ])
3894 }
3895 BorderWidth => {
3896 let widths = parse_style_border_width(value)?;
3897 Ok(vec![
3898 CssProperty::BorderTopWidth(LayoutBorderTopWidth { inner: widths.top }.into()),
3899 CssProperty::BorderRightWidth(
3900 LayoutBorderRightWidth {
3901 inner: widths.right,
3902 }
3903 .into(),
3904 ),
3905 CssProperty::BorderBottomWidth(
3906 LayoutBorderBottomWidth {
3907 inner: widths.bottom,
3908 }
3909 .into(),
3910 ),
3911 CssProperty::BorderLeftWidth(LayoutBorderLeftWidth { inner: widths.left }.into()),
3912 ])
3913 }
3914 BoxShadow => {
3915 let box_shadow = parse_style_box_shadow(value)?;
3916 Ok(vec![
3917 CssProperty::BoxShadowLeft(CssPropertyValue::Exact(BoxOrStatic::heap(box_shadow))),
3918 CssProperty::BoxShadowRight(CssPropertyValue::Exact(BoxOrStatic::heap(box_shadow))),
3919 CssProperty::BoxShadowTop(CssPropertyValue::Exact(BoxOrStatic::heap(box_shadow))),
3920 CssProperty::BoxShadowBottom(CssPropertyValue::Exact(BoxOrStatic::heap(
3921 box_shadow,
3922 ))),
3923 ])
3924 }
3925 BackgroundColor => {
3926 let color = parse_css_color(value)?;
3927 let vec: StyleBackgroundContentVec = vec![StyleBackgroundContent::Color(color)].into();
3928 Ok(vec![CssProperty::BackgroundContent(
3929 CssPropertyValue::Exact(vec),
3930 )])
3931 }
3932 BackgroundImage => {
3933 let background_content = parse_style_background_content(value)?;
3934 let vec: StyleBackgroundContentVec = vec![background_content].into();
3935 Ok(vec![CssProperty::BackgroundContent(
3936 CssPropertyValue::Exact(vec),
3937 )])
3938 }
3939 Background => {
3940 let background_content = parse_style_background_content_multiple(value)?;
3941 Ok(vec![CssProperty::BackgroundContent(
3942 CssPropertyValue::Exact(background_content),
3943 )])
3944 }
3945 Flex => {
3946 let parts: Vec<&str> = value.split_whitespace().collect();
3948 if parts.len() == 1 && parts[0] == "none" {
3949 return Ok(vec![
3950 CssProperty::FlexGrow(
3951 LayoutFlexGrow {
3952 inner: crate::props::basic::length::FloatValue::const_new(0),
3953 }
3954 .into(),
3955 ),
3956 CssProperty::FlexShrink(
3957 LayoutFlexShrink {
3958 inner: crate::props::basic::length::FloatValue::const_new(0),
3959 }
3960 .into(),
3961 ),
3962 CssProperty::FlexBasis(LayoutFlexBasis::Auto.into()),
3963 ]);
3964 }
3965 if parts.len() == 1 {
3966 if let Ok(g) = parse_layout_flex_grow(parts[0]) {
3968 return Ok(vec![
3969 CssProperty::FlexGrow(g.into()),
3970 CssProperty::FlexShrink(
3971 LayoutFlexShrink {
3972 inner: crate::props::basic::length::FloatValue::const_new(1),
3973 }
3974 .into(),
3975 ),
3976 CssProperty::FlexBasis(
3977 LayoutFlexBasis::Exact(PixelValue::px(0.0))
3978 .into(),
3979 ),
3980 ]);
3981 }
3982 if let Ok(b) = parse_layout_flex_basis(parts[0]) {
3983 return Ok(vec![CssProperty::FlexBasis(b.into())]);
3984 }
3985 }
3986 if parts.len() == 2 {
3987 if let (Ok(g), Ok(s)) = (
3990 parse_layout_flex_grow(parts[0]),
3991 parse_layout_flex_shrink(parts[1]),
3992 ) {
3993 return Ok(vec![
3994 CssProperty::FlexGrow(g.into()),
3995 CssProperty::FlexShrink(s.into()),
3996 CssProperty::FlexBasis(
3997 LayoutFlexBasis::Exact(PixelValue::px(0.0))
3998 .into(),
3999 ),
4000 ]);
4001 }
4002 if let (Ok(g), Ok(b)) = (
4004 parse_layout_flex_grow(parts[0]),
4005 parse_layout_flex_basis(parts[1]),
4006 ) {
4007 return Ok(vec![
4008 CssProperty::FlexGrow(g.into()),
4009 CssProperty::FlexShrink(
4010 LayoutFlexShrink {
4011 inner: crate::props::basic::length::FloatValue::const_new(1),
4012 }
4013 .into(),
4014 ),
4015 CssProperty::FlexBasis(b.into()),
4016 ]);
4017 }
4018 }
4019 if parts.len() == 3 {
4020 let g = parse_layout_flex_grow(parts[0])?;
4021 let s = parse_layout_flex_shrink(parts[1])?;
4022 let b = parse_layout_flex_basis(parts[2])?;
4023 return Ok(vec![
4024 CssProperty::FlexGrow(g.into()),
4025 CssProperty::FlexShrink(s.into()),
4026 CssProperty::FlexBasis(b.into()),
4027 ]);
4028 }
4029 Err(CssParsingError::InvalidValue(InvalidValueErr(value)))
4030 }
4031 Grid => {
4032 let tpl = parse_grid_template(value)?;
4034 Ok(vec![
4035 CssProperty::GridTemplateColumns(tpl.clone().into()),
4036 CssProperty::GridTemplateRows(tpl.into()),
4037 ])
4038 }
4039 Gap => {
4040 let parts: Vec<&str> = value.split_whitespace().collect();
4041 if parts.len() == 1 {
4042 let g = parse_layout_gap(parts[0])?;
4043 Ok(vec![
4044 CssProperty::RowGap(LayoutRowGap { inner: g.inner }.into()),
4045 CssProperty::ColumnGap(LayoutColumnGap { inner: g.inner }.into()),
4046 ])
4047 } else if parts.len() == 2 {
4048 let row = parse_layout_gap(parts[0])?;
4049 let col = parse_layout_gap(parts[1])?;
4050 Ok(vec![
4051 CssProperty::RowGap(LayoutRowGap { inner: row.inner }.into()),
4052 CssProperty::ColumnGap(LayoutColumnGap { inner: col.inner }.into()),
4053 ])
4054 } else {
4055 Err(CssParsingError::InvalidValue(InvalidValueErr(value)))
4056 }
4057 }
4058 GridGap => {
4059 let parts: Vec<&str> = value.split_whitespace().collect();
4060 if parts.len() == 1 {
4061 let g = parse_layout_gap(parts[0])?;
4062 Ok(vec![
4063 CssProperty::RowGap(LayoutRowGap { inner: g.inner }.into()),
4064 CssProperty::ColumnGap(LayoutColumnGap { inner: g.inner }.into()),
4065 ])
4066 } else if parts.len() == 2 {
4067 let row = parse_layout_gap(parts[0])?;
4068 let col = parse_layout_gap(parts[1])?;
4069 Ok(vec![
4070 CssProperty::RowGap(LayoutRowGap { inner: row.inner }.into()),
4071 CssProperty::ColumnGap(LayoutColumnGap { inner: col.inner }.into()),
4072 ])
4073 } else {
4074 Err(CssParsingError::InvalidValue(InvalidValueErr(value)))
4075 }
4076 }
4077 Font => {
4078 let fam = parse_style_font_family(value)?;
4079 Ok(vec![CssProperty::Font(fam.into())])
4080 }
4081 Columns => {
4082 let mut props = Vec::new();
4083 for part in value.split_whitespace() {
4084 if let Ok(width) = parse_column_width(part) {
4085 props.push(CssProperty::ColumnWidth(width.into()));
4086 } else if let Ok(count) = parse_column_count(part) {
4087 props.push(CssProperty::ColumnCount(count.into()));
4088 } else {
4089 return Err(CssParsingError::InvalidValue(InvalidValueErr(value)));
4090 }
4091 }
4092 Ok(props)
4093 }
4094 GridArea => {
4095 let parts: Vec<&str> = value.split('/').map(str::trim).collect();
4102 let (row_start, col_start, row_end, col_end) = match parts.len() {
4103 1 => (parts[0], parts[0], parts[0], parts[0]),
4104 2 => (parts[0], parts[1], parts[0], parts[1]),
4105 3 => (parts[0], parts[1], parts[2], parts[1]),
4106 4 => (parts[0], parts[1], parts[2], parts[3]),
4107 _ => return Err(CssParsingError::InvalidValue(InvalidValueErr(value))),
4108 };
4109 let parse_line = |s: &str| -> Result<GridLine, CssParsingError<'_>> {
4110 parse_grid_line_owned(s.trim())
4111 .map_err(|()| CssParsingError::InvalidValue(InvalidValueErr(value)))
4112 };
4113 Ok(vec![
4114 CssProperty::GridRow(CssPropertyValue::Exact(GridPlacement {
4115 grid_start: parse_line(row_start)?,
4116 grid_end: parse_line(row_end)?,
4117 })),
4118 CssProperty::GridColumn(CssPropertyValue::Exact(GridPlacement {
4119 grid_start: parse_line(col_start)?,
4120 grid_end: parse_line(col_end)?,
4121 })),
4122 ])
4123 }
4124 ColumnRule => {
4125 let border = parse_style_border(value)?;
4126 Ok(vec![
4127 CssProperty::ColumnRuleWidth(
4128 ColumnRuleWidth {
4129 inner: border.border_width,
4130 }
4131 .into(),
4132 ),
4133 CssProperty::ColumnRuleStyle(
4134 ColumnRuleStyle {
4135 inner: border.border_style,
4136 }
4137 .into(),
4138 ),
4139 CssProperty::ColumnRuleColor(
4140 ColumnRuleColor {
4141 inner: border.border_color,
4142 }
4143 .into(),
4144 ),
4145 ])
4146 }
4147 TextBox => {
4150 let trimmed = value.trim();
4151 if trimmed == "normal" {
4152 return Ok(vec![
4153 CssProperty::TextBoxTrim(CssPropertyValue::Exact(StyleTextBoxTrim::None)),
4154 CssProperty::TextBoxEdge(CssPropertyValue::Exact(StyleTextBoxEdge::Auto)),
4155 ]);
4156 }
4157 let parts: Vec<&str> = trimmed.split_whitespace().collect();
4158 let mut trim_val = None;
4159 let mut edge_val = None;
4160 for part in &parts {
4161 if let Ok(t) = parse_style_text_box_trim(part) {
4162 trim_val = Some(t);
4163 } else if let Ok(e) = parse_style_text_box_edge(part) {
4164 edge_val = Some(e);
4165 } else {
4166 return Err(CssParsingError::InvalidValue(InvalidValueErr(value)));
4167 }
4168 }
4169 let trim = trim_val.unwrap_or(StyleTextBoxTrim::TrimBoth);
4171 let edge = edge_val.unwrap_or(StyleTextBoxEdge::Auto);
4173 Ok(vec![
4174 CssProperty::TextBoxTrim(CssPropertyValue::Exact(trim)),
4175 CssProperty::TextBoxEdge(CssPropertyValue::Exact(edge)),
4176 ])
4177 }
4178 InsetBlock => {
4181 let parts: Vec<&str> = value.split_whitespace().collect();
4182 let start_val = parts
4183 .first()
4184 .ok_or(CssParsingError::InvalidValue(InvalidValueErr(value)))?;
4185 let end_val = parts.get(1).unwrap_or(start_val);
4186 let start = parse_layout_top(start_val)?;
4187 let end = parse_layout_bottom(end_val)?;
4188 Ok(vec![
4189 CssProperty::Top(start.into()),
4190 CssProperty::Bottom(end.into()),
4191 ])
4192 }
4193 InsetInline => {
4196 let parts: Vec<&str> = value.split_whitespace().collect();
4197 let start_val = parts
4198 .first()
4199 .ok_or(CssParsingError::InvalidValue(InvalidValueErr(value)))?;
4200 let end_val = parts.get(1).unwrap_or(start_val);
4201 let start = parse_layout_left(start_val)?;
4202 let end = parse_layout_right(end_val)?;
4203 Ok(vec![
4204 CssProperty::Left(start.into()),
4205 CssProperty::Right(end.into()),
4206 ])
4207 }
4208 }
4209}
4210
4211macro_rules! impl_from_css_prop {
4213 ($a:ident, $b:ident:: $enum_type:ident) => {
4214 impl From<$a> for $b {
4215 fn from(e: $a) -> Self {
4216 $b::$enum_type(CssPropertyValue::from(e))
4217 }
4218 }
4219 };
4220}
4221
4222impl_from_css_prop!(CaretColor, CssProperty::CaretColor);
4223impl_from_css_prop!(CaretWidth, CssProperty::CaretWidth);
4224impl_from_css_prop!(CaretAnimationDuration, CssProperty::CaretAnimationDuration);
4225impl_from_css_prop!(
4226 SelectionBackgroundColor,
4227 CssProperty::SelectionBackgroundColor
4228);
4229impl_from_css_prop!(SelectionColor, CssProperty::SelectionColor);
4230impl_from_css_prop!(SelectionRadius, CssProperty::SelectionRadius);
4231impl_from_css_prop!(StyleTextColor, CssProperty::TextColor);
4232impl_from_css_prop!(StyleFontSize, CssProperty::FontSize);
4233impl_from_css_prop!(StyleFontFamilyVec, CssProperty::FontFamily);
4234impl_from_css_prop!(StyleTextAlign, CssProperty::TextAlign);
4235impl_from_css_prop!(LayoutTextJustify, CssProperty::TextJustify);
4236impl_from_css_prop!(StyleVerticalAlign, CssProperty::VerticalAlign);
4237impl_from_css_prop!(StyleLetterSpacing, CssProperty::LetterSpacing);
4238impl_from_css_prop!(StyleTextIndent, CssProperty::TextIndent);
4239impl_from_css_prop!(StyleInitialLetter, CssProperty::InitialLetter);
4240impl_from_css_prop!(StyleLineClamp, CssProperty::LineClamp);
4241impl_from_css_prop!(StyleHangingPunctuation, CssProperty::HangingPunctuation);
4242impl_from_css_prop!(StyleTextCombineUpright, CssProperty::TextCombineUpright);
4243impl_from_css_prop!(StyleUnicodeBidi, CssProperty::UnicodeBidi);
4244impl_from_css_prop!(StyleTextBoxTrim, CssProperty::TextBoxTrim);
4245impl_from_css_prop!(StyleTextBoxEdge, CssProperty::TextBoxEdge);
4246impl_from_css_prop!(StyleDominantBaseline, CssProperty::DominantBaseline);
4247impl_from_css_prop!(StyleAlignmentBaseline, CssProperty::AlignmentBaseline);
4248impl_from_css_prop!(StyleInitialLetterAlign, CssProperty::InitialLetterAlign);
4249impl_from_css_prop!(StyleInitialLetterWrap, CssProperty::InitialLetterWrap);
4250impl_from_css_prop!(StyleScrollbarGutter, CssProperty::ScrollbarGutter);
4251impl_from_css_prop!(StyleOverflowClipMargin, CssProperty::OverflowClipMargin);
4252impl_from_css_prop!(StyleClipRect, CssProperty::Clip);
4253impl_from_css_prop!(StyleExclusionMargin, CssProperty::ExclusionMargin);
4254impl_from_css_prop!(StyleHyphenationLanguage, CssProperty::HyphenationLanguage);
4255impl_from_css_prop!(StyleLineHeight, CssProperty::LineHeight);
4256impl_from_css_prop!(StyleWordSpacing, CssProperty::WordSpacing);
4257impl_from_css_prop!(StyleTabSize, CssProperty::TabSize);
4258impl_from_css_prop!(StyleCursor, CssProperty::Cursor);
4259impl_from_css_prop!(LayoutDisplay, CssProperty::Display);
4260impl_from_css_prop!(LayoutFloat, CssProperty::Float);
4261impl_from_css_prop!(LayoutBoxSizing, CssProperty::BoxSizing);
4262impl_from_css_prop!(LayoutWidth, CssProperty::Width);
4263impl_from_css_prop!(LayoutHeight, CssProperty::Height);
4264impl_from_css_prop!(LayoutMinWidth, CssProperty::MinWidth);
4265impl_from_css_prop!(LayoutMinHeight, CssProperty::MinHeight);
4266impl_from_css_prop!(LayoutMaxWidth, CssProperty::MaxWidth);
4267impl_from_css_prop!(LayoutMaxHeight, CssProperty::MaxHeight);
4268impl_from_css_prop!(LayoutPosition, CssProperty::Position);
4269impl_from_css_prop!(LayoutTop, CssProperty::Top);
4270impl_from_css_prop!(LayoutRight, CssProperty::Right);
4271impl_from_css_prop!(LayoutLeft, CssProperty::Left);
4272impl_from_css_prop!(LayoutInsetBottom, CssProperty::Bottom);
4273impl_from_css_prop!(LayoutFlexWrap, CssProperty::FlexWrap);
4274impl_from_css_prop!(LayoutFlexDirection, CssProperty::FlexDirection);
4275impl_from_css_prop!(LayoutFlexGrow, CssProperty::FlexGrow);
4276impl_from_css_prop!(LayoutFlexShrink, CssProperty::FlexShrink);
4277impl_from_css_prop!(LayoutFlexBasis, CssProperty::FlexBasis);
4278impl_from_css_prop!(LayoutJustifyContent, CssProperty::JustifyContent);
4279impl_from_css_prop!(LayoutAlignItems, CssProperty::AlignItems);
4280impl_from_css_prop!(LayoutAlignContent, CssProperty::AlignContent);
4281impl_from_css_prop!(LayoutColumnGap, CssProperty::ColumnGap);
4282impl_from_css_prop!(LayoutRowGap, CssProperty::RowGap);
4283impl_from_css_prop!(LayoutGridAutoFlow, CssProperty::GridAutoFlow);
4284impl_from_css_prop!(LayoutJustifySelf, CssProperty::JustifySelf);
4285impl_from_css_prop!(LayoutJustifyItems, CssProperty::JustifyItems);
4286impl_from_css_prop!(LayoutGap, CssProperty::Gap);
4287impl_from_css_prop!(LayoutAlignSelf, CssProperty::AlignSelf);
4288impl_from_css_prop!(LayoutWritingMode, CssProperty::WritingMode);
4289impl_from_css_prop!(LayoutClear, CssProperty::Clear);
4290
4291impl_from_css_prop!(StyleBackgroundContentVec, CssProperty::BackgroundContent);
4293
4294impl_from_css_prop!(StyleBackgroundPositionVec, CssProperty::BackgroundPosition);
4295impl_from_css_prop!(StyleBackgroundSizeVec, CssProperty::BackgroundSize);
4296impl_from_css_prop!(StyleBackgroundRepeatVec, CssProperty::BackgroundRepeat);
4297impl_from_css_prop!(LayoutPaddingTop, CssProperty::PaddingTop);
4298impl_from_css_prop!(LayoutPaddingLeft, CssProperty::PaddingLeft);
4299impl_from_css_prop!(LayoutPaddingRight, CssProperty::PaddingRight);
4300impl_from_css_prop!(LayoutPaddingBottom, CssProperty::PaddingBottom);
4301impl_from_css_prop!(LayoutPaddingInlineStart, CssProperty::PaddingInlineStart);
4302impl_from_css_prop!(LayoutPaddingInlineEnd, CssProperty::PaddingInlineEnd);
4303impl_from_css_prop!(LayoutMarginTop, CssProperty::MarginTop);
4304impl_from_css_prop!(LayoutMarginLeft, CssProperty::MarginLeft);
4305impl_from_css_prop!(LayoutMarginRight, CssProperty::MarginRight);
4306impl_from_css_prop!(LayoutMarginBottom, CssProperty::MarginBottom);
4307impl_from_css_prop!(StyleBorderTopLeftRadius, CssProperty::BorderTopLeftRadius);
4308impl_from_css_prop!(StyleBorderTopRightRadius, CssProperty::BorderTopRightRadius);
4309impl_from_css_prop!(
4310 StyleBorderBottomLeftRadius,
4311 CssProperty::BorderBottomLeftRadius
4312);
4313impl_from_css_prop!(
4314 StyleBorderBottomRightRadius,
4315 CssProperty::BorderBottomRightRadius
4316);
4317impl_from_css_prop!(StyleBorderTopColor, CssProperty::BorderTopColor);
4318impl_from_css_prop!(StyleBorderRightColor, CssProperty::BorderRightColor);
4319impl_from_css_prop!(StyleBorderLeftColor, CssProperty::BorderLeftColor);
4320impl_from_css_prop!(StyleBorderBottomColor, CssProperty::BorderBottomColor);
4321impl_from_css_prop!(StyleBorderTopStyle, CssProperty::BorderTopStyle);
4322impl_from_css_prop!(StyleBorderRightStyle, CssProperty::BorderRightStyle);
4323impl_from_css_prop!(StyleBorderLeftStyle, CssProperty::BorderLeftStyle);
4324impl_from_css_prop!(StyleBorderBottomStyle, CssProperty::BorderBottomStyle);
4325impl_from_css_prop!(LayoutBorderTopWidth, CssProperty::BorderTopWidth);
4326impl_from_css_prop!(LayoutBorderRightWidth, CssProperty::BorderRightWidth);
4327impl_from_css_prop!(LayoutBorderLeftWidth, CssProperty::BorderLeftWidth);
4328impl_from_css_prop!(LayoutBorderBottomWidth, CssProperty::BorderBottomWidth);
4329impl_from_css_prop!(LayoutScrollbarWidth, CssProperty::ScrollbarWidth);
4330impl_from_css_prop!(StyleScrollbarColor, CssProperty::ScrollbarColor);
4331impl_from_css_prop!(ScrollbarVisibilityMode, CssProperty::ScrollbarVisibility);
4332impl_from_css_prop!(ScrollbarFadeDelay, CssProperty::ScrollbarFadeDelay);
4333impl_from_css_prop!(ScrollbarFadeDuration, CssProperty::ScrollbarFadeDuration);
4334impl_from_css_prop!(StyleOpacity, CssProperty::Opacity);
4335impl_from_css_prop!(StyleVisibility, CssProperty::Visibility);
4336impl_from_css_prop!(StyleTransformVec, CssProperty::Transform);
4337impl_from_css_prop!(StyleTransformOrigin, CssProperty::TransformOrigin);
4338impl_from_css_prop!(StylePerspectiveOrigin, CssProperty::PerspectiveOrigin);
4339impl_from_css_prop!(StyleBackfaceVisibility, CssProperty::BackfaceVisibility);
4340impl_from_css_prop!(StyleMixBlendMode, CssProperty::MixBlendMode);
4341impl_from_css_prop!(StyleHyphens, CssProperty::Hyphens);
4342impl_from_css_prop!(StyleWordBreak, CssProperty::WordBreak);
4343impl_from_css_prop!(StyleOverflowWrap, CssProperty::OverflowWrap);
4344impl_from_css_prop!(StyleLineBreak, CssProperty::LineBreak);
4345impl_from_css_prop!(StyleObjectFit, CssProperty::ObjectFit);
4346impl_from_css_prop!(StyleObjectPosition, CssProperty::ObjectPosition);
4347impl_from_css_prop!(StyleAspectRatio, CssProperty::AspectRatio);
4348impl_from_css_prop!(StyleTextOrientation, CssProperty::TextOrientation);
4349impl_from_css_prop!(StyleTextAlignLast, CssProperty::TextAlignLast);
4350impl_from_css_prop!(StyleTextTransform, CssProperty::TextTransform);
4351impl_from_css_prop!(StyleDirection, CssProperty::Direction);
4352impl_from_css_prop!(StyleWhiteSpace, CssProperty::WhiteSpace);
4353impl_from_css_prop!(PageBreak, CssProperty::BreakBefore);
4354impl_from_css_prop!(BreakInside, CssProperty::BreakInside);
4355impl_from_css_prop!(Widows, CssProperty::Widows);
4356impl_from_css_prop!(Orphans, CssProperty::Orphans);
4357impl_from_css_prop!(BoxDecorationBreak, CssProperty::BoxDecorationBreak);
4358impl_from_css_prop!(ColumnCount, CssProperty::ColumnCount);
4359impl_from_css_prop!(ColumnWidth, CssProperty::ColumnWidth);
4360impl_from_css_prop!(ColumnSpan, CssProperty::ColumnSpan);
4361impl_from_css_prop!(ColumnFill, CssProperty::ColumnFill);
4362impl_from_css_prop!(ColumnRuleWidth, CssProperty::ColumnRuleWidth);
4363impl_from_css_prop!(ColumnRuleStyle, CssProperty::ColumnRuleStyle);
4364impl_from_css_prop!(ColumnRuleColor, CssProperty::ColumnRuleColor);
4365impl_from_css_prop!(FlowInto, CssProperty::FlowInto);
4366impl_from_css_prop!(FlowFrom, CssProperty::FlowFrom);
4367impl_from_css_prop!(ShapeOutside, CssProperty::ShapeOutside);
4368impl_from_css_prop!(ShapeInside, CssProperty::ShapeInside);
4369impl_from_css_prop!(ClipPath, CssProperty::ClipPath);
4370impl_from_css_prop!(ShapeMargin, CssProperty::ShapeMargin);
4371impl_from_css_prop!(ShapeImageThreshold, CssProperty::ShapeImageThreshold);
4372impl_from_css_prop!(Content, CssProperty::Content);
4373impl_from_css_prop!(CounterReset, CssProperty::CounterReset);
4374impl_from_css_prop!(CounterIncrement, CssProperty::CounterIncrement);
4375impl_from_css_prop!(StyleListStyleType, CssProperty::ListStyleType);
4376impl_from_css_prop!(StyleListStylePosition, CssProperty::ListStylePosition);
4377impl_from_css_prop!(StringSet, CssProperty::StringSet);
4378impl_from_css_prop!(LayoutTableLayout, CssProperty::TableLayout);
4379impl_from_css_prop!(StyleBorderCollapse, CssProperty::BorderCollapse);
4380impl_from_css_prop!(LayoutBorderSpacing, CssProperty::BorderSpacing);
4381impl_from_css_prop!(StyleCaptionSide, CssProperty::CaptionSide);
4382impl_from_css_prop!(StyleEmptyCells, CssProperty::EmptyCells);
4383
4384impl CssProperty {
4385 #[must_use] pub const fn key(&self) -> &'static str {
4386 self.get_type().to_str()
4387 }
4388
4389 #[allow(clippy::match_same_arms)]
4393 #[allow(clippy::too_many_lines)] #[must_use] pub fn value(&self) -> String {
4395 match self {
4396 Self::CaretColor(v) => v.get_css_value_fmt(),
4397 Self::CaretWidth(v) => v.get_css_value_fmt(),
4398 Self::CaretAnimationDuration(v) => v.get_css_value_fmt(),
4399 Self::SelectionBackgroundColor(v) => v.get_css_value_fmt(),
4400 Self::SelectionColor(v) => v.get_css_value_fmt(),
4401 Self::SelectionRadius(v) => v.get_css_value_fmt(),
4402 Self::TextJustify(v) => v.get_css_value_fmt(),
4403 Self::TextColor(v) => v.get_css_value_fmt(),
4404 Self::FontSize(v) => v.get_css_value_fmt(),
4405 Self::FontFamily(v) => v.get_css_value_fmt(),
4406 Self::TextAlign(v) => v.get_css_value_fmt(),
4407 Self::LetterSpacing(v) => v.get_css_value_fmt(),
4408 Self::TextIndent(v) => v.get_css_value_fmt(),
4409 Self::InitialLetter(v) => v.get_css_value_fmt(),
4410 Self::LineClamp(v) => v.get_css_value_fmt(),
4411 Self::HangingPunctuation(v) => v.get_css_value_fmt(),
4412 Self::TextCombineUpright(v) => v.get_css_value_fmt(),
4413 Self::UnicodeBidi(v) => v.get_css_value_fmt(),
4414 Self::TextBoxTrim(v) => v.get_css_value_fmt(),
4415 Self::TextBoxEdge(v) => v.get_css_value_fmt(),
4416 Self::DominantBaseline(v) => v.get_css_value_fmt(),
4417 Self::AlignmentBaseline(v) => v.get_css_value_fmt(),
4418 Self::InitialLetterAlign(v) => v.get_css_value_fmt(),
4419 Self::InitialLetterWrap(v) => v.get_css_value_fmt(),
4420 Self::ScrollbarGutter(v) => v.get_css_value_fmt(),
4421 Self::OverflowClipMargin(v) => v.get_css_value_fmt(),
4422 Self::Clip(v) => v.get_css_value_fmt(),
4423 Self::ExclusionMargin(v) => v.get_css_value_fmt(),
4424 Self::HyphenationLanguage(v) => v.get_css_value_fmt(),
4425 Self::LineHeight(v) => v.get_css_value_fmt(),
4426 Self::WordSpacing(v) => v.get_css_value_fmt(),
4427 Self::TabSize(v) => v.get_css_value_fmt(),
4428 Self::Cursor(v) => v.get_css_value_fmt(),
4429 Self::Display(v) => v.get_css_value_fmt(),
4430 Self::Float(v) => v.get_css_value_fmt(),
4431 Self::BoxSizing(v) => v.get_css_value_fmt(),
4432 Self::Width(v) => v.get_css_value_fmt(),
4433 Self::Height(v) => v.get_css_value_fmt(),
4434 Self::MinWidth(v) => v.get_css_value_fmt(),
4435 Self::MinHeight(v) => v.get_css_value_fmt(),
4436 Self::MaxWidth(v) => v.get_css_value_fmt(),
4437 Self::MaxHeight(v) => v.get_css_value_fmt(),
4438 Self::Position(v) => v.get_css_value_fmt(),
4439 Self::Top(v) => v.get_css_value_fmt(),
4440 Self::Right(v) => v.get_css_value_fmt(),
4441 Self::Left(v) => v.get_css_value_fmt(),
4442 Self::Bottom(v) => v.get_css_value_fmt(),
4443 Self::ZIndex(v) => v.get_css_value_fmt(),
4444 Self::FlexWrap(v) => v.get_css_value_fmt(),
4445 Self::FlexDirection(v) => v.get_css_value_fmt(),
4446 Self::FlexGrow(v) => v.get_css_value_fmt(),
4447 Self::FlexShrink(v) => v.get_css_value_fmt(),
4448 Self::FlexBasis(v) => v.get_css_value_fmt(),
4449 Self::JustifyContent(v) => v.get_css_value_fmt(),
4450 Self::AlignItems(v) => v.get_css_value_fmt(),
4451 Self::AlignContent(v) => v.get_css_value_fmt(),
4452 Self::ColumnGap(v) => v.get_css_value_fmt(),
4453 Self::RowGap(v) => v.get_css_value_fmt(),
4454 Self::GridTemplateColumns(v) => v.get_css_value_fmt(),
4455 Self::GridTemplateRows(v) => v.get_css_value_fmt(),
4456 Self::GridAutoFlow(v) => v.get_css_value_fmt(),
4457 Self::JustifySelf(v) => v.get_css_value_fmt(),
4458 Self::JustifyItems(v) => v.get_css_value_fmt(),
4459 Self::Gap(v) => v.get_css_value_fmt(),
4460 Self::GridGap(v) => v.get_css_value_fmt(),
4461 Self::AlignSelf(v) => v.get_css_value_fmt(),
4462 Self::Font(v) => v.get_css_value_fmt(),
4463 Self::GridAutoColumns(v) => v.get_css_value_fmt(),
4464 Self::GridAutoRows(v) => v.get_css_value_fmt(),
4465 Self::GridColumn(v) => v.get_css_value_fmt(),
4466 Self::GridRow(v) => v.get_css_value_fmt(),
4467 Self::GridTemplateAreas(v) => v.get_css_value_fmt(),
4468 Self::WritingMode(v) => v.get_css_value_fmt(),
4469 Self::Clear(v) => v.get_css_value_fmt(),
4470 Self::BackgroundContent(v) => v.get_css_value_fmt(),
4471 Self::BackgroundPosition(v) => v.get_css_value_fmt(),
4472 Self::BackgroundSize(v) => v.get_css_value_fmt(),
4473 Self::BackgroundRepeat(v) => v.get_css_value_fmt(),
4474 Self::OverflowX(v) => v.get_css_value_fmt(),
4475 Self::OverflowY(v) => v.get_css_value_fmt(),
4476 Self::OverflowBlock(v) => v.get_css_value_fmt(),
4477 Self::OverflowInline(v) => v.get_css_value_fmt(),
4478 Self::PaddingTop(v) => v.get_css_value_fmt(),
4479 Self::PaddingLeft(v) => v.get_css_value_fmt(),
4480 Self::PaddingRight(v) => v.get_css_value_fmt(),
4481 Self::PaddingBottom(v) => v.get_css_value_fmt(),
4482 Self::PaddingInlineStart(v) => v.get_css_value_fmt(),
4483 Self::PaddingInlineEnd(v) => v.get_css_value_fmt(),
4484 Self::MarginTop(v) => v.get_css_value_fmt(),
4485 Self::MarginLeft(v) => v.get_css_value_fmt(),
4486 Self::MarginRight(v) => v.get_css_value_fmt(),
4487 Self::MarginBottom(v) => v.get_css_value_fmt(),
4488 Self::BorderTopLeftRadius(v) => v.get_css_value_fmt(),
4489 Self::BorderTopRightRadius(v) => v.get_css_value_fmt(),
4490 Self::BorderBottomLeftRadius(v) => v.get_css_value_fmt(),
4491 Self::BorderBottomRightRadius(v) => v.get_css_value_fmt(),
4492 Self::BorderTopColor(v) => v.get_css_value_fmt(),
4493 Self::BorderRightColor(v) => v.get_css_value_fmt(),
4494 Self::BorderLeftColor(v) => v.get_css_value_fmt(),
4495 Self::BorderBottomColor(v) => v.get_css_value_fmt(),
4496 Self::BorderTopStyle(v) => v.get_css_value_fmt(),
4497 Self::BorderRightStyle(v) => v.get_css_value_fmt(),
4498 Self::BorderLeftStyle(v) => v.get_css_value_fmt(),
4499 Self::BorderBottomStyle(v) => v.get_css_value_fmt(),
4500 Self::BorderTopWidth(v) => v.get_css_value_fmt(),
4501 Self::BorderRightWidth(v) => v.get_css_value_fmt(),
4502 Self::BorderLeftWidth(v) => v.get_css_value_fmt(),
4503 Self::BorderBottomWidth(v) => v.get_css_value_fmt(),
4504 Self::BoxShadowLeft(v) => v.get_css_value_fmt(),
4505 Self::BoxShadowRight(v) => v.get_css_value_fmt(),
4506 Self::BoxShadowTop(v) => v.get_css_value_fmt(),
4507 Self::BoxShadowBottom(v) => v.get_css_value_fmt(),
4508 Self::ScrollbarTrack(v) => v.get_css_value_fmt(),
4509 Self::ScrollbarThumb(v) => v.get_css_value_fmt(),
4510 Self::ScrollbarButton(v) => v.get_css_value_fmt(),
4511 Self::ScrollbarCorner(v) => v.get_css_value_fmt(),
4512 Self::ScrollbarResizer(v) => v.get_css_value_fmt(),
4513 Self::ScrollbarWidth(v) => v.get_css_value_fmt(),
4514 Self::ScrollbarColor(v) => v.get_css_value_fmt(),
4515 Self::ScrollbarVisibility(v) => v.get_css_value_fmt(),
4516 Self::ScrollbarFadeDelay(v) => v.get_css_value_fmt(),
4517 Self::ScrollbarFadeDuration(v) => v.get_css_value_fmt(),
4518 Self::Opacity(v) => v.get_css_value_fmt(),
4519 Self::Visibility(v) => v.get_css_value_fmt(),
4520 Self::Transform(v) => v.get_css_value_fmt(),
4521 Self::TransformOrigin(v) => v.get_css_value_fmt(),
4522 Self::PerspectiveOrigin(v) => v.get_css_value_fmt(),
4523 Self::BackfaceVisibility(v) => v.get_css_value_fmt(),
4524 Self::MixBlendMode(v) => v.get_css_value_fmt(),
4525 Self::Filter(v) => v.get_css_value_fmt(),
4526 Self::BackdropFilter(v) => v.get_css_value_fmt(),
4527 Self::TextShadow(v) => v.get_css_value_fmt(),
4528 Self::Hyphens(v) => v.get_css_value_fmt(),
4529 Self::WordBreak(v) => v.get_css_value_fmt(),
4530 Self::OverflowWrap(v) => v.get_css_value_fmt(),
4531 Self::LineBreak(v) => v.get_css_value_fmt(),
4532 Self::ObjectFit(v) => v.get_css_value_fmt(),
4533 Self::ObjectPosition(v) => v.get_css_value_fmt(),
4534 Self::AspectRatio(v) => v.get_css_value_fmt(),
4535 Self::TextOrientation(v) => v.get_css_value_fmt(),
4536 Self::TextAlignLast(v) => v.get_css_value_fmt(),
4537 Self::TextTransform(v) => v.get_css_value_fmt(),
4538 Self::Direction(v) => v.get_css_value_fmt(),
4539 Self::UserSelect(v) => v.get_css_value_fmt(),
4540 Self::TextDecoration(v) => v.get_css_value_fmt(),
4541 Self::WhiteSpace(v) => v.get_css_value_fmt(),
4542 Self::BreakBefore(v) => v.get_css_value_fmt(),
4543 Self::BreakAfter(v) => v.get_css_value_fmt(),
4544 Self::BreakInside(v) => v.get_css_value_fmt(),
4545 Self::Orphans(v) => v.get_css_value_fmt(),
4546 Self::Widows(v) => v.get_css_value_fmt(),
4547 Self::BoxDecorationBreak(v) => v.get_css_value_fmt(),
4548 Self::ColumnCount(v) => v.get_css_value_fmt(),
4549 Self::ColumnWidth(v) => v.get_css_value_fmt(),
4550 Self::ColumnSpan(v) => v.get_css_value_fmt(),
4551 Self::ColumnFill(v) => v.get_css_value_fmt(),
4552 Self::ColumnRuleWidth(v) => v.get_css_value_fmt(),
4553 Self::ColumnRuleStyle(v) => v.get_css_value_fmt(),
4554 Self::ColumnRuleColor(v) => v.get_css_value_fmt(),
4555 Self::FlowInto(v) => v.get_css_value_fmt(),
4556 Self::FlowFrom(v) => v.get_css_value_fmt(),
4557 Self::ShapeOutside(v) => v.get_css_value_fmt(),
4558 Self::ShapeInside(v) => v.get_css_value_fmt(),
4559 Self::ClipPath(v) => v.get_css_value_fmt(),
4560 Self::ShapeMargin(v) => v.get_css_value_fmt(),
4561 Self::ShapeImageThreshold(v) => v.get_css_value_fmt(),
4562 Self::Content(v) => v.get_css_value_fmt(),
4563 Self::CounterReset(v) => v.get_css_value_fmt(),
4564 Self::CounterIncrement(v) => v.get_css_value_fmt(),
4565 Self::ListStyleType(v) => v.get_css_value_fmt(),
4566 Self::ListStylePosition(v) => v.get_css_value_fmt(),
4567 Self::StringSet(v) => v.get_css_value_fmt(),
4568 Self::TableLayout(v) => v.get_css_value_fmt(),
4569 Self::BorderCollapse(v) => v.get_css_value_fmt(),
4570 Self::BorderSpacing(v) => v.get_css_value_fmt(),
4571 Self::CaptionSide(v) => v.get_css_value_fmt(),
4572 Self::EmptyCells(v) => v.get_css_value_fmt(),
4573 Self::FontWeight(v) => v.get_css_value_fmt(),
4574 Self::FontStyle(v) => v.get_css_value_fmt(),
4575 Self::VerticalAlign(v) => v.get_css_value_fmt(),
4576 }
4577 }
4578
4579 #[must_use] pub fn format_css(&self) -> String {
4580 format!("{}: {};", self.key(), self.value())
4581 }
4582
4583 #[allow(clippy::too_many_lines)] #[must_use] pub fn interpolate(
4585 &self,
4586 other: &Self,
4587 t: f32,
4588 interpolate_resolver: &InterpolateResolver,
4589 ) -> Self {
4590 if t <= 0.0 {
4591 return self.clone();
4592 } else if t >= 1.0 {
4593 return other.clone();
4594 }
4595
4596 let t: f32 = interpolate_resolver.interpolate_func.evaluate(f64::from(t));
4598
4599 let t = t.clamp(0.0, 1.0);
4600
4601 match (self, other) {
4602 (Self::TextColor(col_start), Self::TextColor(col_end)) => {
4603 let col_start = col_start.get_property().copied().unwrap_or_default();
4604 let col_end = col_end.get_property().copied().unwrap_or_default();
4605 Self::text_color(col_start.interpolate(&col_end, t))
4606 }
4607 (Self::FontSize(fs_start), Self::FontSize(fs_end)) => {
4608 let fs_start = fs_start.get_property().copied().unwrap_or_default();
4609 let fs_end = fs_end.get_property().copied().unwrap_or_default();
4610 Self::font_size(fs_start.interpolate(&fs_end, t))
4611 }
4612 (Self::LetterSpacing(ls_start), Self::LetterSpacing(ls_end)) => {
4613 let ls_start = ls_start.get_property().copied().unwrap_or_default();
4614 let ls_end = ls_end.get_property().copied().unwrap_or_default();
4615 Self::letter_spacing(ls_start.interpolate(&ls_end, t))
4616 }
4617 (Self::TextIndent(ti_start), Self::TextIndent(ti_end)) => {
4618 let ti_start = ti_start.get_property().copied().unwrap_or_default();
4619 let ti_end = ti_end.get_property().copied().unwrap_or_default();
4620 Self::text_indent(ti_start.interpolate(&ti_end, t))
4621 }
4622 (Self::LineHeight(lh_start), Self::LineHeight(lh_end)) => {
4623 let lh_start = lh_start.get_property().copied().unwrap_or_default();
4624 let lh_end = lh_end.get_property().copied().unwrap_or_default();
4625 Self::line_height(lh_start.interpolate(&lh_end, t))
4626 }
4627 (Self::WordSpacing(ws_start), Self::WordSpacing(ws_end)) => {
4628 let ws_start = ws_start.get_property().copied().unwrap_or_default();
4629 let ws_end = ws_end.get_property().copied().unwrap_or_default();
4630 Self::word_spacing(ws_start.interpolate(&ws_end, t))
4631 }
4632 (Self::TabSize(tw_start), Self::TabSize(tw_end)) => {
4633 let tw_start = tw_start.get_property().copied().unwrap_or_default();
4634 let tw_end = tw_end.get_property().copied().unwrap_or_default();
4635 Self::tab_size(tw_start.interpolate(&tw_end, t))
4636 }
4637 (Self::Width(start), Self::Width(end)) => {
4638 let start =
4639 start
4640 .get_property()
4641 .cloned()
4642 .unwrap_or(LayoutWidth::Px(PixelValue::px(
4643 interpolate_resolver.current_rect_width,
4644 )));
4645 let end = end.get_property().cloned().unwrap_or_default();
4646 Self::Width(CssPropertyValue::Exact(start.interpolate(&end, t)))
4647 }
4648 (Self::Height(start), Self::Height(end)) => {
4649 let start =
4650 start
4651 .get_property()
4652 .cloned()
4653 .unwrap_or(LayoutHeight::Px(PixelValue::px(
4654 interpolate_resolver.current_rect_height,
4655 )));
4656 let end = end.get_property().cloned().unwrap_or_default();
4657 Self::Height(CssPropertyValue::Exact(start.interpolate(&end, t)))
4658 }
4659 (Self::MinWidth(start), Self::MinWidth(end)) => {
4660 let start = start.get_property().copied().unwrap_or_default();
4661 let end = end.get_property().copied().unwrap_or_default();
4662 Self::MinWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
4663 }
4664 (Self::MinHeight(start), Self::MinHeight(end)) => {
4665 let start = start.get_property().copied().unwrap_or_default();
4666 let end = end.get_property().copied().unwrap_or_default();
4667 Self::MinHeight(CssPropertyValue::Exact(start.interpolate(&end, t)))
4668 }
4669 (Self::MaxWidth(start), Self::MaxWidth(end)) => {
4670 let start = start.get_property().copied().unwrap_or_default();
4671 let end = end.get_property().copied().unwrap_or_default();
4672 Self::MaxWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
4673 }
4674 (Self::MaxHeight(start), Self::MaxHeight(end)) => {
4675 let start = start.get_property().copied().unwrap_or_default();
4676 let end = end.get_property().copied().unwrap_or_default();
4677 Self::MaxHeight(CssPropertyValue::Exact(start.interpolate(&end, t)))
4678 }
4679 (Self::Top(start), Self::Top(end)) => {
4680 let start = start.get_property().copied().unwrap_or_default();
4681 let end = end.get_property().copied().unwrap_or_default();
4682 Self::Top(CssPropertyValue::Exact(start.interpolate(&end, t)))
4683 }
4684 (Self::Right(start), Self::Right(end)) => {
4685 let start = start.get_property().copied().unwrap_or_default();
4686 let end = end.get_property().copied().unwrap_or_default();
4687 Self::Right(CssPropertyValue::Exact(start.interpolate(&end, t)))
4688 }
4689 (Self::Left(start), Self::Left(end)) => {
4690 let start = start.get_property().copied().unwrap_or_default();
4691 let end = end.get_property().copied().unwrap_or_default();
4692 Self::Left(CssPropertyValue::Exact(start.interpolate(&end, t)))
4693 }
4694 (Self::Bottom(start), Self::Bottom(end)) => {
4695 let start = start.get_property().copied().unwrap_or_default();
4696 let end = end.get_property().copied().unwrap_or_default();
4697 Self::Bottom(CssPropertyValue::Exact(start.interpolate(&end, t)))
4698 }
4699 (Self::FlexGrow(start), Self::FlexGrow(end)) => {
4700 let start = start.get_property().copied().unwrap_or_default();
4701 let end = end.get_property().copied().unwrap_or_default();
4702 Self::FlexGrow(CssPropertyValue::Exact(start.interpolate(&end, t)))
4703 }
4704 (Self::FlexShrink(start), Self::FlexShrink(end)) => {
4705 let start = start.get_property().copied().unwrap_or_default();
4706 let end = end.get_property().copied().unwrap_or_default();
4707 Self::FlexShrink(CssPropertyValue::Exact(start.interpolate(&end, t)))
4708 }
4709 (Self::PaddingTop(start), Self::PaddingTop(end)) => {
4710 let start = start.get_property().copied().unwrap_or_default();
4711 let end = end.get_property().copied().unwrap_or_default();
4712 Self::PaddingTop(CssPropertyValue::Exact(start.interpolate(&end, t)))
4713 }
4714 (Self::PaddingLeft(start), Self::PaddingLeft(end)) => {
4715 let start = start.get_property().copied().unwrap_or_default();
4716 let end = end.get_property().copied().unwrap_or_default();
4717 Self::PaddingLeft(CssPropertyValue::Exact(start.interpolate(&end, t)))
4718 }
4719 (Self::PaddingRight(start), Self::PaddingRight(end)) => {
4720 let start = start.get_property().copied().unwrap_or_default();
4721 let end = end.get_property().copied().unwrap_or_default();
4722 Self::PaddingRight(CssPropertyValue::Exact(start.interpolate(&end, t)))
4723 }
4724 (Self::PaddingBottom(start), Self::PaddingBottom(end)) => {
4725 let start = start.get_property().copied().unwrap_or_default();
4726 let end = end.get_property().copied().unwrap_or_default();
4727 Self::PaddingBottom(CssPropertyValue::Exact(start.interpolate(&end, t)))
4728 }
4729 (Self::MarginTop(start), Self::MarginTop(end)) => {
4730 let start = start.get_property().copied().unwrap_or_default();
4731 let end = end.get_property().copied().unwrap_or_default();
4732 Self::MarginTop(CssPropertyValue::Exact(start.interpolate(&end, t)))
4733 }
4734 (Self::MarginLeft(start), Self::MarginLeft(end)) => {
4735 let start = start.get_property().copied().unwrap_or_default();
4736 let end = end.get_property().copied().unwrap_or_default();
4737 Self::MarginLeft(CssPropertyValue::Exact(start.interpolate(&end, t)))
4738 }
4739 (Self::MarginRight(start), Self::MarginRight(end)) => {
4740 let start = start.get_property().copied().unwrap_or_default();
4741 let end = end.get_property().copied().unwrap_or_default();
4742 Self::MarginRight(CssPropertyValue::Exact(start.interpolate(&end, t)))
4743 }
4744 (Self::MarginBottom(start), Self::MarginBottom(end)) => {
4745 let start = start.get_property().copied().unwrap_or_default();
4746 let end = end.get_property().copied().unwrap_or_default();
4747 Self::MarginBottom(CssPropertyValue::Exact(start.interpolate(&end, t)))
4748 }
4749 (Self::BorderTopLeftRadius(start), Self::BorderTopLeftRadius(end)) => {
4750 let start = start.get_property().copied().unwrap_or_default();
4751 let end = end.get_property().copied().unwrap_or_default();
4752 Self::BorderTopLeftRadius(CssPropertyValue::Exact(
4753 start.interpolate(&end, t),
4754 ))
4755 }
4756 (Self::BorderTopRightRadius(start), Self::BorderTopRightRadius(end)) => {
4757 let start = start.get_property().copied().unwrap_or_default();
4758 let end = end.get_property().copied().unwrap_or_default();
4759 Self::BorderTopRightRadius(CssPropertyValue::Exact(
4760 start.interpolate(&end, t),
4761 ))
4762 }
4763 (
4764 Self::BorderBottomLeftRadius(start),
4765 Self::BorderBottomLeftRadius(end),
4766 ) => {
4767 let start = start.get_property().copied().unwrap_or_default();
4768 let end = end.get_property().copied().unwrap_or_default();
4769 Self::BorderBottomLeftRadius(CssPropertyValue::Exact(
4770 start.interpolate(&end, t),
4771 ))
4772 }
4773 (
4774 Self::BorderBottomRightRadius(start),
4775 Self::BorderBottomRightRadius(end),
4776 ) => {
4777 let start = start.get_property().copied().unwrap_or_default();
4778 let end = end.get_property().copied().unwrap_or_default();
4779 Self::BorderBottomRightRadius(CssPropertyValue::Exact(
4780 start.interpolate(&end, t),
4781 ))
4782 }
4783 (Self::BorderTopColor(start), Self::BorderTopColor(end)) => {
4784 let start = start.get_property().copied().unwrap_or_default();
4785 let end = end.get_property().copied().unwrap_or_default();
4786 Self::BorderTopColor(CssPropertyValue::Exact(start.interpolate(&end, t)))
4787 }
4788 (Self::BorderRightColor(start), Self::BorderRightColor(end)) => {
4789 let start = start.get_property().copied().unwrap_or_default();
4790 let end = end.get_property().copied().unwrap_or_default();
4791 Self::BorderRightColor(CssPropertyValue::Exact(start.interpolate(&end, t)))
4792 }
4793 (Self::BorderLeftColor(start), Self::BorderLeftColor(end)) => {
4794 let start = start.get_property().copied().unwrap_or_default();
4795 let end = end.get_property().copied().unwrap_or_default();
4796 Self::BorderLeftColor(CssPropertyValue::Exact(start.interpolate(&end, t)))
4797 }
4798 (Self::BorderBottomColor(start), Self::BorderBottomColor(end)) => {
4799 let start = start.get_property().copied().unwrap_or_default();
4800 let end = end.get_property().copied().unwrap_or_default();
4801 Self::BorderBottomColor(CssPropertyValue::Exact(start.interpolate(&end, t)))
4802 }
4803 (Self::BorderTopWidth(start), Self::BorderTopWidth(end)) => {
4804 let start = start.get_property().copied().unwrap_or_default();
4805 let end = end.get_property().copied().unwrap_or_default();
4806 Self::BorderTopWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
4807 }
4808 (Self::BorderRightWidth(start), Self::BorderRightWidth(end)) => {
4809 let start = start.get_property().copied().unwrap_or_default();
4810 let end = end.get_property().copied().unwrap_or_default();
4811 Self::BorderRightWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
4812 }
4813 (Self::BorderLeftWidth(start), Self::BorderLeftWidth(end)) => {
4814 let start = start.get_property().copied().unwrap_or_default();
4815 let end = end.get_property().copied().unwrap_or_default();
4816 Self::BorderLeftWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
4817 }
4818 (Self::BorderBottomWidth(start), Self::BorderBottomWidth(end)) => {
4819 let start = start.get_property().copied().unwrap_or_default();
4820 let end = end.get_property().copied().unwrap_or_default();
4821 Self::BorderBottomWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
4822 }
4823 (Self::Opacity(start), Self::Opacity(end)) => {
4824 let start = start.get_property().copied().unwrap_or_default();
4825 let end = end.get_property().copied().unwrap_or_default();
4826 Self::Opacity(CssPropertyValue::Exact(start.interpolate(&end, t)))
4827 }
4828 (Self::TransformOrigin(start), Self::TransformOrigin(end)) => {
4829 let start = start.get_property().copied().unwrap_or_default();
4830 let end = end.get_property().copied().unwrap_or_default();
4831 Self::TransformOrigin(CssPropertyValue::Exact(start.interpolate(&end, t)))
4832 }
4833 (Self::PerspectiveOrigin(start), Self::PerspectiveOrigin(end)) => {
4834 let start = start.get_property().copied().unwrap_or_default();
4835 let end = end.get_property().copied().unwrap_or_default();
4836 Self::PerspectiveOrigin(CssPropertyValue::Exact(start.interpolate(&end, t)))
4837 }
4838 (_, _) => {
4854 if t > 0.5 {
4856 other.clone()
4857 } else {
4858 self.clone()
4859 }
4860 }
4861 }
4862 }
4863
4864 #[allow(clippy::too_many_lines)] #[must_use] pub const fn get_type(&self) -> CssPropertyType {
4867 match &self {
4868 Self::CaretColor(_) => CssPropertyType::CaretColor,
4869 Self::CaretWidth(_) => CssPropertyType::CaretWidth,
4870 Self::CaretAnimationDuration(_) => CssPropertyType::CaretAnimationDuration,
4871 Self::SelectionBackgroundColor(_) => CssPropertyType::SelectionBackgroundColor,
4872 Self::SelectionColor(_) => CssPropertyType::SelectionColor,
4873 Self::SelectionRadius(_) => CssPropertyType::SelectionRadius,
4874
4875 Self::TextJustify(_) => CssPropertyType::TextJustify,
4876 Self::TextColor(_) => CssPropertyType::TextColor,
4877 Self::FontSize(_) => CssPropertyType::FontSize,
4878 Self::FontFamily(_) => CssPropertyType::FontFamily,
4879 Self::FontWeight(_) => CssPropertyType::FontWeight,
4880 Self::FontStyle(_) => CssPropertyType::FontStyle,
4881 Self::TextAlign(_) => CssPropertyType::TextAlign,
4882 Self::VerticalAlign(_) => CssPropertyType::VerticalAlign,
4883 Self::LetterSpacing(_) => CssPropertyType::LetterSpacing,
4884 Self::TextIndent(_) => CssPropertyType::TextIndent,
4885 Self::InitialLetter(_) => CssPropertyType::InitialLetter,
4886 Self::LineClamp(_) => CssPropertyType::LineClamp,
4887 Self::HangingPunctuation(_) => CssPropertyType::HangingPunctuation,
4888 Self::TextCombineUpright(_) => CssPropertyType::TextCombineUpright,
4889 Self::UnicodeBidi(_) => CssPropertyType::UnicodeBidi,
4890 Self::TextBoxTrim(_) => CssPropertyType::TextBoxTrim,
4891 Self::TextBoxEdge(_) => CssPropertyType::TextBoxEdge,
4892 Self::DominantBaseline(_) => CssPropertyType::DominantBaseline,
4893 Self::AlignmentBaseline(_) => CssPropertyType::AlignmentBaseline,
4894 Self::InitialLetterAlign(_) => CssPropertyType::InitialLetterAlign,
4895 Self::InitialLetterWrap(_) => CssPropertyType::InitialLetterWrap,
4896 Self::ScrollbarGutter(_) => CssPropertyType::ScrollbarGutter,
4897 Self::OverflowClipMargin(_) => CssPropertyType::OverflowClipMargin,
4898 Self::Clip(_) => CssPropertyType::Clip,
4899 Self::ExclusionMargin(_) => CssPropertyType::ExclusionMargin,
4900 Self::HyphenationLanguage(_) => CssPropertyType::HyphenationLanguage,
4901 Self::LineHeight(_) => CssPropertyType::LineHeight,
4902 Self::WordSpacing(_) => CssPropertyType::WordSpacing,
4903 Self::TabSize(_) => CssPropertyType::TabSize,
4904 Self::Cursor(_) => CssPropertyType::Cursor,
4905 Self::Display(_) => CssPropertyType::Display,
4906 Self::Float(_) => CssPropertyType::Float,
4907 Self::BoxSizing(_) => CssPropertyType::BoxSizing,
4908 Self::Width(_) => CssPropertyType::Width,
4909 Self::Height(_) => CssPropertyType::Height,
4910 Self::MinWidth(_) => CssPropertyType::MinWidth,
4911 Self::MinHeight(_) => CssPropertyType::MinHeight,
4912 Self::MaxWidth(_) => CssPropertyType::MaxWidth,
4913 Self::MaxHeight(_) => CssPropertyType::MaxHeight,
4914 Self::Position(_) => CssPropertyType::Position,
4915 Self::Top(_) => CssPropertyType::Top,
4916 Self::Right(_) => CssPropertyType::Right,
4917 Self::Left(_) => CssPropertyType::Left,
4918 Self::Bottom(_) => CssPropertyType::Bottom,
4919 Self::ZIndex(_) => CssPropertyType::ZIndex,
4920 Self::FlexWrap(_) => CssPropertyType::FlexWrap,
4921 Self::FlexDirection(_) => CssPropertyType::FlexDirection,
4922 Self::FlexGrow(_) => CssPropertyType::FlexGrow,
4923 Self::FlexShrink(_) => CssPropertyType::FlexShrink,
4924 Self::FlexBasis(_) => CssPropertyType::FlexBasis,
4925 Self::JustifyContent(_) => CssPropertyType::JustifyContent,
4926 Self::AlignItems(_) => CssPropertyType::AlignItems,
4927 Self::AlignContent(_) => CssPropertyType::AlignContent,
4928 Self::ColumnGap(_) => CssPropertyType::ColumnGap,
4929 Self::RowGap(_) => CssPropertyType::RowGap,
4930 Self::GridTemplateColumns(_) => CssPropertyType::GridTemplateColumns,
4931 Self::GridTemplateRows(_) => CssPropertyType::GridTemplateRows,
4932 Self::GridAutoColumns(_) => CssPropertyType::GridAutoColumns,
4933 Self::GridAutoRows(_) => CssPropertyType::GridAutoRows,
4934 Self::GridColumn(_) => CssPropertyType::GridColumn,
4935 Self::GridAutoFlow(_) => CssPropertyType::GridAutoFlow,
4936 Self::JustifySelf(_) => CssPropertyType::JustifySelf,
4937 Self::JustifyItems(_) => CssPropertyType::JustifyItems,
4938 Self::Gap(_) => CssPropertyType::Gap,
4939 Self::GridGap(_) => CssPropertyType::GridGap,
4940 Self::AlignSelf(_) => CssPropertyType::AlignSelf,
4941 Self::Font(_) => CssPropertyType::Font,
4942 Self::GridRow(_) => CssPropertyType::GridRow,
4943 Self::GridTemplateAreas(_) => CssPropertyType::GridTemplateAreas,
4944 Self::WritingMode(_) => CssPropertyType::WritingMode,
4945 Self::Clear(_) => CssPropertyType::Clear,
4946 Self::BackgroundContent(_) => CssPropertyType::BackgroundContent,
4947 Self::BackgroundPosition(_) => CssPropertyType::BackgroundPosition,
4948 Self::BackgroundSize(_) => CssPropertyType::BackgroundSize,
4949 Self::BackgroundRepeat(_) => CssPropertyType::BackgroundRepeat,
4950 Self::OverflowX(_) => CssPropertyType::OverflowX,
4951 Self::OverflowY(_) => CssPropertyType::OverflowY,
4952 Self::OverflowBlock(_) => CssPropertyType::OverflowBlock,
4953 Self::OverflowInline(_) => CssPropertyType::OverflowInline,
4954 Self::PaddingTop(_) => CssPropertyType::PaddingTop,
4955 Self::PaddingLeft(_) => CssPropertyType::PaddingLeft,
4956 Self::PaddingRight(_) => CssPropertyType::PaddingRight,
4957 Self::PaddingBottom(_) => CssPropertyType::PaddingBottom,
4958 Self::PaddingInlineStart(_) => CssPropertyType::PaddingInlineStart,
4959 Self::PaddingInlineEnd(_) => CssPropertyType::PaddingInlineEnd,
4960 Self::MarginTop(_) => CssPropertyType::MarginTop,
4961 Self::MarginLeft(_) => CssPropertyType::MarginLeft,
4962 Self::MarginRight(_) => CssPropertyType::MarginRight,
4963 Self::MarginBottom(_) => CssPropertyType::MarginBottom,
4964 Self::BorderTopLeftRadius(_) => CssPropertyType::BorderTopLeftRadius,
4965 Self::BorderTopRightRadius(_) => CssPropertyType::BorderTopRightRadius,
4966 Self::BorderBottomLeftRadius(_) => CssPropertyType::BorderBottomLeftRadius,
4967 Self::BorderBottomRightRadius(_) => CssPropertyType::BorderBottomRightRadius,
4968 Self::BorderTopColor(_) => CssPropertyType::BorderTopColor,
4969 Self::BorderRightColor(_) => CssPropertyType::BorderRightColor,
4970 Self::BorderLeftColor(_) => CssPropertyType::BorderLeftColor,
4971 Self::BorderBottomColor(_) => CssPropertyType::BorderBottomColor,
4972 Self::BorderTopStyle(_) => CssPropertyType::BorderTopStyle,
4973 Self::BorderRightStyle(_) => CssPropertyType::BorderRightStyle,
4974 Self::BorderLeftStyle(_) => CssPropertyType::BorderLeftStyle,
4975 Self::BorderBottomStyle(_) => CssPropertyType::BorderBottomStyle,
4976 Self::BorderTopWidth(_) => CssPropertyType::BorderTopWidth,
4977 Self::BorderRightWidth(_) => CssPropertyType::BorderRightWidth,
4978 Self::BorderLeftWidth(_) => CssPropertyType::BorderLeftWidth,
4979 Self::BorderBottomWidth(_) => CssPropertyType::BorderBottomWidth,
4980 Self::BoxShadowLeft(_) => CssPropertyType::BoxShadowLeft,
4981 Self::BoxShadowRight(_) => CssPropertyType::BoxShadowRight,
4982 Self::BoxShadowTop(_) => CssPropertyType::BoxShadowTop,
4983 Self::BoxShadowBottom(_) => CssPropertyType::BoxShadowBottom,
4984 Self::ScrollbarTrack(_) => CssPropertyType::ScrollbarTrack,
4985 Self::ScrollbarThumb(_) => CssPropertyType::ScrollbarThumb,
4986 Self::ScrollbarButton(_) => CssPropertyType::ScrollbarButton,
4987 Self::ScrollbarCorner(_) => CssPropertyType::ScrollbarCorner,
4988 Self::ScrollbarResizer(_) => CssPropertyType::ScrollbarResizer,
4989 Self::ScrollbarWidth(_) => CssPropertyType::ScrollbarWidth,
4990 Self::ScrollbarColor(_) => CssPropertyType::ScrollbarColor,
4991 Self::ScrollbarVisibility(_) => CssPropertyType::ScrollbarVisibility,
4992 Self::ScrollbarFadeDelay(_) => CssPropertyType::ScrollbarFadeDelay,
4993 Self::ScrollbarFadeDuration(_) => CssPropertyType::ScrollbarFadeDuration,
4994 Self::Opacity(_) => CssPropertyType::Opacity,
4995 Self::Visibility(_) => CssPropertyType::Visibility,
4996 Self::Transform(_) => CssPropertyType::Transform,
4997 Self::PerspectiveOrigin(_) => CssPropertyType::PerspectiveOrigin,
4998 Self::TransformOrigin(_) => CssPropertyType::TransformOrigin,
4999 Self::BackfaceVisibility(_) => CssPropertyType::BackfaceVisibility,
5000 Self::MixBlendMode(_) => CssPropertyType::MixBlendMode,
5001 Self::Filter(_) => CssPropertyType::Filter,
5002 Self::BackdropFilter(_) => CssPropertyType::BackdropFilter,
5003 Self::TextShadow(_) => CssPropertyType::TextShadow,
5004 Self::WhiteSpace(_) => CssPropertyType::WhiteSpace,
5005 Self::Hyphens(_) => CssPropertyType::Hyphens,
5006 Self::WordBreak(_) => CssPropertyType::WordBreak,
5007 Self::OverflowWrap(_) => CssPropertyType::OverflowWrap,
5008 Self::LineBreak(_) => CssPropertyType::LineBreak,
5009 Self::ObjectFit(_) => CssPropertyType::ObjectFit,
5010 Self::ObjectPosition(_) => CssPropertyType::ObjectPosition,
5011 Self::AspectRatio(_) => CssPropertyType::AspectRatio,
5012 Self::TextOrientation(_) => CssPropertyType::TextOrientation,
5013 Self::TextAlignLast(_) => CssPropertyType::TextAlignLast,
5014 Self::TextTransform(_) => CssPropertyType::TextTransform,
5015 Self::Direction(_) => CssPropertyType::Direction,
5016 Self::UserSelect(_) => CssPropertyType::UserSelect,
5017 Self::TextDecoration(_) => CssPropertyType::TextDecoration,
5018 Self::BreakBefore(_) => CssPropertyType::BreakBefore,
5019 Self::BreakAfter(_) => CssPropertyType::BreakAfter,
5020 Self::BreakInside(_) => CssPropertyType::BreakInside,
5021 Self::Orphans(_) => CssPropertyType::Orphans,
5022 Self::Widows(_) => CssPropertyType::Widows,
5023 Self::BoxDecorationBreak(_) => CssPropertyType::BoxDecorationBreak,
5024 Self::ColumnCount(_) => CssPropertyType::ColumnCount,
5025 Self::ColumnWidth(_) => CssPropertyType::ColumnWidth,
5026 Self::ColumnSpan(_) => CssPropertyType::ColumnSpan,
5027 Self::ColumnFill(_) => CssPropertyType::ColumnFill,
5028 Self::ColumnRuleWidth(_) => CssPropertyType::ColumnRuleWidth,
5029 Self::ColumnRuleStyle(_) => CssPropertyType::ColumnRuleStyle,
5030 Self::ColumnRuleColor(_) => CssPropertyType::ColumnRuleColor,
5031 Self::FlowInto(_) => CssPropertyType::FlowInto,
5032 Self::FlowFrom(_) => CssPropertyType::FlowFrom,
5033 Self::ShapeOutside(_) => CssPropertyType::ShapeOutside,
5034 Self::ShapeInside(_) => CssPropertyType::ShapeInside,
5035 Self::ClipPath(_) => CssPropertyType::ClipPath,
5036 Self::ShapeMargin(_) => CssPropertyType::ShapeMargin,
5037 Self::ShapeImageThreshold(_) => CssPropertyType::ShapeImageThreshold,
5038 Self::Content(_) => CssPropertyType::Content,
5039 Self::CounterReset(_) => CssPropertyType::CounterReset,
5040 Self::CounterIncrement(_) => CssPropertyType::CounterIncrement,
5041 Self::ListStyleType(_) => CssPropertyType::ListStyleType,
5042 Self::ListStylePosition(_) => CssPropertyType::ListStylePosition,
5043 Self::StringSet(_) => CssPropertyType::StringSet,
5044 Self::TableLayout(_) => CssPropertyType::TableLayout,
5045 Self::BorderCollapse(_) => CssPropertyType::BorderCollapse,
5046 Self::BorderSpacing(_) => CssPropertyType::BorderSpacing,
5047 Self::CaptionSide(_) => CssPropertyType::CaptionSide,
5048 Self::EmptyCells(_) => CssPropertyType::EmptyCells,
5049 }
5050 }
5051
5052 #[must_use] pub const fn none(prop_type: CssPropertyType) -> Self {
5055 css_property_from_type!(prop_type, None)
5056 }
5057 #[must_use] pub const fn auto(prop_type: CssPropertyType) -> Self {
5058 css_property_from_type!(prop_type, Auto)
5059 }
5060 #[must_use] pub const fn initial(prop_type: CssPropertyType) -> Self {
5061 css_property_from_type!(prop_type, Initial)
5062 }
5063 #[must_use] pub const fn inherit(prop_type: CssPropertyType) -> Self {
5064 css_property_from_type!(prop_type, Inherit)
5065 }
5066
5067 #[must_use] pub const fn text_color(input: StyleTextColor) -> Self {
5068 Self::TextColor(CssPropertyValue::Exact(input))
5069 }
5070 #[must_use] pub const fn font_size(input: StyleFontSize) -> Self {
5071 Self::FontSize(CssPropertyValue::Exact(input))
5072 }
5073 #[must_use] pub const fn font_family(input: StyleFontFamilyVec) -> Self {
5074 Self::FontFamily(CssPropertyValue::Exact(input))
5075 }
5076 #[must_use] pub const fn font_weight(input: StyleFontWeight) -> Self {
5077 Self::FontWeight(CssPropertyValue::Exact(input))
5078 }
5079 #[must_use] pub const fn font_style(input: StyleFontStyle) -> Self {
5080 Self::FontStyle(CssPropertyValue::Exact(input))
5081 }
5082 #[must_use] pub const fn text_align(input: StyleTextAlign) -> Self {
5083 Self::TextAlign(CssPropertyValue::Exact(input))
5084 }
5085 #[must_use] pub const fn text_justify(input: LayoutTextJustify) -> Self {
5086 Self::TextJustify(CssPropertyValue::Exact(input))
5087 }
5088 #[must_use] pub const fn vertical_align(input: StyleVerticalAlign) -> Self {
5089 Self::VerticalAlign(CssPropertyValue::Exact(input))
5090 }
5091 #[must_use] pub const fn letter_spacing(input: StyleLetterSpacing) -> Self {
5092 Self::LetterSpacing(CssPropertyValue::Exact(input))
5093 }
5094 #[must_use] pub const fn text_indent(input: StyleTextIndent) -> Self {
5095 Self::TextIndent(CssPropertyValue::Exact(input))
5096 }
5097 #[must_use] pub const fn line_height(input: StyleLineHeight) -> Self {
5098 Self::LineHeight(CssPropertyValue::Exact(input))
5099 }
5100 #[must_use] pub const fn word_spacing(input: StyleWordSpacing) -> Self {
5101 Self::WordSpacing(CssPropertyValue::Exact(input))
5102 }
5103 #[must_use] pub const fn tab_size(input: StyleTabSize) -> Self {
5104 Self::TabSize(CssPropertyValue::Exact(input))
5105 }
5106 #[must_use] pub const fn cursor(input: StyleCursor) -> Self {
5107 Self::Cursor(CssPropertyValue::Exact(input))
5108 }
5109 #[must_use] pub const fn user_select(input: StyleUserSelect) -> Self {
5110 Self::UserSelect(CssPropertyValue::Exact(input))
5111 }
5112 #[must_use] pub const fn text_decoration(input: StyleTextDecoration) -> Self {
5113 Self::TextDecoration(CssPropertyValue::Exact(input))
5114 }
5115 #[must_use] pub const fn display(input: LayoutDisplay) -> Self {
5116 Self::Display(CssPropertyValue::Exact(input))
5117 }
5118 #[must_use] pub const fn box_sizing(input: LayoutBoxSizing) -> Self {
5119 Self::BoxSizing(CssPropertyValue::Exact(input))
5120 }
5121 #[must_use] pub const fn width(input: LayoutWidth) -> Self {
5122 Self::Width(CssPropertyValue::Exact(input))
5123 }
5124 #[must_use] pub const fn height(input: LayoutHeight) -> Self {
5125 Self::Height(CssPropertyValue::Exact(input))
5126 }
5127 #[must_use] pub const fn min_width(input: LayoutMinWidth) -> Self {
5128 Self::MinWidth(CssPropertyValue::Exact(input))
5129 }
5130 #[must_use] pub const fn caret_color(input: CaretColor) -> Self {
5131 Self::CaretColor(CssPropertyValue::Exact(input))
5132 }
5133 #[must_use] pub const fn caret_width(input: CaretWidth) -> Self {
5134 Self::CaretWidth(CssPropertyValue::Exact(input))
5135 }
5136 #[must_use] pub const fn caret_animation_duration(input: CaretAnimationDuration) -> Self {
5137 Self::CaretAnimationDuration(CssPropertyValue::Exact(input))
5138 }
5139 #[must_use] pub const fn selection_background_color(input: SelectionBackgroundColor) -> Self {
5140 Self::SelectionBackgroundColor(CssPropertyValue::Exact(input))
5141 }
5142 #[must_use] pub const fn selection_color(input: SelectionColor) -> Self {
5143 Self::SelectionColor(CssPropertyValue::Exact(input))
5144 }
5145 #[must_use] pub const fn min_height(input: LayoutMinHeight) -> Self {
5146 Self::MinHeight(CssPropertyValue::Exact(input))
5147 }
5148 #[must_use] pub const fn max_width(input: LayoutMaxWidth) -> Self {
5149 Self::MaxWidth(CssPropertyValue::Exact(input))
5150 }
5151 #[must_use] pub const fn max_height(input: LayoutMaxHeight) -> Self {
5152 Self::MaxHeight(CssPropertyValue::Exact(input))
5153 }
5154 #[must_use] pub const fn position(input: LayoutPosition) -> Self {
5155 Self::Position(CssPropertyValue::Exact(input))
5156 }
5157 #[must_use] pub const fn top(input: LayoutTop) -> Self {
5158 Self::Top(CssPropertyValue::Exact(input))
5159 }
5160 #[must_use] pub const fn right(input: LayoutRight) -> Self {
5161 Self::Right(CssPropertyValue::Exact(input))
5162 }
5163 #[must_use] pub const fn left(input: LayoutLeft) -> Self {
5164 Self::Left(CssPropertyValue::Exact(input))
5165 }
5166 #[must_use] pub const fn bottom(input: LayoutInsetBottom) -> Self {
5167 Self::Bottom(CssPropertyValue::Exact(input))
5168 }
5169 #[must_use] pub const fn z_index(input: LayoutZIndex) -> Self {
5170 Self::ZIndex(CssPropertyValue::Exact(input))
5171 }
5172 #[must_use] pub const fn flex_wrap(input: LayoutFlexWrap) -> Self {
5173 Self::FlexWrap(CssPropertyValue::Exact(input))
5174 }
5175 #[must_use] pub const fn flex_direction(input: LayoutFlexDirection) -> Self {
5176 Self::FlexDirection(CssPropertyValue::Exact(input))
5177 }
5178 #[must_use] pub const fn flex_grow(input: LayoutFlexGrow) -> Self {
5179 Self::FlexGrow(CssPropertyValue::Exact(input))
5180 }
5181 #[must_use] pub const fn flex_shrink(input: LayoutFlexShrink) -> Self {
5182 Self::FlexShrink(CssPropertyValue::Exact(input))
5183 }
5184 #[must_use] pub const fn justify_content(input: LayoutJustifyContent) -> Self {
5185 Self::JustifyContent(CssPropertyValue::Exact(input))
5186 }
5187 #[must_use] pub const fn grid_auto_flow(input: LayoutGridAutoFlow) -> Self {
5188 Self::GridAutoFlow(CssPropertyValue::Exact(input))
5189 }
5190 #[must_use] pub const fn justify_self(input: LayoutJustifySelf) -> Self {
5191 Self::JustifySelf(CssPropertyValue::Exact(input))
5192 }
5193 #[must_use] pub const fn justify_items(input: LayoutJustifyItems) -> Self {
5194 Self::JustifyItems(CssPropertyValue::Exact(input))
5195 }
5196 #[must_use] pub const fn gap(input: LayoutGap) -> Self {
5197 Self::Gap(CssPropertyValue::Exact(input))
5198 }
5199 #[must_use] pub const fn grid_gap(input: LayoutGap) -> Self {
5200 Self::GridGap(CssPropertyValue::Exact(input))
5201 }
5202 #[must_use] pub const fn align_self(input: LayoutAlignSelf) -> Self {
5203 Self::AlignSelf(CssPropertyValue::Exact(input))
5204 }
5205 #[must_use] pub const fn font(input: StyleFontFamilyVec) -> Self {
5206 Self::Font(StyleFontValue::Exact(input))
5207 }
5208 #[must_use] pub const fn align_items(input: LayoutAlignItems) -> Self {
5209 Self::AlignItems(CssPropertyValue::Exact(input))
5210 }
5211 #[must_use] pub const fn align_content(input: LayoutAlignContent) -> Self {
5212 Self::AlignContent(CssPropertyValue::Exact(input))
5213 }
5214 #[must_use] pub const fn background_content(input: StyleBackgroundContentVec) -> Self {
5215 Self::BackgroundContent(CssPropertyValue::Exact(input))
5216 }
5217 #[must_use] pub const fn background_position(input: StyleBackgroundPositionVec) -> Self {
5218 Self::BackgroundPosition(CssPropertyValue::Exact(input))
5219 }
5220 #[must_use] pub const fn background_size(input: StyleBackgroundSizeVec) -> Self {
5221 Self::BackgroundSize(CssPropertyValue::Exact(input))
5222 }
5223 #[must_use] pub const fn background_repeat(input: StyleBackgroundRepeatVec) -> Self {
5224 Self::BackgroundRepeat(CssPropertyValue::Exact(input))
5225 }
5226 #[must_use] pub const fn overflow_x(input: LayoutOverflow) -> Self {
5227 Self::OverflowX(CssPropertyValue::Exact(input))
5228 }
5229 #[must_use] pub const fn overflow_y(input: LayoutOverflow) -> Self {
5230 Self::OverflowY(CssPropertyValue::Exact(input))
5231 }
5232 #[must_use] pub const fn overflow_block(input: LayoutOverflow) -> Self {
5233 Self::OverflowBlock(CssPropertyValue::Exact(input))
5234 }
5235 #[must_use] pub const fn overflow_inline(input: LayoutOverflow) -> Self {
5236 Self::OverflowInline(CssPropertyValue::Exact(input))
5237 }
5238 #[must_use] pub const fn padding_top(input: LayoutPaddingTop) -> Self {
5239 Self::PaddingTop(CssPropertyValue::Exact(input))
5240 }
5241 #[must_use] pub const fn padding_left(input: LayoutPaddingLeft) -> Self {
5242 Self::PaddingLeft(CssPropertyValue::Exact(input))
5243 }
5244 #[must_use] pub const fn padding_right(input: LayoutPaddingRight) -> Self {
5245 Self::PaddingRight(CssPropertyValue::Exact(input))
5246 }
5247 #[must_use] pub const fn padding_bottom(input: LayoutPaddingBottom) -> Self {
5248 Self::PaddingBottom(CssPropertyValue::Exact(input))
5249 }
5250 #[must_use] pub const fn margin_top(input: LayoutMarginTop) -> Self {
5251 Self::MarginTop(CssPropertyValue::Exact(input))
5252 }
5253 #[must_use] pub const fn margin_left(input: LayoutMarginLeft) -> Self {
5254 Self::MarginLeft(CssPropertyValue::Exact(input))
5255 }
5256 #[must_use] pub const fn margin_right(input: LayoutMarginRight) -> Self {
5257 Self::MarginRight(CssPropertyValue::Exact(input))
5258 }
5259 #[must_use] pub const fn margin_bottom(input: LayoutMarginBottom) -> Self {
5260 Self::MarginBottom(CssPropertyValue::Exact(input))
5261 }
5262 #[must_use] pub const fn border_top_left_radius(input: StyleBorderTopLeftRadius) -> Self {
5263 Self::BorderTopLeftRadius(CssPropertyValue::Exact(input))
5264 }
5265 #[must_use] pub const fn border_top_right_radius(input: StyleBorderTopRightRadius) -> Self {
5266 Self::BorderTopRightRadius(CssPropertyValue::Exact(input))
5267 }
5268 #[must_use] pub const fn border_bottom_left_radius(input: StyleBorderBottomLeftRadius) -> Self {
5269 Self::BorderBottomLeftRadius(CssPropertyValue::Exact(input))
5270 }
5271 #[must_use] pub const fn border_bottom_right_radius(input: StyleBorderBottomRightRadius) -> Self {
5272 Self::BorderBottomRightRadius(CssPropertyValue::Exact(input))
5273 }
5274 #[must_use] pub const fn border_top_color(input: StyleBorderTopColor) -> Self {
5275 Self::BorderTopColor(CssPropertyValue::Exact(input))
5276 }
5277 #[must_use] pub const fn border_right_color(input: StyleBorderRightColor) -> Self {
5278 Self::BorderRightColor(CssPropertyValue::Exact(input))
5279 }
5280 #[must_use] pub const fn border_left_color(input: StyleBorderLeftColor) -> Self {
5281 Self::BorderLeftColor(CssPropertyValue::Exact(input))
5282 }
5283 #[must_use] pub const fn border_bottom_color(input: StyleBorderBottomColor) -> Self {
5284 Self::BorderBottomColor(CssPropertyValue::Exact(input))
5285 }
5286 #[must_use] pub const fn border_top_style(input: StyleBorderTopStyle) -> Self {
5287 Self::BorderTopStyle(CssPropertyValue::Exact(input))
5288 }
5289 #[must_use] pub const fn border_right_style(input: StyleBorderRightStyle) -> Self {
5290 Self::BorderRightStyle(CssPropertyValue::Exact(input))
5291 }
5292 #[must_use] pub const fn border_left_style(input: StyleBorderLeftStyle) -> Self {
5293 Self::BorderLeftStyle(CssPropertyValue::Exact(input))
5294 }
5295 #[must_use] pub const fn border_bottom_style(input: StyleBorderBottomStyle) -> Self {
5296 Self::BorderBottomStyle(CssPropertyValue::Exact(input))
5297 }
5298 #[must_use] pub const fn border_top_width(input: LayoutBorderTopWidth) -> Self {
5299 Self::BorderTopWidth(CssPropertyValue::Exact(input))
5300 }
5301 #[must_use] pub const fn border_right_width(input: LayoutBorderRightWidth) -> Self {
5302 Self::BorderRightWidth(CssPropertyValue::Exact(input))
5303 }
5304 #[must_use] pub const fn border_left_width(input: LayoutBorderLeftWidth) -> Self {
5305 Self::BorderLeftWidth(CssPropertyValue::Exact(input))
5306 }
5307 #[must_use] pub const fn border_bottom_width(input: LayoutBorderBottomWidth) -> Self {
5308 Self::BorderBottomWidth(CssPropertyValue::Exact(input))
5309 }
5310 #[must_use] pub fn box_shadow_left(input: StyleBoxShadow) -> Self {
5311 Self::BoxShadowLeft(CssPropertyValue::Exact(BoxOrStatic::heap(input)))
5312 }
5313 #[must_use] pub fn box_shadow_right(input: StyleBoxShadow) -> Self {
5314 Self::BoxShadowRight(CssPropertyValue::Exact(BoxOrStatic::heap(input)))
5315 }
5316 #[must_use] pub fn box_shadow_top(input: StyleBoxShadow) -> Self {
5317 Self::BoxShadowTop(CssPropertyValue::Exact(BoxOrStatic::heap(input)))
5318 }
5319 #[must_use] pub fn box_shadow_bottom(input: StyleBoxShadow) -> Self {
5320 Self::BoxShadowBottom(CssPropertyValue::Exact(BoxOrStatic::heap(input)))
5321 }
5322 #[must_use] pub const fn opacity(input: StyleOpacity) -> Self {
5323 Self::Opacity(CssPropertyValue::Exact(input))
5324 }
5325 #[must_use] pub const fn visibility(input: StyleVisibility) -> Self {
5326 Self::Visibility(CssPropertyValue::Exact(input))
5327 }
5328 #[must_use] pub const fn transform(input: StyleTransformVec) -> Self {
5329 Self::Transform(CssPropertyValue::Exact(input))
5330 }
5331 #[must_use] pub const fn transform_origin(input: StyleTransformOrigin) -> Self {
5332 Self::TransformOrigin(CssPropertyValue::Exact(input))
5333 }
5334 #[must_use] pub const fn perspective_origin(input: StylePerspectiveOrigin) -> Self {
5335 Self::PerspectiveOrigin(CssPropertyValue::Exact(input))
5336 }
5337 #[must_use] pub const fn backface_visibility(input: StyleBackfaceVisibility) -> Self {
5338 Self::BackfaceVisibility(CssPropertyValue::Exact(input))
5339 }
5340
5341 #[must_use] pub const fn break_before(input: PageBreak) -> Self {
5343 Self::BreakBefore(CssPropertyValue::Exact(input))
5344 }
5345 #[must_use] pub const fn break_after(input: PageBreak) -> Self {
5346 Self::BreakAfter(CssPropertyValue::Exact(input))
5347 }
5348 #[must_use] pub const fn break_inside(input: BreakInside) -> Self {
5349 Self::BreakInside(CssPropertyValue::Exact(input))
5350 }
5351 #[must_use] pub const fn orphans(input: Orphans) -> Self {
5352 Self::Orphans(CssPropertyValue::Exact(input))
5353 }
5354 #[must_use] pub const fn widows(input: Widows) -> Self {
5355 Self::Widows(CssPropertyValue::Exact(input))
5356 }
5357 #[must_use] pub const fn box_decoration_break(input: BoxDecorationBreak) -> Self {
5358 Self::BoxDecorationBreak(CssPropertyValue::Exact(input))
5359 }
5360 #[must_use] pub const fn column_count(input: ColumnCount) -> Self {
5361 Self::ColumnCount(CssPropertyValue::Exact(input))
5362 }
5363 #[must_use] pub const fn column_width(input: ColumnWidth) -> Self {
5364 Self::ColumnWidth(CssPropertyValue::Exact(input))
5365 }
5366 #[must_use] pub const fn column_span(input: ColumnSpan) -> Self {
5367 Self::ColumnSpan(CssPropertyValue::Exact(input))
5368 }
5369 #[must_use] pub const fn column_fill(input: ColumnFill) -> Self {
5370 Self::ColumnFill(CssPropertyValue::Exact(input))
5371 }
5372 #[must_use] pub const fn column_rule_width(input: ColumnRuleWidth) -> Self {
5373 Self::ColumnRuleWidth(CssPropertyValue::Exact(input))
5374 }
5375 #[must_use] pub const fn column_rule_style(input: ColumnRuleStyle) -> Self {
5376 Self::ColumnRuleStyle(CssPropertyValue::Exact(input))
5377 }
5378 #[must_use] pub const fn column_rule_color(input: ColumnRuleColor) -> Self {
5379 Self::ColumnRuleColor(CssPropertyValue::Exact(input))
5380 }
5381 #[must_use] pub const fn flow_into(input: FlowInto) -> Self {
5382 Self::FlowInto(CssPropertyValue::Exact(input))
5383 }
5384 #[must_use] pub const fn flow_from(input: FlowFrom) -> Self {
5385 Self::FlowFrom(CssPropertyValue::Exact(input))
5386 }
5387 #[must_use] pub const fn shape_outside(input: ShapeOutside) -> Self {
5388 Self::ShapeOutside(CssPropertyValue::Exact(input))
5389 }
5390 #[must_use] pub const fn shape_inside(input: ShapeInside) -> Self {
5391 Self::ShapeInside(CssPropertyValue::Exact(input))
5392 }
5393 #[must_use] pub const fn clip_path(input: ClipPath) -> Self {
5394 Self::ClipPath(CssPropertyValue::Exact(input))
5395 }
5396 #[must_use] pub const fn shape_margin(input: ShapeMargin) -> Self {
5397 Self::ShapeMargin(CssPropertyValue::Exact(input))
5398 }
5399 #[must_use] pub const fn shape_image_threshold(input: ShapeImageThreshold) -> Self {
5400 Self::ShapeImageThreshold(CssPropertyValue::Exact(input))
5401 }
5402 #[must_use] pub const fn content(input: Content) -> Self {
5403 Self::Content(CssPropertyValue::Exact(input))
5404 }
5405 #[must_use] pub const fn counter_reset(input: CounterReset) -> Self {
5406 Self::CounterReset(CssPropertyValue::Exact(input))
5407 }
5408 #[must_use] pub const fn counter_increment(input: CounterIncrement) -> Self {
5409 Self::CounterIncrement(CssPropertyValue::Exact(input))
5410 }
5411 #[must_use] pub const fn list_style_type(input: StyleListStyleType) -> Self {
5412 Self::ListStyleType(CssPropertyValue::Exact(input))
5413 }
5414 #[must_use] pub const fn list_style_position(input: StyleListStylePosition) -> Self {
5415 Self::ListStylePosition(CssPropertyValue::Exact(input))
5416 }
5417 #[must_use] pub const fn string_set(input: StringSet) -> Self {
5418 Self::StringSet(CssPropertyValue::Exact(input))
5419 }
5420 #[must_use] pub const fn table_layout(input: LayoutTableLayout) -> Self {
5421 Self::TableLayout(CssPropertyValue::Exact(input))
5422 }
5423 #[must_use] pub const fn border_collapse(input: StyleBorderCollapse) -> Self {
5424 Self::BorderCollapse(CssPropertyValue::Exact(input))
5425 }
5426 #[must_use] pub const fn border_spacing(input: LayoutBorderSpacing) -> Self {
5427 Self::BorderSpacing(CssPropertyValue::Exact(input))
5428 }
5429 #[must_use] pub const fn caption_side(input: StyleCaptionSide) -> Self {
5430 Self::CaptionSide(CssPropertyValue::Exact(input))
5431 }
5432 #[must_use] pub const fn empty_cells(input: StyleEmptyCells) -> Self {
5433 Self::EmptyCells(CssPropertyValue::Exact(input))
5434 }
5435
5436 #[must_use] pub const fn as_z_index(&self) -> Option<&LayoutZIndexValue> {
5437 match self {
5438 Self::ZIndex(f) => Some(f),
5439 _ => None,
5440 }
5441 }
5442
5443 #[must_use] pub const fn as_flex_basis(&self) -> Option<&LayoutFlexBasisValue> {
5444 match self {
5445 Self::FlexBasis(f) => Some(f),
5446 _ => None,
5447 }
5448 }
5449
5450 #[must_use] pub const fn as_column_gap(&self) -> Option<&LayoutColumnGapValue> {
5451 match self {
5452 Self::ColumnGap(f) => Some(f),
5453 _ => None,
5454 }
5455 }
5456
5457 #[must_use] pub const fn as_row_gap(&self) -> Option<&LayoutRowGapValue> {
5458 match self {
5459 Self::RowGap(f) => Some(f),
5460 _ => None,
5461 }
5462 }
5463
5464 #[must_use] pub const fn as_grid_template_columns(&self) -> Option<&LayoutGridTemplateColumnsValue> {
5465 match self {
5466 Self::GridTemplateColumns(f) => Some(f),
5467 _ => None,
5468 }
5469 }
5470
5471 #[must_use] pub const fn as_grid_template_rows(&self) -> Option<&LayoutGridTemplateRowsValue> {
5472 match self {
5473 Self::GridTemplateRows(f) => Some(f),
5474 _ => None,
5475 }
5476 }
5477
5478 #[must_use] pub const fn as_grid_auto_columns(&self) -> Option<&LayoutGridAutoColumnsValue> {
5479 match self {
5480 Self::GridAutoColumns(f) => Some(f),
5481 _ => None,
5482 }
5483 }
5484
5485 #[must_use] pub const fn as_grid_auto_rows(&self) -> Option<&LayoutGridAutoRowsValue> {
5486 match self {
5487 Self::GridAutoRows(f) => Some(f),
5488 _ => None,
5489 }
5490 }
5491
5492 #[must_use] pub const fn as_grid_column(&self) -> Option<&LayoutGridColumnValue> {
5493 match self {
5494 Self::GridColumn(f) => Some(f),
5495 _ => None,
5496 }
5497 }
5498
5499 #[must_use] pub const fn as_grid_row(&self) -> Option<&LayoutGridRowValue> {
5500 match self {
5501 Self::GridRow(f) => Some(f),
5502 _ => None,
5503 }
5504 }
5505
5506 #[must_use] pub const fn as_writing_mode(&self) -> Option<&LayoutWritingModeValue> {
5507 match self {
5508 Self::WritingMode(f) => Some(f),
5509 _ => None,
5510 }
5511 }
5512
5513 #[must_use] pub const fn as_clear(&self) -> Option<&LayoutClearValue> {
5514 match self {
5515 Self::Clear(f) => Some(f),
5516 _ => None,
5517 }
5518 }
5519
5520 #[must_use] pub const fn as_scrollbar_track(&self) -> Option<&StyleBackgroundContentValue> {
5521 match self {
5522 Self::ScrollbarTrack(f) => Some(f),
5523 _ => None,
5524 }
5525 }
5526
5527 #[must_use] pub const fn as_scrollbar_thumb(&self) -> Option<&StyleBackgroundContentValue> {
5528 match self {
5529 Self::ScrollbarThumb(f) => Some(f),
5530 _ => None,
5531 }
5532 }
5533
5534 #[must_use] pub const fn as_scrollbar_button(&self) -> Option<&StyleBackgroundContentValue> {
5535 match self {
5536 Self::ScrollbarButton(f) => Some(f),
5537 _ => None,
5538 }
5539 }
5540
5541 #[must_use] pub const fn as_scrollbar_corner(&self) -> Option<&StyleBackgroundContentValue> {
5542 match self {
5543 Self::ScrollbarCorner(f) => Some(f),
5544 _ => None,
5545 }
5546 }
5547
5548 #[must_use] pub const fn as_scrollbar_resizer(&self) -> Option<&StyleBackgroundContentValue> {
5549 match self {
5550 Self::ScrollbarResizer(f) => Some(f),
5551 _ => None,
5552 }
5553 }
5554
5555 #[must_use] pub const fn as_visibility(&self) -> Option<&StyleVisibilityValue> {
5556 match self {
5557 Self::Visibility(f) => Some(f),
5558 _ => None,
5559 }
5560 }
5561
5562 #[must_use] pub const fn as_background_content(&self) -> Option<&StyleBackgroundContentVecValue> {
5563 match self {
5564 Self::BackgroundContent(f) => Some(f),
5565 _ => None,
5566 }
5567 }
5568 #[must_use] pub const fn as_text_justify(&self) -> Option<&LayoutTextJustifyValue> {
5569 match self {
5570 Self::TextJustify(f) => Some(f),
5571 _ => None,
5572 }
5573 }
5574 #[must_use] pub const fn as_caret_color(&self) -> Option<&CaretColorValue> {
5575 match self {
5576 Self::CaretColor(f) => Some(f),
5577 _ => None,
5578 }
5579 }
5580 #[must_use] pub const fn as_caret_width(&self) -> Option<&CaretWidthValue> {
5581 match self {
5582 Self::CaretWidth(f) => Some(f),
5583 _ => None,
5584 }
5585 }
5586 #[must_use] pub const fn as_caret_animation_duration(&self) -> Option<&CaretAnimationDurationValue> {
5587 match self {
5588 Self::CaretAnimationDuration(f) => Some(f),
5589 _ => None,
5590 }
5591 }
5592 #[must_use] pub const fn as_selection_background_color(&self) -> Option<&SelectionBackgroundColorValue> {
5593 match self {
5594 Self::SelectionBackgroundColor(f) => Some(f),
5595 _ => None,
5596 }
5597 }
5598 #[must_use] pub const fn as_selection_color(&self) -> Option<&SelectionColorValue> {
5599 match self {
5600 Self::SelectionColor(f) => Some(f),
5601 _ => None,
5602 }
5603 }
5604 #[must_use] pub const fn as_selection_radius(&self) -> Option<&SelectionRadiusValue> {
5605 match self {
5606 Self::SelectionRadius(f) => Some(f),
5607 _ => None,
5608 }
5609 }
5610 #[must_use] pub const fn as_background_position(&self) -> Option<&StyleBackgroundPositionVecValue> {
5611 match self {
5612 Self::BackgroundPosition(f) => Some(f),
5613 _ => None,
5614 }
5615 }
5616 #[must_use] pub const fn as_background_size(&self) -> Option<&StyleBackgroundSizeVecValue> {
5617 match self {
5618 Self::BackgroundSize(f) => Some(f),
5619 _ => None,
5620 }
5621 }
5622 #[must_use] pub const fn as_background_repeat(&self) -> Option<&StyleBackgroundRepeatVecValue> {
5623 match self {
5624 Self::BackgroundRepeat(f) => Some(f),
5625 _ => None,
5626 }
5627 }
5628
5629 #[must_use] pub const fn as_grid_auto_flow(&self) -> Option<&LayoutGridAutoFlowValue> {
5630 match self {
5631 Self::GridAutoFlow(f) => Some(f),
5632 _ => None,
5633 }
5634 }
5635 #[must_use] pub const fn as_justify_self(&self) -> Option<&LayoutJustifySelfValue> {
5636 match self {
5637 Self::JustifySelf(f) => Some(f),
5638 _ => None,
5639 }
5640 }
5641 #[must_use] pub const fn as_justify_items(&self) -> Option<&LayoutJustifyItemsValue> {
5642 match self {
5643 Self::JustifyItems(f) => Some(f),
5644 _ => None,
5645 }
5646 }
5647 #[must_use] pub const fn as_gap(&self) -> Option<&LayoutGapValue> {
5648 match self {
5649 Self::Gap(f) => Some(f),
5650 _ => None,
5651 }
5652 }
5653 #[must_use] pub const fn as_grid_gap(&self) -> Option<&LayoutGapValue> {
5654 match self {
5655 Self::GridGap(f) => Some(f),
5656 _ => None,
5657 }
5658 }
5659 #[must_use] pub const fn as_align_self(&self) -> Option<&LayoutAlignSelfValue> {
5660 match self {
5661 Self::AlignSelf(f) => Some(f),
5662 _ => None,
5663 }
5664 }
5665 #[must_use] pub const fn as_font(&self) -> Option<&StyleFontValue> {
5666 match self {
5667 Self::Font(f) => Some(f),
5668 _ => None,
5669 }
5670 }
5671 #[must_use] pub const fn as_font_size(&self) -> Option<&StyleFontSizeValue> {
5672 match self {
5673 Self::FontSize(f) => Some(f),
5674 _ => None,
5675 }
5676 }
5677 #[must_use] pub const fn as_font_family(&self) -> Option<&StyleFontFamilyVecValue> {
5678 match self {
5679 Self::FontFamily(f) => Some(f),
5680 _ => None,
5681 }
5682 }
5683 #[must_use] pub const fn as_font_weight(&self) -> Option<&StyleFontWeightValue> {
5684 match self {
5685 Self::FontWeight(f) => Some(f),
5686 _ => None,
5687 }
5688 }
5689 #[must_use] pub const fn as_font_style(&self) -> Option<&StyleFontStyleValue> {
5690 match self {
5691 Self::FontStyle(f) => Some(f),
5692 _ => None,
5693 }
5694 }
5695 #[must_use] pub const fn as_text_color(&self) -> Option<&StyleTextColorValue> {
5696 match self {
5697 Self::TextColor(f) => Some(f),
5698 _ => None,
5699 }
5700 }
5701 #[must_use] pub const fn as_text_align(&self) -> Option<&StyleTextAlignValue> {
5702 match self {
5703 Self::TextAlign(f) => Some(f),
5704 _ => None,
5705 }
5706 }
5707 #[must_use] pub const fn as_vertical_align(&self) -> Option<&StyleVerticalAlignValue> {
5708 match self {
5709 Self::VerticalAlign(f) => Some(f),
5710 _ => None,
5711 }
5712 }
5713 #[must_use] pub const fn as_line_height(&self) -> Option<&StyleLineHeightValue> {
5714 match self {
5715 Self::LineHeight(f) => Some(f),
5716 _ => None,
5717 }
5718 }
5719 #[must_use] pub const fn as_text_indent(&self) -> Option<&StyleTextIndentValue> {
5720 match self {
5721 Self::TextIndent(f) => Some(f),
5722 _ => None,
5723 }
5724 }
5725 #[must_use] pub const fn as_initial_letter(&self) -> Option<&StyleInitialLetterValue> {
5726 match self {
5727 Self::InitialLetter(f) => Some(f),
5728 _ => None,
5729 }
5730 }
5731 #[must_use] pub const fn as_line_clamp(&self) -> Option<&StyleLineClampValue> {
5732 match self {
5733 Self::LineClamp(f) => Some(f),
5734 _ => None,
5735 }
5736 }
5737 #[must_use] pub const fn as_hanging_punctuation(&self) -> Option<&StyleHangingPunctuationValue> {
5738 match self {
5739 Self::HangingPunctuation(f) => Some(f),
5740 _ => None,
5741 }
5742 }
5743 #[must_use] pub const fn as_text_combine_upright(&self) -> Option<&StyleTextCombineUprightValue> {
5744 match self {
5745 Self::TextCombineUpright(f) => Some(f),
5746 _ => None,
5747 }
5748 }
5749 #[must_use] pub const fn as_unicode_bidi(&self) -> Option<&StyleUnicodeBidiValue> {
5750 match self {
5751 Self::UnicodeBidi(f) => Some(f),
5752 _ => None,
5753 }
5754 }
5755 #[must_use] pub const fn as_text_box_trim(&self) -> Option<&StyleTextBoxTrimValue> {
5756 match self {
5757 Self::TextBoxTrim(f) => Some(f),
5758 _ => None,
5759 }
5760 }
5761 #[must_use] pub const fn as_text_box_edge(&self) -> Option<&StyleTextBoxEdgeValue> {
5762 match self {
5763 Self::TextBoxEdge(f) => Some(f),
5764 _ => None,
5765 }
5766 }
5767 #[must_use] pub const fn as_dominant_baseline(&self) -> Option<&StyleDominantBaselineValue> {
5768 match self {
5769 Self::DominantBaseline(f) => Some(f),
5770 _ => None,
5771 }
5772 }
5773 #[must_use] pub const fn as_alignment_baseline(&self) -> Option<&StyleAlignmentBaselineValue> {
5774 match self {
5775 Self::AlignmentBaseline(f) => Some(f),
5776 _ => None,
5777 }
5778 }
5779 #[must_use] pub const fn as_initial_letter_align(&self) -> Option<&StyleInitialLetterAlignValue> {
5780 match self {
5781 Self::InitialLetterAlign(f) => Some(f),
5782 _ => None,
5783 }
5784 }
5785 #[must_use] pub const fn as_initial_letter_wrap(&self) -> Option<&StyleInitialLetterWrapValue> {
5786 match self {
5787 Self::InitialLetterWrap(f) => Some(f),
5788 _ => None,
5789 }
5790 }
5791 #[must_use] pub const fn as_scrollbar_gutter(&self) -> Option<&StyleScrollbarGutterValue> {
5792 match self {
5793 Self::ScrollbarGutter(f) => Some(f),
5794 _ => None,
5795 }
5796 }
5797 #[must_use] pub const fn as_overflow_clip_margin(&self) -> Option<&StyleOverflowClipMarginValue> {
5798 match self {
5799 Self::OverflowClipMargin(f) => Some(f),
5800 _ => None,
5801 }
5802 }
5803 #[must_use] pub const fn as_clip(&self) -> Option<&StyleClipRectValue> {
5804 match self {
5805 Self::Clip(f) => Some(f),
5806 _ => None,
5807 }
5808 }
5809 #[must_use] pub const fn as_exclusion_margin(&self) -> Option<&StyleExclusionMarginValue> {
5810 match self {
5811 Self::ExclusionMargin(f) => Some(f),
5812 _ => None,
5813 }
5814 }
5815 #[must_use] pub const fn as_hyphenation_language(&self) -> Option<&StyleHyphenationLanguageValue> {
5816 match self {
5817 Self::HyphenationLanguage(f) => Some(f),
5818 _ => None,
5819 }
5820 }
5821 #[must_use] pub const fn as_letter_spacing(&self) -> Option<&StyleLetterSpacingValue> {
5822 match self {
5823 Self::LetterSpacing(f) => Some(f),
5824 _ => None,
5825 }
5826 }
5827 #[must_use] pub const fn as_word_spacing(&self) -> Option<&StyleWordSpacingValue> {
5828 match self {
5829 Self::WordSpacing(f) => Some(f),
5830 _ => None,
5831 }
5832 }
5833 #[must_use] pub const fn as_tab_size(&self) -> Option<&StyleTabSizeValue> {
5834 match self {
5835 Self::TabSize(f) => Some(f),
5836 _ => None,
5837 }
5838 }
5839 #[must_use] pub const fn as_cursor(&self) -> Option<&StyleCursorValue> {
5840 match self {
5841 Self::Cursor(f) => Some(f),
5842 _ => None,
5843 }
5844 }
5845 #[must_use] pub const fn as_box_shadow_left(&self) -> Option<&StyleBoxShadowValue> {
5846 match self {
5847 Self::BoxShadowLeft(f) => Some(f),
5848 _ => None,
5849 }
5850 }
5851 #[must_use] pub const fn as_box_shadow_right(&self) -> Option<&StyleBoxShadowValue> {
5852 match self {
5853 Self::BoxShadowRight(f) => Some(f),
5854 _ => None,
5855 }
5856 }
5857 #[must_use] pub const fn as_box_shadow_top(&self) -> Option<&StyleBoxShadowValue> {
5858 match self {
5859 Self::BoxShadowTop(f) => Some(f),
5860 _ => None,
5861 }
5862 }
5863 #[must_use] pub const fn as_box_shadow_bottom(&self) -> Option<&StyleBoxShadowValue> {
5864 match self {
5865 Self::BoxShadowBottom(f) => Some(f),
5866 _ => None,
5867 }
5868 }
5869 #[must_use] pub const fn as_border_top_color(&self) -> Option<&StyleBorderTopColorValue> {
5870 match self {
5871 Self::BorderTopColor(f) => Some(f),
5872 _ => None,
5873 }
5874 }
5875 #[must_use] pub const fn as_border_left_color(&self) -> Option<&StyleBorderLeftColorValue> {
5876 match self {
5877 Self::BorderLeftColor(f) => Some(f),
5878 _ => None,
5879 }
5880 }
5881 #[must_use] pub const fn as_border_right_color(&self) -> Option<&StyleBorderRightColorValue> {
5882 match self {
5883 Self::BorderRightColor(f) => Some(f),
5884 _ => None,
5885 }
5886 }
5887 #[must_use] pub const fn as_border_bottom_color(&self) -> Option<&StyleBorderBottomColorValue> {
5888 match self {
5889 Self::BorderBottomColor(f) => Some(f),
5890 _ => None,
5891 }
5892 }
5893 #[must_use] pub const fn as_border_top_style(&self) -> Option<&StyleBorderTopStyleValue> {
5894 match self {
5895 Self::BorderTopStyle(f) => Some(f),
5896 _ => None,
5897 }
5898 }
5899 #[must_use] pub const fn as_border_left_style(&self) -> Option<&StyleBorderLeftStyleValue> {
5900 match self {
5901 Self::BorderLeftStyle(f) => Some(f),
5902 _ => None,
5903 }
5904 }
5905 #[must_use] pub const fn as_border_right_style(&self) -> Option<&StyleBorderRightStyleValue> {
5906 match self {
5907 Self::BorderRightStyle(f) => Some(f),
5908 _ => None,
5909 }
5910 }
5911 #[must_use] pub const fn as_border_bottom_style(&self) -> Option<&StyleBorderBottomStyleValue> {
5912 match self {
5913 Self::BorderBottomStyle(f) => Some(f),
5914 _ => None,
5915 }
5916 }
5917 #[must_use] pub const fn as_border_top_left_radius(&self) -> Option<&StyleBorderTopLeftRadiusValue> {
5918 match self {
5919 Self::BorderTopLeftRadius(f) => Some(f),
5920 _ => None,
5921 }
5922 }
5923 #[must_use] pub const fn as_border_top_right_radius(&self) -> Option<&StyleBorderTopRightRadiusValue> {
5924 match self {
5925 Self::BorderTopRightRadius(f) => Some(f),
5926 _ => None,
5927 }
5928 }
5929 #[must_use] pub const fn as_border_bottom_left_radius(&self) -> Option<&StyleBorderBottomLeftRadiusValue> {
5930 match self {
5931 Self::BorderBottomLeftRadius(f) => Some(f),
5932 _ => None,
5933 }
5934 }
5935 #[must_use] pub const fn as_border_bottom_right_radius(
5936 &self,
5937 ) -> Option<&StyleBorderBottomRightRadiusValue> {
5938 match self {
5939 Self::BorderBottomRightRadius(f) => Some(f),
5940 _ => None,
5941 }
5942 }
5943 #[must_use] pub const fn as_opacity(&self) -> Option<&StyleOpacityValue> {
5944 match self {
5945 Self::Opacity(f) => Some(f),
5946 _ => None,
5947 }
5948 }
5949 #[must_use] pub const fn as_transform(&self) -> Option<&StyleTransformVecValue> {
5950 match self {
5951 Self::Transform(f) => Some(f),
5952 _ => None,
5953 }
5954 }
5955 #[must_use] pub const fn as_transform_origin(&self) -> Option<&StyleTransformOriginValue> {
5956 match self {
5957 Self::TransformOrigin(f) => Some(f),
5958 _ => None,
5959 }
5960 }
5961 #[must_use] pub const fn as_perspective_origin(&self) -> Option<&StylePerspectiveOriginValue> {
5962 match self {
5963 Self::PerspectiveOrigin(f) => Some(f),
5964 _ => None,
5965 }
5966 }
5967 #[must_use] pub const fn as_backface_visibility(&self) -> Option<&StyleBackfaceVisibilityValue> {
5968 match self {
5969 Self::BackfaceVisibility(f) => Some(f),
5970 _ => None,
5971 }
5972 }
5973 #[must_use] pub const fn as_mix_blend_mode(&self) -> Option<&StyleMixBlendModeValue> {
5974 match self {
5975 Self::MixBlendMode(f) => Some(f),
5976 _ => None,
5977 }
5978 }
5979 #[must_use] pub const fn as_filter(&self) -> Option<&StyleFilterVecValue> {
5980 match self {
5981 Self::Filter(f) => Some(f),
5982 _ => None,
5983 }
5984 }
5985 #[must_use] pub const fn as_backdrop_filter(&self) -> Option<&StyleFilterVecValue> {
5986 match self {
5987 Self::BackdropFilter(f) => Some(f),
5988 _ => None,
5989 }
5990 }
5991 #[must_use] pub const fn as_text_shadow(&self) -> Option<&StyleBoxShadowValue> {
5992 match self {
5993 Self::TextShadow(f) => Some(f),
5994 _ => None,
5995 }
5996 }
5997
5998 #[must_use] pub const fn as_display(&self) -> Option<&LayoutDisplayValue> {
6001 match self {
6002 Self::Display(f) => Some(f),
6003 _ => None,
6004 }
6005 }
6006 #[must_use] pub const fn as_float(&self) -> Option<&LayoutFloatValue> {
6007 match self {
6008 Self::Float(f) => Some(f),
6009 _ => None,
6010 }
6011 }
6012 #[must_use] pub const fn as_box_sizing(&self) -> Option<&LayoutBoxSizingValue> {
6013 match self {
6014 Self::BoxSizing(f) => Some(f),
6015 _ => None,
6016 }
6017 }
6018 #[must_use] pub const fn as_width(&self) -> Option<&LayoutWidthValue> {
6019 match self {
6020 Self::Width(f) => Some(f),
6021 _ => None,
6022 }
6023 }
6024 #[must_use] pub const fn as_height(&self) -> Option<&LayoutHeightValue> {
6025 match self {
6026 Self::Height(f) => Some(f),
6027 _ => None,
6028 }
6029 }
6030 #[must_use] pub const fn as_min_width(&self) -> Option<&LayoutMinWidthValue> {
6031 match self {
6032 Self::MinWidth(f) => Some(f),
6033 _ => None,
6034 }
6035 }
6036 #[must_use] pub const fn as_min_height(&self) -> Option<&LayoutMinHeightValue> {
6037 match self {
6038 Self::MinHeight(f) => Some(f),
6039 _ => None,
6040 }
6041 }
6042 #[must_use] pub const fn as_max_width(&self) -> Option<&LayoutMaxWidthValue> {
6043 match self {
6044 Self::MaxWidth(f) => Some(f),
6045 _ => None,
6046 }
6047 }
6048 #[must_use] pub const fn as_max_height(&self) -> Option<&LayoutMaxHeightValue> {
6049 match self {
6050 Self::MaxHeight(f) => Some(f),
6051 _ => None,
6052 }
6053 }
6054 #[must_use] pub const fn as_position(&self) -> Option<&LayoutPositionValue> {
6055 match self {
6056 Self::Position(f) => Some(f),
6057 _ => None,
6058 }
6059 }
6060 #[must_use] pub const fn as_top(&self) -> Option<&LayoutTopValue> {
6061 match self {
6062 Self::Top(f) => Some(f),
6063 _ => None,
6064 }
6065 }
6066 #[must_use] pub const fn as_bottom(&self) -> Option<&LayoutInsetBottomValue> {
6067 match self {
6068 Self::Bottom(f) => Some(f),
6069 _ => None,
6070 }
6071 }
6072 #[must_use] pub const fn as_right(&self) -> Option<&LayoutRightValue> {
6073 match self {
6074 Self::Right(f) => Some(f),
6075 _ => None,
6076 }
6077 }
6078 #[must_use] pub const fn as_left(&self) -> Option<&LayoutLeftValue> {
6079 match self {
6080 Self::Left(f) => Some(f),
6081 _ => None,
6082 }
6083 }
6084 #[must_use] pub const fn as_padding_top(&self) -> Option<&LayoutPaddingTopValue> {
6085 match self {
6086 Self::PaddingTop(f) => Some(f),
6087 _ => None,
6088 }
6089 }
6090 #[must_use] pub const fn as_padding_bottom(&self) -> Option<&LayoutPaddingBottomValue> {
6091 match self {
6092 Self::PaddingBottom(f) => Some(f),
6093 _ => None,
6094 }
6095 }
6096 #[must_use] pub const fn as_padding_left(&self) -> Option<&LayoutPaddingLeftValue> {
6097 match self {
6098 Self::PaddingLeft(f) => Some(f),
6099 _ => None,
6100 }
6101 }
6102 #[must_use] pub const fn as_padding_right(&self) -> Option<&LayoutPaddingRightValue> {
6103 match self {
6104 Self::PaddingRight(f) => Some(f),
6105 _ => None,
6106 }
6107 }
6108 #[must_use] pub const fn as_margin_top(&self) -> Option<&LayoutMarginTopValue> {
6109 match self {
6110 Self::MarginTop(f) => Some(f),
6111 _ => None,
6112 }
6113 }
6114 #[must_use] pub const fn as_margin_bottom(&self) -> Option<&LayoutMarginBottomValue> {
6115 match self {
6116 Self::MarginBottom(f) => Some(f),
6117 _ => None,
6118 }
6119 }
6120 #[must_use] pub const fn as_margin_left(&self) -> Option<&LayoutMarginLeftValue> {
6121 match self {
6122 Self::MarginLeft(f) => Some(f),
6123 _ => None,
6124 }
6125 }
6126 #[must_use] pub const fn as_margin_right(&self) -> Option<&LayoutMarginRightValue> {
6127 match self {
6128 Self::MarginRight(f) => Some(f),
6129 _ => None,
6130 }
6131 }
6132 #[must_use] pub const fn as_border_top_width(&self) -> Option<&LayoutBorderTopWidthValue> {
6133 match self {
6134 Self::BorderTopWidth(f) => Some(f),
6135 _ => None,
6136 }
6137 }
6138 #[must_use] pub const fn as_border_left_width(&self) -> Option<&LayoutBorderLeftWidthValue> {
6139 match self {
6140 Self::BorderLeftWidth(f) => Some(f),
6141 _ => None,
6142 }
6143 }
6144 #[must_use] pub const fn as_border_right_width(&self) -> Option<&LayoutBorderRightWidthValue> {
6145 match self {
6146 Self::BorderRightWidth(f) => Some(f),
6147 _ => None,
6148 }
6149 }
6150 #[must_use] pub const fn as_border_bottom_width(&self) -> Option<&LayoutBorderBottomWidthValue> {
6151 match self {
6152 Self::BorderBottomWidth(f) => Some(f),
6153 _ => None,
6154 }
6155 }
6156 #[must_use] pub const fn as_overflow_x(&self) -> Option<&LayoutOverflowValue> {
6157 match self {
6158 Self::OverflowX(f) => Some(f),
6159 _ => None,
6160 }
6161 }
6162 #[must_use] pub const fn as_overflow_y(&self) -> Option<&LayoutOverflowValue> {
6163 match self {
6164 Self::OverflowY(f) => Some(f),
6165 _ => None,
6166 }
6167 }
6168 #[must_use] pub const fn as_overflow_block(&self) -> Option<&LayoutOverflowValue> {
6169 match self {
6170 Self::OverflowBlock(f) => Some(f),
6171 _ => None,
6172 }
6173 }
6174 #[must_use] pub const fn as_overflow_inline(&self) -> Option<&LayoutOverflowValue> {
6175 match self {
6176 Self::OverflowInline(f) => Some(f),
6177 _ => None,
6178 }
6179 }
6180 #[must_use] pub const fn as_flex_direction(&self) -> Option<&LayoutFlexDirectionValue> {
6181 match self {
6182 Self::FlexDirection(f) => Some(f),
6183 _ => None,
6184 }
6185 }
6186 #[must_use] pub const fn as_direction(&self) -> Option<&StyleDirectionValue> {
6187 match self {
6188 Self::Direction(f) => Some(f),
6189 _ => None,
6190 }
6191 }
6192 #[must_use] pub const fn as_user_select(&self) -> Option<&StyleUserSelectValue> {
6193 match self {
6194 Self::UserSelect(f) => Some(f),
6195 _ => None,
6196 }
6197 }
6198 #[must_use] pub const fn as_text_decoration(&self) -> Option<&StyleTextDecorationValue> {
6199 match self {
6200 Self::TextDecoration(f) => Some(f),
6201 _ => None,
6202 }
6203 }
6204 #[must_use] pub const fn as_hyphens(&self) -> Option<&StyleHyphensValue> {
6205 match self {
6206 Self::Hyphens(f) => Some(f),
6207 _ => None,
6208 }
6209 }
6210 #[must_use] pub const fn as_word_break(&self) -> Option<&StyleWordBreakValue> {
6211 match self {
6212 Self::WordBreak(f) => Some(f),
6213 _ => None,
6214 }
6215 }
6216 #[must_use] pub const fn as_overflow_wrap(&self) -> Option<&StyleOverflowWrapValue> {
6217 match self {
6218 Self::OverflowWrap(f) => Some(f),
6219 _ => None,
6220 }
6221 }
6222 #[must_use] pub const fn as_line_break(&self) -> Option<&StyleLineBreakValue> {
6223 match self {
6224 Self::LineBreak(f) => Some(f),
6225 _ => None,
6226 }
6227 }
6228 #[must_use] pub const fn as_object_fit(&self) -> Option<&StyleObjectFitValue> {
6229 match self {
6230 Self::ObjectFit(f) => Some(f),
6231 _ => None,
6232 }
6233 }
6234 #[must_use] pub const fn as_object_position(&self) -> Option<&StyleObjectPositionValue> {
6235 match self {
6236 Self::ObjectPosition(f) => Some(f),
6237 _ => None,
6238 }
6239 }
6240 #[must_use] pub const fn as_aspect_ratio(&self) -> Option<&StyleAspectRatioValue> {
6241 match self {
6242 Self::AspectRatio(f) => Some(f),
6243 _ => None,
6244 }
6245 }
6246 #[must_use] pub const fn as_text_orientation(&self) -> Option<&StyleTextOrientationValue> {
6247 match self {
6248 Self::TextOrientation(f) => Some(f),
6249 _ => None,
6250 }
6251 }
6252 #[must_use] pub const fn as_text_transform(&self) -> Option<&StyleTextTransformValue> {
6253 match self {
6254 Self::TextTransform(f) => Some(f),
6255 _ => None,
6256 }
6257 }
6258 #[must_use] pub const fn as_text_align_last(&self) -> Option<&StyleTextAlignLastValue> {
6259 match self {
6260 Self::TextAlignLast(f) => Some(f),
6261 _ => None,
6262 }
6263 }
6264 #[must_use] pub const fn as_white_space(&self) -> Option<&StyleWhiteSpaceValue> {
6265 match self {
6266 Self::WhiteSpace(f) => Some(f),
6267 _ => None,
6268 }
6269 }
6270 #[must_use] pub const fn as_flex_wrap(&self) -> Option<&LayoutFlexWrapValue> {
6271 match self {
6272 Self::FlexWrap(f) => Some(f),
6273 _ => None,
6274 }
6275 }
6276 #[must_use] pub const fn as_flex_grow(&self) -> Option<&LayoutFlexGrowValue> {
6277 match self {
6278 Self::FlexGrow(f) => Some(f),
6279 _ => None,
6280 }
6281 }
6282 #[must_use] pub const fn as_flex_shrink(&self) -> Option<&LayoutFlexShrinkValue> {
6283 match self {
6284 Self::FlexShrink(f) => Some(f),
6285 _ => None,
6286 }
6287 }
6288 #[must_use] pub const fn as_justify_content(&self) -> Option<&LayoutJustifyContentValue> {
6289 match self {
6290 Self::JustifyContent(f) => Some(f),
6291 _ => None,
6292 }
6293 }
6294 #[must_use] pub const fn as_align_items(&self) -> Option<&LayoutAlignItemsValue> {
6295 match self {
6296 Self::AlignItems(f) => Some(f),
6297 _ => None,
6298 }
6299 }
6300 #[must_use] pub const fn as_align_content(&self) -> Option<&LayoutAlignContentValue> {
6301 match self {
6302 Self::AlignContent(f) => Some(f),
6303 _ => None,
6304 }
6305 }
6306 #[must_use] pub const fn as_break_before(&self) -> Option<&PageBreakValue> {
6307 match self {
6308 Self::BreakBefore(f) => Some(f),
6309 _ => None,
6310 }
6311 }
6312 #[must_use] pub const fn as_break_after(&self) -> Option<&PageBreakValue> {
6313 match self {
6314 Self::BreakAfter(f) => Some(f),
6315 _ => None,
6316 }
6317 }
6318 #[must_use] pub const fn as_break_inside(&self) -> Option<&BreakInsideValue> {
6319 match self {
6320 Self::BreakInside(f) => Some(f),
6321 _ => None,
6322 }
6323 }
6324 #[must_use] pub const fn as_orphans(&self) -> Option<&OrphansValue> {
6325 match self {
6326 Self::Orphans(f) => Some(f),
6327 _ => None,
6328 }
6329 }
6330 #[must_use] pub const fn as_widows(&self) -> Option<&WidowsValue> {
6331 match self {
6332 Self::Widows(f) => Some(f),
6333 _ => None,
6334 }
6335 }
6336 #[must_use] pub const fn as_box_decoration_break(&self) -> Option<&BoxDecorationBreakValue> {
6337 match self {
6338 Self::BoxDecorationBreak(f) => Some(f),
6339 _ => None,
6340 }
6341 }
6342 #[must_use] pub const fn as_column_count(&self) -> Option<&ColumnCountValue> {
6343 match self {
6344 Self::ColumnCount(f) => Some(f),
6345 _ => None,
6346 }
6347 }
6348 #[must_use] pub const fn as_column_width(&self) -> Option<&ColumnWidthValue> {
6349 match self {
6350 Self::ColumnWidth(f) => Some(f),
6351 _ => None,
6352 }
6353 }
6354 #[must_use] pub const fn as_column_span(&self) -> Option<&ColumnSpanValue> {
6355 match self {
6356 Self::ColumnSpan(f) => Some(f),
6357 _ => None,
6358 }
6359 }
6360 #[must_use] pub const fn as_column_fill(&self) -> Option<&ColumnFillValue> {
6361 match self {
6362 Self::ColumnFill(f) => Some(f),
6363 _ => None,
6364 }
6365 }
6366 #[must_use] pub const fn as_column_rule_width(&self) -> Option<&ColumnRuleWidthValue> {
6367 match self {
6368 Self::ColumnRuleWidth(f) => Some(f),
6369 _ => None,
6370 }
6371 }
6372 #[must_use] pub const fn as_column_rule_style(&self) -> Option<&ColumnRuleStyleValue> {
6373 match self {
6374 Self::ColumnRuleStyle(f) => Some(f),
6375 _ => None,
6376 }
6377 }
6378 #[must_use] pub const fn as_column_rule_color(&self) -> Option<&ColumnRuleColorValue> {
6379 match self {
6380 Self::ColumnRuleColor(f) => Some(f),
6381 _ => None,
6382 }
6383 }
6384 #[must_use] pub const fn as_flow_into(&self) -> Option<&FlowIntoValue> {
6385 match self {
6386 Self::FlowInto(f) => Some(f),
6387 _ => None,
6388 }
6389 }
6390 #[must_use] pub const fn as_flow_from(&self) -> Option<&FlowFromValue> {
6391 match self {
6392 Self::FlowFrom(f) => Some(f),
6393 _ => None,
6394 }
6395 }
6396 #[must_use] pub const fn as_shape_outside(&self) -> Option<&ShapeOutsideValue> {
6397 match self {
6398 Self::ShapeOutside(f) => Some(f),
6399 _ => None,
6400 }
6401 }
6402 #[must_use] pub const fn as_shape_inside(&self) -> Option<&ShapeInsideValue> {
6403 match self {
6404 Self::ShapeInside(f) => Some(f),
6405 _ => None,
6406 }
6407 }
6408 #[must_use] pub const fn as_clip_path(&self) -> Option<&ClipPathValue> {
6409 match self {
6410 Self::ClipPath(f) => Some(f),
6411 _ => None,
6412 }
6413 }
6414 #[must_use] pub const fn as_shape_margin(&self) -> Option<&ShapeMarginValue> {
6415 match self {
6416 Self::ShapeMargin(f) => Some(f),
6417 _ => None,
6418 }
6419 }
6420 #[must_use] pub const fn as_shape_image_threshold(&self) -> Option<&ShapeImageThresholdValue> {
6421 match self {
6422 Self::ShapeImageThreshold(f) => Some(f),
6423 _ => None,
6424 }
6425 }
6426 #[must_use] pub const fn as_content(&self) -> Option<&ContentValue> {
6427 match self {
6428 Self::Content(f) => Some(f),
6429 _ => None,
6430 }
6431 }
6432 #[must_use] pub const fn as_counter_reset(&self) -> Option<&CounterResetValue> {
6433 match self {
6434 Self::CounterReset(f) => Some(f),
6435 _ => None,
6436 }
6437 }
6438 #[must_use] pub const fn as_counter_increment(&self) -> Option<&CounterIncrementValue> {
6439 match self {
6440 Self::CounterIncrement(f) => Some(f),
6441 _ => None,
6442 }
6443 }
6444 #[must_use] pub const fn as_list_style_type(&self) -> Option<&StyleListStyleTypeValue> {
6445 match self {
6446 Self::ListStyleType(f) => Some(f),
6447 _ => None,
6448 }
6449 }
6450 #[must_use] pub const fn as_list_style_position(&self) -> Option<&StyleListStylePositionValue> {
6451 match self {
6452 Self::ListStylePosition(f) => Some(f),
6453 _ => None,
6454 }
6455 }
6456 #[must_use] pub const fn as_string_set(&self) -> Option<&StringSetValue> {
6457 match self {
6458 Self::StringSet(f) => Some(f),
6459 _ => None,
6460 }
6461 }
6462 #[must_use] pub const fn as_table_layout(&self) -> Option<&LayoutTableLayoutValue> {
6463 match self {
6464 Self::TableLayout(f) => Some(f),
6465 _ => None,
6466 }
6467 }
6468 #[must_use] pub const fn as_border_collapse(&self) -> Option<&StyleBorderCollapseValue> {
6469 match self {
6470 Self::BorderCollapse(f) => Some(f),
6471 _ => None,
6472 }
6473 }
6474 #[must_use] pub const fn as_border_spacing(&self) -> Option<&LayoutBorderSpacingValue> {
6475 match self {
6476 Self::BorderSpacing(f) => Some(f),
6477 _ => None,
6478 }
6479 }
6480 #[must_use] pub const fn as_caption_side(&self) -> Option<&StyleCaptionSideValue> {
6481 match self {
6482 Self::CaptionSide(f) => Some(f),
6483 _ => None,
6484 }
6485 }
6486 #[must_use] pub const fn as_empty_cells(&self) -> Option<&StyleEmptyCellsValue> {
6487 match self {
6488 Self::EmptyCells(f) => Some(f),
6489 _ => None,
6490 }
6491 }
6492
6493 #[must_use] pub const fn as_scrollbar_width(&self) -> Option<&LayoutScrollbarWidthValue> {
6494 match self {
6495 Self::ScrollbarWidth(f) => Some(f),
6496 _ => None,
6497 }
6498 }
6499 #[must_use] pub const fn as_scrollbar_color(&self) -> Option<&StyleScrollbarColorValue> {
6500 match self {
6501 Self::ScrollbarColor(f) => Some(f),
6502 _ => None,
6503 }
6504 }
6505
6506 #[must_use] pub const fn as_scrollbar_visibility(&self) -> Option<&ScrollbarVisibilityModeValue> {
6507 match self {
6508 Self::ScrollbarVisibility(f) => Some(f),
6509 _ => None,
6510 }
6511 }
6512
6513 #[must_use] pub const fn as_scrollbar_fade_delay(&self) -> Option<&ScrollbarFadeDelayValue> {
6514 match self {
6515 Self::ScrollbarFadeDelay(f) => Some(f),
6516 _ => None,
6517 }
6518 }
6519
6520 #[must_use] pub const fn as_scrollbar_fade_duration(&self) -> Option<&ScrollbarFadeDurationValue> {
6521 match self {
6522 Self::ScrollbarFadeDuration(f) => Some(f),
6523 _ => None,
6524 }
6525 }
6526
6527 #[allow(clippy::match_same_arms)]
6530 #[allow(clippy::too_many_lines)] #[must_use] pub const fn is_initial(&self) -> bool {
6532 use self::CssProperty::{CaretColor, CaretWidth, CaretAnimationDuration, SelectionBackgroundColor, SelectionColor, SelectionRadius, TextJustify, TextColor, FontSize, FontFamily, TextAlign, LetterSpacing, TextIndent, InitialLetter, LineClamp, HangingPunctuation, TextCombineUpright, UnicodeBidi, TextBoxTrim, TextBoxEdge, DominantBaseline, AlignmentBaseline, InitialLetterAlign, InitialLetterWrap, ScrollbarGutter, OverflowClipMargin, Clip, ExclusionMargin, HyphenationLanguage, LineHeight, WordSpacing, TabSize, Cursor, Display, Float, BoxSizing, Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight, Position, Top, Right, Left, Bottom, ZIndex, FlexWrap, FlexDirection, FlexGrow, FlexShrink, FlexBasis, JustifyContent, AlignItems, AlignContent, ColumnGap, RowGap, GridTemplateColumns, GridTemplateRows, GridAutoFlow, JustifySelf, JustifyItems, Gap, GridGap, AlignSelf, Font, GridAutoColumns, GridAutoRows, GridColumn, GridRow, GridTemplateAreas, WritingMode, Clear, BackgroundContent, BackgroundPosition, BackgroundSize, BackgroundRepeat, OverflowX, OverflowY, OverflowBlock, OverflowInline, PaddingTop, PaddingLeft, PaddingRight, PaddingBottom, PaddingInlineStart, PaddingInlineEnd, MarginTop, MarginLeft, MarginRight, MarginBottom, BorderTopLeftRadius, BorderTopRightRadius, BorderBottomLeftRadius, BorderBottomRightRadius, BorderTopColor, BorderRightColor, BorderLeftColor, BorderBottomColor, BorderTopStyle, BorderRightStyle, BorderLeftStyle, BorderBottomStyle, BorderTopWidth, BorderRightWidth, BorderLeftWidth, BorderBottomWidth, BoxShadowLeft, BoxShadowRight, BoxShadowTop, BoxShadowBottom, ScrollbarTrack, ScrollbarThumb, ScrollbarButton, ScrollbarCorner, ScrollbarResizer, ScrollbarWidth, ScrollbarColor, ScrollbarVisibility, ScrollbarFadeDelay, ScrollbarFadeDuration, Opacity, Visibility, Transform, TransformOrigin, PerspectiveOrigin, BackfaceVisibility, MixBlendMode, Filter, BackdropFilter, TextShadow, WhiteSpace, Direction, UserSelect, TextDecoration, Hyphens, WordBreak, OverflowWrap, LineBreak, ObjectFit, ObjectPosition, AspectRatio, TextOrientation, TextAlignLast, TextTransform, BreakBefore, BreakAfter, BreakInside, Orphans, Widows, BoxDecorationBreak, ColumnCount, ColumnWidth, ColumnSpan, ColumnFill, ColumnRuleWidth, ColumnRuleStyle, ColumnRuleColor, FlowInto, FlowFrom, ShapeOutside, ShapeInside, ClipPath, ShapeMargin, ShapeImageThreshold, Content, CounterReset, CounterIncrement, ListStyleType, ListStylePosition, StringSet, TableLayout, BorderCollapse, BorderSpacing, CaptionSide, EmptyCells, FontWeight, FontStyle, VerticalAlign};
6533 match self {
6534 CaretColor(c) => c.is_initial(),
6535 CaretWidth(c) => c.is_initial(),
6536 CaretAnimationDuration(c) => c.is_initial(),
6537 SelectionBackgroundColor(c) => c.is_initial(),
6538 SelectionColor(c) => c.is_initial(),
6539 SelectionRadius(c) => c.is_initial(),
6540 TextJustify(c) => c.is_initial(),
6541 TextColor(c) => c.is_initial(),
6542 FontSize(c) => c.is_initial(),
6543 FontFamily(c) => c.is_initial(),
6544 TextAlign(c) => c.is_initial(),
6545 LetterSpacing(c) => c.is_initial(),
6546 TextIndent(c) => c.is_initial(),
6547 InitialLetter(c) => c.is_initial(),
6548 LineClamp(c) => c.is_initial(),
6549 HangingPunctuation(c) => c.is_initial(),
6550 TextCombineUpright(c) => c.is_initial(),
6551 UnicodeBidi(c) => c.is_initial(),
6552 TextBoxTrim(c) => c.is_initial(),
6553 TextBoxEdge(c) => c.is_initial(),
6554 DominantBaseline(c) => c.is_initial(),
6555 AlignmentBaseline(c) => c.is_initial(),
6556 InitialLetterAlign(c) => c.is_initial(),
6557 InitialLetterWrap(c) => c.is_initial(),
6558 ScrollbarGutter(c) => c.is_initial(),
6559 OverflowClipMargin(c) => c.is_initial(),
6560 Clip(c) => c.is_initial(),
6561 ExclusionMargin(c) => c.is_initial(),
6562 HyphenationLanguage(c) => c.is_initial(),
6563 LineHeight(c) => c.is_initial(),
6564 WordSpacing(c) => c.is_initial(),
6565 TabSize(c) => c.is_initial(),
6566 Cursor(c) => c.is_initial(),
6567 Display(c) => c.is_initial(),
6568 Float(c) => c.is_initial(),
6569 BoxSizing(c) => c.is_initial(),
6570 Width(c) => c.is_initial(),
6571 Height(c) => c.is_initial(),
6572 MinWidth(c) => c.is_initial(),
6573 MinHeight(c) => c.is_initial(),
6574 MaxWidth(c) => c.is_initial(),
6575 MaxHeight(c) => c.is_initial(),
6576 Position(c) => c.is_initial(),
6577 Top(c) => c.is_initial(),
6578 Right(c) => c.is_initial(),
6579 Left(c) => c.is_initial(),
6580 Bottom(c) => c.is_initial(),
6581 ZIndex(c) => c.is_initial(),
6582 FlexWrap(c) => c.is_initial(),
6583 FlexDirection(c) => c.is_initial(),
6584 FlexGrow(c) => c.is_initial(),
6585 FlexShrink(c) => c.is_initial(),
6586 FlexBasis(c) => c.is_initial(),
6587 JustifyContent(c) => c.is_initial(),
6588 AlignItems(c) => c.is_initial(),
6589 AlignContent(c) => c.is_initial(),
6590 ColumnGap(c) => c.is_initial(),
6591 RowGap(c) => c.is_initial(),
6592 GridTemplateColumns(c) => c.is_initial(),
6593 GridTemplateRows(c) => c.is_initial(),
6594 GridAutoFlow(c) => c.is_initial(),
6595 JustifySelf(c) => c.is_initial(),
6596 JustifyItems(c) => c.is_initial(),
6597 Gap(c) => c.is_initial(),
6598 GridGap(c) => c.is_initial(),
6599 AlignSelf(c) => c.is_initial(),
6600 Font(c) => c.is_initial(),
6601 GridAutoColumns(c) => c.is_initial(),
6602 GridAutoRows(c) => c.is_initial(),
6603 GridColumn(c) => c.is_initial(),
6604 GridRow(c) => c.is_initial(),
6605 GridTemplateAreas(c) => c.is_initial(),
6606 WritingMode(c) => c.is_initial(),
6607 Clear(c) => c.is_initial(),
6608 BackgroundContent(c) => c.is_initial(),
6609 BackgroundPosition(c) => c.is_initial(),
6610 BackgroundSize(c) => c.is_initial(),
6611 BackgroundRepeat(c) => c.is_initial(),
6612 OverflowX(c) => c.is_initial(),
6613 OverflowY(c) => c.is_initial(),
6614 OverflowBlock(c) => c.is_initial(),
6615 OverflowInline(c) => c.is_initial(),
6616 PaddingTop(c) => c.is_initial(),
6617 PaddingLeft(c) => c.is_initial(),
6618 PaddingRight(c) => c.is_initial(),
6619 PaddingBottom(c) => c.is_initial(),
6620 PaddingInlineStart(c) => c.is_initial(),
6621 PaddingInlineEnd(c) => c.is_initial(),
6622 MarginTop(c) => c.is_initial(),
6623 MarginLeft(c) => c.is_initial(),
6624 MarginRight(c) => c.is_initial(),
6625 MarginBottom(c) => c.is_initial(),
6626 BorderTopLeftRadius(c) => c.is_initial(),
6627 BorderTopRightRadius(c) => c.is_initial(),
6628 BorderBottomLeftRadius(c) => c.is_initial(),
6629 BorderBottomRightRadius(c) => c.is_initial(),
6630 BorderTopColor(c) => c.is_initial(),
6631 BorderRightColor(c) => c.is_initial(),
6632 BorderLeftColor(c) => c.is_initial(),
6633 BorderBottomColor(c) => c.is_initial(),
6634 BorderTopStyle(c) => c.is_initial(),
6635 BorderRightStyle(c) => c.is_initial(),
6636 BorderLeftStyle(c) => c.is_initial(),
6637 BorderBottomStyle(c) => c.is_initial(),
6638 BorderTopWidth(c) => c.is_initial(),
6639 BorderRightWidth(c) => c.is_initial(),
6640 BorderLeftWidth(c) => c.is_initial(),
6641 BorderBottomWidth(c) => c.is_initial(),
6642 BoxShadowLeft(c) => c.is_initial(),
6643 BoxShadowRight(c) => c.is_initial(),
6644 BoxShadowTop(c) => c.is_initial(),
6645 BoxShadowBottom(c) => c.is_initial(),
6646 ScrollbarTrack(c) => c.is_initial(),
6647 ScrollbarThumb(c) => c.is_initial(),
6648 ScrollbarButton(c) => c.is_initial(),
6649 ScrollbarCorner(c) => c.is_initial(),
6650 ScrollbarResizer(c) => c.is_initial(),
6651 ScrollbarWidth(c) => c.is_initial(),
6652 ScrollbarColor(c) => c.is_initial(),
6653 ScrollbarVisibility(c) => c.is_initial(),
6654 ScrollbarFadeDelay(c) => c.is_initial(),
6655 ScrollbarFadeDuration(c) => c.is_initial(),
6656 Opacity(c) => c.is_initial(),
6657 Visibility(c) => c.is_initial(),
6658 Transform(c) => c.is_initial(),
6659 TransformOrigin(c) => c.is_initial(),
6660 PerspectiveOrigin(c) => c.is_initial(),
6661 BackfaceVisibility(c) => c.is_initial(),
6662 MixBlendMode(c) => c.is_initial(),
6663 Filter(c) => c.is_initial(),
6664 BackdropFilter(c) => c.is_initial(),
6665 TextShadow(c) => c.is_initial(),
6666 WhiteSpace(c) => c.is_initial(),
6667 Direction(c) => c.is_initial(),
6668 UserSelect(c) => c.is_initial(),
6669 TextDecoration(c) => c.is_initial(),
6670 Hyphens(c) => c.is_initial(),
6671 WordBreak(c) => c.is_initial(),
6672 OverflowWrap(c) => c.is_initial(),
6673 LineBreak(c) => c.is_initial(),
6674 ObjectFit(c) => c.is_initial(),
6675 ObjectPosition(c) => c.is_initial(),
6676 AspectRatio(c) => c.is_initial(),
6677 TextOrientation(c) => c.is_initial(),
6678 TextAlignLast(c) => c.is_initial(),
6679 TextTransform(c) => c.is_initial(),
6680 BreakBefore(c) => c.is_initial(),
6681 BreakAfter(c) => c.is_initial(),
6682 BreakInside(c) => c.is_initial(),
6683 Orphans(c) => c.is_initial(),
6684 Widows(c) => c.is_initial(),
6685 BoxDecorationBreak(c) => c.is_initial(),
6686 ColumnCount(c) => c.is_initial(),
6687 ColumnWidth(c) => c.is_initial(),
6688 ColumnSpan(c) => c.is_initial(),
6689 ColumnFill(c) => c.is_initial(),
6690 ColumnRuleWidth(c) => c.is_initial(),
6691 ColumnRuleStyle(c) => c.is_initial(),
6692 ColumnRuleColor(c) => c.is_initial(),
6693 FlowInto(c) => c.is_initial(),
6694 FlowFrom(c) => c.is_initial(),
6695 ShapeOutside(c) => c.is_initial(),
6696 ShapeInside(c) => c.is_initial(),
6697 ClipPath(c) => c.is_initial(),
6698 ShapeMargin(c) => c.is_initial(),
6699 ShapeImageThreshold(c) => c.is_initial(),
6700 Content(c) => c.is_initial(),
6701 CounterReset(c) => c.is_initial(),
6702 CounterIncrement(c) => c.is_initial(),
6703 ListStyleType(c) => c.is_initial(),
6704 ListStylePosition(c) => c.is_initial(),
6705 StringSet(c) => c.is_initial(),
6706 TableLayout(c) => c.is_initial(),
6707 BorderCollapse(c) => c.is_initial(),
6708 BorderSpacing(c) => c.is_initial(),
6709 CaptionSide(c) => c.is_initial(),
6710 EmptyCells(c) => c.is_initial(),
6711 FontWeight(c) => c.is_initial(),
6712 FontStyle(c) => c.is_initial(),
6713 VerticalAlign(c) => c.is_initial(),
6714 }
6715 }
6716
6717 #[must_use] pub const fn const_none(prop_type: CssPropertyType) -> Self {
6718 css_property_from_type!(prop_type, None)
6719 }
6720 #[must_use] pub const fn const_auto(prop_type: CssPropertyType) -> Self {
6721 css_property_from_type!(prop_type, Auto)
6722 }
6723 #[must_use] pub const fn const_initial(prop_type: CssPropertyType) -> Self {
6724 css_property_from_type!(prop_type, Initial)
6725 }
6726 #[must_use] pub const fn const_inherit(prop_type: CssPropertyType) -> Self {
6727 css_property_from_type!(prop_type, Inherit)
6728 }
6729
6730 #[must_use] pub const fn const_text_color(input: StyleTextColor) -> Self {
6731 Self::TextColor(StyleTextColorValue::Exact(input))
6732 }
6733 #[must_use] pub const fn const_font_size(input: StyleFontSize) -> Self {
6734 Self::FontSize(StyleFontSizeValue::Exact(input))
6735 }
6736 #[must_use] pub const fn const_font_family(input: StyleFontFamilyVec) -> Self {
6737 Self::FontFamily(StyleFontFamilyVecValue::Exact(input))
6738 }
6739 #[must_use] pub const fn const_text_align(input: StyleTextAlign) -> Self {
6740 Self::TextAlign(StyleTextAlignValue::Exact(input))
6741 }
6742 #[must_use] pub const fn const_vertical_align(input: StyleVerticalAlign) -> Self {
6743 Self::VerticalAlign(StyleVerticalAlignValue::Exact(input))
6744 }
6745 #[must_use] pub const fn const_letter_spacing(input: StyleLetterSpacing) -> Self {
6746 Self::LetterSpacing(StyleLetterSpacingValue::Exact(input))
6747 }
6748 #[must_use] pub const fn const_text_indent(input: StyleTextIndent) -> Self {
6749 Self::TextIndent(StyleTextIndentValue::Exact(input))
6750 }
6751 #[must_use] pub const fn const_line_height(input: StyleLineHeight) -> Self {
6752 Self::LineHeight(StyleLineHeightValue::Exact(input))
6753 }
6754 #[must_use] pub const fn const_word_spacing(input: StyleWordSpacing) -> Self {
6755 Self::WordSpacing(StyleWordSpacingValue::Exact(input))
6756 }
6757 #[must_use] pub const fn const_tab_size(input: StyleTabSize) -> Self {
6758 Self::TabSize(StyleTabSizeValue::Exact(input))
6759 }
6760 #[must_use] pub const fn const_cursor(input: StyleCursor) -> Self {
6761 Self::Cursor(StyleCursorValue::Exact(input))
6762 }
6763 #[must_use] pub const fn const_display(input: LayoutDisplay) -> Self {
6764 Self::Display(LayoutDisplayValue::Exact(input))
6765 }
6766 #[must_use] pub const fn const_float(input: LayoutFloat) -> Self {
6767 Self::Float(LayoutFloatValue::Exact(input))
6768 }
6769 #[must_use] pub const fn const_box_sizing(input: LayoutBoxSizing) -> Self {
6770 Self::BoxSizing(LayoutBoxSizingValue::Exact(input))
6771 }
6772 #[must_use] pub const fn const_width(input: LayoutWidth) -> Self {
6773 Self::Width(LayoutWidthValue::Exact(input))
6774 }
6775 #[must_use] pub const fn const_height(input: LayoutHeight) -> Self {
6776 Self::Height(LayoutHeightValue::Exact(input))
6777 }
6778 #[must_use] pub const fn const_min_width(input: LayoutMinWidth) -> Self {
6779 Self::MinWidth(LayoutMinWidthValue::Exact(input))
6780 }
6781 #[must_use] pub const fn const_min_height(input: LayoutMinHeight) -> Self {
6782 Self::MinHeight(LayoutMinHeightValue::Exact(input))
6783 }
6784 #[must_use] pub const fn const_max_width(input: LayoutMaxWidth) -> Self {
6785 Self::MaxWidth(LayoutMaxWidthValue::Exact(input))
6786 }
6787 #[must_use] pub const fn const_max_height(input: LayoutMaxHeight) -> Self {
6788 Self::MaxHeight(LayoutMaxHeightValue::Exact(input))
6789 }
6790 #[must_use] pub const fn const_position(input: LayoutPosition) -> Self {
6791 Self::Position(LayoutPositionValue::Exact(input))
6792 }
6793 #[must_use] pub const fn const_top(input: LayoutTop) -> Self {
6794 Self::Top(LayoutTopValue::Exact(input))
6795 }
6796 #[must_use] pub const fn const_right(input: LayoutRight) -> Self {
6797 Self::Right(LayoutRightValue::Exact(input))
6798 }
6799 #[must_use] pub const fn const_left(input: LayoutLeft) -> Self {
6800 Self::Left(LayoutLeftValue::Exact(input))
6801 }
6802 #[must_use] pub const fn const_bottom(input: LayoutInsetBottom) -> Self {
6803 Self::Bottom(LayoutInsetBottomValue::Exact(input))
6804 }
6805 #[must_use] pub const fn const_flex_wrap(input: LayoutFlexWrap) -> Self {
6806 Self::FlexWrap(LayoutFlexWrapValue::Exact(input))
6807 }
6808 #[must_use] pub const fn const_flex_direction(input: LayoutFlexDirection) -> Self {
6809 Self::FlexDirection(LayoutFlexDirectionValue::Exact(input))
6810 }
6811 #[must_use] pub const fn const_flex_grow(input: LayoutFlexGrow) -> Self {
6812 Self::FlexGrow(LayoutFlexGrowValue::Exact(input))
6813 }
6814 #[must_use] pub const fn const_flex_shrink(input: LayoutFlexShrink) -> Self {
6815 Self::FlexShrink(LayoutFlexShrinkValue::Exact(input))
6816 }
6817 #[must_use] pub const fn const_justify_content(input: LayoutJustifyContent) -> Self {
6818 Self::JustifyContent(LayoutJustifyContentValue::Exact(input))
6819 }
6820 #[must_use] pub const fn const_align_items(input: LayoutAlignItems) -> Self {
6821 Self::AlignItems(LayoutAlignItemsValue::Exact(input))
6822 }
6823 #[must_use] pub const fn const_align_content(input: LayoutAlignContent) -> Self {
6824 Self::AlignContent(LayoutAlignContentValue::Exact(input))
6825 }
6826 #[must_use] pub const fn const_background_content(input: StyleBackgroundContentVec) -> Self {
6827 Self::BackgroundContent(StyleBackgroundContentVecValue::Exact(input))
6828 }
6829 #[must_use] pub const fn const_background_position(input: StyleBackgroundPositionVec) -> Self {
6830 Self::BackgroundPosition(StyleBackgroundPositionVecValue::Exact(input))
6831 }
6832 #[must_use] pub const fn const_background_size(input: StyleBackgroundSizeVec) -> Self {
6833 Self::BackgroundSize(StyleBackgroundSizeVecValue::Exact(input))
6834 }
6835 #[must_use] pub const fn const_background_repeat(input: StyleBackgroundRepeatVec) -> Self {
6836 Self::BackgroundRepeat(StyleBackgroundRepeatVecValue::Exact(input))
6837 }
6838 #[must_use] pub const fn const_overflow_x(input: LayoutOverflow) -> Self {
6839 Self::OverflowX(LayoutOverflowValue::Exact(input))
6840 }
6841 #[must_use] pub const fn const_overflow_y(input: LayoutOverflow) -> Self {
6842 Self::OverflowY(LayoutOverflowValue::Exact(input))
6843 }
6844 #[must_use] pub const fn const_overflow_block(input: LayoutOverflow) -> Self {
6845 Self::OverflowBlock(LayoutOverflowValue::Exact(input))
6846 }
6847 #[must_use] pub const fn const_overflow_inline(input: LayoutOverflow) -> Self {
6848 Self::OverflowInline(LayoutOverflowValue::Exact(input))
6849 }
6850 #[must_use] pub const fn const_padding_top(input: LayoutPaddingTop) -> Self {
6851 Self::PaddingTop(LayoutPaddingTopValue::Exact(input))
6852 }
6853 #[must_use] pub const fn const_padding_left(input: LayoutPaddingLeft) -> Self {
6854 Self::PaddingLeft(LayoutPaddingLeftValue::Exact(input))
6855 }
6856 #[must_use] pub const fn const_padding_right(input: LayoutPaddingRight) -> Self {
6857 Self::PaddingRight(LayoutPaddingRightValue::Exact(input))
6858 }
6859 #[must_use] pub const fn const_padding_bottom(input: LayoutPaddingBottom) -> Self {
6860 Self::PaddingBottom(LayoutPaddingBottomValue::Exact(input))
6861 }
6862 #[must_use] pub const fn const_margin_top(input: LayoutMarginTop) -> Self {
6863 Self::MarginTop(LayoutMarginTopValue::Exact(input))
6864 }
6865 #[must_use] pub const fn const_margin_left(input: LayoutMarginLeft) -> Self {
6866 Self::MarginLeft(LayoutMarginLeftValue::Exact(input))
6867 }
6868 #[must_use] pub const fn const_margin_right(input: LayoutMarginRight) -> Self {
6869 Self::MarginRight(LayoutMarginRightValue::Exact(input))
6870 }
6871 #[must_use] pub const fn const_margin_bottom(input: LayoutMarginBottom) -> Self {
6872 Self::MarginBottom(LayoutMarginBottomValue::Exact(input))
6873 }
6874 #[must_use] pub const fn const_border_top_left_radius(input: StyleBorderTopLeftRadius) -> Self {
6875 Self::BorderTopLeftRadius(StyleBorderTopLeftRadiusValue::Exact(input))
6876 }
6877 #[must_use] pub const fn const_border_top_right_radius(input: StyleBorderTopRightRadius) -> Self {
6878 Self::BorderTopRightRadius(StyleBorderTopRightRadiusValue::Exact(input))
6879 }
6880 #[must_use] pub const fn const_border_bottom_left_radius(input: StyleBorderBottomLeftRadius) -> Self {
6881 Self::BorderBottomLeftRadius(StyleBorderBottomLeftRadiusValue::Exact(input))
6882 }
6883 #[must_use] pub const fn const_border_bottom_right_radius(input: StyleBorderBottomRightRadius) -> Self {
6884 Self::BorderBottomRightRadius(StyleBorderBottomRightRadiusValue::Exact(input))
6885 }
6886 #[must_use] pub const fn const_border_top_color(input: StyleBorderTopColor) -> Self {
6887 Self::BorderTopColor(StyleBorderTopColorValue::Exact(input))
6888 }
6889 #[must_use] pub const fn const_border_right_color(input: StyleBorderRightColor) -> Self {
6890 Self::BorderRightColor(StyleBorderRightColorValue::Exact(input))
6891 }
6892 #[must_use] pub const fn const_border_left_color(input: StyleBorderLeftColor) -> Self {
6893 Self::BorderLeftColor(StyleBorderLeftColorValue::Exact(input))
6894 }
6895 #[must_use] pub const fn const_border_bottom_color(input: StyleBorderBottomColor) -> Self {
6896 Self::BorderBottomColor(StyleBorderBottomColorValue::Exact(input))
6897 }
6898 #[must_use] pub const fn const_border_top_style(input: StyleBorderTopStyle) -> Self {
6899 Self::BorderTopStyle(StyleBorderTopStyleValue::Exact(input))
6900 }
6901 #[must_use] pub const fn const_border_right_style(input: StyleBorderRightStyle) -> Self {
6902 Self::BorderRightStyle(StyleBorderRightStyleValue::Exact(input))
6903 }
6904 #[must_use] pub const fn const_border_left_style(input: StyleBorderLeftStyle) -> Self {
6905 Self::BorderLeftStyle(StyleBorderLeftStyleValue::Exact(input))
6906 }
6907 #[must_use] pub const fn const_border_bottom_style(input: StyleBorderBottomStyle) -> Self {
6908 Self::BorderBottomStyle(StyleBorderBottomStyleValue::Exact(input))
6909 }
6910 #[must_use] pub const fn const_border_top_width(input: LayoutBorderTopWidth) -> Self {
6911 Self::BorderTopWidth(LayoutBorderTopWidthValue::Exact(input))
6912 }
6913 #[must_use] pub const fn const_border_right_width(input: LayoutBorderRightWidth) -> Self {
6914 Self::BorderRightWidth(LayoutBorderRightWidthValue::Exact(input))
6915 }
6916 #[must_use] pub const fn const_border_left_width(input: LayoutBorderLeftWidth) -> Self {
6917 Self::BorderLeftWidth(LayoutBorderLeftWidthValue::Exact(input))
6918 }
6919 #[must_use] pub const fn const_border_bottom_width(input: LayoutBorderBottomWidth) -> Self {
6920 Self::BorderBottomWidth(LayoutBorderBottomWidthValue::Exact(input))
6921 }
6922 #[must_use] pub fn const_box_shadow_left(input: StyleBoxShadow) -> Self {
6923 Self::BoxShadowLeft(StyleBoxShadowValue::Exact(BoxOrStatic::heap(input)))
6924 }
6925 #[must_use] pub fn const_box_shadow_right(input: StyleBoxShadow) -> Self {
6926 Self::BoxShadowRight(StyleBoxShadowValue::Exact(BoxOrStatic::heap(input)))
6927 }
6928 #[must_use] pub fn const_box_shadow_top(input: StyleBoxShadow) -> Self {
6929 Self::BoxShadowTop(StyleBoxShadowValue::Exact(BoxOrStatic::heap(input)))
6930 }
6931 #[must_use] pub fn const_box_shadow_bottom(input: StyleBoxShadow) -> Self {
6932 Self::BoxShadowBottom(StyleBoxShadowValue::Exact(BoxOrStatic::heap(input)))
6933 }
6934 #[must_use] pub const fn const_opacity(input: StyleOpacity) -> Self {
6935 Self::Opacity(StyleOpacityValue::Exact(input))
6936 }
6937 #[must_use] pub const fn const_transform(input: StyleTransformVec) -> Self {
6938 Self::Transform(StyleTransformVecValue::Exact(input))
6939 }
6940 #[must_use] pub const fn const_transform_origin(input: StyleTransformOrigin) -> Self {
6941 Self::TransformOrigin(StyleTransformOriginValue::Exact(input))
6942 }
6943 #[must_use] pub const fn const_perspective_origin(input: StylePerspectiveOrigin) -> Self {
6944 Self::PerspectiveOrigin(StylePerspectiveOriginValue::Exact(input))
6945 }
6946 #[must_use] pub const fn const_backface_visibility(input: StyleBackfaceVisibility) -> Self {
6947 Self::BackfaceVisibility(StyleBackfaceVisibilityValue::Exact(input))
6948 }
6949 #[must_use] pub const fn const_break_before(input: PageBreak) -> Self {
6950 Self::BreakBefore(PageBreakValue::Exact(input))
6951 }
6952 #[must_use] pub const fn const_break_after(input: PageBreak) -> Self {
6953 Self::BreakAfter(PageBreakValue::Exact(input))
6954 }
6955 #[must_use] pub const fn const_break_inside(input: BreakInside) -> Self {
6956 Self::BreakInside(BreakInsideValue::Exact(input))
6957 }
6958 #[must_use] pub const fn const_orphans(input: Orphans) -> Self {
6959 Self::Orphans(OrphansValue::Exact(input))
6960 }
6961 #[must_use] pub const fn const_widows(input: Widows) -> Self {
6962 Self::Widows(WidowsValue::Exact(input))
6963 }
6964 #[must_use] pub const fn const_box_decoration_break(input: BoxDecorationBreak) -> Self {
6965 Self::BoxDecorationBreak(BoxDecorationBreakValue::Exact(input))
6966 }
6967 #[must_use] pub const fn const_column_count(input: ColumnCount) -> Self {
6968 Self::ColumnCount(ColumnCountValue::Exact(input))
6969 }
6970 #[must_use] pub const fn const_column_width(input: ColumnWidth) -> Self {
6971 Self::ColumnWidth(ColumnWidthValue::Exact(input))
6972 }
6973 #[must_use] pub const fn const_column_span(input: ColumnSpan) -> Self {
6974 Self::ColumnSpan(ColumnSpanValue::Exact(input))
6975 }
6976 #[must_use] pub const fn const_column_fill(input: ColumnFill) -> Self {
6977 Self::ColumnFill(ColumnFillValue::Exact(input))
6978 }
6979 #[must_use] pub const fn const_column_rule_width(input: ColumnRuleWidth) -> Self {
6980 Self::ColumnRuleWidth(ColumnRuleWidthValue::Exact(input))
6981 }
6982 #[must_use] pub const fn const_column_rule_style(input: ColumnRuleStyle) -> Self {
6983 Self::ColumnRuleStyle(ColumnRuleStyleValue::Exact(input))
6984 }
6985 #[must_use] pub const fn const_column_rule_color(input: ColumnRuleColor) -> Self {
6986 Self::ColumnRuleColor(ColumnRuleColorValue::Exact(input))
6987 }
6988 #[must_use] pub const fn const_flow_into(input: FlowInto) -> Self {
6989 Self::FlowInto(FlowIntoValue::Exact(input))
6990 }
6991 #[must_use] pub const fn const_flow_from(input: FlowFrom) -> Self {
6992 Self::FlowFrom(FlowFromValue::Exact(input))
6993 }
6994 #[must_use] pub const fn const_shape_outside(input: ShapeOutside) -> Self {
6995 Self::ShapeOutside(ShapeOutsideValue::Exact(input))
6996 }
6997 #[must_use] pub const fn const_shape_inside(input: ShapeInside) -> Self {
6998 Self::ShapeInside(ShapeInsideValue::Exact(input))
6999 }
7000 #[must_use] pub const fn const_clip_path(input: ClipPath) -> Self {
7001 Self::ClipPath(ClipPathValue::Exact(input))
7002 }
7003 #[must_use] pub const fn const_shape_margin(input: ShapeMargin) -> Self {
7004 Self::ShapeMargin(ShapeMarginValue::Exact(input))
7005 }
7006 #[must_use] pub const fn const_shape_image_threshold(input: ShapeImageThreshold) -> Self {
7007 Self::ShapeImageThreshold(ShapeImageThresholdValue::Exact(input))
7008 }
7009 #[must_use] pub const fn const_content(input: Content) -> Self {
7010 Self::Content(ContentValue::Exact(input))
7011 }
7012 #[must_use] pub const fn const_counter_reset(input: CounterReset) -> Self {
7013 Self::CounterReset(CounterResetValue::Exact(input))
7014 }
7015 #[must_use] pub const fn const_counter_increment(input: CounterIncrement) -> Self {
7016 Self::CounterIncrement(CounterIncrementValue::Exact(input))
7017 }
7018 #[must_use] pub const fn const_list_style_type(input: StyleListStyleType) -> Self {
7019 Self::ListStyleType(StyleListStyleTypeValue::Exact(input))
7020 }
7021 #[must_use] pub const fn const_list_style_position(input: StyleListStylePosition) -> Self {
7022 Self::ListStylePosition(StyleListStylePositionValue::Exact(input))
7023 }
7024 #[must_use] pub const fn const_string_set(input: StringSet) -> Self {
7025 Self::StringSet(StringSetValue::Exact(input))
7026 }
7027 #[must_use] pub const fn const_table_layout(input: LayoutTableLayout) -> Self {
7028 Self::TableLayout(LayoutTableLayoutValue::Exact(input))
7029 }
7030 #[must_use] pub const fn const_border_collapse(input: StyleBorderCollapse) -> Self {
7031 Self::BorderCollapse(StyleBorderCollapseValue::Exact(input))
7032 }
7033 #[must_use] pub const fn const_border_spacing(input: LayoutBorderSpacing) -> Self {
7034 Self::BorderSpacing(LayoutBorderSpacingValue::Exact(input))
7035 }
7036 #[must_use] pub const fn const_caption_side(input: StyleCaptionSide) -> Self {
7037 Self::CaptionSide(StyleCaptionSideValue::Exact(input))
7038 }
7039 #[must_use] pub const fn const_empty_cells(input: StyleEmptyCells) -> Self {
7040 Self::EmptyCells(StyleEmptyCellsValue::Exact(input))
7041 }
7042}
7043
7044#[allow(clippy::match_same_arms)]
7047#[allow(clippy::too_many_lines)] #[must_use] pub fn format_static_css_prop(prop: &CssProperty, tabs: usize) -> String {
7049 match prop {
7050 CssProperty::CaretColor(p) => format!(
7051 "CssProperty::CaretColor({})",
7052 print_css_property_value(p, tabs, "CaretColor")
7053 ),
7054 CssProperty::CaretWidth(p) => format!(
7055 "CssProperty::CaretWidth({})",
7056 print_css_property_value(p, tabs, "CaretWidth")
7057 ),
7058 CssProperty::CaretAnimationDuration(p) => format!(
7059 "CssProperty::CaretAnimationDuration({})",
7060 print_css_property_value(p, tabs, "CaretAnimationDuration")
7061 ),
7062 CssProperty::SelectionBackgroundColor(p) => format!(
7063 "CssProperty::SelectionBackgroundColor({})",
7064 print_css_property_value(p, tabs, "SelectionBackgroundColor")
7065 ),
7066 CssProperty::SelectionColor(p) => format!(
7067 "CssProperty::SelectionColor({})",
7068 print_css_property_value(p, tabs, "SelectionColor")
7069 ),
7070 CssProperty::SelectionRadius(p) => format!(
7071 "CssProperty::SelectionRadius({})",
7072 print_css_property_value(p, tabs, "SelectionRadius")
7073 ),
7074 CssProperty::TextJustify(p) => format!(
7075 "CssProperty::TextJustify({})",
7076 print_css_property_value(p, tabs, "LayoutTextJustify")
7077 ),
7078 CssProperty::TextColor(p) => format!(
7079 "CssProperty::TextColor({})",
7080 print_css_property_value(p, tabs, "StyleTextColor")
7081 ),
7082 CssProperty::FontSize(p) => format!(
7083 "CssProperty::FontSize({})",
7084 print_css_property_value(p, tabs, "StyleFontSize")
7085 ),
7086 CssProperty::FontFamily(p) => format!(
7087 "CssProperty::FontFamily({})",
7088 print_css_property_value(p, tabs, "StyleFontFamilyVec")
7089 ),
7090 CssProperty::TextAlign(p) => format!(
7091 "CssProperty::TextAlign({})",
7092 print_css_property_value(p, tabs, "StyleTextAlign")
7093 ),
7094 CssProperty::VerticalAlign(p) => format!(
7095 "CssProperty::VerticalAlign({})",
7096 print_css_property_value(p, tabs, "StyleVerticalAlign")
7097 ),
7098 CssProperty::LetterSpacing(p) => format!(
7099 "CssProperty::LetterSpacing({})",
7100 print_css_property_value(p, tabs, "StyleLetterSpacing")
7101 ),
7102 CssProperty::TextIndent(p) => format!(
7103 "CssProperty::TextIndent({})",
7104 print_css_property_value(p, tabs, "StyleTextIndent")
7105 ),
7106 CssProperty::InitialLetter(p) => format!(
7107 "CssProperty::InitialLetter({})",
7108 print_css_property_value(p, tabs, "StyleInitialLetter")
7109 ),
7110 CssProperty::LineClamp(p) => format!(
7111 "CssProperty::LineClamp({})",
7112 print_css_property_value(p, tabs, "StyleLineClamp")
7113 ),
7114 CssProperty::HangingPunctuation(p) => format!(
7115 "CssProperty::HangingPunctuation({})",
7116 print_css_property_value(p, tabs, "StyleHangingPunctuation")
7117 ),
7118 CssProperty::TextCombineUpright(p) => format!(
7119 "CssProperty::TextCombineUpright({})",
7120 print_css_property_value(p, tabs, "StyleTextCombineUpright")
7121 ),
7122 CssProperty::UnicodeBidi(p) => format!(
7123 "CssProperty::UnicodeBidi({})",
7124 print_css_property_value(p, tabs, "StyleUnicodeBidi")
7125 ),
7126 CssProperty::TextBoxTrim(p) => format!(
7127 "CssProperty::TextBoxTrim({})",
7128 print_css_property_value(p, tabs, "StyleTextBoxTrim")
7129 ),
7130 CssProperty::TextBoxEdge(p) => format!(
7131 "CssProperty::TextBoxEdge({})",
7132 print_css_property_value(p, tabs, "StyleTextBoxEdge")
7133 ),
7134 CssProperty::DominantBaseline(p) => format!(
7135 "CssProperty::DominantBaseline({})",
7136 print_css_property_value(p, tabs, "StyleDominantBaseline")
7137 ),
7138 CssProperty::AlignmentBaseline(p) => format!(
7139 "CssProperty::AlignmentBaseline({})",
7140 print_css_property_value(p, tabs, "StyleAlignmentBaseline")
7141 ),
7142 CssProperty::InitialLetterAlign(p) => format!(
7143 "CssProperty::InitialLetterAlign({})",
7144 print_css_property_value(p, tabs, "StyleInitialLetterAlign")
7145 ),
7146 CssProperty::InitialLetterWrap(p) => format!(
7147 "CssProperty::InitialLetterWrap({})",
7148 print_css_property_value(p, tabs, "StyleInitialLetterWrap")
7149 ),
7150 CssProperty::ScrollbarGutter(p) => format!(
7151 "CssProperty::ScrollbarGutter({})",
7152 print_css_property_value(p, tabs, "StyleScrollbarGutter")
7153 ),
7154 CssProperty::OverflowClipMargin(p) => format!(
7155 "CssProperty::OverflowClipMargin({})",
7156 print_css_property_value(p, tabs, "StyleOverflowClipMargin")
7157 ),
7158 CssProperty::Clip(p) => format!(
7159 "CssProperty::Clip({})",
7160 print_css_property_value(p, tabs, "StyleClipRect")
7161 ),
7162 CssProperty::ExclusionMargin(p) => format!(
7163 "CssProperty::ExclusionMargin({})",
7164 print_css_property_value(p, tabs, "StyleExclusionMargin")
7165 ),
7166 CssProperty::HyphenationLanguage(p) => format!(
7167 "CssProperty::HyphenationLanguage({})",
7168 print_css_property_value(p, tabs, "StyleHyphenationLanguage")
7169 ),
7170 CssProperty::LineHeight(p) => format!(
7171 "CssProperty::LineHeight({})",
7172 print_css_property_value(p, tabs, "StyleLineHeight")
7173 ),
7174 CssProperty::WordSpacing(p) => format!(
7175 "CssProperty::WordSpacing({})",
7176 print_css_property_value(p, tabs, "StyleWordSpacing")
7177 ),
7178 CssProperty::TabSize(p) => format!(
7179 "CssProperty::TabSize({})",
7180 print_css_property_value(p, tabs, "StyleTabSize")
7181 ),
7182 CssProperty::Cursor(p) => format!(
7183 "CssProperty::Cursor({})",
7184 print_css_property_value(p, tabs, "StyleCursor")
7185 ),
7186 CssProperty::Display(p) => format!(
7187 "CssProperty::Display({})",
7188 print_css_property_value(p, tabs, "LayoutDisplay")
7189 ),
7190 CssProperty::Float(p) => format!(
7191 "CssProperty::Float({})",
7192 print_css_property_value(p, tabs, "LayoutFloat")
7193 ),
7194 CssProperty::BoxSizing(p) => format!(
7195 "CssProperty::BoxSizing({})",
7196 print_css_property_value(p, tabs, "LayoutBoxSizing")
7197 ),
7198 CssProperty::Width(p) => format!(
7199 "CssProperty::Width({})",
7200 print_css_property_value(p, tabs, "LayoutWidth")
7201 ),
7202 CssProperty::Height(p) => format!(
7203 "CssProperty::Height({})",
7204 print_css_property_value(p, tabs, "LayoutHeight")
7205 ),
7206 CssProperty::MinWidth(p) => format!(
7207 "CssProperty::MinWidth({})",
7208 print_css_property_value(p, tabs, "LayoutMinWidth")
7209 ),
7210 CssProperty::MinHeight(p) => format!(
7211 "CssProperty::MinHeight({})",
7212 print_css_property_value(p, tabs, "LayoutMinHeight")
7213 ),
7214 CssProperty::MaxWidth(p) => format!(
7215 "CssProperty::MaxWidth({})",
7216 print_css_property_value(p, tabs, "LayoutMaxWidth")
7217 ),
7218 CssProperty::MaxHeight(p) => format!(
7219 "CssProperty::MaxHeight({})",
7220 print_css_property_value(p, tabs, "LayoutMaxHeight")
7221 ),
7222 CssProperty::Position(p) => format!(
7223 "CssProperty::Position({})",
7224 print_css_property_value(p, tabs, "LayoutPosition")
7225 ),
7226 CssProperty::Top(p) => format!(
7227 "CssProperty::Top({})",
7228 print_css_property_value(p, tabs, "LayoutTop")
7229 ),
7230 CssProperty::Right(p) => format!(
7231 "CssProperty::Right({})",
7232 print_css_property_value(p, tabs, "LayoutRight")
7233 ),
7234 CssProperty::Left(p) => format!(
7235 "CssProperty::Left({})",
7236 print_css_property_value(p, tabs, "LayoutLeft")
7237 ),
7238 CssProperty::Bottom(p) => format!(
7239 "CssProperty::Bottom({})",
7240 print_css_property_value(p, tabs, "LayoutInsetBottom")
7241 ),
7242 CssProperty::ZIndex(p) => format!(
7243 "CssProperty::ZIndex({})",
7244 print_css_property_value(p, tabs, "LayoutZIndex")
7245 ),
7246 CssProperty::FlexWrap(p) => format!(
7247 "CssProperty::FlexWrap({})",
7248 print_css_property_value(p, tabs, "LayoutFlexWrap")
7249 ),
7250 CssProperty::FlexDirection(p) => format!(
7251 "CssProperty::FlexDirection({})",
7252 print_css_property_value(p, tabs, "LayoutFlexDirection")
7253 ),
7254 CssProperty::FlexGrow(p) => format!(
7255 "CssProperty::FlexGrow({})",
7256 print_css_property_value(p, tabs, "LayoutFlexGrow")
7257 ),
7258 CssProperty::FlexShrink(p) => format!(
7259 "CssProperty::FlexShrink({})",
7260 print_css_property_value(p, tabs, "LayoutFlexShrink")
7261 ),
7262 CssProperty::JustifyContent(p) => format!(
7263 "CssProperty::JustifyContent({})",
7264 print_css_property_value(p, tabs, "LayoutJustifyContent")
7265 ),
7266 CssProperty::AlignItems(p) => format!(
7267 "CssProperty::AlignItems({})",
7268 print_css_property_value(p, tabs, "LayoutAlignItems")
7269 ),
7270 CssProperty::AlignContent(p) => format!(
7271 "CssProperty::AlignContent({})",
7272 print_css_property_value(p, tabs, "LayoutAlignContent")
7273 ),
7274 CssProperty::BackgroundContent(p) => format!(
7275 "CssProperty::BackgroundContent({})",
7276 print_css_property_value(p, tabs, "StyleBackgroundContentVec")
7277 ),
7278 CssProperty::BackgroundPosition(p) => format!(
7279 "CssProperty::BackgroundPosition({})",
7280 print_css_property_value(p, tabs, "StyleBackgroundPositionVec")
7281 ),
7282 CssProperty::BackgroundSize(p) => format!(
7283 "CssProperty::BackgroundSize({})",
7284 print_css_property_value(p, tabs, "StyleBackgroundSizeVec")
7285 ),
7286 CssProperty::BackgroundRepeat(p) => format!(
7287 "CssProperty::BackgroundRepeat({})",
7288 print_css_property_value(p, tabs, "StyleBackgroundRepeatVec")
7289 ),
7290 CssProperty::OverflowX(p) => format!(
7291 "CssProperty::OverflowX({})",
7292 print_css_property_value(p, tabs, "LayoutOverflow")
7293 ),
7294 CssProperty::OverflowY(p) => format!(
7295 "CssProperty::OverflowY({})",
7296 print_css_property_value(p, tabs, "LayoutOverflow")
7297 ),
7298 CssProperty::OverflowBlock(p) => format!(
7299 "CssProperty::OverflowBlock({})",
7300 print_css_property_value(p, tabs, "LayoutOverflow")
7301 ),
7302 CssProperty::OverflowInline(p) => format!(
7303 "CssProperty::OverflowInline({})",
7304 print_css_property_value(p, tabs, "LayoutOverflow")
7305 ),
7306 CssProperty::PaddingTop(p) => format!(
7307 "CssProperty::PaddingTop({})",
7308 print_css_property_value(p, tabs, "LayoutPaddingTop")
7309 ),
7310 CssProperty::PaddingLeft(p) => format!(
7311 "CssProperty::PaddingLeft({})",
7312 print_css_property_value(p, tabs, "LayoutPaddingLeft")
7313 ),
7314 CssProperty::PaddingRight(p) => format!(
7315 "CssProperty::PaddingRight({})",
7316 print_css_property_value(p, tabs, "LayoutPaddingRight")
7317 ),
7318 CssProperty::PaddingBottom(p) => format!(
7319 "CssProperty::PaddingBottom({})",
7320 print_css_property_value(p, tabs, "LayoutPaddingBottom")
7321 ),
7322 CssProperty::PaddingInlineStart(p) => format!(
7323 "CssProperty::PaddingInlineStart({})",
7324 print_css_property_value(p, tabs, "LayoutPaddingInlineStart")
7325 ),
7326 CssProperty::PaddingInlineEnd(p) => format!(
7327 "CssProperty::PaddingInlineEnd({})",
7328 print_css_property_value(p, tabs, "LayoutPaddingInlineEnd")
7329 ),
7330 CssProperty::MarginTop(p) => format!(
7331 "CssProperty::MarginTop({})",
7332 print_css_property_value(p, tabs, "LayoutMarginTop")
7333 ),
7334 CssProperty::MarginLeft(p) => format!(
7335 "CssProperty::MarginLeft({})",
7336 print_css_property_value(p, tabs, "LayoutMarginLeft")
7337 ),
7338 CssProperty::MarginRight(p) => format!(
7339 "CssProperty::MarginRight({})",
7340 print_css_property_value(p, tabs, "LayoutMarginRight")
7341 ),
7342 CssProperty::MarginBottom(p) => format!(
7343 "CssProperty::MarginBottom({})",
7344 print_css_property_value(p, tabs, "LayoutMarginBottom")
7345 ),
7346 CssProperty::BorderTopLeftRadius(p) => format!(
7347 "CssProperty::BorderTopLeftRadius({})",
7348 print_css_property_value(p, tabs, "StyleBorderTopLeftRadius")
7349 ),
7350 CssProperty::BorderTopRightRadius(p) => format!(
7351 "CssProperty::BorderTopRightRadius({})",
7352 print_css_property_value(p, tabs, "StyleBorderTopRightRadius")
7353 ),
7354 CssProperty::BorderBottomLeftRadius(p) => format!(
7355 "CssProperty::BorderBottomLeftRadius({})",
7356 print_css_property_value(p, tabs, "StyleBorderBottomLeftRadius")
7357 ),
7358 CssProperty::BorderBottomRightRadius(p) => format!(
7359 "CssProperty::BorderBottomRightRadius({})",
7360 print_css_property_value(p, tabs, "StyleBorderBottomRightRadius")
7361 ),
7362 CssProperty::BorderTopColor(p) => format!(
7363 "CssProperty::BorderTopColor({})",
7364 print_css_property_value(p, tabs, "StyleBorderTopColor")
7365 ),
7366 CssProperty::BorderRightColor(p) => format!(
7367 "CssProperty::BorderRightColor({})",
7368 print_css_property_value(p, tabs, "StyleBorderRightColor")
7369 ),
7370 CssProperty::BorderLeftColor(p) => format!(
7371 "CssProperty::BorderLeftColor({})",
7372 print_css_property_value(p, tabs, "StyleBorderLeftColor")
7373 ),
7374 CssProperty::BorderBottomColor(p) => format!(
7375 "CssProperty::BorderBottomColor({})",
7376 print_css_property_value(p, tabs, "StyleBorderBottomColor")
7377 ),
7378 CssProperty::BorderTopStyle(p) => format!(
7379 "CssProperty::BorderTopStyle({})",
7380 print_css_property_value(p, tabs, "StyleBorderTopStyle")
7381 ),
7382 CssProperty::BorderRightStyle(p) => format!(
7383 "CssProperty::BorderRightStyle({})",
7384 print_css_property_value(p, tabs, "StyleBorderRightStyle")
7385 ),
7386 CssProperty::BorderLeftStyle(p) => format!(
7387 "CssProperty::BorderLeftStyle({})",
7388 print_css_property_value(p, tabs, "StyleBorderLeftStyle")
7389 ),
7390 CssProperty::BorderBottomStyle(p) => format!(
7391 "CssProperty::BorderBottomStyle({})",
7392 print_css_property_value(p, tabs, "StyleBorderBottomStyle")
7393 ),
7394 CssProperty::BorderTopWidth(p) => format!(
7395 "CssProperty::BorderTopWidth({})",
7396 print_css_property_value(p, tabs, "LayoutBorderTopWidth")
7397 ),
7398 CssProperty::BorderRightWidth(p) => format!(
7399 "CssProperty::BorderRightWidth({})",
7400 print_css_property_value(p, tabs, "LayoutBorderRightWidth")
7401 ),
7402 CssProperty::BorderLeftWidth(p) => format!(
7403 "CssProperty::BorderLeftWidth({})",
7404 print_css_property_value(p, tabs, "LayoutBorderLeftWidth")
7405 ),
7406 CssProperty::BorderBottomWidth(p) => format!(
7407 "CssProperty::BorderBottomWidth({})",
7408 print_css_property_value(p, tabs, "LayoutBorderBottomWidth")
7409 ),
7410 CssProperty::BoxShadowLeft(p) => format!(
7411 "CssProperty::BoxShadowLeft({})",
7412 print_css_property_value(p, tabs, "StyleBoxShadow")
7413 ),
7414 CssProperty::BoxShadowRight(p) => format!(
7415 "CssProperty::BoxShadowRight({})",
7416 print_css_property_value(p, tabs, "StyleBoxShadow")
7417 ),
7418 CssProperty::BoxShadowTop(p) => format!(
7419 "CssProperty::BoxShadowTop({})",
7420 print_css_property_value(p, tabs, "StyleBoxShadow")
7421 ),
7422 CssProperty::BoxShadowBottom(p) => format!(
7423 "CssProperty::BoxShadowBottom({})",
7424 print_css_property_value(p, tabs, "StyleBoxShadow")
7425 ),
7426 CssProperty::ScrollbarWidth(p) => format!(
7427 "CssProperty::ScrollbarWidth({})",
7428 print_css_property_value(p, tabs, "LayoutScrollbarWidth")
7429 ),
7430 CssProperty::ScrollbarColor(p) => format!(
7431 "CssProperty::ScrollbarColor({})",
7432 print_css_property_value(p, tabs, "StyleScrollbarColor")
7433 ),
7434 CssProperty::ScrollbarVisibility(p) => format!(
7435 "CssProperty::ScrollbarVisibility({})",
7436 print_css_property_value(p, tabs, "ScrollbarVisibilityMode")
7437 ),
7438 CssProperty::ScrollbarFadeDelay(p) => format!(
7439 "CssProperty::ScrollbarFadeDelay({})",
7440 print_css_property_value(p, tabs, "ScrollbarFadeDelay")
7441 ),
7442 CssProperty::ScrollbarFadeDuration(p) => format!(
7443 "CssProperty::ScrollbarFadeDuration({})",
7444 print_css_property_value(p, tabs, "ScrollbarFadeDuration")
7445 ),
7446 CssProperty::ScrollbarTrack(p) => format!(
7447 "CssProperty::ScrollbarTrack({})",
7448 print_css_property_value(p, tabs, "StyleBackgroundContent")
7449 ),
7450 CssProperty::ScrollbarThumb(p) => format!(
7451 "CssProperty::ScrollbarThumb({})",
7452 print_css_property_value(p, tabs, "StyleBackgroundContent")
7453 ),
7454 CssProperty::ScrollbarButton(p) => format!(
7455 "CssProperty::ScrollbarButton({})",
7456 print_css_property_value(p, tabs, "StyleBackgroundContent")
7457 ),
7458 CssProperty::ScrollbarCorner(p) => format!(
7459 "CssProperty::ScrollbarCorner({})",
7460 print_css_property_value(p, tabs, "StyleBackgroundContent")
7461 ),
7462 CssProperty::ScrollbarResizer(p) => format!(
7463 "CssProperty::ScrollbarResizer({})",
7464 print_css_property_value(p, tabs, "StyleBackgroundContent")
7465 ),
7466 CssProperty::Opacity(p) => format!(
7467 "CssProperty::Opacity({})",
7468 print_css_property_value(p, tabs, "StyleOpacity")
7469 ),
7470 CssProperty::Visibility(p) => format!(
7471 "CssProperty::Visibility({})",
7472 print_css_property_value(p, tabs, "StyleVisibility")
7473 ),
7474 CssProperty::Transform(p) => format!(
7475 "CssProperty::Transform({})",
7476 print_css_property_value(p, tabs, "StyleTransformVec")
7477 ),
7478 CssProperty::TransformOrigin(p) => format!(
7479 "CssProperty::TransformOrigin({})",
7480 print_css_property_value(p, tabs, "StyleTransformOrigin")
7481 ),
7482 CssProperty::PerspectiveOrigin(p) => format!(
7483 "CssProperty::PerspectiveOrigin({})",
7484 print_css_property_value(p, tabs, "StylePerspectiveOrigin")
7485 ),
7486 CssProperty::BackfaceVisibility(p) => format!(
7487 "CssProperty::BackfaceVisibility({})",
7488 print_css_property_value(p, tabs, "StyleBackfaceVisibility")
7489 ),
7490 CssProperty::MixBlendMode(p) => format!(
7491 "CssProperty::MixBlendMode({})",
7492 print_css_property_value(p, tabs, "StyleMixBlendMode")
7493 ),
7494 CssProperty::Filter(p) => format!(
7495 "CssProperty::Filter({})",
7496 print_css_property_value(p, tabs, "StyleFilterVec")
7497 ),
7498 CssProperty::BackdropFilter(p) => format!(
7499 "CssProperty::Filter({})",
7500 print_css_property_value(p, tabs, "StyleFilterVec")
7501 ),
7502 CssProperty::TextShadow(p) => format!(
7503 "CssProperty::TextShadow({})",
7504 print_css_property_value(p, tabs, "StyleBoxShadow")
7505 ),
7506 CssProperty::Hyphens(p) => format!(
7507 "CssProperty::Hyphens({})",
7508 print_css_property_value(p, tabs, "StyleHyphens")
7509 ),
7510 CssProperty::WordBreak(p) => format!(
7511 "CssProperty::WordBreak({})",
7512 print_css_property_value(p, tabs, "StyleWordBreak")
7513 ),
7514 CssProperty::OverflowWrap(p) => format!(
7515 "CssProperty::OverflowWrap({})",
7516 print_css_property_value(p, tabs, "StyleOverflowWrap")
7517 ),
7518 CssProperty::LineBreak(p) => format!(
7519 "CssProperty::LineBreak({})",
7520 print_css_property_value(p, tabs, "StyleLineBreak")
7521 ),
7522 CssProperty::ObjectFit(p) => format!(
7523 "CssProperty::ObjectFit({})",
7524 print_css_property_value(p, tabs, "StyleObjectFit")
7525 ),
7526 CssProperty::ObjectPosition(p) => format!(
7527 "CssProperty::ObjectPosition({})",
7528 print_css_property_value(p, tabs, "StyleObjectPosition")
7529 ),
7530 CssProperty::AspectRatio(p) => format!(
7531 "CssProperty::AspectRatio({})",
7532 print_css_property_value(p, tabs, "StyleAspectRatio")
7533 ),
7534 CssProperty::TextOrientation(p) => format!(
7535 "CssProperty::TextOrientation({})",
7536 print_css_property_value(p, tabs, "StyleTextOrientation")
7537 ),
7538 CssProperty::TextAlignLast(p) => format!(
7539 "CssProperty::TextAlignLast({})",
7540 print_css_property_value(p, tabs, "StyleTextAlignLast")
7541 ),
7542 CssProperty::TextTransform(p) => format!(
7543 "CssProperty::TextTransform({})",
7544 print_css_property_value(p, tabs, "StyleTextTransform")
7545 ),
7546 CssProperty::Direction(p) => format!(
7547 "CssProperty::Direction({})",
7548 print_css_property_value(p, tabs, "Direction")
7549 ),
7550 CssProperty::UserSelect(p) => format!(
7551 "CssProperty::UserSelect({})",
7552 print_css_property_value(p, tabs, "StyleUserSelect")
7553 ),
7554 CssProperty::TextDecoration(p) => format!(
7555 "CssProperty::TextDecoration({})",
7556 print_css_property_value(p, tabs, "StyleTextDecoration")
7557 ),
7558 CssProperty::WhiteSpace(p) => format!(
7559 "CssProperty::WhiteSpace({})",
7560 print_css_property_value(p, tabs, "WhiteSpace")
7561 ),
7562 CssProperty::FlexBasis(p) => format!(
7563 "CssProperty::FlexBasis({})",
7564 print_css_property_value(p, tabs, "LayoutFlexBasis")
7565 ),
7566 CssProperty::ColumnGap(p) => format!(
7567 "CssProperty::ColumnGap({})",
7568 print_css_property_value(p, tabs, "LayoutColumnGap")
7569 ),
7570 CssProperty::RowGap(p) => format!(
7571 "CssProperty::RowGap({})",
7572 print_css_property_value(p, tabs, "LayoutRowGap")
7573 ),
7574 CssProperty::GridTemplateColumns(p) => format!(
7575 "CssProperty::GridTemplateColumns({})",
7576 print_css_property_value(p, tabs, "LayoutGridTemplateColumns")
7577 ),
7578 CssProperty::GridTemplateRows(p) => format!(
7579 "CssProperty::GridTemplateRows({})",
7580 print_css_property_value(p, tabs, "LayoutGridTemplateRows")
7581 ),
7582 CssProperty::GridAutoFlow(p) => format!(
7583 "CssProperty::GridAutoFlow({})",
7584 print_css_property_value(p, tabs, "LayoutGridAutoFlow")
7585 ),
7586 CssProperty::JustifySelf(p) => format!(
7587 "CssProperty::JustifySelf({})",
7588 print_css_property_value(p, tabs, "LayoutJustifySelf")
7589 ),
7590 CssProperty::JustifyItems(p) => format!(
7591 "CssProperty::JustifyItems({})",
7592 print_css_property_value(p, tabs, "LayoutJustifyItems")
7593 ),
7594 CssProperty::Gap(p) => format!(
7595 "CssProperty::Gap({})",
7596 print_css_property_value(p, tabs, "LayoutGap")
7597 ),
7598 CssProperty::GridGap(p) => format!(
7599 "CssProperty::GridGap({})",
7600 print_css_property_value(p, tabs, "LayoutGap")
7601 ),
7602 CssProperty::AlignSelf(p) => format!(
7603 "CssProperty::AlignSelf({})",
7604 print_css_property_value(p, tabs, "LayoutAlignSelf")
7605 ),
7606 CssProperty::Font(p) => format!(
7607 "CssProperty::Font({})",
7608 print_css_property_value(p, tabs, "StyleFontFamilyVec")
7609 ),
7610 CssProperty::GridAutoRows(p) => format!(
7611 "CssProperty::GridAutoRows({})",
7612 print_css_property_value(p, tabs, "LayoutGridAutoRows")
7613 ),
7614 CssProperty::GridAutoColumns(p) => format!(
7615 "CssProperty::GridAutoColumns({})",
7616 print_css_property_value(p, tabs, "LayoutGridAutoColumns")
7617 ),
7618 CssProperty::GridRow(p) => format!(
7619 "CssProperty::GridRow({})",
7620 print_css_property_value(p, tabs, "LayoutGridRow")
7621 ),
7622 CssProperty::GridColumn(p) => format!(
7623 "CssProperty::GridColumn({})",
7624 print_css_property_value(p, tabs, "LayoutGridColumn")
7625 ),
7626 CssProperty::GridTemplateAreas(p) => format!(
7627 "CssProperty::GridTemplateAreas({})",
7628 print_css_property_value(p, tabs, "GridTemplateAreas")
7629 ),
7630 CssProperty::WritingMode(p) => format!(
7631 "CssProperty::WritingMode({})",
7632 print_css_property_value(p, tabs, "LayoutWritingMode")
7633 ),
7634 CssProperty::Clear(p) => format!(
7635 "CssProperty::Clear({})",
7636 print_css_property_value(p, tabs, "LayoutClear")
7637 ),
7638 CssProperty::BreakBefore(p) => format!(
7639 "CssProperty::BreakBefore({})",
7640 print_css_property_value(p, tabs, "PageBreak")
7641 ),
7642 CssProperty::BreakAfter(p) => format!(
7643 "CssProperty::BreakAfter({})",
7644 print_css_property_value(p, tabs, "PageBreak")
7645 ),
7646 CssProperty::BreakInside(p) => format!(
7647 "CssProperty::BreakInside({})",
7648 print_css_property_value(p, tabs, "BreakInside")
7649 ),
7650 CssProperty::Orphans(p) => format!(
7651 "CssProperty::Orphans({})",
7652 print_css_property_value(p, tabs, "Orphans")
7653 ),
7654 CssProperty::Widows(p) => format!(
7655 "CssProperty::Widows({})",
7656 print_css_property_value(p, tabs, "Widows")
7657 ),
7658 CssProperty::BoxDecorationBreak(p) => format!(
7659 "CssProperty::BoxDecorationBreak({})",
7660 print_css_property_value(p, tabs, "BoxDecorationBreak")
7661 ),
7662 CssProperty::ColumnCount(p) => format!(
7663 "CssProperty::ColumnCount({})",
7664 print_css_property_value(p, tabs, "ColumnCount")
7665 ),
7666 CssProperty::ColumnWidth(p) => format!(
7667 "CssProperty::ColumnWidth({})",
7668 print_css_property_value(p, tabs, "ColumnWidth")
7669 ),
7670 CssProperty::ColumnSpan(p) => format!(
7671 "CssProperty::ColumnSpan({})",
7672 print_css_property_value(p, tabs, "ColumnSpan")
7673 ),
7674 CssProperty::ColumnFill(p) => format!(
7675 "CssProperty::ColumnFill({})",
7676 print_css_property_value(p, tabs, "ColumnFill")
7677 ),
7678 CssProperty::ColumnRuleWidth(p) => format!(
7679 "CssProperty::ColumnRuleWidth({})",
7680 print_css_property_value(p, tabs, "ColumnRuleWidth")
7681 ),
7682 CssProperty::ColumnRuleStyle(p) => format!(
7683 "CssProperty::ColumnRuleStyle({})",
7684 print_css_property_value(p, tabs, "ColumnRuleStyle")
7685 ),
7686 CssProperty::ColumnRuleColor(p) => format!(
7687 "CssProperty::ColumnRuleColor({})",
7688 print_css_property_value(p, tabs, "ColumnRuleColor")
7689 ),
7690 CssProperty::FlowInto(p) => format!(
7691 "CssProperty::FlowInto({})",
7692 print_css_property_value(p, tabs, "FlowInto")
7693 ),
7694 CssProperty::FlowFrom(p) => format!(
7695 "CssProperty::FlowFrom({})",
7696 print_css_property_value(p, tabs, "FlowFrom")
7697 ),
7698 CssProperty::ShapeOutside(p) => format!(
7699 "CssProperty::ShapeOutside({})",
7700 print_css_property_value(p, tabs, "ShapeOutside")
7701 ),
7702 CssProperty::ShapeInside(p) => format!(
7703 "CssProperty::ShapeInside({})",
7704 print_css_property_value(p, tabs, "ShapeInside")
7705 ),
7706 CssProperty::ClipPath(p) => format!(
7707 "CssProperty::ClipPath({})",
7708 print_css_property_value(p, tabs, "ClipPath")
7709 ),
7710 CssProperty::ShapeMargin(p) => format!(
7711 "CssProperty::ShapeMargin({})",
7712 print_css_property_value(p, tabs, "ShapeMargin")
7713 ),
7714 CssProperty::ShapeImageThreshold(p) => format!(
7715 "CssProperty::ShapeImageThreshold({})",
7716 print_css_property_value(p, tabs, "ShapeImageThreshold")
7717 ),
7718 CssProperty::Content(p) => format!(
7719 "CssProperty::Content({})",
7720 print_css_property_value(p, tabs, "Content")
7721 ),
7722 CssProperty::CounterReset(p) => format!(
7723 "CssProperty::CounterReset({})",
7724 print_css_property_value(p, tabs, "CounterReset")
7725 ),
7726 CssProperty::CounterIncrement(p) => format!(
7727 "CssProperty::CounterIncrement({})",
7728 print_css_property_value(p, tabs, "CounterIncrement")
7729 ),
7730 CssProperty::ListStyleType(p) => format!(
7731 "CssProperty::ListStyleType({})",
7732 print_css_property_value(p, tabs, "StyleListStyleType")
7733 ),
7734 CssProperty::ListStylePosition(p) => format!(
7735 "CssProperty::ListStylePosition({})",
7736 print_css_property_value(p, tabs, "StyleListStylePosition")
7737 ),
7738 CssProperty::StringSet(p) => format!(
7739 "CssProperty::StringSet({})",
7740 print_css_property_value(p, tabs, "StringSet")
7741 ),
7742 CssProperty::TableLayout(p) => format!(
7743 "CssProperty::TableLayout({})",
7744 print_css_property_value(p, tabs, "LayoutTableLayout")
7745 ),
7746 CssProperty::BorderCollapse(p) => format!(
7747 "CssProperty::BorderCollapse({})",
7748 print_css_property_value(p, tabs, "StyleBorderCollapse")
7749 ),
7750 CssProperty::BorderSpacing(p) => format!(
7751 "CssProperty::BorderSpacing({})",
7752 print_css_property_value(p, tabs, "LayoutBorderSpacing")
7753 ),
7754 CssProperty::CaptionSide(p) => format!(
7755 "CssProperty::CaptionSide({})",
7756 print_css_property_value(p, tabs, "StyleCaptionSide")
7757 ),
7758 CssProperty::EmptyCells(p) => format!(
7759 "CssProperty::EmptyCells({})",
7760 print_css_property_value(p, tabs, "StyleEmptyCells")
7761 ),
7762 CssProperty::FontWeight(p) => format!(
7763 "CssProperty::FontWeight({})",
7764 print_css_property_value(p, tabs, "StyleFontWeight")
7765 ),
7766 CssProperty::FontStyle(p) => format!(
7767 "CssProperty::FontStyle({})",
7768 print_css_property_value(p, tabs, "StyleFontStyle")
7769 ),
7770 }
7771}
7772
7773fn print_css_property_value<T: FormatAsRustCode>(
7774 prop_val: &CssPropertyValue<T>,
7775 tabs: usize,
7776 property_value_type: &'static str,
7777) -> String {
7778 match prop_val {
7779 CssPropertyValue::Auto => format!("{property_value_type}Value::Auto"),
7780 CssPropertyValue::None => format!("{property_value_type}Value::None"),
7781 CssPropertyValue::Initial => format!("{property_value_type}Value::Initial"),
7782 CssPropertyValue::Inherit => format!("{property_value_type}Value::Inherit"),
7783 CssPropertyValue::Revert => format!("{property_value_type}Value::Revert"),
7784 CssPropertyValue::Unset => format!("{property_value_type}Value::Unset"),
7785 CssPropertyValue::Exact(t) => format!(
7786 "{}Value::Exact({})",
7787 property_value_type,
7788 t.format_as_rust_code(tabs)
7789 ),
7790 }
7791}