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::CssPropertyValue,
15 props::basic::{error::InvalidValueErr, pixel::PixelValueWithAuto},
16};
17use crate::{
19 format_rust_code::FormatAsRustCode,
20 props::{
21 basic::{
22 color::{parse_css_color, ColorU, CssColorParseError, CssColorParseErrorOwned},
23 font::{
24 parse_style_font_family, CssStyleFontFamilyParseError,
25 CssStyleFontFamilyParseErrorOwned, StyleFontFamilyVec, *,
26 },
27 length::{parse_float_value, parse_percentage_value, FloatValue, PercentageValue},
28 pixel::{
29 parse_pixel_value, CssPixelValueParseError, CssPixelValueParseErrorOwned,
30 PixelValue,
31 },
32 DurationParseError, DurationParseErrorOwned, InterpolateResolver, InvalidValueErrOwned,
33 PercentageParseError,
34 },
35 formatter::PrintAsCssValue,
36 layout::{
37 column::*, dimensions::*, display::*, flex::*, flow::*, fragmentation::*, grid::*,
38 overflow::*, position::*, shape::*, spacing::*, table::*, text::*, wrapping::*,
39 },
40 style::{
41 azul_exclusion::*, background::*, border::*, border_radius::*, box_shadow::*,
42 content::*, effects::*, filter::*, lists::*, scrollbar::*, text::*, transform::*,
43 SelectionBackgroundColor, SelectionColor, SelectionRadius,
44 },
45 },
46};
47
48const COMBINED_CSS_PROPERTIES_KEY_MAP: [(CombinedCssPropertyType, &'static str); 23] = [
49 (CombinedCssPropertyType::BorderRadius, "border-radius"),
50 (CombinedCssPropertyType::Overflow, "overflow"),
51 (CombinedCssPropertyType::Padding, "padding"),
52 (CombinedCssPropertyType::Margin, "margin"),
53 (CombinedCssPropertyType::Border, "border"),
54 (CombinedCssPropertyType::BorderLeft, "border-left"),
55 (CombinedCssPropertyType::BorderRight, "border-right"),
56 (CombinedCssPropertyType::BorderTop, "border-top"),
57 (CombinedCssPropertyType::BorderBottom, "border-bottom"),
58 (CombinedCssPropertyType::BorderColor, "border-color"),
59 (CombinedCssPropertyType::BorderStyle, "border-style"),
60 (CombinedCssPropertyType::BorderWidth, "border-width"),
61 (CombinedCssPropertyType::BoxShadow, "box-shadow"),
62 (CombinedCssPropertyType::BackgroundColor, "background-color"),
63 (CombinedCssPropertyType::BackgroundImage, "background-image"),
64 (CombinedCssPropertyType::Background, "background"),
65 (CombinedCssPropertyType::Flex, "flex"),
66 (CombinedCssPropertyType::Grid, "grid"),
67 (CombinedCssPropertyType::Gap, "gap"),
68 (CombinedCssPropertyType::GridGap, "grid-gap"),
69 (CombinedCssPropertyType::Font, "font"),
70 (CombinedCssPropertyType::Columns, "columns"),
71 (CombinedCssPropertyType::ColumnRule, "column-rule"),
72];
73
74const CSS_PROPERTY_KEY_MAP: [(CssPropertyType, &'static str); 149] = [
75 (CssPropertyType::Display, "display"),
76 (CssPropertyType::Float, "float"),
77 (CssPropertyType::BoxSizing, "box-sizing"),
78 (CssPropertyType::TextColor, "color"),
79 (CssPropertyType::FontSize, "font-size"),
80 (CssPropertyType::FontFamily, "font-family"),
81 (CssPropertyType::FontWeight, "font-weight"),
82 (CssPropertyType::FontStyle, "font-style"),
83 (CssPropertyType::TextAlign, "text-align"),
84 (CssPropertyType::TextJustify, "text-justify"),
85 (CssPropertyType::VerticalAlign, "vertical-align"),
86 (CssPropertyType::LetterSpacing, "letter-spacing"),
87 (CssPropertyType::LineHeight, "line-height"),
88 (CssPropertyType::WordSpacing, "word-spacing"),
89 (CssPropertyType::TabWidth, "tab-width"),
90 (CssPropertyType::WhiteSpace, "white-space"),
91 (CssPropertyType::Hyphens, "hyphens"),
92 (CssPropertyType::Direction, "direction"),
93 (CssPropertyType::UserSelect, "user-select"),
94 (CssPropertyType::TextDecoration, "text-decoration"),
95 (CssPropertyType::TextIndent, "text-indent"),
96 (CssPropertyType::InitialLetter, "initial-letter"),
97 (CssPropertyType::LineClamp, "line-clamp"),
98 (CssPropertyType::HangingPunctuation, "hanging-punctuation"),
99 (CssPropertyType::TextCombineUpright, "text-combine-upright"),
100 (CssPropertyType::ExclusionMargin, "-azul-exclusion-margin"),
101 (
102 CssPropertyType::HyphenationLanguage,
103 "-azul-hyphenation-language",
104 ),
105 (CssPropertyType::Cursor, "cursor"),
106 (CssPropertyType::Width, "width"),
107 (CssPropertyType::Height, "height"),
108 (CssPropertyType::MinWidth, "min-width"),
109 (CssPropertyType::MinHeight, "min-height"),
110 (CssPropertyType::MaxWidth, "max-width"),
111 (CssPropertyType::MaxHeight, "max-height"),
112 (CssPropertyType::Position, "position"),
113 (CssPropertyType::Top, "top"),
114 (CssPropertyType::Right, "right"),
115 (CssPropertyType::Left, "left"),
116 (CssPropertyType::Bottom, "bottom"),
117 (CssPropertyType::ZIndex, "z-index"),
118 (CssPropertyType::FlexWrap, "flex-wrap"),
119 (CssPropertyType::FlexDirection, "flex-direction"),
120 (CssPropertyType::FlexGrow, "flex-grow"),
121 (CssPropertyType::FlexShrink, "flex-shrink"),
122 (CssPropertyType::FlexBasis, "flex-basis"),
123 (CssPropertyType::JustifyContent, "justify-content"),
124 (CssPropertyType::AlignItems, "align-items"),
125 (CssPropertyType::AlignContent, "align-content"),
126 (CssPropertyType::ColumnGap, "column-gap"),
127 (CssPropertyType::RowGap, "row-gap"),
128 (
129 CssPropertyType::GridTemplateColumns,
130 "grid-template-columns",
131 ),
132 (CssPropertyType::GridTemplateRows, "grid-template-rows"),
133 (CssPropertyType::GridAutoColumns, "grid-auto-columns"),
134 (CssPropertyType::GridAutoRows, "grid-auto-rows"),
135 (CssPropertyType::GridColumn, "grid-column"),
136 (CssPropertyType::GridRow, "grid-row"),
137 (CssPropertyType::WritingMode, "writing-mode"),
138 (CssPropertyType::Clear, "clear"),
139 (CssPropertyType::OverflowX, "overflow-x"),
140 (CssPropertyType::OverflowY, "overflow-y"),
141 (CssPropertyType::PaddingTop, "padding-top"),
142 (CssPropertyType::PaddingLeft, "padding-left"),
143 (CssPropertyType::PaddingRight, "padding-right"),
144 (CssPropertyType::PaddingBottom, "padding-bottom"),
145 (CssPropertyType::PaddingInlineStart, "padding-inline-start"),
146 (CssPropertyType::PaddingInlineEnd, "padding-inline-end"),
147 (CssPropertyType::MarginTop, "margin-top"),
148 (CssPropertyType::MarginLeft, "margin-left"),
149 (CssPropertyType::MarginRight, "margin-right"),
150 (CssPropertyType::MarginBottom, "margin-bottom"),
151 (CssPropertyType::BackgroundContent, "background"),
152 (CssPropertyType::BackgroundPosition, "background-position"),
153 (CssPropertyType::BackgroundSize, "background-size"),
154 (CssPropertyType::BackgroundRepeat, "background-repeat"),
155 (
156 CssPropertyType::BorderTopLeftRadius,
157 "border-top-left-radius",
158 ),
159 (
160 CssPropertyType::BorderTopRightRadius,
161 "border-top-right-radius",
162 ),
163 (
164 CssPropertyType::BorderBottomLeftRadius,
165 "border-bottom-left-radius",
166 ),
167 (
168 CssPropertyType::BorderBottomRightRadius,
169 "border-bottom-right-radius",
170 ),
171 (CssPropertyType::BorderTopColor, "border-top-color"),
172 (CssPropertyType::BorderRightColor, "border-right-color"),
173 (CssPropertyType::BorderLeftColor, "border-left-color"),
174 (CssPropertyType::BorderBottomColor, "border-bottom-color"),
175 (CssPropertyType::BorderTopStyle, "border-top-style"),
176 (CssPropertyType::BorderRightStyle, "border-right-style"),
177 (CssPropertyType::BorderLeftStyle, "border-left-style"),
178 (CssPropertyType::BorderBottomStyle, "border-bottom-style"),
179 (CssPropertyType::BorderTopWidth, "border-top-width"),
180 (CssPropertyType::BorderRightWidth, "border-right-width"),
181 (CssPropertyType::BorderLeftWidth, "border-left-width"),
182 (CssPropertyType::BorderBottomWidth, "border-bottom-width"),
183 (CssPropertyType::BoxShadowTop, "-azul-box-shadow-top"),
184 (CssPropertyType::BoxShadowRight, "-azul-box-shadow-right"),
185 (CssPropertyType::BoxShadowLeft, "-azul-box-shadow-left"),
186 (CssPropertyType::BoxShadowBottom, "-azul-box-shadow-bottom"),
187 (CssPropertyType::Scrollbar, "-azul-scrollbar-style"),
188 (CssPropertyType::CaretColor, "caret-color"),
189 (
190 CssPropertyType::CaretAnimationDuration,
191 "caret-animation-duration",
192 ),
193 (CssPropertyType::CaretWidth, "-azul-caret-width"),
194 (
195 CssPropertyType::SelectionBackgroundColor,
196 "-azul-selection-background-color",
197 ),
198 (CssPropertyType::SelectionColor, "-azul-selection-color"),
199 (CssPropertyType::SelectionRadius, "-azul-selection-radius"),
200 (CssPropertyType::ScrollbarWidth, "scrollbar-width"),
201 (CssPropertyType::ScrollbarColor, "scrollbar-color"),
202 (CssPropertyType::Opacity, "opacity"),
203 (CssPropertyType::Visibility, "visibility"),
204 (CssPropertyType::Transform, "transform"),
205 (CssPropertyType::PerspectiveOrigin, "perspective-origin"),
206 (CssPropertyType::TransformOrigin, "transform-origin"),
207 (CssPropertyType::BackfaceVisibility, "backface-visibility"),
208 (CssPropertyType::MixBlendMode, "mix-blend-mode"),
209 (CssPropertyType::Filter, "filter"),
210 (CssPropertyType::BackdropFilter, "backdrop-filter"),
211 (CssPropertyType::TextShadow, "text-shadow"),
212 (CssPropertyType::GridAutoFlow, "grid-auto-flow"),
213 (CssPropertyType::JustifySelf, "justify-self"),
214 (CssPropertyType::JustifyItems, "justify-items"),
215 (CssPropertyType::Gap, "gap"),
216 (CssPropertyType::GridGap, "grid-gap"),
217 (CssPropertyType::AlignSelf, "align-self"),
218 (CssPropertyType::Font, "font"),
219 (CssPropertyType::BreakBefore, "break-before"),
220 (CssPropertyType::BreakAfter, "break-after"),
221 (CssPropertyType::BreakInside, "break-inside"),
222 (CssPropertyType::BreakBefore, "page-break-before"),
224 (CssPropertyType::BreakAfter, "page-break-after"),
225 (CssPropertyType::BreakInside, "page-break-inside"),
226 (CssPropertyType::Orphans, "orphans"),
227 (CssPropertyType::Widows, "widows"),
228 (CssPropertyType::BoxDecorationBreak, "box-decoration-break"),
229 (CssPropertyType::ColumnCount, "column-count"),
230 (CssPropertyType::ColumnWidth, "column-width"),
231 (CssPropertyType::ColumnSpan, "column-span"),
232 (CssPropertyType::ColumnFill, "column-fill"),
233 (CssPropertyType::ColumnRuleWidth, "column-rule-width"),
234 (CssPropertyType::ColumnRuleStyle, "column-rule-style"),
235 (CssPropertyType::ColumnRuleColor, "column-rule-color"),
236 (CssPropertyType::FlowInto, "flow-into"),
237 (CssPropertyType::FlowFrom, "flow-from"),
238 (CssPropertyType::ShapeOutside, "shape-outside"),
239 (CssPropertyType::ShapeInside, "shape-inside"),
240 (CssPropertyType::ClipPath, "clip-path"),
241 (CssPropertyType::ShapeMargin, "shape-margin"),
242 (
243 CssPropertyType::ShapeImageThreshold,
244 "shape-image-threshold",
245 ),
246 (CssPropertyType::Content, "content"),
247 (CssPropertyType::CounterReset, "counter-reset"),
248 (CssPropertyType::CounterIncrement, "counter-increment"),
249 (CssPropertyType::ListStyleType, "list-style-type"),
250 (CssPropertyType::ListStylePosition, "list-style-position"),
251 (CssPropertyType::StringSet, "string-set"),
252];
253
254pub type CaretColorValue = CssPropertyValue<CaretColor>;
256pub type CaretAnimationDurationValue = CssPropertyValue<CaretAnimationDuration>;
257pub type CaretWidthValue = CssPropertyValue<CaretWidth>;
258pub type SelectionBackgroundColorValue = CssPropertyValue<SelectionBackgroundColor>;
259pub type SelectionColorValue = CssPropertyValue<SelectionColor>;
260pub type SelectionRadiusValue = CssPropertyValue<SelectionRadius>;
261pub type StyleBackgroundContentVecValue = CssPropertyValue<StyleBackgroundContentVec>;
262pub type StyleBackgroundPositionVecValue = CssPropertyValue<StyleBackgroundPositionVec>;
263pub type StyleBackgroundSizeVecValue = CssPropertyValue<StyleBackgroundSizeVec>;
264pub type StyleBackgroundRepeatVecValue = CssPropertyValue<StyleBackgroundRepeatVec>;
265pub type StyleFontSizeValue = CssPropertyValue<StyleFontSize>;
266pub type StyleFontFamilyVecValue = CssPropertyValue<StyleFontFamilyVec>;
267pub type StyleFontWeightValue = CssPropertyValue<StyleFontWeight>;
268pub type StyleFontStyleValue = CssPropertyValue<StyleFontStyle>;
269pub type StyleTextColorValue = CssPropertyValue<StyleTextColor>;
270pub type StyleTextAlignValue = CssPropertyValue<StyleTextAlign>;
271pub type StyleVerticalAlignValue = CssPropertyValue<StyleVerticalAlign>;
272pub type StyleLineHeightValue = CssPropertyValue<StyleLineHeight>;
273pub type StyleLetterSpacingValue = CssPropertyValue<StyleLetterSpacing>;
274pub type StyleTextIndentValue = CssPropertyValue<StyleTextIndent>;
275pub type StyleInitialLetterValue = CssPropertyValue<StyleInitialLetter>;
276pub type StyleLineClampValue = CssPropertyValue<StyleLineClamp>;
277pub type StyleHangingPunctuationValue = CssPropertyValue<StyleHangingPunctuation>;
278pub type StyleTextCombineUprightValue = CssPropertyValue<StyleTextCombineUpright>;
279pub type StyleExclusionMarginValue = CssPropertyValue<StyleExclusionMargin>;
280pub type StyleHyphenationLanguageValue = CssPropertyValue<StyleHyphenationLanguage>;
281pub type StyleWordSpacingValue = CssPropertyValue<StyleWordSpacing>;
282pub type StyleTabWidthValue = CssPropertyValue<StyleTabWidth>;
283pub type StyleCursorValue = CssPropertyValue<StyleCursor>;
284pub type StyleBoxShadowValue = CssPropertyValue<StyleBoxShadow>;
285pub type StyleBorderTopColorValue = CssPropertyValue<StyleBorderTopColor>;
286pub type StyleBorderLeftColorValue = CssPropertyValue<StyleBorderLeftColor>;
287pub type StyleBorderRightColorValue = CssPropertyValue<StyleBorderRightColor>;
288pub type StyleBorderBottomColorValue = CssPropertyValue<StyleBorderBottomColor>;
289pub type StyleBorderTopStyleValue = CssPropertyValue<StyleBorderTopStyle>;
290pub type StyleBorderLeftStyleValue = CssPropertyValue<StyleBorderLeftStyle>;
291pub type StyleBorderRightStyleValue = CssPropertyValue<StyleBorderRightStyle>;
292pub type StyleBorderBottomStyleValue = CssPropertyValue<StyleBorderBottomStyle>;
293pub type StyleBorderTopLeftRadiusValue = CssPropertyValue<StyleBorderTopLeftRadius>;
294pub type StyleBorderTopRightRadiusValue = CssPropertyValue<StyleBorderTopRightRadius>;
295pub type StyleBorderBottomLeftRadiusValue = CssPropertyValue<StyleBorderBottomLeftRadius>;
296pub type StyleBorderBottomRightRadiusValue = CssPropertyValue<StyleBorderBottomRightRadius>;
297pub type StyleOpacityValue = CssPropertyValue<StyleOpacity>;
298pub type StyleVisibilityValue = CssPropertyValue<StyleVisibility>;
299pub type StyleTransformVecValue = CssPropertyValue<StyleTransformVec>;
300pub type StyleTransformOriginValue = CssPropertyValue<StyleTransformOrigin>;
301pub type StylePerspectiveOriginValue = CssPropertyValue<StylePerspectiveOrigin>;
302pub type StyleBackfaceVisibilityValue = CssPropertyValue<StyleBackfaceVisibility>;
303pub type StyleMixBlendModeValue = CssPropertyValue<StyleMixBlendMode>;
304pub type StyleFilterVecValue = CssPropertyValue<StyleFilterVec>;
305pub type ScrollbarStyleValue = CssPropertyValue<ScrollbarStyle>;
306pub type LayoutScrollbarWidthValue = CssPropertyValue<LayoutScrollbarWidth>;
307pub type StyleScrollbarColorValue = CssPropertyValue<StyleScrollbarColor>;
308pub type LayoutDisplayValue = CssPropertyValue<LayoutDisplay>;
309pub type StyleHyphensValue = CssPropertyValue<StyleHyphens>;
310pub type StyleDirectionValue = CssPropertyValue<StyleDirection>;
311pub type StyleUserSelectValue = CssPropertyValue<StyleUserSelect>;
312pub type StyleTextDecorationValue = CssPropertyValue<StyleTextDecoration>;
313pub type StyleWhiteSpaceValue = CssPropertyValue<StyleWhiteSpace>;
314pub type LayoutFloatValue = CssPropertyValue<LayoutFloat>;
315pub type LayoutBoxSizingValue = CssPropertyValue<LayoutBoxSizing>;
316pub type LayoutWidthValue = CssPropertyValue<LayoutWidth>;
317pub type LayoutHeightValue = CssPropertyValue<LayoutHeight>;
318pub type LayoutMinWidthValue = CssPropertyValue<LayoutMinWidth>;
319pub type LayoutMinHeightValue = CssPropertyValue<LayoutMinHeight>;
320pub type LayoutMaxWidthValue = CssPropertyValue<LayoutMaxWidth>;
321pub type LayoutMaxHeightValue = CssPropertyValue<LayoutMaxHeight>;
322pub type LayoutPositionValue = CssPropertyValue<LayoutPosition>;
323pub type LayoutTopValue = CssPropertyValue<LayoutTop>;
324pub type LayoutInsetBottomValue = CssPropertyValue<LayoutInsetBottom>;
325pub type LayoutRightValue = CssPropertyValue<LayoutRight>;
326pub type LayoutLeftValue = CssPropertyValue<LayoutLeft>;
327pub type LayoutZIndexValue = CssPropertyValue<LayoutZIndex>;
328pub type LayoutPaddingTopValue = CssPropertyValue<LayoutPaddingTop>;
329pub type LayoutPaddingBottomValue = CssPropertyValue<LayoutPaddingBottom>;
330pub type LayoutPaddingLeftValue = CssPropertyValue<LayoutPaddingLeft>;
331pub type LayoutPaddingRightValue = CssPropertyValue<LayoutPaddingRight>;
332pub type LayoutPaddingInlineStartValue = CssPropertyValue<LayoutPaddingInlineStart>;
333pub type LayoutPaddingInlineEndValue = CssPropertyValue<LayoutPaddingInlineEnd>;
334pub type LayoutMarginTopValue = CssPropertyValue<LayoutMarginTop>;
335pub type LayoutMarginBottomValue = CssPropertyValue<LayoutMarginBottom>;
336pub type LayoutTextJustifyValue = CssPropertyValue<LayoutTextJustify>;
337pub type LayoutMarginLeftValue = CssPropertyValue<LayoutMarginLeft>;
338pub type LayoutMarginRightValue = CssPropertyValue<LayoutMarginRight>;
339pub type LayoutBorderTopWidthValue = CssPropertyValue<LayoutBorderTopWidth>;
340pub type LayoutBorderLeftWidthValue = CssPropertyValue<LayoutBorderLeftWidth>;
341pub type LayoutBorderRightWidthValue = CssPropertyValue<LayoutBorderRightWidth>;
342pub type LayoutBorderBottomWidthValue = CssPropertyValue<LayoutBorderBottomWidth>;
343pub type LayoutOverflowValue = CssPropertyValue<LayoutOverflow>;
344pub type LayoutFlexDirectionValue = CssPropertyValue<LayoutFlexDirection>;
345pub type LayoutFlexWrapValue = CssPropertyValue<LayoutFlexWrap>;
346pub type LayoutFlexGrowValue = CssPropertyValue<LayoutFlexGrow>;
347pub type LayoutFlexShrinkValue = CssPropertyValue<LayoutFlexShrink>;
348pub type LayoutFlexBasisValue = CssPropertyValue<LayoutFlexBasis>;
349pub type LayoutJustifyContentValue = CssPropertyValue<LayoutJustifyContent>;
350pub type LayoutAlignItemsValue = CssPropertyValue<LayoutAlignItems>;
351pub type LayoutAlignContentValue = CssPropertyValue<LayoutAlignContent>;
352pub type LayoutColumnGapValue = CssPropertyValue<LayoutColumnGap>;
353pub type LayoutRowGapValue = CssPropertyValue<LayoutRowGap>;
354pub type LayoutGridTemplateColumnsValue = CssPropertyValue<GridTemplate>;
355pub type LayoutGridTemplateRowsValue = CssPropertyValue<GridTemplate>;
356pub type LayoutGridAutoColumnsValue = CssPropertyValue<GridAutoTracks>;
357pub type LayoutGridAutoRowsValue = CssPropertyValue<GridAutoTracks>;
358pub type LayoutGridColumnValue = CssPropertyValue<GridPlacement>;
359pub type LayoutGridRowValue = CssPropertyValue<GridPlacement>;
360pub type LayoutWritingModeValue = CssPropertyValue<LayoutWritingMode>;
361pub type LayoutClearValue = CssPropertyValue<LayoutClear>;
362pub type LayoutGridAutoFlowValue = CssPropertyValue<LayoutGridAutoFlow>;
363pub type LayoutJustifySelfValue = CssPropertyValue<LayoutJustifySelf>;
364pub type LayoutJustifyItemsValue = CssPropertyValue<LayoutJustifyItems>;
365pub type LayoutGapValue = CssPropertyValue<LayoutGap>;
366pub type LayoutAlignSelfValue = CssPropertyValue<LayoutAlignSelf>;
367pub type StyleFontValue = CssPropertyValue<StyleFontFamilyVec>;
368pub type PageBreakValue = CssPropertyValue<PageBreak>;
369pub type BreakInsideValue = CssPropertyValue<BreakInside>;
370pub type WidowsValue = CssPropertyValue<Widows>;
371pub type OrphansValue = CssPropertyValue<Orphans>;
372pub type BoxDecorationBreakValue = CssPropertyValue<BoxDecorationBreak>;
373pub type ColumnCountValue = CssPropertyValue<ColumnCount>;
374pub type ColumnWidthValue = CssPropertyValue<ColumnWidth>;
375pub type ColumnSpanValue = CssPropertyValue<ColumnSpan>;
376pub type ColumnFillValue = CssPropertyValue<ColumnFill>;
377pub type ColumnRuleWidthValue = CssPropertyValue<ColumnRuleWidth>;
378pub type ColumnRuleStyleValue = CssPropertyValue<ColumnRuleStyle>;
379pub type ColumnRuleColorValue = CssPropertyValue<ColumnRuleColor>;
380pub type FlowIntoValue = CssPropertyValue<FlowInto>;
381pub type FlowFromValue = CssPropertyValue<FlowFrom>;
382pub type ShapeOutsideValue = CssPropertyValue<ShapeOutside>;
383pub type ShapeInsideValue = CssPropertyValue<ShapeInside>;
384pub type ClipPathValue = CssPropertyValue<ClipPath>;
385pub type ShapeMarginValue = CssPropertyValue<ShapeMargin>;
386pub type ShapeImageThresholdValue = CssPropertyValue<ShapeImageThreshold>;
387pub type LayoutTableLayoutValue = CssPropertyValue<LayoutTableLayout>;
388pub type StyleBorderCollapseValue = CssPropertyValue<StyleBorderCollapse>;
389pub type LayoutBorderSpacingValue = CssPropertyValue<LayoutBorderSpacing>;
390pub type StyleCaptionSideValue = CssPropertyValue<StyleCaptionSide>;
391pub type StyleEmptyCellsValue = CssPropertyValue<StyleEmptyCells>;
392pub type ContentValue = CssPropertyValue<Content>;
393pub type CounterResetValue = CssPropertyValue<CounterReset>;
394pub type CounterIncrementValue = CssPropertyValue<CounterIncrement>;
395pub type StyleListStyleTypeValue = CssPropertyValue<StyleListStyleType>;
396pub type StyleListStylePositionValue = CssPropertyValue<StyleListStylePosition>;
397pub type StringSetValue = CssPropertyValue<StringSet>;
398
399#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
400pub struct CssKeyMap {
401 pub non_shorthands: BTreeMap<&'static str, CssPropertyType>,
403 pub shorthands: BTreeMap<&'static str, CombinedCssPropertyType>,
405}
406
407impl CssKeyMap {
408 pub fn get() -> Self {
409 get_css_key_map()
410 }
411}
412
413pub fn get_css_key_map() -> CssKeyMap {
415 CssKeyMap {
416 non_shorthands: CSS_PROPERTY_KEY_MAP.iter().map(|(v, k)| (*k, *v)).collect(),
417 shorthands: COMBINED_CSS_PROPERTIES_KEY_MAP
418 .iter()
419 .map(|(v, k)| (*k, *v))
420 .collect(),
421 }
422}
423
424#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
425pub enum CombinedCssPropertyType {
426 BorderRadius,
427 Overflow,
428 Margin,
429 Border,
430 BorderLeft,
431 BorderRight,
432 BorderTop,
433 BorderBottom,
434 BorderColor,
435 BorderStyle,
436 BorderWidth,
437 Padding,
438 BoxShadow,
439 BackgroundColor, BackgroundImage, Background,
442 Flex,
443 Grid,
444 Gap,
445 GridGap,
446 Font,
447 Columns,
448 ColumnRule,
449}
450
451impl fmt::Display for CombinedCssPropertyType {
452 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
453 let key = COMBINED_CSS_PROPERTIES_KEY_MAP
454 .iter()
455 .find(|(v, _)| *v == *self)
456 .and_then(|(k, _)| Some(k))
457 .unwrap();
458 write!(f, "{}", key)
459 }
460}
461
462impl CombinedCssPropertyType {
463 pub fn from_str(input: &str, map: &CssKeyMap) -> Option<Self> {
476 let input = input.trim();
477 map.shorthands.get(input).map(|x| *x)
478 }
479
480 pub fn to_str(&self, map: &CssKeyMap) -> &'static str {
482 map.shorthands
483 .iter()
484 .find(|(_, v)| *v == self)
485 .map(|(k, _)| k)
486 .unwrap()
487 }
488}
489
490#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
493#[repr(C, u8)]
494pub enum CssProperty {
495 CaretColor(CaretColorValue),
496 CaretAnimationDuration(CaretAnimationDurationValue),
497 CaretWidth(CaretWidthValue),
498 SelectionBackgroundColor(SelectionBackgroundColorValue),
499 SelectionColor(SelectionColorValue),
500 SelectionRadius(SelectionRadiusValue),
501 TextColor(StyleTextColorValue),
502 FontSize(StyleFontSizeValue),
503 FontFamily(StyleFontFamilyVecValue),
504 FontWeight(StyleFontWeightValue),
505 FontStyle(StyleFontStyleValue),
506 TextAlign(StyleTextAlignValue),
507 TextJustify(LayoutTextJustifyValue),
508 VerticalAlign(StyleVerticalAlignValue),
509 LetterSpacing(StyleLetterSpacingValue),
510 TextIndent(StyleTextIndentValue),
511 InitialLetter(StyleInitialLetterValue),
512 LineClamp(StyleLineClampValue),
513 HangingPunctuation(StyleHangingPunctuationValue),
514 TextCombineUpright(StyleTextCombineUprightValue),
515 ExclusionMargin(StyleExclusionMarginValue),
516 HyphenationLanguage(StyleHyphenationLanguageValue),
517 LineHeight(StyleLineHeightValue),
518 WordSpacing(StyleWordSpacingValue),
519 TabWidth(StyleTabWidthValue),
520 WhiteSpace(StyleWhiteSpaceValue),
521 Hyphens(StyleHyphensValue),
522 Direction(StyleDirectionValue),
523 UserSelect(StyleUserSelectValue),
524 TextDecoration(StyleTextDecorationValue),
525 Cursor(StyleCursorValue),
526 Display(LayoutDisplayValue),
527 Float(LayoutFloatValue),
528 BoxSizing(LayoutBoxSizingValue),
529 Width(LayoutWidthValue),
530 Height(LayoutHeightValue),
531 MinWidth(LayoutMinWidthValue),
532 MinHeight(LayoutMinHeightValue),
533 MaxWidth(LayoutMaxWidthValue),
534 MaxHeight(LayoutMaxHeightValue),
535 Position(LayoutPositionValue),
536 Top(LayoutTopValue),
537 Right(LayoutRightValue),
538 Left(LayoutLeftValue),
539 Bottom(LayoutInsetBottomValue),
540 ZIndex(LayoutZIndexValue),
541 FlexWrap(LayoutFlexWrapValue),
542 FlexDirection(LayoutFlexDirectionValue),
543 FlexGrow(LayoutFlexGrowValue),
544 FlexShrink(LayoutFlexShrinkValue),
545 FlexBasis(LayoutFlexBasisValue),
546 JustifyContent(LayoutJustifyContentValue),
547 AlignItems(LayoutAlignItemsValue),
548 AlignContent(LayoutAlignContentValue),
549 ColumnGap(LayoutColumnGapValue),
550 RowGap(LayoutRowGapValue),
551 GridTemplateColumns(LayoutGridTemplateColumnsValue),
552 GridTemplateRows(LayoutGridTemplateRowsValue),
553 GridAutoColumns(LayoutGridAutoColumnsValue),
554 GridAutoRows(LayoutGridAutoRowsValue),
555 GridColumn(LayoutGridColumnValue),
556 GridRow(LayoutGridRowValue),
557 WritingMode(LayoutWritingModeValue),
558 Clear(LayoutClearValue),
559 BackgroundContent(StyleBackgroundContentVecValue),
560 BackgroundPosition(StyleBackgroundPositionVecValue),
561 BackgroundSize(StyleBackgroundSizeVecValue),
562 BackgroundRepeat(StyleBackgroundRepeatVecValue),
563 OverflowX(LayoutOverflowValue),
564 OverflowY(LayoutOverflowValue),
565 GridAutoFlow(LayoutGridAutoFlowValue),
566 JustifySelf(LayoutJustifySelfValue),
567 JustifyItems(LayoutJustifyItemsValue),
568 Gap(LayoutGapValue),
569 GridGap(LayoutGapValue),
570 AlignSelf(LayoutAlignSelfValue),
571 Font(StyleFontValue),
572 PaddingTop(LayoutPaddingTopValue),
573 PaddingLeft(LayoutPaddingLeftValue),
574 PaddingRight(LayoutPaddingRightValue),
575 PaddingBottom(LayoutPaddingBottomValue),
576 PaddingInlineStart(LayoutPaddingInlineStartValue),
577 PaddingInlineEnd(LayoutPaddingInlineEndValue),
578 MarginTop(LayoutMarginTopValue),
579 MarginLeft(LayoutMarginLeftValue),
580 MarginRight(LayoutMarginRightValue),
581 MarginBottom(LayoutMarginBottomValue),
582 BorderTopLeftRadius(StyleBorderTopLeftRadiusValue),
583 LayoutTextJustify(LayoutTextJustifyValue),
584 BorderTopRightRadius(StyleBorderTopRightRadiusValue),
585 BorderBottomLeftRadius(StyleBorderBottomLeftRadiusValue),
586 BorderBottomRightRadius(StyleBorderBottomRightRadiusValue),
587 BorderTopColor(StyleBorderTopColorValue),
588 BorderRightColor(StyleBorderRightColorValue),
589 BorderLeftColor(StyleBorderLeftColorValue),
590 BorderBottomColor(StyleBorderBottomColorValue),
591 BorderTopStyle(StyleBorderTopStyleValue),
592 BorderRightStyle(StyleBorderRightStyleValue),
593 BorderLeftStyle(StyleBorderLeftStyleValue),
594 BorderBottomStyle(StyleBorderBottomStyleValue),
595 BorderTopWidth(LayoutBorderTopWidthValue),
596 BorderRightWidth(LayoutBorderRightWidthValue),
597 BorderLeftWidth(LayoutBorderLeftWidthValue),
598 BorderBottomWidth(LayoutBorderBottomWidthValue),
599 BoxShadowLeft(StyleBoxShadowValue),
600 BoxShadowRight(StyleBoxShadowValue),
601 BoxShadowTop(StyleBoxShadowValue),
602 BoxShadowBottom(StyleBoxShadowValue),
603 Scrollbar(ScrollbarStyleValue),
604 ScrollbarWidth(LayoutScrollbarWidthValue),
605 ScrollbarColor(StyleScrollbarColorValue),
606 Opacity(StyleOpacityValue),
607 Visibility(StyleVisibilityValue),
608 Transform(StyleTransformVecValue),
609 TransformOrigin(StyleTransformOriginValue),
610 PerspectiveOrigin(StylePerspectiveOriginValue),
611 BackfaceVisibility(StyleBackfaceVisibilityValue),
612 MixBlendMode(StyleMixBlendModeValue),
613 Filter(StyleFilterVecValue),
614 BackdropFilter(StyleFilterVecValue),
615 TextShadow(StyleBoxShadowValue),
616 BreakBefore(PageBreakValue),
617 BreakAfter(PageBreakValue),
618 BreakInside(BreakInsideValue),
619 Orphans(OrphansValue),
620 Widows(WidowsValue),
621 BoxDecorationBreak(BoxDecorationBreakValue),
622 ColumnCount(ColumnCountValue),
623 ColumnWidth(ColumnWidthValue),
624 ColumnSpan(ColumnSpanValue),
625 ColumnFill(ColumnFillValue),
626 ColumnRuleWidth(ColumnRuleWidthValue),
627 ColumnRuleStyle(ColumnRuleStyleValue),
628 ColumnRuleColor(ColumnRuleColorValue),
629 FlowInto(FlowIntoValue),
630 FlowFrom(FlowFromValue),
631 ShapeOutside(ShapeOutsideValue),
632 ShapeInside(ShapeInsideValue),
633 ClipPath(ClipPathValue),
634 ShapeMargin(ShapeMarginValue),
635 ShapeImageThreshold(ShapeImageThresholdValue),
636 TableLayout(LayoutTableLayoutValue),
637 BorderCollapse(StyleBorderCollapseValue),
638 BorderSpacing(LayoutBorderSpacingValue),
639 CaptionSide(StyleCaptionSideValue),
640 EmptyCells(StyleEmptyCellsValue),
641 Content(ContentValue),
642 CounterReset(CounterResetValue),
643 CounterIncrement(CounterIncrementValue),
644 ListStyleType(StyleListStyleTypeValue),
645 ListStylePosition(StyleListStylePositionValue),
646 StringSet(StringSetValue),
647}
648
649impl_option!(
650 CssProperty,
651 OptionCssProperty,
652 copy = false,
653 [Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord]
654);
655
656crate::impl_vec!(
657 CssProperty,
658 CssPropertyVec,
659 CssPropertyVecDestructor,
660 CssPropertyVecDestructorType
661);
662crate::impl_vec_clone!(CssProperty, CssPropertyVec, CssPropertyVecDestructor);
663crate::impl_vec_debug!(CssProperty, CssPropertyVec);
664crate::impl_vec_partialeq!(CssProperty, CssPropertyVec);
665crate::impl_vec_eq!(CssProperty, CssPropertyVec);
666crate::impl_vec_partialord!(CssProperty, CssPropertyVec);
667crate::impl_vec_ord!(CssProperty, CssPropertyVec);
668crate::impl_vec_hash!(CssProperty, CssPropertyVec);
669
670#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
672pub enum CssPropertyCategory {
673 GpuOnly,
674 Layout,
676 Paint,
678 InheritedLayout,
680 InheritedPaint,
682}
683
684#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, strum_macros::EnumIter)]
687#[repr(C)]
688pub enum CssPropertyType {
689 CaretColor,
690 CaretAnimationDuration,
691 CaretWidth,
692 SelectionBackgroundColor,
693 SelectionColor,
694 SelectionRadius,
695 TextColor,
696 FontSize,
697 FontFamily,
698 FontWeight,
699 FontStyle,
700 TextAlign,
701 TextJustify,
702 VerticalAlign,
703 LetterSpacing,
704 TextIndent,
705 InitialLetter,
706 LineClamp,
707 HangingPunctuation,
708 TextCombineUpright,
709 ExclusionMargin,
710 HyphenationLanguage,
711 LineHeight,
712 WordSpacing,
713 TabWidth,
714 WhiteSpace,
715 Hyphens,
716 Direction,
717 UserSelect,
718 TextDecoration,
719 Cursor,
720 Display,
721 Float,
722 BoxSizing,
723 Width,
724 Height,
725 MinWidth,
726 MinHeight,
727 MaxWidth,
728 MaxHeight,
729 Position,
730 Top,
731 Right,
732 Left,
733 Bottom,
734 ZIndex,
735 FlexWrap,
736 FlexDirection,
737 FlexGrow,
738 FlexShrink,
739 FlexBasis,
740 JustifyContent,
741 AlignItems,
742 AlignContent,
743 ColumnGap,
744 RowGap,
745 GridTemplateColumns,
746 GridTemplateRows,
747 GridAutoColumns,
748 GridAutoRows,
749 GridColumn,
750 GridRow,
751 GridAutoFlow,
752 JustifySelf,
753 JustifyItems,
754 Gap,
755 GridGap,
756 AlignSelf,
757 Font,
758 WritingMode,
759 Clear,
760 BackgroundContent,
761 BackgroundPosition,
762 BackgroundSize,
763 BackgroundRepeat,
764 OverflowX,
765 OverflowY,
766 PaddingTop,
767 PaddingLeft,
768 PaddingRight,
769 PaddingBottom,
770 PaddingInlineStart,
771 PaddingInlineEnd,
772 MarginTop,
773 MarginLeft,
774 MarginRight,
775 MarginBottom,
776 BorderTopLeftRadius,
777 BorderTopRightRadius,
778 BorderBottomLeftRadius,
779 BorderBottomRightRadius,
780 BorderTopColor,
781 BorderRightColor,
782 BorderLeftColor,
783 BorderBottomColor,
784 BorderTopStyle,
785 BorderRightStyle,
786 BorderLeftStyle,
787 BorderBottomStyle,
788 BorderTopWidth,
789 BorderRightWidth,
790 BorderLeftWidth,
791 BorderBottomWidth,
792 BoxShadowLeft,
793 BoxShadowRight,
794 BoxShadowTop,
795 BoxShadowBottom,
796 Scrollbar,
797 ScrollbarWidth,
798 ScrollbarColor,
799 Opacity,
800 Visibility,
801 Transform,
802 TransformOrigin,
803 PerspectiveOrigin,
804 BackfaceVisibility,
805 MixBlendMode,
806 Filter,
807 BackdropFilter,
808 TextShadow,
809 BreakBefore,
810 BreakAfter,
811 BreakInside,
812 Orphans,
813 Widows,
814 BoxDecorationBreak,
815 ColumnCount,
816 ColumnWidth,
817 ColumnSpan,
818 ColumnFill,
819 ColumnRuleWidth,
820 ColumnRuleStyle,
821 ColumnRuleColor,
822 FlowInto,
823 FlowFrom,
824 ShapeOutside,
825 ShapeInside,
826 ClipPath,
827 ShapeMargin,
828 ShapeImageThreshold,
829 TableLayout,
830 BorderCollapse,
831 BorderSpacing,
832 CaptionSide,
833 EmptyCells,
834 Content,
835 CounterReset,
836 CounterIncrement,
837 ListStyleType,
838 ListStylePosition,
839 StringSet,
840}
841
842impl fmt::Debug for CssPropertyType {
843 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
844 write!(f, "{}", self.to_str())
845 }
846}
847
848impl fmt::Display for CssPropertyType {
849 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
850 write!(f, "{}", self.to_str())
851 }
852}
853
854impl CssPropertyType {
855 pub fn from_str(input: &str, map: &CssKeyMap) -> Option<Self> {
873 let input = input.trim();
874 map.non_shorthands.get(input).and_then(|x| Some(*x))
875 }
876
877 pub fn to_str(&self) -> &'static str {
879 match self {
880 CssPropertyType::CaretColor => "caret-color",
881 CssPropertyType::CaretAnimationDuration => "caret-animation-duration",
882 CssPropertyType::CaretWidth => "-azul-caret-width",
883 CssPropertyType::SelectionBackgroundColor => "-azul-selection-background-color",
884 CssPropertyType::SelectionColor => "-azul-selection-color",
885 CssPropertyType::SelectionRadius => "-azul-selection-radius",
886 CssPropertyType::TextColor => "color",
887 CssPropertyType::FontSize => "font-size",
888 CssPropertyType::FontFamily => "font-family",
889 CssPropertyType::FontWeight => "font-weight",
890 CssPropertyType::FontStyle => "font-style",
891 CssPropertyType::TextAlign => "text-align",
892 CssPropertyType::TextJustify => "text-justify",
893 CssPropertyType::VerticalAlign => "vertical-align",
894 CssPropertyType::LetterSpacing => "letter-spacing",
895 CssPropertyType::TextIndent => "text-indent",
896 CssPropertyType::InitialLetter => "initial-letter",
897 CssPropertyType::LineClamp => "line-clamp",
898 CssPropertyType::HangingPunctuation => "hanging-punctuation",
899 CssPropertyType::TextCombineUpright => "text-combine-upright",
900 CssPropertyType::ExclusionMargin => "-azul-exclusion-margin",
901 CssPropertyType::HyphenationLanguage => "-azul-hyphenation-language",
902 CssPropertyType::LineHeight => "line-height",
903 CssPropertyType::WordSpacing => "word-spacing",
904 CssPropertyType::TabWidth => "tab-width",
905 CssPropertyType::Cursor => "cursor",
906 CssPropertyType::Display => "display",
907 CssPropertyType::Float => "float",
908 CssPropertyType::BoxSizing => "box-sizing",
909 CssPropertyType::Width => "width",
910 CssPropertyType::Height => "height",
911 CssPropertyType::MinWidth => "min-width",
912 CssPropertyType::MinHeight => "min-height",
913 CssPropertyType::MaxWidth => "max-width",
914 CssPropertyType::MaxHeight => "max-height",
915 CssPropertyType::Position => "position",
916 CssPropertyType::Top => "top",
917 CssPropertyType::Right => "right",
918 CssPropertyType::Left => "left",
919 CssPropertyType::Bottom => "bottom",
920 CssPropertyType::ZIndex => "z-index",
921 CssPropertyType::FlexWrap => "flex-wrap",
922 CssPropertyType::FlexDirection => "flex-direction",
923 CssPropertyType::FlexGrow => "flex-grow",
924 CssPropertyType::FlexShrink => "flex-shrink",
925 CssPropertyType::FlexBasis => "flex-basis",
926 CssPropertyType::JustifyContent => "justify-content",
927 CssPropertyType::AlignItems => "align-items",
928 CssPropertyType::AlignContent => "align-content",
929 CssPropertyType::ColumnGap => "column-gap",
930 CssPropertyType::RowGap => "row-gap",
931 CssPropertyType::GridTemplateColumns => "grid-template-columns",
932 CssPropertyType::GridTemplateRows => "grid-template-rows",
933 CssPropertyType::GridAutoFlow => "grid-auto-flow",
934 CssPropertyType::JustifySelf => "justify-self",
935 CssPropertyType::JustifyItems => "justify-items",
936 CssPropertyType::Gap => "gap",
937 CssPropertyType::GridGap => "grid-gap",
938 CssPropertyType::AlignSelf => "align-self",
939 CssPropertyType::Font => "font",
940 CssPropertyType::GridAutoColumns => "grid-auto-columns",
941 CssPropertyType::GridAutoRows => "grid-auto-rows",
942 CssPropertyType::GridColumn => "grid-column",
943 CssPropertyType::GridRow => "grid-row",
944 CssPropertyType::WritingMode => "writing-mode",
945 CssPropertyType::Clear => "clear",
946 CssPropertyType::BackgroundContent => "background",
947 CssPropertyType::BackgroundPosition => "background-position",
948 CssPropertyType::BackgroundSize => "background-size",
949 CssPropertyType::BackgroundRepeat => "background-repeat",
950 CssPropertyType::OverflowX => "overflow-x",
951 CssPropertyType::OverflowY => "overflow-y",
952 CssPropertyType::PaddingTop => "padding-top",
953 CssPropertyType::PaddingLeft => "padding-left",
954 CssPropertyType::PaddingRight => "padding-right",
955 CssPropertyType::PaddingBottom => "padding-bottom",
956 CssPropertyType::PaddingInlineStart => "padding-inline-start",
957 CssPropertyType::PaddingInlineEnd => "padding-inline-end",
958 CssPropertyType::MarginTop => "margin-top",
959 CssPropertyType::MarginLeft => "margin-left",
960 CssPropertyType::MarginRight => "margin-right",
961 CssPropertyType::MarginBottom => "margin-bottom",
962 CssPropertyType::BorderTopLeftRadius => "border-top-left-radius",
963 CssPropertyType::BorderTopRightRadius => "border-top-right-radius",
964 CssPropertyType::BorderBottomLeftRadius => "border-bottom-left-radius",
965 CssPropertyType::BorderBottomRightRadius => "border-bottom-right-radius",
966 CssPropertyType::BorderTopColor => "border-top-color",
967 CssPropertyType::BorderRightColor => "border-right-color",
968 CssPropertyType::BorderLeftColor => "border-left-color",
969 CssPropertyType::BorderBottomColor => "border-bottom-color",
970 CssPropertyType::BorderTopStyle => "border-top-style",
971 CssPropertyType::BorderRightStyle => "border-right-style",
972 CssPropertyType::BorderLeftStyle => "border-left-style",
973 CssPropertyType::BorderBottomStyle => "border-bottom-style",
974 CssPropertyType::BorderTopWidth => "border-top-width",
975 CssPropertyType::BorderRightWidth => "border-right-width",
976 CssPropertyType::BorderLeftWidth => "border-left-width",
977 CssPropertyType::BorderBottomWidth => "border-bottom-width",
978 CssPropertyType::BoxShadowLeft => "-azul-box-shadow-left",
979 CssPropertyType::BoxShadowRight => "-azul-box-shadow-right",
980 CssPropertyType::BoxShadowTop => "-azul-box-shadow-top",
981 CssPropertyType::BoxShadowBottom => "-azul-box-shadow-bottom",
982 CssPropertyType::Scrollbar => "-azul-scrollbar-style",
983 CssPropertyType::ScrollbarWidth => "scrollbar-width",
984 CssPropertyType::ScrollbarColor => "scrollbar-color",
985 CssPropertyType::Opacity => "opacity",
986 CssPropertyType::Visibility => "visibility",
987 CssPropertyType::Transform => "transform",
988 CssPropertyType::TransformOrigin => "transform-origin",
989 CssPropertyType::PerspectiveOrigin => "perspective-origin",
990 CssPropertyType::BackfaceVisibility => "backface-visibility",
991 CssPropertyType::MixBlendMode => "mix-blend-mode",
992 CssPropertyType::Filter => "filter",
993 CssPropertyType::BackdropFilter => "backdrop-filter",
994 CssPropertyType::TextShadow => "text-shadow",
995 CssPropertyType::WhiteSpace => "white-space",
996 CssPropertyType::Hyphens => "hyphens",
997 CssPropertyType::Direction => "direction",
998 CssPropertyType::UserSelect => "user-select",
999 CssPropertyType::TextDecoration => "text-decoration",
1000 CssPropertyType::BreakBefore => "break-before",
1001 CssPropertyType::BreakAfter => "break-after",
1002 CssPropertyType::BreakInside => "break-inside",
1003 CssPropertyType::Orphans => "orphans",
1004 CssPropertyType::Widows => "widows",
1005 CssPropertyType::BoxDecorationBreak => "box-decoration-break",
1006 CssPropertyType::ColumnCount => "column-count",
1007 CssPropertyType::ColumnWidth => "column-width",
1008 CssPropertyType::ColumnSpan => "column-span",
1009 CssPropertyType::ColumnFill => "column-fill",
1010 CssPropertyType::ColumnRuleWidth => "column-rule-width",
1011 CssPropertyType::ColumnRuleStyle => "column-rule-style",
1012 CssPropertyType::ColumnRuleColor => "column-rule-color",
1013 CssPropertyType::FlowInto => "flow-into",
1014 CssPropertyType::FlowFrom => "flow-from",
1015 CssPropertyType::ShapeOutside => "shape-outside",
1016 CssPropertyType::ShapeInside => "shape-inside",
1017 CssPropertyType::ClipPath => "clip-path",
1018 CssPropertyType::ShapeMargin => "shape-margin",
1019 CssPropertyType::ShapeImageThreshold => "shape-image-threshold",
1020 CssPropertyType::TableLayout => "table-layout",
1021 CssPropertyType::BorderCollapse => "border-collapse",
1022 CssPropertyType::BorderSpacing => "border-spacing",
1023 CssPropertyType::CaptionSide => "caption-side",
1024 CssPropertyType::EmptyCells => "empty-cells",
1025 CssPropertyType::Content => "content",
1026 CssPropertyType::CounterReset => "counter-reset",
1027 CssPropertyType::CounterIncrement => "counter-increment",
1028 CssPropertyType::ListStyleType => "list-style-type",
1029 CssPropertyType::ListStylePosition => "list-style-position",
1030 CssPropertyType::StringSet => "string-set",
1031 }
1032 }
1033
1034 pub fn is_inheritable(&self) -> bool {
1039 use self::CssPropertyType::*;
1040 match self {
1041 FontFamily | FontSize | FontWeight | FontStyle | LineHeight | LetterSpacing | WordSpacing | TextIndent |
1043
1044 TextColor | TextAlign | TextJustify | TextDecoration | WhiteSpace | Direction | Hyphens | TabWidth |
1046 HangingPunctuation | TextCombineUpright | HyphenationLanguage |
1047
1048 ListStyleType | ListStylePosition |
1050
1051 BorderCollapse | BorderSpacing | CaptionSide | EmptyCells |
1053
1054 Visibility | Cursor | Widows | Orphans |
1060
1061 WritingMode |
1063
1064 UserSelect
1066 => true,
1067
1068 _ => false,
1069 }
1070 }
1071
1072 pub fn get_category(&self) -> CssPropertyCategory {
1073 if self.is_gpu_only_property() {
1074 CssPropertyCategory::GpuOnly
1075 } else {
1076 let is_inheritable = self.is_inheritable();
1077 let can_trigger_layout = self.can_trigger_relayout();
1078 match (is_inheritable, can_trigger_layout) {
1079 (true, true) => CssPropertyCategory::InheritedLayout,
1080 (true, false) => CssPropertyCategory::InheritedPaint,
1081 (false, true) => CssPropertyCategory::Layout,
1082 (false, false) => CssPropertyCategory::Paint,
1083 }
1084 }
1085 }
1086
1087 pub fn can_trigger_relayout(&self) -> bool {
1090 use self::CssPropertyType::*;
1091
1092 match self {
1099 TextColor
1100 | Cursor
1101 | BackgroundContent
1102 | BackgroundPosition
1103 | BackgroundSize
1104 | BackgroundRepeat
1105 | BorderTopLeftRadius
1106 | BorderTopRightRadius
1107 | BorderBottomLeftRadius
1108 | BorderBottomRightRadius
1109 | BorderTopColor
1110 | BorderRightColor
1111 | BorderLeftColor
1112 | BorderBottomColor
1113 | BorderTopStyle
1114 | BorderRightStyle
1115 | BorderLeftStyle
1116 | BorderBottomStyle
1117 | ColumnRuleColor
1118 | ColumnRuleStyle
1119 | BoxShadowLeft
1120 | BoxShadowRight
1121 | BoxShadowTop
1122 | BoxShadowBottom
1123 | BoxDecorationBreak
1124 | Scrollbar
1125 | Opacity
1126 | Transform
1127 | TransformOrigin
1128 | PerspectiveOrigin
1129 | BackfaceVisibility
1130 | MixBlendMode
1131 | Filter
1132 | BackdropFilter
1133 | TextShadow => false,
1134 _ => true,
1135 }
1136 }
1137
1138 pub fn is_gpu_only_property(&self) -> bool {
1140 match self {
1141 CssPropertyType::Opacity |
1142 CssPropertyType::Transform => true,
1143 _ => false
1144 }
1145 }
1146}
1147
1148#[derive(Clone, PartialEq)]
1152pub enum CssParsingError<'a> {
1153 Border(CssBorderParseError<'a>),
1155 BorderRadius(CssStyleBorderRadiusParseError<'a>),
1156 Padding(LayoutPaddingParseError<'a>),
1157 Margin(LayoutMarginParseError<'a>),
1158 Overflow(InvalidValueErr<'a>),
1159 BoxShadow(CssShadowParseError<'a>),
1160
1161 Color(CssColorParseError<'a>),
1163 PixelValue(CssPixelValueParseError<'a>),
1164 Percentage(PercentageParseError),
1165 FontFamily(CssStyleFontFamilyParseError<'a>),
1166 InvalidValue(InvalidValueErr<'a>),
1167 FlexGrow(FlexGrowParseError<'a>),
1168 FlexShrink(FlexShrinkParseError<'a>),
1169 Background(CssBackgroundParseError<'a>),
1170 BackgroundPosition(CssBackgroundPositionParseError<'a>),
1171 Opacity(OpacityParseError<'a>),
1172 Visibility(StyleVisibilityParseError<'a>),
1173 Scrollbar(CssScrollbarStyleParseError<'a>),
1174 LayoutScrollbarWidth(LayoutScrollbarWidthParseError<'a>),
1175 StyleScrollbarColor(StyleScrollbarColorParseError<'a>),
1176 Transform(CssStyleTransformParseError<'a>),
1177 TransformOrigin(CssStyleTransformOriginParseError<'a>),
1178 PerspectiveOrigin(CssStylePerspectiveOriginParseError<'a>),
1179 Filter(CssStyleFilterParseError<'a>),
1180
1181 TextColor(StyleTextColorParseError<'a>),
1183 FontSize(CssStyleFontSizeParseError<'a>),
1184 FontWeight(CssFontWeightParseError<'a>),
1185 FontStyle(CssFontStyleParseError<'a>),
1186 TextAlign(StyleTextAlignParseError<'a>),
1187 TextJustify(TextJustifyParseError<'a>),
1188 VerticalAlign(StyleVerticalAlignParseError<'a>),
1189 LetterSpacing(StyleLetterSpacingParseError<'a>),
1190 TextIndent(StyleTextIndentParseError<'a>),
1191 InitialLetter(StyleInitialLetterParseError<'a>),
1192 LineClamp(StyleLineClampParseError<'a>),
1193 HangingPunctuation(StyleHangingPunctuationParseError<'a>),
1194 TextCombineUpright(StyleTextCombineUprightParseError<'a>),
1195 ExclusionMargin(StyleExclusionMarginParseError),
1196 HyphenationLanguage(StyleHyphenationLanguageParseError),
1197 LineHeight(StyleLineHeightParseError),
1198 WordSpacing(StyleWordSpacingParseError<'a>),
1199 TabWidth(StyleTabWidthParseError<'a>),
1200 WhiteSpace(StyleWhiteSpaceParseError<'a>),
1201 Hyphens(StyleHyphensParseError<'a>),
1202 Direction(StyleDirectionParseError<'a>),
1203 UserSelect(StyleUserSelectParseError<'a>),
1204 TextDecoration(StyleTextDecorationParseError<'a>),
1205 Cursor(CursorParseError<'a>),
1206 CaretColor(CssColorParseError<'a>),
1207 CaretAnimationDuration(DurationParseError<'a>),
1208 CaretWidth(CssPixelValueParseError<'a>),
1209 SelectionBackgroundColor(CssColorParseError<'a>),
1210 SelectionColor(CssColorParseError<'a>),
1211 SelectionRadius(CssPixelValueParseError<'a>),
1212
1213 LayoutDisplay(LayoutDisplayParseError<'a>),
1215 LayoutFloat(LayoutFloatParseError<'a>),
1216 LayoutBoxSizing(LayoutBoxSizingParseError<'a>),
1217
1218 LayoutWidth(LayoutWidthParseError<'a>),
1220 LayoutHeight(LayoutHeightParseError<'a>),
1221 LayoutMinWidth(LayoutMinWidthParseError<'a>),
1222 LayoutMinHeight(LayoutMinHeightParseError<'a>),
1223 LayoutMaxWidth(LayoutMaxWidthParseError<'a>),
1224 LayoutMaxHeight(LayoutMaxHeightParseError<'a>),
1225
1226 LayoutPosition(LayoutPositionParseError<'a>),
1228 LayoutTop(LayoutTopParseError<'a>),
1229 LayoutRight(LayoutRightParseError<'a>),
1230 LayoutLeft(LayoutLeftParseError<'a>),
1231 LayoutInsetBottom(LayoutInsetBottomParseError<'a>),
1232 LayoutZIndex(LayoutZIndexParseError<'a>),
1233
1234 FlexWrap(FlexWrapParseError<'a>),
1236 FlexDirection(FlexDirectionParseError<'a>),
1237 FlexBasis(FlexBasisParseError<'a>),
1238 JustifyContent(JustifyContentParseError<'a>),
1239 AlignItems(AlignItemsParseError<'a>),
1240 AlignContent(AlignContentParseError<'a>),
1241
1242 Grid(GridParseError<'a>),
1244 GridAutoFlow(GridAutoFlowParseError<'a>),
1245 JustifySelf(JustifySelfParseError<'a>),
1246 JustifyItems(JustifyItemsParseError<'a>),
1247 AlignSelf(AlignSelfParseError<'a>),
1248
1249 LayoutWrap(LayoutWrapParseError<'a>),
1251 LayoutWritingMode(LayoutWritingModeParseError<'a>),
1252 LayoutClear(LayoutClearParseError<'a>),
1253
1254 LayoutOverflow(LayoutOverflowParseError<'a>),
1256
1257 BorderTopLeftRadius(StyleBorderTopLeftRadiusParseError<'a>),
1259 BorderTopRightRadius(StyleBorderTopRightRadiusParseError<'a>),
1260 BorderBottomLeftRadius(StyleBorderBottomLeftRadiusParseError<'a>),
1261 BorderBottomRightRadius(StyleBorderBottomRightRadiusParseError<'a>),
1262
1263 BorderStyle(CssBorderStyleParseError<'a>),
1265
1266 BackfaceVisibility(CssBackfaceVisibilityParseError<'a>),
1268 MixBlendMode(MixBlendModeParseError<'a>),
1269
1270 PageBreak(PageBreakParseError<'a>),
1272 BreakInside(BreakInsideParseError<'a>),
1273 Widows(WidowsParseError<'a>),
1274 Orphans(OrphansParseError<'a>),
1275 BoxDecorationBreak(BoxDecorationBreakParseError<'a>),
1276
1277 ColumnCount(ColumnCountParseError<'a>),
1279 ColumnWidth(ColumnWidthParseError<'a>),
1280 ColumnSpan(ColumnSpanParseError<'a>),
1281 ColumnFill(ColumnFillParseError<'a>),
1282 ColumnRuleWidth(ColumnRuleWidthParseError<'a>),
1283 ColumnRuleStyle(ColumnRuleStyleParseError<'a>),
1284 ColumnRuleColor(ColumnRuleColorParseError<'a>),
1285
1286 FlowInto(FlowIntoParseError<'a>),
1288 FlowFrom(FlowFromParseError<'a>),
1289 GenericParseError,
1290
1291 Content, Counter,
1294 ListStyleType(StyleListStyleTypeParseError<'a>),
1295 ListStylePosition(StyleListStylePositionParseError<'a>),
1296 StringSet,
1297}
1298
1299#[derive(Debug, Clone, PartialEq)]
1301pub enum CssParsingErrorOwned {
1302 Border(CssBorderParseErrorOwned),
1304 BorderRadius(CssStyleBorderRadiusParseErrorOwned),
1305 Padding(LayoutPaddingParseErrorOwned),
1306 Margin(LayoutMarginParseErrorOwned),
1307 Overflow(InvalidValueErrOwned),
1308 BoxShadow(CssShadowParseErrorOwned),
1309
1310 Color(CssColorParseErrorOwned),
1312 PixelValue(CssPixelValueParseErrorOwned),
1313 Percentage(PercentageParseError),
1314 FontFamily(CssStyleFontFamilyParseErrorOwned),
1315 InvalidValue(InvalidValueErrOwned),
1316 FlexGrow(FlexGrowParseErrorOwned),
1317 FlexShrink(FlexShrinkParseErrorOwned),
1318 Background(CssBackgroundParseErrorOwned),
1319 BackgroundPosition(CssBackgroundPositionParseErrorOwned),
1320 Opacity(OpacityParseErrorOwned),
1321 Visibility(StyleVisibilityParseErrorOwned),
1322 Scrollbar(CssScrollbarStyleParseErrorOwned),
1323 LayoutScrollbarWidth(LayoutScrollbarWidthParseErrorOwned),
1324 StyleScrollbarColor(StyleScrollbarColorParseErrorOwned),
1325 Transform(CssStyleTransformParseErrorOwned),
1326 TransformOrigin(CssStyleTransformOriginParseErrorOwned),
1327 PerspectiveOrigin(CssStylePerspectiveOriginParseErrorOwned),
1328 Filter(CssStyleFilterParseErrorOwned),
1329
1330 TextColor(StyleTextColorParseErrorOwned),
1332 FontSize(CssStyleFontSizeParseErrorOwned),
1333 FontWeight(CssFontWeightParseErrorOwned),
1334 FontStyle(CssFontStyleParseErrorOwned),
1335 TextAlign(StyleTextAlignParseErrorOwned),
1336 TextJustify(TextJustifyParseErrorOwned),
1337 VerticalAlign(StyleVerticalAlignParseErrorOwned),
1338 LetterSpacing(StyleLetterSpacingParseErrorOwned),
1339 TextIndent(StyleTextIndentParseErrorOwned),
1340 InitialLetter(StyleInitialLetterParseErrorOwned),
1341 LineClamp(StyleLineClampParseErrorOwned),
1342 HangingPunctuation(StyleHangingPunctuationParseErrorOwned),
1343 TextCombineUpright(StyleTextCombineUprightParseErrorOwned),
1344 ExclusionMargin(StyleExclusionMarginParseErrorOwned),
1345 HyphenationLanguage(StyleHyphenationLanguageParseErrorOwned),
1346 LineHeight(StyleLineHeightParseError),
1347 WordSpacing(StyleWordSpacingParseErrorOwned),
1348 TabWidth(StyleTabWidthParseErrorOwned),
1349 WhiteSpace(StyleWhiteSpaceParseErrorOwned),
1350 Hyphens(StyleHyphensParseErrorOwned),
1351 Direction(StyleDirectionParseErrorOwned),
1352 UserSelect(StyleUserSelectParseErrorOwned),
1353 TextDecoration(StyleTextDecorationParseErrorOwned),
1354 Cursor(CursorParseErrorOwned),
1355 CaretColor(CssColorParseErrorOwned),
1356 CaretAnimationDuration(DurationParseErrorOwned),
1357 CaretWidth(CssPixelValueParseErrorOwned),
1358 SelectionBackgroundColor(CssColorParseErrorOwned),
1359 SelectionColor(CssColorParseErrorOwned),
1360 SelectionRadius(CssPixelValueParseErrorOwned),
1361
1362 LayoutDisplay(LayoutDisplayParseErrorOwned),
1364 LayoutFloat(LayoutFloatParseErrorOwned),
1365 LayoutBoxSizing(LayoutBoxSizingParseErrorOwned),
1366
1367 LayoutWidth(LayoutWidthParseErrorOwned),
1369 LayoutHeight(LayoutHeightParseErrorOwned),
1370 LayoutMinWidth(LayoutMinWidthParseErrorOwned),
1371 LayoutMinHeight(LayoutMinHeightParseErrorOwned),
1372 LayoutMaxWidth(LayoutMaxWidthParseErrorOwned),
1373 LayoutMaxHeight(LayoutMaxHeightParseErrorOwned),
1374
1375 LayoutPosition(LayoutPositionParseErrorOwned),
1377 LayoutTop(LayoutTopParseErrorOwned),
1378 LayoutRight(LayoutRightParseErrorOwned),
1379 LayoutLeft(LayoutLeftParseErrorOwned),
1380 LayoutInsetBottom(LayoutInsetBottomParseErrorOwned),
1381 LayoutZIndex(LayoutZIndexParseErrorOwned),
1382
1383 FlexWrap(FlexWrapParseErrorOwned),
1385 FlexDirection(FlexDirectionParseErrorOwned),
1386 FlexBasis(FlexBasisParseErrorOwned),
1387 JustifyContent(JustifyContentParseErrorOwned),
1388 AlignItems(AlignItemsParseErrorOwned),
1389 AlignContent(AlignContentParseErrorOwned),
1390
1391 Grid(GridParseErrorOwned),
1393 GridAutoFlow(GridAutoFlowParseErrorOwned),
1394 JustifySelf(JustifySelfParseErrorOwned),
1395 JustifyItems(JustifyItemsParseErrorOwned),
1396 AlignSelf(AlignSelfParseErrorOwned),
1397
1398 LayoutWrap(LayoutWrapParseErrorOwned),
1400 LayoutWritingMode(LayoutWritingModeParseErrorOwned),
1401 LayoutClear(LayoutClearParseErrorOwned),
1402
1403 LayoutOverflow(LayoutOverflowParseErrorOwned),
1405
1406 BorderTopLeftRadius(StyleBorderTopLeftRadiusParseErrorOwned),
1408 BorderTopRightRadius(StyleBorderTopRightRadiusParseErrorOwned),
1409 BorderBottomLeftRadius(StyleBorderBottomLeftRadiusParseErrorOwned),
1410 BorderBottomRightRadius(StyleBorderBottomRightRadiusParseErrorOwned),
1411
1412 BorderStyle(CssBorderStyleParseErrorOwned),
1414
1415 BackfaceVisibility(CssBackfaceVisibilityParseErrorOwned),
1417 MixBlendMode(MixBlendModeParseErrorOwned),
1418
1419 PageBreak(PageBreakParseErrorOwned),
1421 BreakInside(BreakInsideParseErrorOwned),
1422 Widows(WidowsParseErrorOwned),
1423 Orphans(OrphansParseErrorOwned),
1424 BoxDecorationBreak(BoxDecorationBreakParseErrorOwned),
1425
1426 ColumnCount(ColumnCountParseErrorOwned),
1428 ColumnWidth(ColumnWidthParseErrorOwned),
1429 ColumnSpan(ColumnSpanParseErrorOwned),
1430 ColumnFill(ColumnFillParseErrorOwned),
1431 ColumnRuleWidth(ColumnRuleWidthParseErrorOwned),
1432 ColumnRuleStyle(ColumnRuleStyleParseErrorOwned),
1433 ColumnRuleColor(ColumnRuleColorParseErrorOwned),
1434
1435 FlowInto(FlowIntoParseErrorOwned),
1437 FlowFrom(FlowFromParseErrorOwned),
1438 GenericParseError,
1439
1440 Content,
1442 Counter,
1443 ListStyleType(StyleListStyleTypeParseErrorOwned),
1444 ListStylePosition(StyleListStylePositionParseErrorOwned),
1445 StringSet,
1446}
1447
1448impl_debug_as_display!(CssParsingError<'a>);
1451impl_display! { CssParsingError<'a>, {
1452 CaretColor(e) => format!("Invalid caret-color: {}", e),
1453 CaretAnimationDuration(e) => format!("Invalid caret-animation-duration: {}", e),
1454 CaretWidth(e) => format!("Invalid -azul-caret-width: {}", e),
1455 SelectionBackgroundColor(e) => format!("Invalid -azul-selection-background-color: {}", e),
1456 SelectionColor(e) => format!("Invalid -azul-selection-color: {}", e),
1457 SelectionRadius(e) => format!("Invalid -azul-selection-radius: {}", e),
1458 Border(e) => format!("Invalid border property: {}", e),
1459 BorderRadius(e) => format!("Invalid border-radius: {}", e),
1460 Padding(e) => format!("Invalid padding property: {}", e),
1461 Margin(e) => format!("Invalid margin property: {}", e),
1462 Overflow(e) => format!("Invalid overflow property: \"{}\"", e.0),
1463 BoxShadow(e) => format!("Invalid shadow property: {}", e),
1464 Color(e) => format!("Invalid color value: {}", e),
1465 PixelValue(e) => format!("Invalid pixel value: {}", e),
1466 Percentage(e) => format!("Invalid percentage value: {}", e),
1467 FontFamily(e) => format!("Invalid font-family value: {}", e),
1468 InvalidValue(e) => format!("Invalid value: \"{}\"", e.0),
1469 FlexGrow(e) => format!("Invalid flex-grow value: {}", e),
1470 FlexShrink(e) => format!("Invalid flex-shrink value: {}", e),
1471 Background(e) => format!("Invalid background property: {}", e),
1472 BackgroundPosition(e) => format!("Invalid background-position: {}", e),
1473 Opacity(e) => format!("Invalid opacity value: {}", e),
1474 Visibility(e) => format!("Invalid visibility value: {}", e),
1475 Scrollbar(e) => format!("Invalid scrollbar style: {}", e),
1476 LayoutScrollbarWidth(e) => format!("Invalid scrollbar-width: {}", e),
1477 StyleScrollbarColor(e) => format!("Invalid scrollbar-color: {}", e),
1478 Transform(e) => format!("Invalid transform property: {}", e),
1479 TransformOrigin(e) => format!("Invalid transform-origin: {}", e),
1480 PerspectiveOrigin(e) => format!("Invalid perspective-origin: {}", e),
1481 Filter(e) => format!("Invalid filter property: {}", e),
1482 LayoutWidth(e) => format!("Invalid width value: {}", e),
1483 LayoutHeight(e) => format!("Invalid height value: {}", e),
1484 LayoutMinWidth(e) => format!("Invalid min-width value: {}", e),
1485 LayoutMinHeight(e) => format!("Invalid min-height value: {}", e),
1486 LayoutMaxWidth(e) => format!("Invalid max-width value: {}", e),
1487 LayoutMaxHeight(e) => format!("Invalid max-height value: {}", e),
1488 LayoutPosition(e) => format!("Invalid position value: {}", e),
1489 LayoutTop(e) => format!("Invalid top value: {}", e),
1490 LayoutRight(e) => format!("Invalid right value: {}", e),
1491 LayoutLeft(e) => format!("Invalid left value: {}", e),
1492 LayoutInsetBottom(e) => format!("Invalid bottom value: {}", e),
1493 LayoutZIndex(e) => format!("Invalid z-index value: {}", e),
1494 FlexWrap(e) => format!("Invalid flex-wrap value: {}", e),
1495 FlexDirection(e) => format!("Invalid flex-direction value: {}", e),
1496 FlexBasis(e) => format!("Invalid flex-basis value: {}", e),
1497 JustifyContent(e) => format!("Invalid justify-content value: {}", e),
1498 AlignItems(e) => format!("Invalid align-items value: {}", e),
1499 AlignContent(e) => format!("Invalid align-content value: {}", e),
1500 GridAutoFlow(e) => format!("Invalid grid-auto-flow value: {}", e),
1501 JustifySelf(e) => format!("Invalid justify-self value: {}", e),
1502 JustifyItems(e) => format!("Invalid justify-items value: {}", e),
1503 AlignSelf(e) => format!("Invalid align-self value: {}", e),
1504 Grid(e) => format!("Invalid grid value: {}", e),
1505 LayoutWrap(e) => format!("Invalid wrap value: {}", e),
1506 LayoutWritingMode(e) => format!("Invalid writing-mode value: {}", e),
1507 LayoutClear(e) => format!("Invalid clear value: {}", e),
1508 LayoutOverflow(e) => format!("Invalid overflow value: {}", e),
1509 BorderTopLeftRadius(e) => format!("Invalid border-top-left-radius: {}", e),
1510 BorderTopRightRadius(e) => format!("Invalid border-top-right-radius: {}", e),
1511 BorderBottomLeftRadius(e) => format!("Invalid border-bottom-left-radius: {}", e),
1512 BorderBottomRightRadius(e) => format!("Invalid border-bottom-right-radius: {}", e),
1513 BorderStyle(e) => format!("Invalid border style: {}", e),
1514 BackfaceVisibility(e) => format!("Invalid backface-visibility: {}", e),
1515 MixBlendMode(e) => format!("Invalid mix-blend-mode: {}", e),
1516 TextColor(e) => format!("Invalid text color: {}", e),
1517 FontSize(e) => format!("Invalid font-size: {}", e),
1518 FontWeight(e) => format!("Invalid font-weight: {}", e),
1519 FontStyle(e) => format!("Invalid font-style: {}", e),
1520 TextAlign(e) => format!("Invalid text-align: {}", e),
1521 TextJustify(e) => format!("Invalid text-justify: {}", e),
1522 VerticalAlign(e) => format!("Invalid vertical-align: {}", e),
1523 LetterSpacing(e) => format!("Invalid letter-spacing: {}", e),
1524 TextIndent(e) => format!("Invalid text-indent: {}", e),
1525 InitialLetter(e) => format!("Invalid initial-letter: {}", e),
1526 LineClamp(e) => format!("Invalid line-clamp: {}", e),
1527 HangingPunctuation(e) => format!("Invalid hanging-punctuation: {}", e),
1528 TextCombineUpright(e) => format!("Invalid text-combine-upright: {}", e),
1529 ExclusionMargin(e) => format!("Invalid -azul-exclusion-margin: {}", e),
1530 HyphenationLanguage(e) => format!("Invalid -azul-hyphenation-language: {}", e),
1531 LineHeight(e) => format!("Invalid line-height: {}", e),
1532 WordSpacing(e) => format!("Invalid word-spacing: {}", e),
1533 TabWidth(e) => format!("Invalid tab-width: {}", e),
1534 WhiteSpace(e) => format!("Invalid white-space: {}", e),
1535 Hyphens(e) => format!("Invalid hyphens: {}", e),
1536 Direction(e) => format!("Invalid direction: {}", e),
1537 UserSelect(e) => format!("Invalid user-select: {}", e),
1538 TextDecoration(e) => format!("Invalid text-decoration: {}", e),
1539 Cursor(e) => format!("Invalid cursor: {}", e),
1540 LayoutDisplay(e) => format!("Invalid display: {}", e),
1541 LayoutFloat(e) => format!("Invalid float: {}", e),
1542 LayoutBoxSizing(e) => format!("Invalid box-sizing: {}", e),
1543 PageBreak(e) => format!("Invalid break property: {}", e),
1544 BreakInside(e) => format!("Invalid break-inside property: {}", e),
1545 Widows(e) => format!("Invalid widows property: {}", e),
1546 Orphans(e) => format!("Invalid orphans property: {}", e),
1547 BoxDecorationBreak(e) => format!("Invalid box-decoration-break property: {}", e),
1548 ColumnCount(e) => format!("Invalid column-count: {}", e),
1549 ColumnWidth(e) => format!("Invalid column-width: {}", e),
1550 ColumnSpan(e) => format!("Invalid column-span: {}", e),
1551 ColumnFill(e) => format!("Invalid column-fill: {}", e),
1552 ColumnRuleWidth(e) => format!("Invalid column-rule-width: {}", e),
1553 ColumnRuleStyle(e) => format!("Invalid column-rule-style: {}", e),
1554 ColumnRuleColor(e) => format!("Invalid column-rule-color: {}", e),
1555 FlowInto(e) => format!("Invalid flow-into: {}", e),
1556 FlowFrom(e) => format!("Invalid flow-from: {}", e),
1557 GenericParseError => "Failed to parse value",
1558 Content => "Failed to parse content property",
1559 Counter => "Failed to parse counter property",
1560 ListStyleType(e) => format!("Invalid list-style-type: {}", e),
1561 ListStylePosition(e) => format!("Invalid list-style-position: {}", e),
1562 StringSet => "Failed to parse string-set property",
1563}}
1564
1565impl_from!(
1567 DurationParseError<'a>,
1568 CssParsingError::CaretAnimationDuration
1569);
1570impl_from!(CssBorderParseError<'a>, CssParsingError::Border);
1571impl_from!(
1572 CssStyleBorderRadiusParseError<'a>,
1573 CssParsingError::BorderRadius
1574);
1575impl_from!(LayoutPaddingParseError<'a>, CssParsingError::Padding);
1576impl_from!(LayoutMarginParseError<'a>, CssParsingError::Margin);
1577impl_from!(CssShadowParseError<'a>, CssParsingError::BoxShadow);
1578impl_from!(CssColorParseError<'a>, CssParsingError::Color);
1579impl_from!(CssPixelValueParseError<'a>, CssParsingError::PixelValue);
1580impl_from!(
1581 CssStyleFontFamilyParseError<'a>,
1582 CssParsingError::FontFamily
1583);
1584impl_from!(CssFontWeightParseError<'a>, CssParsingError::FontWeight);
1585impl_from!(CssFontStyleParseError<'a>, CssParsingError::FontStyle);
1586impl_from!(
1587 StyleInitialLetterParseError<'a>,
1588 CssParsingError::InitialLetter
1589);
1590impl_from!(StyleLineClampParseError<'a>, CssParsingError::LineClamp);
1591impl_from!(
1592 StyleHangingPunctuationParseError<'a>,
1593 CssParsingError::HangingPunctuation
1594);
1595impl_from!(
1596 StyleTextCombineUprightParseError<'a>,
1597 CssParsingError::TextCombineUpright
1598);
1599
1600#[cfg(feature = "parser")]
1602impl<'a> From<StyleExclusionMarginParseError> for CssParsingError<'a> {
1603 fn from(e: StyleExclusionMarginParseError) -> Self {
1604 CssParsingError::ExclusionMargin(e)
1605 }
1606}
1607
1608#[cfg(feature = "parser")]
1610impl<'a> From<StyleHyphenationLanguageParseError> for CssParsingError<'a> {
1611 fn from(e: StyleHyphenationLanguageParseError) -> Self {
1612 CssParsingError::HyphenationLanguage(e)
1613 }
1614}
1615impl_from!(FlexGrowParseError<'a>, CssParsingError::FlexGrow);
1616impl_from!(FlexShrinkParseError<'a>, CssParsingError::FlexShrink);
1617impl_from!(CssBackgroundParseError<'a>, CssParsingError::Background);
1618impl_from!(
1619 CssBackgroundPositionParseError<'a>,
1620 CssParsingError::BackgroundPosition
1621);
1622impl_from!(OpacityParseError<'a>, CssParsingError::Opacity);
1623impl_from!(StyleVisibilityParseError<'a>, CssParsingError::Visibility);
1624impl_from!(CssScrollbarStyleParseError<'a>, CssParsingError::Scrollbar);
1625impl_from!(
1626 LayoutScrollbarWidthParseError<'a>,
1627 CssParsingError::LayoutScrollbarWidth
1628);
1629impl_from!(
1630 StyleScrollbarColorParseError<'a>,
1631 CssParsingError::StyleScrollbarColor
1632);
1633impl_from!(CssStyleTransformParseError<'a>, CssParsingError::Transform);
1634impl_from!(
1635 CssStyleTransformOriginParseError<'a>,
1636 CssParsingError::TransformOrigin
1637);
1638impl_from!(
1639 CssStylePerspectiveOriginParseError<'a>,
1640 CssParsingError::PerspectiveOrigin
1641);
1642impl_from!(CssStyleFilterParseError<'a>, CssParsingError::Filter);
1643
1644impl_from!(LayoutWidthParseError<'a>, CssParsingError::LayoutWidth);
1646impl_from!(LayoutHeightParseError<'a>, CssParsingError::LayoutHeight);
1647impl_from!(
1648 LayoutMinWidthParseError<'a>,
1649 CssParsingError::LayoutMinWidth
1650);
1651impl_from!(
1652 LayoutMinHeightParseError<'a>,
1653 CssParsingError::LayoutMinHeight
1654);
1655impl_from!(
1656 LayoutMaxWidthParseError<'a>,
1657 CssParsingError::LayoutMaxWidth
1658);
1659impl_from!(
1660 LayoutMaxHeightParseError<'a>,
1661 CssParsingError::LayoutMaxHeight
1662);
1663
1664impl_from!(
1666 LayoutPositionParseError<'a>,
1667 CssParsingError::LayoutPosition
1668);
1669impl_from!(LayoutTopParseError<'a>, CssParsingError::LayoutTop);
1670impl_from!(LayoutRightParseError<'a>, CssParsingError::LayoutRight);
1671impl_from!(LayoutLeftParseError<'a>, CssParsingError::LayoutLeft);
1672impl_from!(
1673 LayoutInsetBottomParseError<'a>,
1674 CssParsingError::LayoutInsetBottom
1675);
1676impl_from!(LayoutZIndexParseError<'a>, CssParsingError::LayoutZIndex);
1677
1678impl_from!(FlexWrapParseError<'a>, CssParsingError::FlexWrap);
1680impl_from!(FlexDirectionParseError<'a>, CssParsingError::FlexDirection);
1681impl_from!(FlexBasisParseError<'a>, CssParsingError::FlexBasis);
1682impl_from!(
1683 JustifyContentParseError<'a>,
1684 CssParsingError::JustifyContent
1685);
1686impl_from!(AlignItemsParseError<'a>, CssParsingError::AlignItems);
1687impl_from!(AlignContentParseError<'a>, CssParsingError::AlignContent);
1688
1689impl_from!(GridParseError<'a>, CssParsingError::Grid);
1691impl_from!(GridAutoFlowParseError<'a>, CssParsingError::GridAutoFlow);
1692impl_from!(JustifySelfParseError<'a>, CssParsingError::JustifySelf);
1693impl_from!(JustifyItemsParseError<'a>, CssParsingError::JustifyItems);
1694impl_from!(AlignSelfParseError<'a>, CssParsingError::AlignSelf);
1697
1698impl_from!(LayoutWrapParseError<'a>, CssParsingError::LayoutWrap);
1700impl_from!(
1701 LayoutWritingModeParseError<'a>,
1702 CssParsingError::LayoutWritingMode
1703);
1704impl_from!(LayoutClearParseError<'a>, CssParsingError::LayoutClear);
1705
1706impl_from!(
1708 LayoutOverflowParseError<'a>,
1709 CssParsingError::LayoutOverflow
1710);
1711
1712impl_from!(
1714 StyleBorderTopLeftRadiusParseError<'a>,
1715 CssParsingError::BorderTopLeftRadius
1716);
1717impl_from!(
1718 StyleBorderTopRightRadiusParseError<'a>,
1719 CssParsingError::BorderTopRightRadius
1720);
1721impl_from!(
1722 StyleBorderBottomLeftRadiusParseError<'a>,
1723 CssParsingError::BorderBottomLeftRadius
1724);
1725impl_from!(
1726 StyleBorderBottomRightRadiusParseError<'a>,
1727 CssParsingError::BorderBottomRightRadius
1728);
1729
1730impl_from!(CssBorderStyleParseError<'a>, CssParsingError::BorderStyle);
1732
1733impl_from!(
1735 CssBackfaceVisibilityParseError<'a>,
1736 CssParsingError::BackfaceVisibility
1737);
1738impl_from!(MixBlendModeParseError<'a>, CssParsingError::MixBlendMode);
1739
1740impl_from!(StyleTextColorParseError<'a>, CssParsingError::TextColor);
1742impl_from!(CssStyleFontSizeParseError<'a>, CssParsingError::FontSize);
1743impl_from!(StyleTextAlignParseError<'a>, CssParsingError::TextAlign);
1744impl_from!(TextJustifyParseError<'a>, CssParsingError::TextJustify);
1745impl_from!(
1746 StyleLetterSpacingParseError<'a>,
1747 CssParsingError::LetterSpacing
1748);
1749impl_from!(StyleWordSpacingParseError<'a>, CssParsingError::WordSpacing);
1750impl_from!(StyleTabWidthParseError<'a>, CssParsingError::TabWidth);
1751impl_from!(StyleWhiteSpaceParseError<'a>, CssParsingError::WhiteSpace);
1752impl_from!(StyleHyphensParseError<'a>, CssParsingError::Hyphens);
1753impl_from!(StyleDirectionParseError<'a>, CssParsingError::Direction);
1754impl_from!(StyleUserSelectParseError<'a>, CssParsingError::UserSelect);
1755impl_from!(
1756 StyleTextDecorationParseError<'a>,
1757 CssParsingError::TextDecoration
1758);
1759impl_from!(CursorParseError<'a>, CssParsingError::Cursor);
1760
1761impl_from!(LayoutDisplayParseError<'a>, CssParsingError::LayoutDisplay);
1763impl_from!(LayoutFloatParseError<'a>, CssParsingError::LayoutFloat);
1764impl_from!(
1765 LayoutBoxSizingParseError<'a>,
1766 CssParsingError::LayoutBoxSizing
1767);
1768
1769impl_from!(PageBreakParseError<'a>, CssParsingError::PageBreak);
1771impl_from!(BreakInsideParseError<'a>, CssParsingError::BreakInside);
1772impl_from!(WidowsParseError<'a>, CssParsingError::Widows);
1773impl_from!(OrphansParseError<'a>, CssParsingError::Orphans);
1774impl_from!(
1775 BoxDecorationBreakParseError<'a>,
1776 CssParsingError::BoxDecorationBreak
1777);
1778impl_from!(ColumnCountParseError<'a>, CssParsingError::ColumnCount);
1779impl_from!(ColumnWidthParseError<'a>, CssParsingError::ColumnWidth);
1780impl_from!(ColumnSpanParseError<'a>, CssParsingError::ColumnSpan);
1781impl_from!(ColumnFillParseError<'a>, CssParsingError::ColumnFill);
1782impl_from!(
1783 ColumnRuleWidthParseError<'a>,
1784 CssParsingError::ColumnRuleWidth
1785);
1786impl_from!(
1787 ColumnRuleStyleParseError<'a>,
1788 CssParsingError::ColumnRuleStyle
1789);
1790impl_from!(
1791 ColumnRuleColorParseError<'a>,
1792 CssParsingError::ColumnRuleColor
1793);
1794impl_from!(FlowIntoParseError<'a>, CssParsingError::FlowInto);
1795impl_from!(FlowFromParseError<'a>, CssParsingError::FlowFrom);
1796
1797impl<'a> From<InvalidValueErr<'a>> for CssParsingError<'a> {
1798 fn from(e: InvalidValueErr<'a>) -> Self {
1799 CssParsingError::InvalidValue(e)
1800 }
1801}
1802
1803impl<'a> From<PercentageParseError> for CssParsingError<'a> {
1804 fn from(e: PercentageParseError) -> Self {
1805 CssParsingError::Percentage(e)
1806 }
1807}
1808
1809impl<'a> From<StyleLineHeightParseError> for CssParsingError<'a> {
1810 fn from(e: StyleLineHeightParseError) -> Self {
1811 CssParsingError::LineHeight(e)
1812 }
1813}
1814
1815impl<'a> From<StyleTextIndentParseError<'a>> for CssParsingError<'a> {
1816 fn from(e: StyleTextIndentParseError<'a>) -> Self {
1817 CssParsingError::TextIndent(e)
1818 }
1819}
1820
1821impl<'a> From<StyleVerticalAlignParseError<'a>> for CssParsingError<'a> {
1822 fn from(e: StyleVerticalAlignParseError<'a>) -> Self {
1823 CssParsingError::VerticalAlign(e)
1824 }
1825}
1826
1827impl<'a> CssParsingError<'a> {
1828 pub fn to_contained(&self) -> CssParsingErrorOwned {
1829 match self {
1830 CssParsingError::CaretColor(e) => CssParsingErrorOwned::CaretColor(e.to_contained()),
1831 CssParsingError::CaretWidth(e) => CssParsingErrorOwned::CaretWidth(e.to_contained()),
1832 CssParsingError::CaretAnimationDuration(e) => {
1833 CssParsingErrorOwned::CaretAnimationDuration(e.to_contained())
1834 }
1835 CssParsingError::SelectionBackgroundColor(e) => {
1836 CssParsingErrorOwned::SelectionBackgroundColor(e.to_contained())
1837 }
1838 CssParsingError::SelectionColor(e) => {
1839 CssParsingErrorOwned::SelectionColor(e.to_contained())
1840 }
1841 CssParsingError::SelectionRadius(e) => {
1842 CssParsingErrorOwned::SelectionRadius(e.to_contained())
1843 }
1844 CssParsingError::Border(e) => CssParsingErrorOwned::Border(e.to_contained()),
1845 CssParsingError::BorderRadius(e) => {
1846 CssParsingErrorOwned::BorderRadius(e.to_contained())
1847 }
1848 CssParsingError::Padding(e) => CssParsingErrorOwned::Padding(e.to_contained()),
1849 CssParsingError::Margin(e) => CssParsingErrorOwned::Margin(e.to_contained()),
1850 CssParsingError::Overflow(e) => CssParsingErrorOwned::Overflow(e.to_contained()),
1851 CssParsingError::BoxShadow(e) => CssParsingErrorOwned::BoxShadow(e.to_contained()),
1852 CssParsingError::Color(e) => CssParsingErrorOwned::Color(e.to_contained()),
1853 CssParsingError::PixelValue(e) => CssParsingErrorOwned::PixelValue(e.to_contained()),
1854 CssParsingError::Percentage(e) => CssParsingErrorOwned::Percentage(e.clone()),
1855 CssParsingError::FontFamily(e) => CssParsingErrorOwned::FontFamily(e.to_contained()),
1856 CssParsingError::InvalidValue(e) => {
1857 CssParsingErrorOwned::InvalidValue(e.to_contained())
1858 }
1859 CssParsingError::FlexGrow(e) => CssParsingErrorOwned::FlexGrow(e.to_contained()),
1860 CssParsingError::FlexShrink(e) => CssParsingErrorOwned::FlexShrink(e.to_contained()),
1861 CssParsingError::Background(e) => CssParsingErrorOwned::Background(e.to_contained()),
1862 CssParsingError::BackgroundPosition(e) => {
1863 CssParsingErrorOwned::BackgroundPosition(e.to_contained())
1864 }
1865 CssParsingError::GridAutoFlow(e) => {
1866 CssParsingErrorOwned::GridAutoFlow(e.to_contained())
1867 }
1868 CssParsingError::JustifySelf(e) => CssParsingErrorOwned::JustifySelf(e.to_contained()),
1869 CssParsingError::JustifyItems(e) => {
1870 CssParsingErrorOwned::JustifyItems(e.to_contained())
1871 }
1872 CssParsingError::AlignSelf(e) => CssParsingErrorOwned::AlignSelf(e.to_contained()),
1873 CssParsingError::Opacity(e) => CssParsingErrorOwned::Opacity(e.to_contained()),
1874 CssParsingError::Visibility(e) => CssParsingErrorOwned::Visibility(e.to_contained()),
1875 CssParsingError::Scrollbar(e) => CssParsingErrorOwned::Scrollbar(e.to_contained()),
1876 CssParsingError::LayoutScrollbarWidth(e) => {
1877 CssParsingErrorOwned::LayoutScrollbarWidth(e.to_contained())
1878 }
1879 CssParsingError::StyleScrollbarColor(e) => {
1880 CssParsingErrorOwned::StyleScrollbarColor(e.to_contained())
1881 }
1882 CssParsingError::Transform(e) => CssParsingErrorOwned::Transform(e.to_contained()),
1883 CssParsingError::TransformOrigin(e) => {
1884 CssParsingErrorOwned::TransformOrigin(e.to_contained())
1885 }
1886 CssParsingError::PerspectiveOrigin(e) => {
1887 CssParsingErrorOwned::PerspectiveOrigin(e.to_contained())
1888 }
1889 CssParsingError::Filter(e) => CssParsingErrorOwned::Filter(e.to_contained()),
1890 CssParsingError::LayoutWidth(e) => CssParsingErrorOwned::LayoutWidth(e.to_contained()),
1891 CssParsingError::LayoutHeight(e) => {
1892 CssParsingErrorOwned::LayoutHeight(e.to_contained())
1893 }
1894 CssParsingError::LayoutMinWidth(e) => {
1895 CssParsingErrorOwned::LayoutMinWidth(e.to_contained())
1896 }
1897 CssParsingError::LayoutMinHeight(e) => {
1898 CssParsingErrorOwned::LayoutMinHeight(e.to_contained())
1899 }
1900 CssParsingError::LayoutMaxWidth(e) => {
1901 CssParsingErrorOwned::LayoutMaxWidth(e.to_contained())
1902 }
1903 CssParsingError::LayoutMaxHeight(e) => {
1904 CssParsingErrorOwned::LayoutMaxHeight(e.to_contained())
1905 }
1906 CssParsingError::LayoutPosition(e) => {
1907 CssParsingErrorOwned::LayoutPosition(e.to_contained())
1908 }
1909 CssParsingError::LayoutTop(e) => CssParsingErrorOwned::LayoutTop(e.to_contained()),
1910 CssParsingError::LayoutRight(e) => CssParsingErrorOwned::LayoutRight(e.to_contained()),
1911 CssParsingError::LayoutLeft(e) => CssParsingErrorOwned::LayoutLeft(e.to_contained()),
1912 CssParsingError::LayoutInsetBottom(e) => {
1913 CssParsingErrorOwned::LayoutInsetBottom(e.to_contained())
1914 }
1915 CssParsingError::LayoutZIndex(e) => {
1916 CssParsingErrorOwned::LayoutZIndex(e.to_contained())
1917 }
1918 CssParsingError::FlexWrap(e) => CssParsingErrorOwned::FlexWrap(e.to_contained()),
1919 CssParsingError::FlexDirection(e) => {
1920 CssParsingErrorOwned::FlexDirection(e.to_contained())
1921 }
1922 CssParsingError::FlexBasis(e) => CssParsingErrorOwned::FlexBasis(e.to_contained()),
1923 CssParsingError::JustifyContent(e) => {
1924 CssParsingErrorOwned::JustifyContent(e.to_contained())
1925 }
1926 CssParsingError::AlignItems(e) => CssParsingErrorOwned::AlignItems(e.to_contained()),
1927 CssParsingError::AlignContent(e) => {
1928 CssParsingErrorOwned::AlignContent(e.to_contained())
1929 }
1930 CssParsingError::Grid(e) => CssParsingErrorOwned::Grid(e.to_contained()),
1931 CssParsingError::LayoutWrap(e) => CssParsingErrorOwned::LayoutWrap(e.to_contained()),
1932 CssParsingError::LayoutWritingMode(e) => {
1933 CssParsingErrorOwned::LayoutWritingMode(e.to_contained())
1934 }
1935 CssParsingError::LayoutClear(e) => CssParsingErrorOwned::LayoutClear(e.to_contained()),
1936 CssParsingError::LayoutOverflow(e) => {
1937 CssParsingErrorOwned::LayoutOverflow(e.to_contained())
1938 }
1939 CssParsingError::BorderTopLeftRadius(e) => {
1940 CssParsingErrorOwned::BorderTopLeftRadius(e.to_contained())
1941 }
1942 CssParsingError::BorderTopRightRadius(e) => {
1943 CssParsingErrorOwned::BorderTopRightRadius(e.to_contained())
1944 }
1945 CssParsingError::BorderBottomLeftRadius(e) => {
1946 CssParsingErrorOwned::BorderBottomLeftRadius(e.to_contained())
1947 }
1948 CssParsingError::BorderBottomRightRadius(e) => {
1949 CssParsingErrorOwned::BorderBottomRightRadius(e.to_contained())
1950 }
1951 CssParsingError::BorderStyle(e) => CssParsingErrorOwned::BorderStyle(e.to_contained()),
1952 CssParsingError::BackfaceVisibility(e) => {
1953 CssParsingErrorOwned::BackfaceVisibility(e.to_contained())
1954 }
1955 CssParsingError::MixBlendMode(e) => {
1956 CssParsingErrorOwned::MixBlendMode(e.to_contained())
1957 }
1958 CssParsingError::TextColor(e) => CssParsingErrorOwned::TextColor(e.to_contained()),
1959 CssParsingError::FontSize(e) => CssParsingErrorOwned::FontSize(e.to_contained()),
1960 CssParsingError::TextAlign(e) => CssParsingErrorOwned::TextAlign(e.to_contained()),
1961 CssParsingError::TextJustify(e) => CssParsingErrorOwned::TextJustify(e.to_owned()),
1962 CssParsingError::VerticalAlign(e) => {
1963 CssParsingErrorOwned::VerticalAlign(e.to_contained())
1964 }
1965 CssParsingError::LetterSpacing(e) => {
1966 CssParsingErrorOwned::LetterSpacing(e.to_contained())
1967 }
1968 CssParsingError::TextIndent(e) => CssParsingErrorOwned::TextIndent(e.to_contained()),
1969 CssParsingError::InitialLetter(e) => {
1970 CssParsingErrorOwned::InitialLetter(e.to_contained())
1971 }
1972 CssParsingError::LineClamp(e) => CssParsingErrorOwned::LineClamp(e.to_contained()),
1973 CssParsingError::HangingPunctuation(e) => {
1974 CssParsingErrorOwned::HangingPunctuation(e.to_contained())
1975 }
1976 CssParsingError::TextCombineUpright(e) => {
1977 CssParsingErrorOwned::TextCombineUpright(e.to_contained())
1978 }
1979 CssParsingError::ExclusionMargin(e) => {
1980 CssParsingErrorOwned::ExclusionMargin(e.to_contained())
1981 }
1982 CssParsingError::HyphenationLanguage(e) => {
1983 CssParsingErrorOwned::HyphenationLanguage(e.to_contained())
1984 }
1985 CssParsingError::LineHeight(e) => CssParsingErrorOwned::LineHeight(e.clone()),
1986 CssParsingError::WordSpacing(e) => CssParsingErrorOwned::WordSpacing(e.to_contained()),
1987 CssParsingError::TabWidth(e) => CssParsingErrorOwned::TabWidth(e.to_contained()),
1988 CssParsingError::WhiteSpace(e) => CssParsingErrorOwned::WhiteSpace(e.to_contained()),
1989 CssParsingError::Hyphens(e) => CssParsingErrorOwned::Hyphens(e.to_contained()),
1990 CssParsingError::Direction(e) => CssParsingErrorOwned::Direction(e.to_contained()),
1991 CssParsingError::UserSelect(e) => CssParsingErrorOwned::UserSelect(e.to_contained()),
1992 CssParsingError::TextDecoration(e) => {
1993 CssParsingErrorOwned::TextDecoration(e.to_contained())
1994 }
1995 CssParsingError::Cursor(e) => CssParsingErrorOwned::Cursor(e.to_contained()),
1996 CssParsingError::LayoutDisplay(e) => {
1997 CssParsingErrorOwned::LayoutDisplay(e.to_contained())
1998 }
1999 CssParsingError::LayoutFloat(e) => CssParsingErrorOwned::LayoutFloat(e.to_contained()),
2000 CssParsingError::LayoutBoxSizing(e) => {
2001 CssParsingErrorOwned::LayoutBoxSizing(e.to_contained())
2002 }
2003 CssParsingError::PageBreak(e) => CssParsingErrorOwned::PageBreak(e.to_contained()),
2005 CssParsingError::BreakInside(e) => CssParsingErrorOwned::BreakInside(e.to_contained()),
2006 CssParsingError::Widows(e) => CssParsingErrorOwned::Widows(e.to_contained()),
2007 CssParsingError::Orphans(e) => CssParsingErrorOwned::Orphans(e.to_contained()),
2008 CssParsingError::BoxDecorationBreak(e) => {
2009 CssParsingErrorOwned::BoxDecorationBreak(e.to_contained())
2010 }
2011 CssParsingError::ColumnCount(e) => CssParsingErrorOwned::ColumnCount(e.to_contained()),
2012 CssParsingError::ColumnWidth(e) => CssParsingErrorOwned::ColumnWidth(e.to_contained()),
2013 CssParsingError::ColumnSpan(e) => CssParsingErrorOwned::ColumnSpan(e.to_contained()),
2014 CssParsingError::ColumnFill(e) => CssParsingErrorOwned::ColumnFill(e.to_contained()),
2015 CssParsingError::ColumnRuleWidth(e) => {
2016 CssParsingErrorOwned::ColumnRuleWidth(e.to_contained())
2017 }
2018 CssParsingError::ColumnRuleStyle(e) => {
2019 CssParsingErrorOwned::ColumnRuleStyle(e.to_contained())
2020 }
2021 CssParsingError::ColumnRuleColor(e) => {
2022 CssParsingErrorOwned::ColumnRuleColor(e.to_contained())
2023 }
2024 CssParsingError::FlowInto(e) => CssParsingErrorOwned::FlowInto(e.to_contained()),
2025 CssParsingError::FlowFrom(e) => CssParsingErrorOwned::FlowFrom(e.to_contained()),
2026 CssParsingError::GenericParseError => CssParsingErrorOwned::GenericParseError,
2027 CssParsingError::Content => CssParsingErrorOwned::Content,
2028 CssParsingError::Counter => CssParsingErrorOwned::Counter,
2029 CssParsingError::ListStyleType(e) => {
2030 CssParsingErrorOwned::ListStyleType(e.to_contained())
2031 }
2032 CssParsingError::ListStylePosition(e) => {
2033 CssParsingErrorOwned::ListStylePosition(e.to_contained())
2034 }
2035 CssParsingError::StringSet => CssParsingErrorOwned::StringSet,
2036 CssParsingError::FontWeight(e) => CssParsingErrorOwned::FontWeight(e.to_contained()),
2037 CssParsingError::FontStyle(e) => CssParsingErrorOwned::FontStyle(e.to_contained()),
2038 }
2039 }
2040}
2041
2042impl CssParsingErrorOwned {
2043 pub fn to_shared<'a>(&'a self) -> CssParsingError<'a> {
2044 match self {
2045 CssParsingErrorOwned::CaretColor(e) => CssParsingError::CaretColor(e.to_shared()),
2046 CssParsingErrorOwned::CaretWidth(e) => CssParsingError::CaretWidth(e.to_shared()),
2047 CssParsingErrorOwned::CaretAnimationDuration(e) => {
2048 CssParsingError::CaretAnimationDuration(e.to_shared())
2049 }
2050 CssParsingErrorOwned::SelectionBackgroundColor(e) => {
2051 CssParsingError::SelectionBackgroundColor(e.to_shared())
2052 }
2053 CssParsingErrorOwned::SelectionColor(e) => {
2054 CssParsingError::SelectionColor(e.to_shared())
2055 }
2056 CssParsingErrorOwned::SelectionRadius(e) => {
2057 CssParsingError::SelectionRadius(e.to_shared())
2058 }
2059 CssParsingErrorOwned::Border(e) => CssParsingError::Border(e.to_shared()),
2060 CssParsingErrorOwned::BorderRadius(e) => CssParsingError::BorderRadius(e.to_shared()),
2061 CssParsingErrorOwned::Padding(e) => CssParsingError::Padding(e.to_shared()),
2062 CssParsingErrorOwned::Margin(e) => CssParsingError::Margin(e.to_shared()),
2063 CssParsingErrorOwned::Overflow(e) => CssParsingError::Overflow(e.to_shared()),
2064 CssParsingErrorOwned::BoxShadow(e) => CssParsingError::BoxShadow(e.to_shared()),
2065 CssParsingErrorOwned::Color(e) => CssParsingError::Color(e.to_shared()),
2066 CssParsingErrorOwned::PixelValue(e) => CssParsingError::PixelValue(e.to_shared()),
2067 CssParsingErrorOwned::Percentage(e) => CssParsingError::Percentage(e.clone()),
2068 CssParsingErrorOwned::FontFamily(e) => CssParsingError::FontFamily(e.to_shared()),
2069 CssParsingErrorOwned::InvalidValue(e) => CssParsingError::InvalidValue(e.to_shared()),
2070 CssParsingErrorOwned::FlexGrow(e) => CssParsingError::FlexGrow(e.to_shared()),
2071 CssParsingErrorOwned::FlexShrink(e) => CssParsingError::FlexShrink(e.to_shared()),
2072 CssParsingErrorOwned::Background(e) => CssParsingError::Background(e.to_shared()),
2073 CssParsingErrorOwned::BackgroundPosition(e) => {
2074 CssParsingError::BackgroundPosition(e.to_shared())
2075 }
2076 CssParsingErrorOwned::Opacity(e) => CssParsingError::Opacity(e.to_shared()),
2077 CssParsingErrorOwned::Visibility(e) => CssParsingError::Visibility(e.to_shared()),
2078 CssParsingErrorOwned::Scrollbar(e) => CssParsingError::Scrollbar(e.to_shared()),
2079 CssParsingErrorOwned::LayoutScrollbarWidth(e) => {
2080 CssParsingError::LayoutScrollbarWidth(e.to_shared())
2081 }
2082 CssParsingErrorOwned::StyleScrollbarColor(e) => {
2083 CssParsingError::StyleScrollbarColor(e.to_shared())
2084 }
2085 CssParsingErrorOwned::Transform(e) => CssParsingError::Transform(e.to_shared()),
2086 CssParsingErrorOwned::TransformOrigin(e) => {
2087 CssParsingError::TransformOrigin(e.to_shared())
2088 }
2089 CssParsingErrorOwned::PerspectiveOrigin(e) => {
2090 CssParsingError::PerspectiveOrigin(e.to_shared())
2091 }
2092 CssParsingErrorOwned::Filter(e) => CssParsingError::Filter(e.to_shared()),
2093 CssParsingErrorOwned::LayoutWidth(e) => CssParsingError::LayoutWidth(e.to_shared()),
2094 CssParsingErrorOwned::LayoutHeight(e) => CssParsingError::LayoutHeight(e.to_shared()),
2095 CssParsingErrorOwned::LayoutMinWidth(e) => {
2096 CssParsingError::LayoutMinWidth(e.to_shared())
2097 }
2098 CssParsingErrorOwned::LayoutMinHeight(e) => {
2099 CssParsingError::LayoutMinHeight(e.to_shared())
2100 }
2101 CssParsingErrorOwned::LayoutMaxWidth(e) => {
2102 CssParsingError::LayoutMaxWidth(e.to_shared())
2103 }
2104 CssParsingErrorOwned::LayoutMaxHeight(e) => {
2105 CssParsingError::LayoutMaxHeight(e.to_shared())
2106 }
2107 CssParsingErrorOwned::LayoutPosition(e) => {
2108 CssParsingError::LayoutPosition(e.to_shared())
2109 }
2110 CssParsingErrorOwned::LayoutTop(e) => CssParsingError::LayoutTop(e.to_shared()),
2111 CssParsingErrorOwned::LayoutRight(e) => CssParsingError::LayoutRight(e.to_shared()),
2112 CssParsingErrorOwned::LayoutLeft(e) => CssParsingError::LayoutLeft(e.to_shared()),
2113 CssParsingErrorOwned::LayoutInsetBottom(e) => {
2114 CssParsingError::LayoutInsetBottom(e.to_shared())
2115 }
2116 CssParsingErrorOwned::LayoutZIndex(e) => CssParsingError::LayoutZIndex(e.to_shared()),
2117 CssParsingErrorOwned::FlexWrap(e) => CssParsingError::FlexWrap(e.to_shared()),
2118 CssParsingErrorOwned::FlexDirection(e) => CssParsingError::FlexDirection(e.to_shared()),
2119 CssParsingErrorOwned::FlexBasis(e) => CssParsingError::FlexBasis(e.to_shared()),
2120 CssParsingErrorOwned::JustifyContent(e) => {
2121 CssParsingError::JustifyContent(e.to_shared())
2122 }
2123 CssParsingErrorOwned::AlignItems(e) => CssParsingError::AlignItems(e.to_shared()),
2124 CssParsingErrorOwned::AlignContent(e) => CssParsingError::AlignContent(e.to_shared()),
2125 CssParsingErrorOwned::Grid(e) => CssParsingError::Grid(e.to_shared()),
2126 CssParsingErrorOwned::GridAutoFlow(e) => CssParsingError::GridAutoFlow(e.to_shared()),
2127 CssParsingErrorOwned::JustifySelf(e) => CssParsingError::JustifySelf(e.to_shared()),
2128 CssParsingErrorOwned::JustifyItems(e) => CssParsingError::JustifyItems(e.to_shared()),
2129 CssParsingErrorOwned::AlignSelf(e) => CssParsingError::AlignSelf(e.to_shared()),
2130 CssParsingErrorOwned::LayoutWrap(e) => CssParsingError::LayoutWrap(e.to_shared()),
2131 CssParsingErrorOwned::LayoutWritingMode(e) => {
2132 CssParsingError::LayoutWritingMode(e.to_shared())
2133 }
2134 CssParsingErrorOwned::LayoutClear(e) => CssParsingError::LayoutClear(e.to_shared()),
2135 CssParsingErrorOwned::LayoutOverflow(e) => {
2136 CssParsingError::LayoutOverflow(e.to_shared())
2137 }
2138 CssParsingErrorOwned::BorderTopLeftRadius(e) => {
2139 CssParsingError::BorderTopLeftRadius(e.to_shared())
2140 }
2141 CssParsingErrorOwned::BorderTopRightRadius(e) => {
2142 CssParsingError::BorderTopRightRadius(e.to_shared())
2143 }
2144 CssParsingErrorOwned::BorderBottomLeftRadius(e) => {
2145 CssParsingError::BorderBottomLeftRadius(e.to_shared())
2146 }
2147 CssParsingErrorOwned::BorderBottomRightRadius(e) => {
2148 CssParsingError::BorderBottomRightRadius(e.to_shared())
2149 }
2150 CssParsingErrorOwned::BorderStyle(e) => CssParsingError::BorderStyle(e.to_shared()),
2151 CssParsingErrorOwned::BackfaceVisibility(e) => {
2152 CssParsingError::BackfaceVisibility(e.to_shared())
2153 }
2154 CssParsingErrorOwned::MixBlendMode(e) => CssParsingError::MixBlendMode(e.to_shared()),
2155 CssParsingErrorOwned::TextColor(e) => CssParsingError::TextColor(e.to_shared()),
2156 CssParsingErrorOwned::FontSize(e) => CssParsingError::FontSize(e.to_shared()),
2157 CssParsingErrorOwned::TextAlign(e) => CssParsingError::TextAlign(e.to_shared()),
2158 CssParsingErrorOwned::TextJustify(e) => CssParsingError::TextJustify(e.to_borrowed()),
2159 CssParsingErrorOwned::LetterSpacing(e) => CssParsingError::LetterSpacing(e.to_shared()),
2160 CssParsingErrorOwned::TextIndent(e) => CssParsingError::TextIndent(e.to_shared()),
2161 CssParsingErrorOwned::InitialLetter(e) => CssParsingError::InitialLetter(e.to_shared()),
2162 CssParsingErrorOwned::LineClamp(e) => CssParsingError::LineClamp(e.to_shared()),
2163 CssParsingErrorOwned::HangingPunctuation(e) => {
2164 CssParsingError::HangingPunctuation(e.to_shared())
2165 }
2166 CssParsingErrorOwned::TextCombineUpright(e) => {
2167 CssParsingError::TextCombineUpright(e.to_shared())
2168 }
2169 CssParsingErrorOwned::ExclusionMargin(e) => {
2170 CssParsingError::ExclusionMargin(e.to_shared())
2171 }
2172 CssParsingErrorOwned::HyphenationLanguage(e) => {
2173 CssParsingError::HyphenationLanguage(e.to_shared())
2174 }
2175 CssParsingErrorOwned::LineHeight(e) => CssParsingError::LineHeight(e.clone()),
2176 CssParsingErrorOwned::WordSpacing(e) => CssParsingError::WordSpacing(e.to_shared()),
2177 CssParsingErrorOwned::TabWidth(e) => CssParsingError::TabWidth(e.to_shared()),
2178 CssParsingErrorOwned::WhiteSpace(e) => CssParsingError::WhiteSpace(e.to_shared()),
2179 CssParsingErrorOwned::Hyphens(e) => CssParsingError::Hyphens(e.to_shared()),
2180 CssParsingErrorOwned::Direction(e) => CssParsingError::Direction(e.to_shared()),
2181 CssParsingErrorOwned::UserSelect(e) => CssParsingError::UserSelect(e.to_shared()),
2182 CssParsingErrorOwned::TextDecoration(e) => {
2183 CssParsingError::TextDecoration(e.to_shared())
2184 }
2185 CssParsingErrorOwned::Cursor(e) => CssParsingError::Cursor(e.to_shared()),
2186 CssParsingErrorOwned::LayoutDisplay(e) => CssParsingError::LayoutDisplay(e.to_shared()),
2187 CssParsingErrorOwned::LayoutFloat(e) => CssParsingError::LayoutFloat(e.to_shared()),
2188 CssParsingErrorOwned::LayoutBoxSizing(e) => {
2189 CssParsingError::LayoutBoxSizing(e.to_shared())
2190 }
2191 CssParsingErrorOwned::PageBreak(e) => CssParsingError::PageBreak(e.to_shared()),
2193 CssParsingErrorOwned::BreakInside(e) => CssParsingError::BreakInside(e.to_shared()),
2194 CssParsingErrorOwned::Widows(e) => CssParsingError::Widows(e.to_shared()),
2195 CssParsingErrorOwned::Orphans(e) => CssParsingError::Orphans(e.to_shared()),
2196 CssParsingErrorOwned::BoxDecorationBreak(e) => {
2197 CssParsingError::BoxDecorationBreak(e.to_shared())
2198 }
2199 CssParsingErrorOwned::ColumnCount(e) => CssParsingError::ColumnCount(e.to_shared()),
2200 CssParsingErrorOwned::ColumnWidth(e) => CssParsingError::ColumnWidth(e.to_shared()),
2201 CssParsingErrorOwned::ColumnSpan(e) => CssParsingError::ColumnSpan(e.to_shared()),
2202 CssParsingErrorOwned::ColumnFill(e) => CssParsingError::ColumnFill(e.to_shared()),
2203 CssParsingErrorOwned::ColumnRuleWidth(e) => {
2204 CssParsingError::ColumnRuleWidth(e.to_shared())
2205 }
2206 CssParsingErrorOwned::ColumnRuleStyle(e) => {
2207 CssParsingError::ColumnRuleStyle(e.to_shared())
2208 }
2209 CssParsingErrorOwned::ColumnRuleColor(e) => {
2210 CssParsingError::ColumnRuleColor(e.to_shared())
2211 }
2212 CssParsingErrorOwned::FlowInto(e) => CssParsingError::FlowInto(e.to_shared()),
2213 CssParsingErrorOwned::FlowFrom(e) => CssParsingError::FlowFrom(e.to_shared()),
2214 CssParsingErrorOwned::GenericParseError => CssParsingError::GenericParseError,
2215 CssParsingErrorOwned::Content => CssParsingError::Content,
2216 CssParsingErrorOwned::Counter => CssParsingError::Counter,
2217 CssParsingErrorOwned::ListStyleType(e) => CssParsingError::ListStyleType(e.to_shared()),
2218 CssParsingErrorOwned::ListStylePosition(e) => {
2219 CssParsingError::ListStylePosition(e.to_shared())
2220 }
2221 CssParsingErrorOwned::StringSet => CssParsingError::StringSet,
2222 CssParsingErrorOwned::FontWeight(e) => CssParsingError::FontWeight(e.to_shared()),
2223 CssParsingErrorOwned::FontStyle(e) => CssParsingError::FontStyle(e.to_shared()),
2224 CssParsingErrorOwned::VerticalAlign(e) => CssParsingError::VerticalAlign(e.to_shared()),
2225 }
2226 }
2227}
2228
2229#[cfg(feature = "parser")]
2230pub fn parse_css_property<'a>(
2231 key: CssPropertyType,
2232 value: &'a str,
2233) -> Result<CssProperty, CssParsingError<'a>> {
2234 use crate::props::style::{
2235 parse_selection_background_color, parse_selection_color, parse_selection_radius,
2236 };
2237
2238 let value = value.trim();
2239
2240 let has_typed_auto = matches!(
2243 key,
2244 CssPropertyType::Hyphens | CssPropertyType::OverflowX |
2246 CssPropertyType::OverflowY |
2247 CssPropertyType::UserSelect );
2249
2250 let has_typed_none = matches!(
2251 key,
2252 CssPropertyType::Hyphens | CssPropertyType::Display | CssPropertyType::UserSelect |
2255 CssPropertyType::Float | CssPropertyType::TextDecoration );
2258
2259 Ok(match value {
2260 "auto" if !has_typed_auto => CssProperty::auto(key),
2261 "none" if !has_typed_none => CssProperty::none(key),
2262 "initial" => CssProperty::initial(key),
2263 "inherit" => CssProperty::inherit(key),
2264 value => match key {
2265 CssPropertyType::CaretColor => parse_caret_color(value)?.into(),
2266 CssPropertyType::CaretWidth => parse_caret_width(value)?.into(),
2267 CssPropertyType::CaretAnimationDuration => {
2268 parse_caret_animation_duration(value)?.into()
2269 }
2270 CssPropertyType::SelectionBackgroundColor => {
2271 parse_selection_background_color(value)?.into()
2272 }
2273 CssPropertyType::SelectionColor => parse_selection_color(value)?.into(),
2274 CssPropertyType::SelectionRadius => parse_selection_radius(value)?.into(),
2275
2276 CssPropertyType::TextColor => parse_style_text_color(value)?.into(),
2277 CssPropertyType::FontSize => {
2278 CssProperty::FontSize(parse_style_font_size(value)?.into())
2279 }
2280 CssPropertyType::FontFamily => parse_style_font_family(value)?.into(),
2281 CssPropertyType::FontWeight => {
2282 CssProperty::FontWeight(parse_font_weight(value)?.into())
2283 }
2284 CssPropertyType::FontStyle => CssProperty::FontStyle(parse_font_style(value)?.into()),
2285 CssPropertyType::TextAlign => parse_style_text_align(value)?.into(),
2286 CssPropertyType::TextJustify => parse_layout_text_justify(value)?.into(),
2287 CssPropertyType::VerticalAlign => parse_style_vertical_align(value)?.into(),
2288 CssPropertyType::LetterSpacing => parse_style_letter_spacing(value)?.into(),
2289 CssPropertyType::TextIndent => parse_style_text_indent(value)?.into(),
2290 CssPropertyType::InitialLetter => parse_style_initial_letter(value)?.into(),
2291 CssPropertyType::LineClamp => parse_style_line_clamp(value)?.into(),
2292 CssPropertyType::HangingPunctuation => parse_style_hanging_punctuation(value)?.into(),
2293 CssPropertyType::TextCombineUpright => parse_style_text_combine_upright(value)?.into(),
2294 CssPropertyType::ExclusionMargin => parse_style_exclusion_margin(value)?.into(),
2295 CssPropertyType::HyphenationLanguage => parse_style_hyphenation_language(value)?.into(),
2296 CssPropertyType::LineHeight => parse_style_line_height(value)?.into(),
2297 CssPropertyType::WordSpacing => parse_style_word_spacing(value)?.into(),
2298 CssPropertyType::TabWidth => parse_style_tab_width(value)?.into(),
2299 CssPropertyType::WhiteSpace => parse_style_white_space(value)?.into(),
2300 CssPropertyType::Hyphens => parse_style_hyphens(value)?.into(),
2301 CssPropertyType::Direction => parse_style_direction(value)?.into(),
2302 CssPropertyType::UserSelect => parse_style_user_select(value)?.into(),
2303 CssPropertyType::TextDecoration => parse_style_text_decoration(value)?.into(),
2304 CssPropertyType::Cursor => parse_style_cursor(value)?.into(),
2305
2306 CssPropertyType::Display => parse_layout_display(value)?.into(),
2307 CssPropertyType::Float => parse_layout_float(value)?.into(),
2308 CssPropertyType::BoxSizing => parse_layout_box_sizing(value)?.into(),
2309 CssPropertyType::Width => parse_layout_width(value)?.into(),
2310 CssPropertyType::Height => parse_layout_height(value)?.into(),
2311 CssPropertyType::MinWidth => parse_layout_min_width(value)?.into(),
2312 CssPropertyType::MinHeight => parse_layout_min_height(value)?.into(),
2313 CssPropertyType::MaxWidth => parse_layout_max_width(value)?.into(),
2314 CssPropertyType::MaxHeight => parse_layout_max_height(value)?.into(),
2315 CssPropertyType::Position => parse_layout_position(value)?.into(),
2316 CssPropertyType::Top => parse_layout_top(value)?.into(),
2317 CssPropertyType::Right => parse_layout_right(value)?.into(),
2318 CssPropertyType::Left => parse_layout_left(value)?.into(),
2319 CssPropertyType::Bottom => parse_layout_bottom(value)?.into(),
2320 CssPropertyType::ZIndex => CssProperty::ZIndex(parse_layout_z_index(value)?.into()),
2321
2322 CssPropertyType::FlexWrap => parse_layout_flex_wrap(value)?.into(),
2323 CssPropertyType::FlexDirection => parse_layout_flex_direction(value)?.into(),
2324 CssPropertyType::FlexGrow => parse_layout_flex_grow(value)?.into(),
2325 CssPropertyType::FlexShrink => parse_layout_flex_shrink(value)?.into(),
2326 CssPropertyType::FlexBasis => parse_layout_flex_basis(value)?.into(),
2327 CssPropertyType::JustifyContent => parse_layout_justify_content(value)?.into(),
2328 CssPropertyType::AlignItems => parse_layout_align_items(value)?.into(),
2329 CssPropertyType::AlignContent => parse_layout_align_content(value)?.into(),
2330 CssPropertyType::ColumnGap => parse_layout_column_gap(value)?.into(),
2331 CssPropertyType::RowGap => parse_layout_row_gap(value)?.into(),
2332 CssPropertyType::GridTemplateColumns => {
2333 CssProperty::GridTemplateColumns(parse_grid_template(value)?.into())
2334 }
2335 CssPropertyType::GridTemplateRows => {
2336 CssProperty::GridTemplateRows(parse_grid_template(value)?.into())
2337 }
2338 CssPropertyType::GridAutoColumns => {
2339 let template = parse_grid_template(value)?;
2340 CssProperty::GridAutoColumns(CssPropertyValue::Exact(GridAutoTracks::from(
2341 template,
2342 )))
2343 }
2344 CssPropertyType::GridAutoFlow => {
2345 CssProperty::GridAutoFlow(parse_layout_grid_auto_flow(value)?.into())
2346 }
2347 CssPropertyType::JustifySelf => {
2348 CssProperty::JustifySelf(parse_layout_justify_self(value)?.into())
2349 }
2350 CssPropertyType::JustifyItems => {
2351 CssProperty::JustifyItems(parse_layout_justify_items(value)?.into())
2352 }
2353 CssPropertyType::Gap => {
2354 CssProperty::Gap(parse_layout_gap(value)?.into())
2356 }
2357 CssPropertyType::GridGap => CssProperty::GridGap(parse_layout_gap(value)?.into()),
2358 CssPropertyType::AlignSelf => {
2359 CssProperty::AlignSelf(parse_layout_align_self(value)?.into())
2360 }
2361 CssPropertyType::Font => {
2362 let fam = parse_style_font_family(value)?;
2364 CssProperty::Font(fam.into())
2365 }
2366 CssPropertyType::GridAutoRows => {
2367 let template = parse_grid_template(value)?;
2368 CssProperty::GridAutoRows(CssPropertyValue::Exact(GridAutoTracks::from(template)))
2369 }
2370 CssPropertyType::GridColumn => {
2371 CssProperty::GridColumn(parse_grid_placement(value)?.into())
2372 }
2373 CssPropertyType::GridRow => CssProperty::GridRow(parse_grid_placement(value)?.into()),
2374 CssPropertyType::WritingMode => parse_layout_writing_mode(value)?.into(),
2375 CssPropertyType::Clear => parse_layout_clear(value)?.into(),
2376
2377 CssPropertyType::BackgroundContent => {
2378 parse_style_background_content_multiple(value)?.into()
2379 }
2380 CssPropertyType::BackgroundPosition => {
2381 parse_style_background_position_multiple(value)?.into()
2382 }
2383 CssPropertyType::BackgroundSize => parse_style_background_size_multiple(value)?.into(),
2384 CssPropertyType::BackgroundRepeat => {
2385 parse_style_background_repeat_multiple(value)?.into()
2386 }
2387
2388 CssPropertyType::OverflowX => {
2389 CssProperty::OverflowX(parse_layout_overflow(value)?.into())
2390 }
2391 CssPropertyType::OverflowY => {
2392 CssProperty::OverflowY(parse_layout_overflow(value)?.into())
2393 }
2394
2395 CssPropertyType::PaddingTop => parse_layout_padding_top(value)?.into(),
2396 CssPropertyType::PaddingLeft => parse_layout_padding_left(value)?.into(),
2397 CssPropertyType::PaddingRight => parse_layout_padding_right(value)?.into(),
2398 CssPropertyType::PaddingBottom => parse_layout_padding_bottom(value)?.into(),
2399 CssPropertyType::PaddingInlineStart => parse_layout_padding_inline_start(value)?.into(),
2400 CssPropertyType::PaddingInlineEnd => parse_layout_padding_inline_end(value)?.into(),
2401
2402 CssPropertyType::MarginTop => parse_layout_margin_top(value)?.into(),
2403 CssPropertyType::MarginLeft => parse_layout_margin_left(value)?.into(),
2404 CssPropertyType::MarginRight => parse_layout_margin_right(value)?.into(),
2405 CssPropertyType::MarginBottom => parse_layout_margin_bottom(value)?.into(),
2406
2407 CssPropertyType::BorderTopLeftRadius => {
2408 parse_style_border_top_left_radius(value)?.into()
2409 }
2410 CssPropertyType::BorderTopRightRadius => {
2411 parse_style_border_top_right_radius(value)?.into()
2412 }
2413 CssPropertyType::BorderBottomLeftRadius => {
2414 parse_style_border_bottom_left_radius(value)?.into()
2415 }
2416 CssPropertyType::BorderBottomRightRadius => {
2417 parse_style_border_bottom_right_radius(value)?.into()
2418 }
2419
2420 CssPropertyType::BorderTopColor => parse_border_top_color(value)?.into(),
2421 CssPropertyType::BorderRightColor => parse_border_right_color(value)?.into(),
2422 CssPropertyType::BorderLeftColor => parse_border_left_color(value)?.into(),
2423 CssPropertyType::BorderBottomColor => parse_border_bottom_color(value)?.into(),
2424
2425 CssPropertyType::BorderTopStyle => parse_border_top_style(value)?.into(),
2426 CssPropertyType::BorderRightStyle => parse_border_right_style(value)?.into(),
2427 CssPropertyType::BorderLeftStyle => parse_border_left_style(value)?.into(),
2428 CssPropertyType::BorderBottomStyle => parse_border_bottom_style(value)?.into(),
2429
2430 CssPropertyType::BorderTopWidth => parse_border_top_width(value)?.into(),
2431 CssPropertyType::BorderRightWidth => parse_border_right_width(value)?.into(),
2432 CssPropertyType::BorderLeftWidth => parse_border_left_width(value)?.into(),
2433 CssPropertyType::BorderBottomWidth => parse_border_bottom_width(value)?.into(),
2434
2435 CssPropertyType::BoxShadowLeft => {
2436 CssProperty::BoxShadowLeft(parse_style_box_shadow(value)?.into())
2437 }
2438 CssPropertyType::BoxShadowRight => {
2439 CssProperty::BoxShadowRight(parse_style_box_shadow(value)?.into())
2440 }
2441 CssPropertyType::BoxShadowTop => {
2442 CssProperty::BoxShadowTop(parse_style_box_shadow(value)?.into())
2443 }
2444 CssPropertyType::BoxShadowBottom => {
2445 CssProperty::BoxShadowBottom(parse_style_box_shadow(value)?.into())
2446 }
2447
2448 CssPropertyType::Scrollbar => parse_scrollbar_style(value)?.into(),
2449 CssPropertyType::ScrollbarWidth => parse_layout_scrollbar_width(value)?.into(),
2450 CssPropertyType::ScrollbarColor => parse_style_scrollbar_color(value)?.into(),
2451 CssPropertyType::Opacity => parse_style_opacity(value)?.into(),
2452 CssPropertyType::Visibility => parse_style_visibility(value)?.into(),
2453 CssPropertyType::Transform => parse_style_transform_vec(value)?.into(),
2454 CssPropertyType::TransformOrigin => parse_style_transform_origin(value)?.into(),
2455 CssPropertyType::PerspectiveOrigin => parse_style_perspective_origin(value)?.into(),
2456 CssPropertyType::BackfaceVisibility => parse_style_backface_visibility(value)?.into(),
2457
2458 CssPropertyType::MixBlendMode => parse_style_mix_blend_mode(value)?.into(),
2459 CssPropertyType::Filter => CssProperty::Filter(parse_style_filter_vec(value)?.into()),
2460 CssPropertyType::BackdropFilter => {
2461 CssProperty::BackdropFilter(parse_style_filter_vec(value)?.into())
2462 }
2463 CssPropertyType::TextShadow => {
2464 CssProperty::TextShadow(parse_style_box_shadow(value)?.into())
2465 }
2466
2467 CssPropertyType::BreakBefore => {
2469 CssProperty::BreakBefore(parse_page_break(value)?.into())
2470 }
2471 CssPropertyType::BreakAfter => CssProperty::BreakAfter(parse_page_break(value)?.into()),
2472 CssPropertyType::BreakInside => {
2473 CssProperty::BreakInside(parse_break_inside(value)?.into())
2474 }
2475 CssPropertyType::Orphans => CssProperty::Orphans(parse_orphans(value)?.into()),
2476 CssPropertyType::Widows => CssProperty::Widows(parse_widows(value)?.into()),
2477 CssPropertyType::BoxDecorationBreak => {
2478 CssProperty::BoxDecorationBreak(parse_box_decoration_break(value)?.into())
2479 }
2480 CssPropertyType::ColumnCount => {
2481 CssProperty::ColumnCount(parse_column_count(value)?.into())
2482 }
2483 CssPropertyType::ColumnWidth => {
2484 CssProperty::ColumnWidth(parse_column_width(value)?.into())
2485 }
2486 CssPropertyType::ColumnSpan => {
2487 CssProperty::ColumnSpan(parse_column_span(value)?.into())
2488 }
2489 CssPropertyType::ColumnFill => {
2490 CssProperty::ColumnFill(parse_column_fill(value)?.into())
2491 }
2492 CssPropertyType::ColumnRuleWidth => {
2493 CssProperty::ColumnRuleWidth(parse_column_rule_width(value)?.into())
2494 }
2495 CssPropertyType::ColumnRuleStyle => {
2496 CssProperty::ColumnRuleStyle(parse_column_rule_style(value)?.into())
2497 }
2498 CssPropertyType::ColumnRuleColor => {
2499 CssProperty::ColumnRuleColor(parse_column_rule_color(value)?.into())
2500 }
2501 CssPropertyType::FlowInto => CssProperty::FlowInto(parse_flow_into(value)?.into()),
2502 CssPropertyType::FlowFrom => CssProperty::FlowFrom(parse_flow_from(value)?.into()),
2503 CssPropertyType::ShapeOutside => CssProperty::ShapeOutside(
2504 parse_shape_outside(value)
2505 .map_err(|_| CssParsingError::GenericParseError)?
2506 .into(),
2507 ),
2508 CssPropertyType::ShapeInside => CssProperty::ShapeInside(
2509 parse_shape_inside(value)
2510 .map_err(|_| CssParsingError::GenericParseError)?
2511 .into(),
2512 ),
2513 CssPropertyType::ClipPath => CssProperty::ClipPath(
2514 parse_clip_path(value)
2515 .map_err(|_| CssParsingError::GenericParseError)?
2516 .into(),
2517 ),
2518 CssPropertyType::ShapeMargin => {
2519 CssProperty::ShapeMargin(parse_shape_margin(value)?.into())
2520 }
2521 CssPropertyType::ShapeImageThreshold => CssProperty::ShapeImageThreshold(
2522 parse_shape_image_threshold(value)
2523 .map_err(|_| CssParsingError::GenericParseError)?
2524 .into(),
2525 ),
2526 CssPropertyType::Content => CssProperty::Content(
2527 parse_content(value)
2528 .map_err(|_| CssParsingError::Content)?
2529 .into(),
2530 ),
2531 CssPropertyType::CounterReset => CssProperty::CounterReset(
2532 parse_counter_reset(value)
2533 .map_err(|_| CssParsingError::Counter)?
2534 .into(),
2535 ),
2536 CssPropertyType::CounterIncrement => CssProperty::CounterIncrement(
2537 parse_counter_increment(value)
2538 .map_err(|_| CssParsingError::Counter)?
2539 .into(),
2540 ),
2541 CssPropertyType::ListStyleType => CssProperty::ListStyleType(
2542 parse_style_list_style_type(value)
2543 .map_err(|e| CssParsingError::ListStyleType(e))?
2544 .into(),
2545 ),
2546 CssPropertyType::ListStylePosition => CssProperty::ListStylePosition(
2547 parse_style_list_style_position(value)
2548 .map_err(|e| CssParsingError::ListStylePosition(e))?
2549 .into(),
2550 ),
2551 CssPropertyType::StringSet => CssProperty::StringSet(
2552 parse_string_set(value)
2553 .map_err(|_| CssParsingError::StringSet)?
2554 .into(),
2555 ),
2556 CssPropertyType::TableLayout => CssProperty::TableLayout(
2557 parse_table_layout(value)
2558 .map_err(|_| CssParsingError::GenericParseError)?
2559 .into(),
2560 ),
2561 CssPropertyType::BorderCollapse => CssProperty::BorderCollapse(
2562 parse_border_collapse(value)
2563 .map_err(|_| CssParsingError::GenericParseError)?
2564 .into(),
2565 ),
2566 CssPropertyType::BorderSpacing => CssProperty::BorderSpacing(
2567 parse_border_spacing(value)
2568 .map_err(|_| CssParsingError::GenericParseError)?
2569 .into(),
2570 ),
2571 CssPropertyType::CaptionSide => CssProperty::CaptionSide(
2572 parse_caption_side(value)
2573 .map_err(|_| CssParsingError::GenericParseError)?
2574 .into(),
2575 ),
2576 CssPropertyType::EmptyCells => CssProperty::EmptyCells(
2577 parse_empty_cells(value)
2578 .map_err(|_| CssParsingError::GenericParseError)?
2579 .into(),
2580 ),
2581 },
2582 })
2583}
2584
2585#[cfg(feature = "parser")]
2586
2587#[cfg(feature = "parser")]
2616pub fn parse_combined_css_property<'a>(
2617 key: CombinedCssPropertyType,
2618 value: &'a str,
2619) -> Result<Vec<CssProperty>, CssParsingError<'a>> {
2620 use self::CombinedCssPropertyType::*;
2621
2622 macro_rules! convert_value {
2623 ($thing:expr, $prop_type:ident, $wrapper:ident) => {
2624 match $thing {
2625 PixelValueWithAuto::None => CssProperty::none(CssPropertyType::$prop_type),
2626 PixelValueWithAuto::Initial => CssProperty::initial(CssPropertyType::$prop_type),
2627 PixelValueWithAuto::Inherit => CssProperty::inherit(CssPropertyType::$prop_type),
2628 PixelValueWithAuto::Auto => CssProperty::auto(CssPropertyType::$prop_type),
2629 PixelValueWithAuto::Exact(x) => {
2630 CssProperty::$prop_type($wrapper { inner: x }.into())
2631 }
2632 }
2633 };
2634 }
2635
2636 let keys = match key {
2637 BorderRadius => {
2638 vec![
2639 CssPropertyType::BorderTopLeftRadius,
2640 CssPropertyType::BorderTopRightRadius,
2641 CssPropertyType::BorderBottomLeftRadius,
2642 CssPropertyType::BorderBottomRightRadius,
2643 ]
2644 }
2645 Overflow => {
2646 vec![CssPropertyType::OverflowX, CssPropertyType::OverflowY]
2647 }
2648 Padding => {
2649 vec![
2650 CssPropertyType::PaddingTop,
2651 CssPropertyType::PaddingBottom,
2652 CssPropertyType::PaddingLeft,
2653 CssPropertyType::PaddingRight,
2654 ]
2655 }
2656 Margin => {
2657 vec![
2658 CssPropertyType::MarginTop,
2659 CssPropertyType::MarginBottom,
2660 CssPropertyType::MarginLeft,
2661 CssPropertyType::MarginRight,
2662 ]
2663 }
2664 Border => {
2665 vec![
2666 CssPropertyType::BorderTopColor,
2667 CssPropertyType::BorderRightColor,
2668 CssPropertyType::BorderLeftColor,
2669 CssPropertyType::BorderBottomColor,
2670 CssPropertyType::BorderTopStyle,
2671 CssPropertyType::BorderRightStyle,
2672 CssPropertyType::BorderLeftStyle,
2673 CssPropertyType::BorderBottomStyle,
2674 CssPropertyType::BorderTopWidth,
2675 CssPropertyType::BorderRightWidth,
2676 CssPropertyType::BorderLeftWidth,
2677 CssPropertyType::BorderBottomWidth,
2678 ]
2679 }
2680 BorderLeft => {
2681 vec![
2682 CssPropertyType::BorderLeftColor,
2683 CssPropertyType::BorderLeftStyle,
2684 CssPropertyType::BorderLeftWidth,
2685 ]
2686 }
2687 BorderRight => {
2688 vec![
2689 CssPropertyType::BorderRightColor,
2690 CssPropertyType::BorderRightStyle,
2691 CssPropertyType::BorderRightWidth,
2692 ]
2693 }
2694 BorderTop => {
2695 vec![
2696 CssPropertyType::BorderTopColor,
2697 CssPropertyType::BorderTopStyle,
2698 CssPropertyType::BorderTopWidth,
2699 ]
2700 }
2701 BorderBottom => {
2702 vec![
2703 CssPropertyType::BorderBottomColor,
2704 CssPropertyType::BorderBottomStyle,
2705 CssPropertyType::BorderBottomWidth,
2706 ]
2707 }
2708 BorderColor => {
2709 vec![
2710 CssPropertyType::BorderTopColor,
2711 CssPropertyType::BorderRightColor,
2712 CssPropertyType::BorderBottomColor,
2713 CssPropertyType::BorderLeftColor,
2714 ]
2715 }
2716 BorderStyle => {
2717 vec![
2718 CssPropertyType::BorderTopStyle,
2719 CssPropertyType::BorderRightStyle,
2720 CssPropertyType::BorderBottomStyle,
2721 CssPropertyType::BorderLeftStyle,
2722 ]
2723 }
2724 BorderWidth => {
2725 vec![
2726 CssPropertyType::BorderTopWidth,
2727 CssPropertyType::BorderRightWidth,
2728 CssPropertyType::BorderBottomWidth,
2729 CssPropertyType::BorderLeftWidth,
2730 ]
2731 }
2732 BoxShadow => {
2733 vec![
2734 CssPropertyType::BoxShadowLeft,
2735 CssPropertyType::BoxShadowRight,
2736 CssPropertyType::BoxShadowTop,
2737 CssPropertyType::BoxShadowBottom,
2738 ]
2739 }
2740 BackgroundColor => {
2741 vec![CssPropertyType::BackgroundContent]
2742 }
2743 BackgroundImage => {
2744 vec![CssPropertyType::BackgroundContent]
2745 }
2746 Background => {
2747 vec![CssPropertyType::BackgroundContent]
2748 }
2749 Flex => {
2750 vec![
2751 CssPropertyType::FlexGrow,
2752 CssPropertyType::FlexShrink,
2753 CssPropertyType::FlexBasis,
2754 ]
2755 }
2756 Grid => {
2757 vec![
2758 CssPropertyType::GridTemplateColumns,
2759 CssPropertyType::GridTemplateRows,
2760 ]
2761 }
2762 Gap => {
2763 vec![CssPropertyType::RowGap, CssPropertyType::ColumnGap]
2764 }
2765 GridGap => {
2766 vec![CssPropertyType::RowGap, CssPropertyType::ColumnGap]
2767 }
2768 Font => {
2769 vec![CssPropertyType::Font]
2770 }
2771 Columns => {
2772 vec![CssPropertyType::ColumnWidth, CssPropertyType::ColumnCount]
2773 }
2774 ColumnRule => {
2775 vec![
2776 CssPropertyType::ColumnRuleWidth,
2777 CssPropertyType::ColumnRuleStyle,
2778 CssPropertyType::ColumnRuleColor,
2779 ]
2780 }
2781 };
2782
2783 let has_typed_auto = matches!(key, Overflow);
2786 let has_typed_none = false; match value {
2789 "auto" if !has_typed_auto => {
2790 return Ok(keys.into_iter().map(|ty| CssProperty::auto(ty)).collect())
2791 }
2792 "none" if !has_typed_none => {
2793 return Ok(keys.into_iter().map(|ty| CssProperty::none(ty)).collect())
2794 }
2795 "initial" => {
2796 return Ok(keys
2797 .into_iter()
2798 .map(|ty| CssProperty::initial(ty))
2799 .collect());
2800 }
2801 "inherit" => {
2802 return Ok(keys
2803 .into_iter()
2804 .map(|ty| CssProperty::inherit(ty))
2805 .collect());
2806 }
2807 _ => {}
2808 };
2809
2810 match key {
2811 BorderRadius => {
2812 let border_radius = parse_style_border_radius(value)?;
2813 Ok(vec![
2814 CssProperty::BorderTopLeftRadius(
2815 StyleBorderTopLeftRadius {
2816 inner: border_radius.top_left,
2817 }
2818 .into(),
2819 ),
2820 CssProperty::BorderTopRightRadius(
2821 StyleBorderTopRightRadius {
2822 inner: border_radius.top_right,
2823 }
2824 .into(),
2825 ),
2826 CssProperty::BorderBottomLeftRadius(
2827 StyleBorderBottomLeftRadius {
2828 inner: border_radius.bottom_left,
2829 }
2830 .into(),
2831 ),
2832 CssProperty::BorderBottomRightRadius(
2833 StyleBorderBottomRightRadius {
2834 inner: border_radius.bottom_right,
2835 }
2836 .into(),
2837 ),
2838 ])
2839 }
2840 Overflow => {
2841 let overflow = parse_layout_overflow(value)?;
2842 Ok(vec![
2843 CssProperty::OverflowX(overflow.into()),
2844 CssProperty::OverflowY(overflow.into()),
2845 ])
2846 }
2847 Padding => {
2848 let padding = parse_layout_padding(value)?;
2849 Ok(vec![
2850 convert_value!(padding.top, PaddingTop, LayoutPaddingTop),
2851 convert_value!(padding.bottom, PaddingBottom, LayoutPaddingBottom),
2852 convert_value!(padding.left, PaddingLeft, LayoutPaddingLeft),
2853 convert_value!(padding.right, PaddingRight, LayoutPaddingRight),
2854 ])
2855 }
2856 Margin => {
2857 let margin = parse_layout_margin(value)?;
2858 Ok(vec![
2859 convert_value!(margin.top, MarginTop, LayoutMarginTop),
2860 convert_value!(margin.bottom, MarginBottom, LayoutMarginBottom),
2861 convert_value!(margin.left, MarginLeft, LayoutMarginLeft),
2862 convert_value!(margin.right, MarginRight, LayoutMarginRight),
2863 ])
2864 }
2865 Border => {
2866 let border = parse_style_border(value)?;
2867 Ok(vec![
2868 CssProperty::BorderTopColor(
2869 StyleBorderTopColor {
2870 inner: border.border_color,
2871 }
2872 .into(),
2873 ),
2874 CssProperty::BorderRightColor(
2875 StyleBorderRightColor {
2876 inner: border.border_color,
2877 }
2878 .into(),
2879 ),
2880 CssProperty::BorderLeftColor(
2881 StyleBorderLeftColor {
2882 inner: border.border_color,
2883 }
2884 .into(),
2885 ),
2886 CssProperty::BorderBottomColor(
2887 StyleBorderBottomColor {
2888 inner: border.border_color,
2889 }
2890 .into(),
2891 ),
2892 CssProperty::BorderTopStyle(
2893 StyleBorderTopStyle {
2894 inner: border.border_style,
2895 }
2896 .into(),
2897 ),
2898 CssProperty::BorderRightStyle(
2899 StyleBorderRightStyle {
2900 inner: border.border_style,
2901 }
2902 .into(),
2903 ),
2904 CssProperty::BorderLeftStyle(
2905 StyleBorderLeftStyle {
2906 inner: border.border_style,
2907 }
2908 .into(),
2909 ),
2910 CssProperty::BorderBottomStyle(
2911 StyleBorderBottomStyle {
2912 inner: border.border_style,
2913 }
2914 .into(),
2915 ),
2916 CssProperty::BorderTopWidth(
2917 LayoutBorderTopWidth {
2918 inner: border.border_width,
2919 }
2920 .into(),
2921 ),
2922 CssProperty::BorderRightWidth(
2923 LayoutBorderRightWidth {
2924 inner: border.border_width,
2925 }
2926 .into(),
2927 ),
2928 CssProperty::BorderLeftWidth(
2929 LayoutBorderLeftWidth {
2930 inner: border.border_width,
2931 }
2932 .into(),
2933 ),
2934 CssProperty::BorderBottomWidth(
2935 LayoutBorderBottomWidth {
2936 inner: border.border_width,
2937 }
2938 .into(),
2939 ),
2940 ])
2941 }
2942 BorderLeft => {
2943 let border = parse_style_border(value)?;
2944 Ok(vec![
2945 CssProperty::BorderLeftColor(
2946 StyleBorderLeftColor {
2947 inner: border.border_color,
2948 }
2949 .into(),
2950 ),
2951 CssProperty::BorderLeftStyle(
2952 StyleBorderLeftStyle {
2953 inner: border.border_style,
2954 }
2955 .into(),
2956 ),
2957 CssProperty::BorderLeftWidth(
2958 LayoutBorderLeftWidth {
2959 inner: border.border_width,
2960 }
2961 .into(),
2962 ),
2963 ])
2964 }
2965 BorderRight => {
2966 let border = parse_style_border(value)?;
2967 Ok(vec![
2968 CssProperty::BorderRightColor(
2969 StyleBorderRightColor {
2970 inner: border.border_color,
2971 }
2972 .into(),
2973 ),
2974 CssProperty::BorderRightStyle(
2975 StyleBorderRightStyle {
2976 inner: border.border_style,
2977 }
2978 .into(),
2979 ),
2980 CssProperty::BorderRightWidth(
2981 LayoutBorderRightWidth {
2982 inner: border.border_width,
2983 }
2984 .into(),
2985 ),
2986 ])
2987 }
2988 BorderTop => {
2989 let border = parse_style_border(value)?;
2990 Ok(vec![
2991 CssProperty::BorderTopColor(
2992 StyleBorderTopColor {
2993 inner: border.border_color,
2994 }
2995 .into(),
2996 ),
2997 CssProperty::BorderTopStyle(
2998 StyleBorderTopStyle {
2999 inner: border.border_style,
3000 }
3001 .into(),
3002 ),
3003 CssProperty::BorderTopWidth(
3004 LayoutBorderTopWidth {
3005 inner: border.border_width,
3006 }
3007 .into(),
3008 ),
3009 ])
3010 }
3011 BorderBottom => {
3012 let border = parse_style_border(value)?;
3013 Ok(vec![
3014 CssProperty::BorderBottomColor(
3015 StyleBorderBottomColor {
3016 inner: border.border_color,
3017 }
3018 .into(),
3019 ),
3020 CssProperty::BorderBottomStyle(
3021 StyleBorderBottomStyle {
3022 inner: border.border_style,
3023 }
3024 .into(),
3025 ),
3026 CssProperty::BorderBottomWidth(
3027 LayoutBorderBottomWidth {
3028 inner: border.border_width,
3029 }
3030 .into(),
3031 ),
3032 ])
3033 }
3034 BorderColor => {
3035 let colors = parse_style_border_color(value)?;
3036 Ok(vec![
3037 CssProperty::BorderTopColor(
3038 StyleBorderTopColor { inner: colors.top }.into(),
3039 ),
3040 CssProperty::BorderRightColor(
3041 StyleBorderRightColor { inner: colors.right }.into(),
3042 ),
3043 CssProperty::BorderBottomColor(
3044 StyleBorderBottomColor { inner: colors.bottom }.into(),
3045 ),
3046 CssProperty::BorderLeftColor(
3047 StyleBorderLeftColor { inner: colors.left }.into(),
3048 ),
3049 ])
3050 }
3051 BorderStyle => {
3052 let styles = parse_style_border_style(value)?;
3053 Ok(vec![
3054 CssProperty::BorderTopStyle(
3055 StyleBorderTopStyle { inner: styles.top }.into(),
3056 ),
3057 CssProperty::BorderRightStyle(
3058 StyleBorderRightStyle { inner: styles.right }.into(),
3059 ),
3060 CssProperty::BorderBottomStyle(
3061 StyleBorderBottomStyle { inner: styles.bottom }.into(),
3062 ),
3063 CssProperty::BorderLeftStyle(
3064 StyleBorderLeftStyle { inner: styles.left }.into(),
3065 ),
3066 ])
3067 }
3068 BorderWidth => {
3069 let widths = parse_style_border_width(value)?;
3070 Ok(vec![
3071 CssProperty::BorderTopWidth(
3072 LayoutBorderTopWidth { inner: widths.top }.into(),
3073 ),
3074 CssProperty::BorderRightWidth(
3075 LayoutBorderRightWidth { inner: widths.right }.into(),
3076 ),
3077 CssProperty::BorderBottomWidth(
3078 LayoutBorderBottomWidth { inner: widths.bottom }.into(),
3079 ),
3080 CssProperty::BorderLeftWidth(
3081 LayoutBorderLeftWidth { inner: widths.left }.into(),
3082 ),
3083 ])
3084 }
3085 BoxShadow => {
3086 let box_shadow = parse_style_box_shadow(value)?;
3087 Ok(vec![
3088 CssProperty::BoxShadowLeft(CssPropertyValue::Exact(box_shadow)),
3089 CssProperty::BoxShadowRight(CssPropertyValue::Exact(box_shadow)),
3090 CssProperty::BoxShadowTop(CssPropertyValue::Exact(box_shadow)),
3091 CssProperty::BoxShadowBottom(CssPropertyValue::Exact(box_shadow)),
3092 ])
3093 }
3094 BackgroundColor => {
3095 let color = parse_css_color(value)?;
3096 let vec: StyleBackgroundContentVec = vec![StyleBackgroundContent::Color(color)].into();
3097 Ok(vec![CssProperty::BackgroundContent(vec.into())])
3098 }
3099 BackgroundImage => {
3100 let background_content = parse_style_background_content(value)?;
3101 let vec: StyleBackgroundContentVec = vec![background_content].into();
3102 Ok(vec![CssProperty::BackgroundContent(vec.into())])
3103 }
3104 Background => {
3105 let background_content = parse_style_background_content_multiple(value)?;
3106 Ok(vec![CssProperty::BackgroundContent(
3107 background_content.into(),
3108 )])
3109 }
3110 Flex => {
3111 let parts: Vec<&str> = value.split_whitespace().collect();
3113 if parts.len() == 1 && parts[0] == "none" {
3114 return Ok(vec![
3115 CssProperty::FlexGrow(
3116 LayoutFlexGrow {
3117 inner: crate::props::basic::length::FloatValue::const_new(0),
3118 }
3119 .into(),
3120 ),
3121 CssProperty::FlexShrink(
3122 LayoutFlexShrink {
3123 inner: crate::props::basic::length::FloatValue::const_new(0),
3124 }
3125 .into(),
3126 ),
3127 CssProperty::FlexBasis(LayoutFlexBasis::Auto.into()),
3128 ]);
3129 }
3130 if parts.len() == 1 {
3131 if let Ok(g) = parse_layout_flex_grow(parts[0]) {
3133 return Ok(vec![CssProperty::FlexGrow(g.into())]);
3134 }
3135 if let Ok(b) = parse_layout_flex_basis(parts[0]) {
3136 return Ok(vec![CssProperty::FlexBasis(b.into())]);
3137 }
3138 }
3139 if parts.len() == 2 {
3140 if let (Ok(g), Ok(b)) = (
3141 parse_layout_flex_grow(parts[0]),
3142 parse_layout_flex_basis(parts[1]),
3143 ) {
3144 return Ok(vec![
3145 CssProperty::FlexGrow(g.into()),
3146 CssProperty::FlexBasis(b.into()),
3147 ]);
3148 }
3149 if let (Ok(g), Ok(s)) = (
3150 parse_layout_flex_grow(parts[0]),
3151 parse_layout_flex_shrink(parts[1]),
3152 ) {
3153 return Ok(vec![
3154 CssProperty::FlexGrow(g.into()),
3155 CssProperty::FlexShrink(s.into()),
3156 ]);
3157 }
3158 }
3159 if parts.len() == 3 {
3160 let g = parse_layout_flex_grow(parts[0])?;
3161 let s = parse_layout_flex_shrink(parts[1])?;
3162 let b = parse_layout_flex_basis(parts[2])?;
3163 return Ok(vec![
3164 CssProperty::FlexGrow(g.into()),
3165 CssProperty::FlexShrink(s.into()),
3166 CssProperty::FlexBasis(b.into()),
3167 ]);
3168 }
3169 return Err(CssParsingError::InvalidValue(InvalidValueErr(value)));
3170 }
3171 Grid => {
3172 let tpl = parse_grid_template(value)?;
3174 Ok(vec![
3175 CssProperty::GridTemplateColumns(tpl.clone().into()),
3176 CssProperty::GridTemplateRows(tpl.into()),
3177 ])
3178 }
3179 Gap => {
3180 let parts: Vec<&str> = value.split_whitespace().collect();
3181 if parts.len() == 1 {
3182 let g = parse_layout_gap(parts[0])?;
3183 return Ok(vec![
3184 CssProperty::RowGap(LayoutRowGap { inner: g.inner }.into()),
3185 CssProperty::ColumnGap(LayoutColumnGap { inner: g.inner }.into()),
3186 ]);
3187 } else if parts.len() == 2 {
3188 let row = parse_layout_gap(parts[0])?;
3189 let col = parse_layout_gap(parts[1])?;
3190 return Ok(vec![
3191 CssProperty::RowGap(LayoutRowGap { inner: row.inner }.into()),
3192 CssProperty::ColumnGap(LayoutColumnGap { inner: col.inner }.into()),
3193 ]);
3194 } else {
3195 return Err(CssParsingError::InvalidValue(InvalidValueErr(value)));
3196 }
3197 }
3198 GridGap => {
3199 let parts: Vec<&str> = value.split_whitespace().collect();
3200 if parts.len() == 1 {
3201 let g = parse_layout_gap(parts[0])?;
3202 return Ok(vec![
3203 CssProperty::RowGap(LayoutRowGap { inner: g.inner }.into()),
3204 CssProperty::ColumnGap(LayoutColumnGap { inner: g.inner }.into()),
3205 ]);
3206 } else if parts.len() == 2 {
3207 let row = parse_layout_gap(parts[0])?;
3208 let col = parse_layout_gap(parts[1])?;
3209 return Ok(vec![
3210 CssProperty::RowGap(LayoutRowGap { inner: row.inner }.into()),
3211 CssProperty::ColumnGap(LayoutColumnGap { inner: col.inner }.into()),
3212 ]);
3213 } else {
3214 return Err(CssParsingError::InvalidValue(InvalidValueErr(value)));
3215 }
3216 }
3217 Font => {
3218 let fam = parse_style_font_family(value)?;
3219 Ok(vec![CssProperty::Font(fam.into())])
3220 }
3221 Columns => {
3222 let mut props = Vec::new();
3223 for part in value.split_whitespace() {
3224 if let Ok(width) = parse_column_width(part) {
3225 props.push(CssProperty::ColumnWidth(width.into()));
3226 } else if let Ok(count) = parse_column_count(part) {
3227 props.push(CssProperty::ColumnCount(count.into()));
3228 } else {
3229 return Err(CssParsingError::InvalidValue(InvalidValueErr(value)));
3230 }
3231 }
3232 Ok(props)
3233 }
3234 ColumnRule => {
3235 let border = parse_style_border(value)?;
3236 Ok(vec![
3237 CssProperty::ColumnRuleWidth(
3238 ColumnRuleWidth {
3239 inner: border.border_width,
3240 }
3241 .into(),
3242 ),
3243 CssProperty::ColumnRuleStyle(
3244 ColumnRuleStyle {
3245 inner: border.border_style,
3246 }
3247 .into(),
3248 ),
3249 CssProperty::ColumnRuleColor(
3250 ColumnRuleColor {
3251 inner: border.border_color,
3252 }
3253 .into(),
3254 ),
3255 ])
3256 }
3257 }
3258}
3259
3260macro_rules! impl_from_css_prop {
3262 ($a:ident, $b:ident:: $enum_type:ident) => {
3263 impl From<$a> for $b {
3264 fn from(e: $a) -> Self {
3265 $b::$enum_type(CssPropertyValue::from(e))
3266 }
3267 }
3268 };
3269}
3270
3271impl_from_css_prop!(CaretColor, CssProperty::CaretColor);
3272impl_from_css_prop!(CaretWidth, CssProperty::CaretWidth);
3273impl_from_css_prop!(CaretAnimationDuration, CssProperty::CaretAnimationDuration);
3274impl_from_css_prop!(
3275 SelectionBackgroundColor,
3276 CssProperty::SelectionBackgroundColor
3277);
3278impl_from_css_prop!(SelectionColor, CssProperty::SelectionColor);
3279impl_from_css_prop!(SelectionRadius, CssProperty::SelectionRadius);
3280impl_from_css_prop!(StyleTextColor, CssProperty::TextColor);
3281impl_from_css_prop!(StyleFontSize, CssProperty::FontSize);
3282impl_from_css_prop!(StyleFontFamilyVec, CssProperty::FontFamily);
3283impl_from_css_prop!(StyleTextAlign, CssProperty::TextAlign);
3284impl_from_css_prop!(LayoutTextJustify, CssProperty::TextJustify);
3285impl_from_css_prop!(StyleVerticalAlign, CssProperty::VerticalAlign);
3286impl_from_css_prop!(StyleLetterSpacing, CssProperty::LetterSpacing);
3287impl_from_css_prop!(StyleTextIndent, CssProperty::TextIndent);
3288impl_from_css_prop!(StyleInitialLetter, CssProperty::InitialLetter);
3289impl_from_css_prop!(StyleLineClamp, CssProperty::LineClamp);
3290impl_from_css_prop!(StyleHangingPunctuation, CssProperty::HangingPunctuation);
3291impl_from_css_prop!(StyleTextCombineUpright, CssProperty::TextCombineUpright);
3292impl_from_css_prop!(StyleExclusionMargin, CssProperty::ExclusionMargin);
3293impl_from_css_prop!(StyleHyphenationLanguage, CssProperty::HyphenationLanguage);
3294impl_from_css_prop!(StyleLineHeight, CssProperty::LineHeight);
3295impl_from_css_prop!(StyleWordSpacing, CssProperty::WordSpacing);
3296impl_from_css_prop!(StyleTabWidth, CssProperty::TabWidth);
3297impl_from_css_prop!(StyleCursor, CssProperty::Cursor);
3298impl_from_css_prop!(LayoutDisplay, CssProperty::Display);
3299impl_from_css_prop!(LayoutFloat, CssProperty::Float);
3300impl_from_css_prop!(LayoutBoxSizing, CssProperty::BoxSizing);
3301impl_from_css_prop!(LayoutWidth, CssProperty::Width);
3302impl_from_css_prop!(LayoutHeight, CssProperty::Height);
3303impl_from_css_prop!(LayoutMinWidth, CssProperty::MinWidth);
3304impl_from_css_prop!(LayoutMinHeight, CssProperty::MinHeight);
3305impl_from_css_prop!(LayoutMaxWidth, CssProperty::MaxWidth);
3306impl_from_css_prop!(LayoutMaxHeight, CssProperty::MaxHeight);
3307impl_from_css_prop!(LayoutPosition, CssProperty::Position);
3308impl_from_css_prop!(LayoutTop, CssProperty::Top);
3309impl_from_css_prop!(LayoutRight, CssProperty::Right);
3310impl_from_css_prop!(LayoutLeft, CssProperty::Left);
3311impl_from_css_prop!(LayoutInsetBottom, CssProperty::Bottom);
3312impl_from_css_prop!(LayoutFlexWrap, CssProperty::FlexWrap);
3313impl_from_css_prop!(LayoutFlexDirection, CssProperty::FlexDirection);
3314impl_from_css_prop!(LayoutFlexGrow, CssProperty::FlexGrow);
3315impl_from_css_prop!(LayoutFlexShrink, CssProperty::FlexShrink);
3316impl_from_css_prop!(LayoutFlexBasis, CssProperty::FlexBasis);
3317impl_from_css_prop!(LayoutJustifyContent, CssProperty::JustifyContent);
3318impl_from_css_prop!(LayoutAlignItems, CssProperty::AlignItems);
3319impl_from_css_prop!(LayoutAlignContent, CssProperty::AlignContent);
3320impl_from_css_prop!(LayoutColumnGap, CssProperty::ColumnGap);
3321impl_from_css_prop!(LayoutRowGap, CssProperty::RowGap);
3322impl_from_css_prop!(LayoutGridAutoFlow, CssProperty::GridAutoFlow);
3323impl_from_css_prop!(LayoutJustifySelf, CssProperty::JustifySelf);
3324impl_from_css_prop!(LayoutJustifyItems, CssProperty::JustifyItems);
3325impl_from_css_prop!(LayoutGap, CssProperty::Gap);
3326impl_from_css_prop!(LayoutAlignSelf, CssProperty::AlignSelf);
3327impl_from_css_prop!(LayoutWritingMode, CssProperty::WritingMode);
3328impl_from_css_prop!(LayoutClear, CssProperty::Clear);
3329impl_from_css_prop!(StyleBackgroundContentVec, CssProperty::BackgroundContent);
3330
3331impl_from_css_prop!(StyleBackgroundPositionVec, CssProperty::BackgroundPosition);
3332impl_from_css_prop!(StyleBackgroundSizeVec, CssProperty::BackgroundSize);
3333impl_from_css_prop!(StyleBackgroundRepeatVec, CssProperty::BackgroundRepeat);
3334impl_from_css_prop!(LayoutPaddingTop, CssProperty::PaddingTop);
3335impl_from_css_prop!(LayoutPaddingLeft, CssProperty::PaddingLeft);
3336impl_from_css_prop!(LayoutPaddingRight, CssProperty::PaddingRight);
3337impl_from_css_prop!(LayoutPaddingBottom, CssProperty::PaddingBottom);
3338impl_from_css_prop!(LayoutPaddingInlineStart, CssProperty::PaddingInlineStart);
3339impl_from_css_prop!(LayoutPaddingInlineEnd, CssProperty::PaddingInlineEnd);
3340impl_from_css_prop!(LayoutMarginTop, CssProperty::MarginTop);
3341impl_from_css_prop!(LayoutMarginLeft, CssProperty::MarginLeft);
3342impl_from_css_prop!(LayoutMarginRight, CssProperty::MarginRight);
3343impl_from_css_prop!(LayoutMarginBottom, CssProperty::MarginBottom);
3344impl_from_css_prop!(StyleBorderTopLeftRadius, CssProperty::BorderTopLeftRadius);
3345impl_from_css_prop!(StyleBorderTopRightRadius, CssProperty::BorderTopRightRadius);
3346impl_from_css_prop!(
3347 StyleBorderBottomLeftRadius,
3348 CssProperty::BorderBottomLeftRadius
3349);
3350impl_from_css_prop!(
3351 StyleBorderBottomRightRadius,
3352 CssProperty::BorderBottomRightRadius
3353);
3354impl_from_css_prop!(StyleBorderTopColor, CssProperty::BorderTopColor);
3355impl_from_css_prop!(StyleBorderRightColor, CssProperty::BorderRightColor);
3356impl_from_css_prop!(StyleBorderLeftColor, CssProperty::BorderLeftColor);
3357impl_from_css_prop!(StyleBorderBottomColor, CssProperty::BorderBottomColor);
3358impl_from_css_prop!(StyleBorderTopStyle, CssProperty::BorderTopStyle);
3359impl_from_css_prop!(StyleBorderRightStyle, CssProperty::BorderRightStyle);
3360impl_from_css_prop!(StyleBorderLeftStyle, CssProperty::BorderLeftStyle);
3361impl_from_css_prop!(StyleBorderBottomStyle, CssProperty::BorderBottomStyle);
3362impl_from_css_prop!(LayoutBorderTopWidth, CssProperty::BorderTopWidth);
3363impl_from_css_prop!(LayoutBorderRightWidth, CssProperty::BorderRightWidth);
3364impl_from_css_prop!(LayoutBorderLeftWidth, CssProperty::BorderLeftWidth);
3365impl_from_css_prop!(LayoutBorderBottomWidth, CssProperty::BorderBottomWidth);
3366impl_from_css_prop!(ScrollbarStyle, CssProperty::Scrollbar);
3367impl_from_css_prop!(LayoutScrollbarWidth, CssProperty::ScrollbarWidth);
3368impl_from_css_prop!(StyleScrollbarColor, CssProperty::ScrollbarColor);
3369impl_from_css_prop!(StyleOpacity, CssProperty::Opacity);
3370impl_from_css_prop!(StyleVisibility, CssProperty::Visibility);
3371impl_from_css_prop!(StyleTransformVec, CssProperty::Transform);
3372impl_from_css_prop!(StyleTransformOrigin, CssProperty::TransformOrigin);
3373impl_from_css_prop!(StylePerspectiveOrigin, CssProperty::PerspectiveOrigin);
3374impl_from_css_prop!(StyleBackfaceVisibility, CssProperty::BackfaceVisibility);
3375impl_from_css_prop!(StyleMixBlendMode, CssProperty::MixBlendMode);
3376impl_from_css_prop!(StyleHyphens, CssProperty::Hyphens);
3377impl_from_css_prop!(StyleDirection, CssProperty::Direction);
3378impl_from_css_prop!(StyleWhiteSpace, CssProperty::WhiteSpace);
3379impl_from_css_prop!(PageBreak, CssProperty::BreakBefore);
3380impl_from_css_prop!(BreakInside, CssProperty::BreakInside);
3381impl_from_css_prop!(Widows, CssProperty::Widows);
3382impl_from_css_prop!(Orphans, CssProperty::Orphans);
3383impl_from_css_prop!(BoxDecorationBreak, CssProperty::BoxDecorationBreak);
3384impl_from_css_prop!(ColumnCount, CssProperty::ColumnCount);
3385impl_from_css_prop!(ColumnWidth, CssProperty::ColumnWidth);
3386impl_from_css_prop!(ColumnSpan, CssProperty::ColumnSpan);
3387impl_from_css_prop!(ColumnFill, CssProperty::ColumnFill);
3388impl_from_css_prop!(ColumnRuleWidth, CssProperty::ColumnRuleWidth);
3389impl_from_css_prop!(ColumnRuleStyle, CssProperty::ColumnRuleStyle);
3390impl_from_css_prop!(ColumnRuleColor, CssProperty::ColumnRuleColor);
3391impl_from_css_prop!(FlowInto, CssProperty::FlowInto);
3392impl_from_css_prop!(FlowFrom, CssProperty::FlowFrom);
3393impl_from_css_prop!(ShapeOutside, CssProperty::ShapeOutside);
3394impl_from_css_prop!(ShapeInside, CssProperty::ShapeInside);
3395impl_from_css_prop!(ClipPath, CssProperty::ClipPath);
3396impl_from_css_prop!(ShapeMargin, CssProperty::ShapeMargin);
3397impl_from_css_prop!(ShapeImageThreshold, CssProperty::ShapeImageThreshold);
3398impl_from_css_prop!(Content, CssProperty::Content);
3399impl_from_css_prop!(CounterReset, CssProperty::CounterReset);
3400impl_from_css_prop!(CounterIncrement, CssProperty::CounterIncrement);
3401impl_from_css_prop!(StyleListStyleType, CssProperty::ListStyleType);
3402impl_from_css_prop!(StyleListStylePosition, CssProperty::ListStylePosition);
3403impl_from_css_prop!(StringSet, CssProperty::StringSet);
3404impl_from_css_prop!(LayoutTableLayout, CssProperty::TableLayout);
3405impl_from_css_prop!(StyleBorderCollapse, CssProperty::BorderCollapse);
3406impl_from_css_prop!(LayoutBorderSpacing, CssProperty::BorderSpacing);
3407impl_from_css_prop!(StyleCaptionSide, CssProperty::CaptionSide);
3408impl_from_css_prop!(StyleEmptyCells, CssProperty::EmptyCells);
3409
3410impl CssProperty {
3411 pub fn key(&self) -> &'static str {
3412 self.get_type().to_str()
3413 }
3414
3415 pub fn value(&self) -> String {
3416 match self {
3417 CssProperty::CaretColor(v) => v.get_css_value_fmt(),
3418 CssProperty::CaretWidth(v) => v.get_css_value_fmt(),
3419 CssProperty::CaretAnimationDuration(v) => v.get_css_value_fmt(),
3420 CssProperty::SelectionBackgroundColor(v) => v.get_css_value_fmt(),
3421 CssProperty::SelectionColor(v) => v.get_css_value_fmt(),
3422 CssProperty::SelectionRadius(v) => v.get_css_value_fmt(),
3423 CssProperty::TextJustify(v) => v.get_css_value_fmt(),
3424 CssProperty::LayoutTextJustify(v) => format!("{:?}", v),
3425 CssProperty::TextColor(v) => v.get_css_value_fmt(),
3426 CssProperty::FontSize(v) => v.get_css_value_fmt(),
3427 CssProperty::FontFamily(v) => v.get_css_value_fmt(),
3428 CssProperty::TextAlign(v) => v.get_css_value_fmt(),
3429 CssProperty::LetterSpacing(v) => v.get_css_value_fmt(),
3430 CssProperty::TextIndent(v) => v.get_css_value_fmt(),
3431 CssProperty::InitialLetter(v) => v.get_css_value_fmt(),
3432 CssProperty::LineClamp(v) => v.get_css_value_fmt(),
3433 CssProperty::HangingPunctuation(v) => v.get_css_value_fmt(),
3434 CssProperty::TextCombineUpright(v) => v.get_css_value_fmt(),
3435 CssProperty::ExclusionMargin(v) => v.get_css_value_fmt(),
3436 CssProperty::HyphenationLanguage(v) => v.get_css_value_fmt(),
3437 CssProperty::LineHeight(v) => v.get_css_value_fmt(),
3438 CssProperty::WordSpacing(v) => v.get_css_value_fmt(),
3439 CssProperty::TabWidth(v) => v.get_css_value_fmt(),
3440 CssProperty::Cursor(v) => v.get_css_value_fmt(),
3441 CssProperty::Display(v) => v.get_css_value_fmt(),
3442 CssProperty::Float(v) => v.get_css_value_fmt(),
3443 CssProperty::BoxSizing(v) => v.get_css_value_fmt(),
3444 CssProperty::Width(v) => v.get_css_value_fmt(),
3445 CssProperty::Height(v) => v.get_css_value_fmt(),
3446 CssProperty::MinWidth(v) => v.get_css_value_fmt(),
3447 CssProperty::MinHeight(v) => v.get_css_value_fmt(),
3448 CssProperty::MaxWidth(v) => v.get_css_value_fmt(),
3449 CssProperty::MaxHeight(v) => v.get_css_value_fmt(),
3450 CssProperty::Position(v) => v.get_css_value_fmt(),
3451 CssProperty::Top(v) => v.get_css_value_fmt(),
3452 CssProperty::Right(v) => v.get_css_value_fmt(),
3453 CssProperty::Left(v) => v.get_css_value_fmt(),
3454 CssProperty::Bottom(v) => v.get_css_value_fmt(),
3455 CssProperty::ZIndex(v) => v.get_css_value_fmt(),
3456 CssProperty::FlexWrap(v) => v.get_css_value_fmt(),
3457 CssProperty::FlexDirection(v) => v.get_css_value_fmt(),
3458 CssProperty::FlexGrow(v) => v.get_css_value_fmt(),
3459 CssProperty::FlexShrink(v) => v.get_css_value_fmt(),
3460 CssProperty::FlexBasis(v) => v.get_css_value_fmt(),
3461 CssProperty::JustifyContent(v) => v.get_css_value_fmt(),
3462 CssProperty::AlignItems(v) => v.get_css_value_fmt(),
3463 CssProperty::AlignContent(v) => v.get_css_value_fmt(),
3464 CssProperty::ColumnGap(v) => v.get_css_value_fmt(),
3465 CssProperty::RowGap(v) => v.get_css_value_fmt(),
3466 CssProperty::GridTemplateColumns(v) => v.get_css_value_fmt(),
3467 CssProperty::GridTemplateRows(v) => v.get_css_value_fmt(),
3468 CssProperty::GridAutoFlow(v) => v.get_css_value_fmt(),
3469 CssProperty::JustifySelf(v) => v.get_css_value_fmt(),
3470 CssProperty::JustifyItems(v) => v.get_css_value_fmt(),
3471 CssProperty::Gap(v) => v.get_css_value_fmt(),
3472 CssProperty::GridGap(v) => v.get_css_value_fmt(),
3473 CssProperty::AlignSelf(v) => v.get_css_value_fmt(),
3474 CssProperty::Font(v) => v.get_css_value_fmt(),
3475 CssProperty::GridAutoColumns(v) => v.get_css_value_fmt(),
3476 CssProperty::GridAutoRows(v) => v.get_css_value_fmt(),
3477 CssProperty::GridColumn(v) => v.get_css_value_fmt(),
3478 CssProperty::GridRow(v) => v.get_css_value_fmt(),
3479 CssProperty::WritingMode(v) => v.get_css_value_fmt(),
3480 CssProperty::Clear(v) => v.get_css_value_fmt(),
3481 CssProperty::BackgroundContent(v) => v.get_css_value_fmt(),
3482 CssProperty::BackgroundPosition(v) => v.get_css_value_fmt(),
3483 CssProperty::BackgroundSize(v) => v.get_css_value_fmt(),
3484 CssProperty::BackgroundRepeat(v) => v.get_css_value_fmt(),
3485 CssProperty::OverflowX(v) => v.get_css_value_fmt(),
3486 CssProperty::OverflowY(v) => v.get_css_value_fmt(),
3487 CssProperty::PaddingTop(v) => v.get_css_value_fmt(),
3488 CssProperty::PaddingLeft(v) => v.get_css_value_fmt(),
3489 CssProperty::PaddingRight(v) => v.get_css_value_fmt(),
3490 CssProperty::PaddingBottom(v) => v.get_css_value_fmt(),
3491 CssProperty::PaddingInlineStart(v) => v.get_css_value_fmt(),
3492 CssProperty::PaddingInlineEnd(v) => v.get_css_value_fmt(),
3493 CssProperty::MarginTop(v) => v.get_css_value_fmt(),
3494 CssProperty::MarginLeft(v) => v.get_css_value_fmt(),
3495 CssProperty::MarginRight(v) => v.get_css_value_fmt(),
3496 CssProperty::MarginBottom(v) => v.get_css_value_fmt(),
3497 CssProperty::BorderTopLeftRadius(v) => v.get_css_value_fmt(),
3498 CssProperty::BorderTopRightRadius(v) => v.get_css_value_fmt(),
3499 CssProperty::BorderBottomLeftRadius(v) => v.get_css_value_fmt(),
3500 CssProperty::BorderBottomRightRadius(v) => v.get_css_value_fmt(),
3501 CssProperty::BorderTopColor(v) => v.get_css_value_fmt(),
3502 CssProperty::BorderRightColor(v) => v.get_css_value_fmt(),
3503 CssProperty::BorderLeftColor(v) => v.get_css_value_fmt(),
3504 CssProperty::BorderBottomColor(v) => v.get_css_value_fmt(),
3505 CssProperty::BorderTopStyle(v) => v.get_css_value_fmt(),
3506 CssProperty::BorderRightStyle(v) => v.get_css_value_fmt(),
3507 CssProperty::BorderLeftStyle(v) => v.get_css_value_fmt(),
3508 CssProperty::BorderBottomStyle(v) => v.get_css_value_fmt(),
3509 CssProperty::BorderTopWidth(v) => v.get_css_value_fmt(),
3510 CssProperty::BorderRightWidth(v) => v.get_css_value_fmt(),
3511 CssProperty::BorderLeftWidth(v) => v.get_css_value_fmt(),
3512 CssProperty::BorderBottomWidth(v) => v.get_css_value_fmt(),
3513 CssProperty::BoxShadowLeft(v) => v.get_css_value_fmt(),
3514 CssProperty::BoxShadowRight(v) => v.get_css_value_fmt(),
3515 CssProperty::BoxShadowTop(v) => v.get_css_value_fmt(),
3516 CssProperty::BoxShadowBottom(v) => v.get_css_value_fmt(),
3517 CssProperty::Scrollbar(v) => v.get_css_value_fmt(),
3518 CssProperty::ScrollbarWidth(v) => v.get_css_value_fmt(),
3519 CssProperty::ScrollbarColor(v) => v.get_css_value_fmt(),
3520 CssProperty::Opacity(v) => v.get_css_value_fmt(),
3521 CssProperty::Visibility(v) => v.get_css_value_fmt(),
3522 CssProperty::Transform(v) => v.get_css_value_fmt(),
3523 CssProperty::TransformOrigin(v) => v.get_css_value_fmt(),
3524 CssProperty::PerspectiveOrigin(v) => v.get_css_value_fmt(),
3525 CssProperty::BackfaceVisibility(v) => v.get_css_value_fmt(),
3526 CssProperty::MixBlendMode(v) => v.get_css_value_fmt(),
3527 CssProperty::Filter(v) => v.get_css_value_fmt(),
3528 CssProperty::BackdropFilter(v) => v.get_css_value_fmt(),
3529 CssProperty::TextShadow(v) => v.get_css_value_fmt(),
3530 CssProperty::Hyphens(v) => v.get_css_value_fmt(),
3531 CssProperty::Direction(v) => v.get_css_value_fmt(),
3532 CssProperty::UserSelect(v) => v.get_css_value_fmt(),
3533 CssProperty::TextDecoration(v) => v.get_css_value_fmt(),
3534 CssProperty::WhiteSpace(v) => v.get_css_value_fmt(),
3535 CssProperty::BreakBefore(v) => v.get_css_value_fmt(),
3536 CssProperty::BreakAfter(v) => v.get_css_value_fmt(),
3537 CssProperty::BreakInside(v) => v.get_css_value_fmt(),
3538 CssProperty::Orphans(v) => v.get_css_value_fmt(),
3539 CssProperty::Widows(v) => v.get_css_value_fmt(),
3540 CssProperty::BoxDecorationBreak(v) => v.get_css_value_fmt(),
3541 CssProperty::ColumnCount(v) => v.get_css_value_fmt(),
3542 CssProperty::ColumnWidth(v) => v.get_css_value_fmt(),
3543 CssProperty::ColumnSpan(v) => v.get_css_value_fmt(),
3544 CssProperty::ColumnFill(v) => v.get_css_value_fmt(),
3545 CssProperty::ColumnRuleWidth(v) => v.get_css_value_fmt(),
3546 CssProperty::ColumnRuleStyle(v) => v.get_css_value_fmt(),
3547 CssProperty::ColumnRuleColor(v) => v.get_css_value_fmt(),
3548 CssProperty::FlowInto(v) => v.get_css_value_fmt(),
3549 CssProperty::FlowFrom(v) => v.get_css_value_fmt(),
3550 CssProperty::ShapeOutside(v) => v.get_css_value_fmt(),
3551 CssProperty::ShapeInside(v) => v.get_css_value_fmt(),
3552 CssProperty::ClipPath(v) => v.get_css_value_fmt(),
3553 CssProperty::ShapeMargin(v) => v.get_css_value_fmt(),
3554 CssProperty::ShapeImageThreshold(v) => v.get_css_value_fmt(),
3555 CssProperty::Content(v) => v.get_css_value_fmt(),
3556 CssProperty::CounterReset(v) => v.get_css_value_fmt(),
3557 CssProperty::CounterIncrement(v) => v.get_css_value_fmt(),
3558 CssProperty::ListStyleType(v) => v.get_css_value_fmt(),
3559 CssProperty::ListStylePosition(v) => v.get_css_value_fmt(),
3560 CssProperty::StringSet(v) => v.get_css_value_fmt(),
3561 CssProperty::TableLayout(v) => v.get_css_value_fmt(),
3562 CssProperty::BorderCollapse(v) => v.get_css_value_fmt(),
3563 CssProperty::BorderSpacing(v) => v.get_css_value_fmt(),
3564 CssProperty::CaptionSide(v) => v.get_css_value_fmt(),
3565 CssProperty::EmptyCells(v) => v.get_css_value_fmt(),
3566 CssProperty::FontWeight(v) => v.get_css_value_fmt(),
3567 CssProperty::FontStyle(v) => v.get_css_value_fmt(),
3568 CssProperty::VerticalAlign(v) => v.get_css_value_fmt(),
3569 }
3570 }
3571
3572 pub fn format_css(&self) -> String {
3573 format!("{}: {};", self.key(), self.value())
3574 }
3575
3576 pub fn interpolate(
3577 &self,
3578 other: &Self,
3579 t: f32,
3580 interpolate_resolver: &InterpolateResolver,
3581 ) -> Self {
3582 if t <= 0.0 {
3583 return self.clone();
3584 } else if t >= 1.0 {
3585 return other.clone();
3586 }
3587
3588 let t: f32 = interpolate_resolver.interpolate_func.evaluate(t as f64);
3590
3591 let t = t.max(0.0).min(1.0);
3592
3593 match (self, other) {
3594 (CssProperty::TextColor(col_start), CssProperty::TextColor(col_end)) => {
3595 let col_start = col_start.get_property().copied().unwrap_or_default();
3596 let col_end = col_end.get_property().copied().unwrap_or_default();
3597 CssProperty::text_color(col_start.interpolate(&col_end, t))
3598 }
3599 (CssProperty::FontSize(fs_start), CssProperty::FontSize(fs_end)) => {
3600 let fs_start = fs_start.get_property().copied().unwrap_or_default();
3601 let fs_end = fs_end.get_property().copied().unwrap_or_default();
3602 CssProperty::font_size(fs_start.interpolate(&fs_end, t))
3603 }
3604 (CssProperty::LetterSpacing(ls_start), CssProperty::LetterSpacing(ls_end)) => {
3605 let ls_start = ls_start.get_property().copied().unwrap_or_default();
3606 let ls_end = ls_end.get_property().copied().unwrap_or_default();
3607 CssProperty::letter_spacing(ls_start.interpolate(&ls_end, t))
3608 }
3609 (CssProperty::TextIndent(ti_start), CssProperty::TextIndent(ti_end)) => {
3610 let ti_start = ti_start.get_property().copied().unwrap_or_default();
3611 let ti_end = ti_end.get_property().copied().unwrap_or_default();
3612 CssProperty::text_indent(ti_start.interpolate(&ti_end, t))
3613 }
3614 (CssProperty::LineHeight(lh_start), CssProperty::LineHeight(lh_end)) => {
3615 let lh_start = lh_start.get_property().copied().unwrap_or_default();
3616 let lh_end = lh_end.get_property().copied().unwrap_or_default();
3617 CssProperty::line_height(lh_start.interpolate(&lh_end, t))
3618 }
3619 (CssProperty::WordSpacing(ws_start), CssProperty::WordSpacing(ws_end)) => {
3620 let ws_start = ws_start.get_property().copied().unwrap_or_default();
3621 let ws_end = ws_end.get_property().copied().unwrap_or_default();
3622 CssProperty::word_spacing(ws_start.interpolate(&ws_end, t))
3623 }
3624 (CssProperty::TabWidth(tw_start), CssProperty::TabWidth(tw_end)) => {
3625 let tw_start = tw_start.get_property().copied().unwrap_or_default();
3626 let tw_end = tw_end.get_property().copied().unwrap_or_default();
3627 CssProperty::tab_width(tw_start.interpolate(&tw_end, t))
3628 }
3629 (CssProperty::Width(start), CssProperty::Width(end)) => {
3630 let start =
3631 start
3632 .get_property()
3633 .copied()
3634 .unwrap_or(LayoutWidth::Px(PixelValue::px(
3635 interpolate_resolver.current_rect_width,
3636 )));
3637 let end = end.get_property().copied().unwrap_or_default();
3638 CssProperty::Width(CssPropertyValue::Exact(start.interpolate(&end, t)))
3639 }
3640 (CssProperty::Height(start), CssProperty::Height(end)) => {
3641 let start =
3642 start
3643 .get_property()
3644 .copied()
3645 .unwrap_or(LayoutHeight::Px(PixelValue::px(
3646 interpolate_resolver.current_rect_height,
3647 )));
3648 let end = end.get_property().copied().unwrap_or_default();
3649 CssProperty::Height(CssPropertyValue::Exact(start.interpolate(&end, t)))
3650 }
3651 (CssProperty::MinWidth(start), CssProperty::MinWidth(end)) => {
3652 let start = start.get_property().copied().unwrap_or_default();
3653 let end = end.get_property().copied().unwrap_or_default();
3654 CssProperty::MinWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
3655 }
3656 (CssProperty::MinHeight(start), CssProperty::MinHeight(end)) => {
3657 let start = start.get_property().copied().unwrap_or_default();
3658 let end = end.get_property().copied().unwrap_or_default();
3659 CssProperty::MinHeight(CssPropertyValue::Exact(start.interpolate(&end, t)))
3660 }
3661 (CssProperty::MaxWidth(start), CssProperty::MaxWidth(end)) => {
3662 let start = start.get_property().copied().unwrap_or_default();
3663 let end = end.get_property().copied().unwrap_or_default();
3664 CssProperty::MaxWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
3665 }
3666 (CssProperty::MaxHeight(start), CssProperty::MaxHeight(end)) => {
3667 let start = start.get_property().copied().unwrap_or_default();
3668 let end = end.get_property().copied().unwrap_or_default();
3669 CssProperty::MaxHeight(CssPropertyValue::Exact(start.interpolate(&end, t)))
3670 }
3671 (CssProperty::Top(start), CssProperty::Top(end)) => {
3672 let start = start.get_property().copied().unwrap_or_default();
3673 let end = end.get_property().copied().unwrap_or_default();
3674 CssProperty::Top(CssPropertyValue::Exact(start.interpolate(&end, t)))
3675 }
3676 (CssProperty::Right(start), CssProperty::Right(end)) => {
3677 let start = start.get_property().copied().unwrap_or_default();
3678 let end = end.get_property().copied().unwrap_or_default();
3679 CssProperty::Right(CssPropertyValue::Exact(start.interpolate(&end, t)))
3680 }
3681 (CssProperty::Left(start), CssProperty::Left(end)) => {
3682 let start = start.get_property().copied().unwrap_or_default();
3683 let end = end.get_property().copied().unwrap_or_default();
3684 CssProperty::Left(CssPropertyValue::Exact(start.interpolate(&end, t)))
3685 }
3686 (CssProperty::Bottom(start), CssProperty::Bottom(end)) => {
3687 let start = start.get_property().copied().unwrap_or_default();
3688 let end = end.get_property().copied().unwrap_or_default();
3689 CssProperty::Bottom(CssPropertyValue::Exact(start.interpolate(&end, t)))
3690 }
3691 (CssProperty::FlexGrow(start), CssProperty::FlexGrow(end)) => {
3692 let start = start.get_property().copied().unwrap_or_default();
3693 let end = end.get_property().copied().unwrap_or_default();
3694 CssProperty::FlexGrow(CssPropertyValue::Exact(start.interpolate(&end, t)))
3695 }
3696 (CssProperty::FlexShrink(start), CssProperty::FlexShrink(end)) => {
3697 let start = start.get_property().copied().unwrap_or_default();
3698 let end = end.get_property().copied().unwrap_or_default();
3699 CssProperty::FlexShrink(CssPropertyValue::Exact(start.interpolate(&end, t)))
3700 }
3701 (CssProperty::PaddingTop(start), CssProperty::PaddingTop(end)) => {
3702 let start = start.get_property().copied().unwrap_or_default();
3703 let end = end.get_property().copied().unwrap_or_default();
3704 CssProperty::PaddingTop(CssPropertyValue::Exact(start.interpolate(&end, t)))
3705 }
3706 (CssProperty::PaddingLeft(start), CssProperty::PaddingLeft(end)) => {
3707 let start = start.get_property().copied().unwrap_or_default();
3708 let end = end.get_property().copied().unwrap_or_default();
3709 CssProperty::PaddingLeft(CssPropertyValue::Exact(start.interpolate(&end, t)))
3710 }
3711 (CssProperty::PaddingRight(start), CssProperty::PaddingRight(end)) => {
3712 let start = start.get_property().copied().unwrap_or_default();
3713 let end = end.get_property().copied().unwrap_or_default();
3714 CssProperty::PaddingRight(CssPropertyValue::Exact(start.interpolate(&end, t)))
3715 }
3716 (CssProperty::PaddingBottom(start), CssProperty::PaddingBottom(end)) => {
3717 let start = start.get_property().copied().unwrap_or_default();
3718 let end = end.get_property().copied().unwrap_or_default();
3719 CssProperty::PaddingBottom(CssPropertyValue::Exact(start.interpolate(&end, t)))
3720 }
3721 (CssProperty::MarginTop(start), CssProperty::MarginTop(end)) => {
3722 let start = start.get_property().copied().unwrap_or_default();
3723 let end = end.get_property().copied().unwrap_or_default();
3724 CssProperty::MarginTop(CssPropertyValue::Exact(start.interpolate(&end, t)))
3725 }
3726 (CssProperty::MarginLeft(start), CssProperty::MarginLeft(end)) => {
3727 let start = start.get_property().copied().unwrap_or_default();
3728 let end = end.get_property().copied().unwrap_or_default();
3729 CssProperty::MarginLeft(CssPropertyValue::Exact(start.interpolate(&end, t)))
3730 }
3731 (CssProperty::MarginRight(start), CssProperty::MarginRight(end)) => {
3732 let start = start.get_property().copied().unwrap_or_default();
3733 let end = end.get_property().copied().unwrap_or_default();
3734 CssProperty::MarginRight(CssPropertyValue::Exact(start.interpolate(&end, t)))
3735 }
3736 (CssProperty::MarginBottom(start), CssProperty::MarginBottom(end)) => {
3737 let start = start.get_property().copied().unwrap_or_default();
3738 let end = end.get_property().copied().unwrap_or_default();
3739 CssProperty::MarginBottom(CssPropertyValue::Exact(start.interpolate(&end, t)))
3740 }
3741 (CssProperty::BorderTopLeftRadius(start), CssProperty::BorderTopLeftRadius(end)) => {
3742 let start = start.get_property().copied().unwrap_or_default();
3743 let end = end.get_property().copied().unwrap_or_default();
3744 CssProperty::BorderTopLeftRadius(CssPropertyValue::Exact(
3745 start.interpolate(&end, t),
3746 ))
3747 }
3748 (CssProperty::BorderTopRightRadius(start), CssProperty::BorderTopRightRadius(end)) => {
3749 let start = start.get_property().copied().unwrap_or_default();
3750 let end = end.get_property().copied().unwrap_or_default();
3751 CssProperty::BorderTopRightRadius(CssPropertyValue::Exact(
3752 start.interpolate(&end, t),
3753 ))
3754 }
3755 (
3756 CssProperty::BorderBottomLeftRadius(start),
3757 CssProperty::BorderBottomLeftRadius(end),
3758 ) => {
3759 let start = start.get_property().copied().unwrap_or_default();
3760 let end = end.get_property().copied().unwrap_or_default();
3761 CssProperty::BorderBottomLeftRadius(CssPropertyValue::Exact(
3762 start.interpolate(&end, t),
3763 ))
3764 }
3765 (
3766 CssProperty::BorderBottomRightRadius(start),
3767 CssProperty::BorderBottomRightRadius(end),
3768 ) => {
3769 let start = start.get_property().copied().unwrap_or_default();
3770 let end = end.get_property().copied().unwrap_or_default();
3771 CssProperty::BorderBottomRightRadius(CssPropertyValue::Exact(
3772 start.interpolate(&end, t),
3773 ))
3774 }
3775 (CssProperty::BorderTopColor(start), CssProperty::BorderTopColor(end)) => {
3776 let start = start.get_property().copied().unwrap_or_default();
3777 let end = end.get_property().copied().unwrap_or_default();
3778 CssProperty::BorderTopColor(CssPropertyValue::Exact(start.interpolate(&end, t)))
3779 }
3780 (CssProperty::BorderRightColor(start), CssProperty::BorderRightColor(end)) => {
3781 let start = start.get_property().copied().unwrap_or_default();
3782 let end = end.get_property().copied().unwrap_or_default();
3783 CssProperty::BorderRightColor(CssPropertyValue::Exact(start.interpolate(&end, t)))
3784 }
3785 (CssProperty::BorderLeftColor(start), CssProperty::BorderLeftColor(end)) => {
3786 let start = start.get_property().copied().unwrap_or_default();
3787 let end = end.get_property().copied().unwrap_or_default();
3788 CssProperty::BorderLeftColor(CssPropertyValue::Exact(start.interpolate(&end, t)))
3789 }
3790 (CssProperty::BorderBottomColor(start), CssProperty::BorderBottomColor(end)) => {
3791 let start = start.get_property().copied().unwrap_or_default();
3792 let end = end.get_property().copied().unwrap_or_default();
3793 CssProperty::BorderBottomColor(CssPropertyValue::Exact(start.interpolate(&end, t)))
3794 }
3795 (CssProperty::BorderTopWidth(start), CssProperty::BorderTopWidth(end)) => {
3796 let start = start.get_property().copied().unwrap_or_default();
3797 let end = end.get_property().copied().unwrap_or_default();
3798 CssProperty::BorderTopWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
3799 }
3800 (CssProperty::BorderRightWidth(start), CssProperty::BorderRightWidth(end)) => {
3801 let start = start.get_property().copied().unwrap_or_default();
3802 let end = end.get_property().copied().unwrap_or_default();
3803 CssProperty::BorderRightWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
3804 }
3805 (CssProperty::BorderLeftWidth(start), CssProperty::BorderLeftWidth(end)) => {
3806 let start = start.get_property().copied().unwrap_or_default();
3807 let end = end.get_property().copied().unwrap_or_default();
3808 CssProperty::BorderLeftWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
3809 }
3810 (CssProperty::BorderBottomWidth(start), CssProperty::BorderBottomWidth(end)) => {
3811 let start = start.get_property().copied().unwrap_or_default();
3812 let end = end.get_property().copied().unwrap_or_default();
3813 CssProperty::BorderBottomWidth(CssPropertyValue::Exact(start.interpolate(&end, t)))
3814 }
3815 (CssProperty::Opacity(start), CssProperty::Opacity(end)) => {
3816 let start = start.get_property().copied().unwrap_or_default();
3817 let end = end.get_property().copied().unwrap_or_default();
3818 CssProperty::Opacity(CssPropertyValue::Exact(start.interpolate(&end, t)))
3819 }
3820 (CssProperty::TransformOrigin(start), CssProperty::TransformOrigin(end)) => {
3821 let start = start.get_property().copied().unwrap_or_default();
3822 let end = end.get_property().copied().unwrap_or_default();
3823 CssProperty::TransformOrigin(CssPropertyValue::Exact(start.interpolate(&end, t)))
3824 }
3825 (CssProperty::PerspectiveOrigin(start), CssProperty::PerspectiveOrigin(end)) => {
3826 let start = start.get_property().copied().unwrap_or_default();
3827 let end = end.get_property().copied().unwrap_or_default();
3828 CssProperty::PerspectiveOrigin(CssPropertyValue::Exact(start.interpolate(&end, t)))
3829 }
3830 (_, _) => {
3846 if t > 0.5 {
3848 other.clone()
3849 } else {
3850 self.clone()
3851 }
3852 }
3853 }
3854 }
3855
3856 pub const fn get_type(&self) -> CssPropertyType {
3858 match &self {
3859 CssProperty::CaretColor(_) => CssPropertyType::CaretColor,
3860 CssProperty::CaretWidth(_) => CssPropertyType::CaretWidth,
3861 CssProperty::CaretAnimationDuration(_) => CssPropertyType::CaretAnimationDuration,
3862 CssProperty::SelectionBackgroundColor(_) => CssPropertyType::SelectionBackgroundColor,
3863 CssProperty::SelectionColor(_) => CssPropertyType::SelectionColor,
3864 CssProperty::SelectionRadius(_) => CssPropertyType::SelectionRadius,
3865
3866 CssProperty::TextJustify(_) => CssPropertyType::TextJustify,
3867 CssProperty::LayoutTextJustify(_) => CssPropertyType::TextAlign, CssProperty::TextColor(_) => CssPropertyType::TextColor,
3870 CssProperty::FontSize(_) => CssPropertyType::FontSize,
3871 CssProperty::FontFamily(_) => CssPropertyType::FontFamily,
3872 CssProperty::FontWeight(_) => CssPropertyType::FontWeight,
3873 CssProperty::FontStyle(_) => CssPropertyType::FontStyle,
3874 CssProperty::TextAlign(_) => CssPropertyType::TextAlign,
3875 CssProperty::VerticalAlign(_) => CssPropertyType::VerticalAlign,
3876 CssProperty::LetterSpacing(_) => CssPropertyType::LetterSpacing,
3877 CssProperty::TextIndent(_) => CssPropertyType::TextIndent,
3878 CssProperty::InitialLetter(_) => CssPropertyType::InitialLetter,
3879 CssProperty::LineClamp(_) => CssPropertyType::LineClamp,
3880 CssProperty::HangingPunctuation(_) => CssPropertyType::HangingPunctuation,
3881 CssProperty::TextCombineUpright(_) => CssPropertyType::TextCombineUpright,
3882 CssProperty::ExclusionMargin(_) => CssPropertyType::ExclusionMargin,
3883 CssProperty::HyphenationLanguage(_) => CssPropertyType::HyphenationLanguage,
3884 CssProperty::LineHeight(_) => CssPropertyType::LineHeight,
3885 CssProperty::WordSpacing(_) => CssPropertyType::WordSpacing,
3886 CssProperty::TabWidth(_) => CssPropertyType::TabWidth,
3887 CssProperty::Cursor(_) => CssPropertyType::Cursor,
3888 CssProperty::Display(_) => CssPropertyType::Display,
3889 CssProperty::Float(_) => CssPropertyType::Float,
3890 CssProperty::BoxSizing(_) => CssPropertyType::BoxSizing,
3891 CssProperty::Width(_) => CssPropertyType::Width,
3892 CssProperty::Height(_) => CssPropertyType::Height,
3893 CssProperty::MinWidth(_) => CssPropertyType::MinWidth,
3894 CssProperty::MinHeight(_) => CssPropertyType::MinHeight,
3895 CssProperty::MaxWidth(_) => CssPropertyType::MaxWidth,
3896 CssProperty::MaxHeight(_) => CssPropertyType::MaxHeight,
3897 CssProperty::Position(_) => CssPropertyType::Position,
3898 CssProperty::Top(_) => CssPropertyType::Top,
3899 CssProperty::Right(_) => CssPropertyType::Right,
3900 CssProperty::Left(_) => CssPropertyType::Left,
3901 CssProperty::Bottom(_) => CssPropertyType::Bottom,
3902 CssProperty::ZIndex(_) => CssPropertyType::ZIndex,
3903 CssProperty::FlexWrap(_) => CssPropertyType::FlexWrap,
3904 CssProperty::FlexDirection(_) => CssPropertyType::FlexDirection,
3905 CssProperty::FlexGrow(_) => CssPropertyType::FlexGrow,
3906 CssProperty::FlexShrink(_) => CssPropertyType::FlexShrink,
3907 CssProperty::FlexBasis(_) => CssPropertyType::FlexBasis,
3908 CssProperty::JustifyContent(_) => CssPropertyType::JustifyContent,
3909 CssProperty::AlignItems(_) => CssPropertyType::AlignItems,
3910 CssProperty::AlignContent(_) => CssPropertyType::AlignContent,
3911 CssProperty::ColumnGap(_) => CssPropertyType::ColumnGap,
3912 CssProperty::RowGap(_) => CssPropertyType::RowGap,
3913 CssProperty::GridTemplateColumns(_) => CssPropertyType::GridTemplateColumns,
3914 CssProperty::GridTemplateRows(_) => CssPropertyType::GridTemplateRows,
3915 CssProperty::GridAutoColumns(_) => CssPropertyType::GridAutoColumns,
3916 CssProperty::GridAutoRows(_) => CssPropertyType::GridAutoRows,
3917 CssProperty::GridColumn(_) => CssPropertyType::GridColumn,
3918 CssProperty::GridAutoFlow(_) => CssPropertyType::GridAutoFlow,
3919 CssProperty::JustifySelf(_) => CssPropertyType::JustifySelf,
3920 CssProperty::JustifyItems(_) => CssPropertyType::JustifyItems,
3921 CssProperty::Gap(_) => CssPropertyType::Gap,
3922 CssProperty::GridGap(_) => CssPropertyType::GridGap,
3923 CssProperty::AlignSelf(_) => CssPropertyType::AlignSelf,
3924 CssProperty::Font(_) => CssPropertyType::Font,
3925 CssProperty::GridRow(_) => CssPropertyType::GridRow,
3926 CssProperty::WritingMode(_) => CssPropertyType::WritingMode,
3927 CssProperty::Clear(_) => CssPropertyType::Clear,
3928 CssProperty::BackgroundContent(_) => CssPropertyType::BackgroundContent,
3929 CssProperty::BackgroundPosition(_) => CssPropertyType::BackgroundPosition,
3930 CssProperty::BackgroundSize(_) => CssPropertyType::BackgroundSize,
3931 CssProperty::BackgroundRepeat(_) => CssPropertyType::BackgroundRepeat,
3932 CssProperty::OverflowX(_) => CssPropertyType::OverflowX,
3933 CssProperty::OverflowY(_) => CssPropertyType::OverflowY,
3934 CssProperty::PaddingTop(_) => CssPropertyType::PaddingTop,
3935 CssProperty::PaddingLeft(_) => CssPropertyType::PaddingLeft,
3936 CssProperty::PaddingRight(_) => CssPropertyType::PaddingRight,
3937 CssProperty::PaddingBottom(_) => CssPropertyType::PaddingBottom,
3938 CssProperty::PaddingInlineStart(_) => CssPropertyType::PaddingInlineStart,
3939 CssProperty::PaddingInlineEnd(_) => CssPropertyType::PaddingInlineEnd,
3940 CssProperty::MarginTop(_) => CssPropertyType::MarginTop,
3941 CssProperty::MarginLeft(_) => CssPropertyType::MarginLeft,
3942 CssProperty::MarginRight(_) => CssPropertyType::MarginRight,
3943 CssProperty::MarginBottom(_) => CssPropertyType::MarginBottom,
3944 CssProperty::BorderTopLeftRadius(_) => CssPropertyType::BorderTopLeftRadius,
3945 CssProperty::BorderTopRightRadius(_) => CssPropertyType::BorderTopRightRadius,
3946 CssProperty::BorderBottomLeftRadius(_) => CssPropertyType::BorderBottomLeftRadius,
3947 CssProperty::BorderBottomRightRadius(_) => CssPropertyType::BorderBottomRightRadius,
3948 CssProperty::BorderTopColor(_) => CssPropertyType::BorderTopColor,
3949 CssProperty::BorderRightColor(_) => CssPropertyType::BorderRightColor,
3950 CssProperty::BorderLeftColor(_) => CssPropertyType::BorderLeftColor,
3951 CssProperty::BorderBottomColor(_) => CssPropertyType::BorderBottomColor,
3952 CssProperty::BorderTopStyle(_) => CssPropertyType::BorderTopStyle,
3953 CssProperty::BorderRightStyle(_) => CssPropertyType::BorderRightStyle,
3954 CssProperty::BorderLeftStyle(_) => CssPropertyType::BorderLeftStyle,
3955 CssProperty::BorderBottomStyle(_) => CssPropertyType::BorderBottomStyle,
3956 CssProperty::BorderTopWidth(_) => CssPropertyType::BorderTopWidth,
3957 CssProperty::BorderRightWidth(_) => CssPropertyType::BorderRightWidth,
3958 CssProperty::BorderLeftWidth(_) => CssPropertyType::BorderLeftWidth,
3959 CssProperty::BorderBottomWidth(_) => CssPropertyType::BorderBottomWidth,
3960 CssProperty::BoxShadowLeft(_) => CssPropertyType::BoxShadowLeft,
3961 CssProperty::BoxShadowRight(_) => CssPropertyType::BoxShadowRight,
3962 CssProperty::BoxShadowTop(_) => CssPropertyType::BoxShadowTop,
3963 CssProperty::BoxShadowBottom(_) => CssPropertyType::BoxShadowBottom,
3964 CssProperty::Scrollbar(_) => CssPropertyType::Scrollbar,
3965 CssProperty::ScrollbarWidth(_) => CssPropertyType::ScrollbarWidth,
3966 CssProperty::ScrollbarColor(_) => CssPropertyType::ScrollbarColor,
3967 CssProperty::Opacity(_) => CssPropertyType::Opacity,
3968 CssProperty::Visibility(_) => CssPropertyType::Visibility,
3969 CssProperty::Transform(_) => CssPropertyType::Transform,
3970 CssProperty::PerspectiveOrigin(_) => CssPropertyType::PerspectiveOrigin,
3971 CssProperty::TransformOrigin(_) => CssPropertyType::TransformOrigin,
3972 CssProperty::BackfaceVisibility(_) => CssPropertyType::BackfaceVisibility,
3973 CssProperty::MixBlendMode(_) => CssPropertyType::MixBlendMode,
3974 CssProperty::Filter(_) => CssPropertyType::Filter,
3975 CssProperty::BackdropFilter(_) => CssPropertyType::BackdropFilter,
3976 CssProperty::TextShadow(_) => CssPropertyType::TextShadow,
3977 CssProperty::WhiteSpace(_) => CssPropertyType::WhiteSpace,
3978 CssProperty::Hyphens(_) => CssPropertyType::Hyphens,
3979 CssProperty::Direction(_) => CssPropertyType::Direction,
3980 CssProperty::UserSelect(_) => CssPropertyType::UserSelect,
3981 CssProperty::TextDecoration(_) => CssPropertyType::TextDecoration,
3982 CssProperty::BreakBefore(_) => CssPropertyType::BreakBefore,
3983 CssProperty::BreakAfter(_) => CssPropertyType::BreakAfter,
3984 CssProperty::BreakInside(_) => CssPropertyType::BreakInside,
3985 CssProperty::Orphans(_) => CssPropertyType::Orphans,
3986 CssProperty::Widows(_) => CssPropertyType::Widows,
3987 CssProperty::BoxDecorationBreak(_) => CssPropertyType::BoxDecorationBreak,
3988 CssProperty::ColumnCount(_) => CssPropertyType::ColumnCount,
3989 CssProperty::ColumnWidth(_) => CssPropertyType::ColumnWidth,
3990 CssProperty::ColumnSpan(_) => CssPropertyType::ColumnSpan,
3991 CssProperty::ColumnFill(_) => CssPropertyType::ColumnFill,
3992 CssProperty::ColumnRuleWidth(_) => CssPropertyType::ColumnRuleWidth,
3993 CssProperty::ColumnRuleStyle(_) => CssPropertyType::ColumnRuleStyle,
3994 CssProperty::ColumnRuleColor(_) => CssPropertyType::ColumnRuleColor,
3995 CssProperty::FlowInto(_) => CssPropertyType::FlowInto,
3996 CssProperty::FlowFrom(_) => CssPropertyType::FlowFrom,
3997 CssProperty::ShapeOutside(_) => CssPropertyType::ShapeOutside,
3998 CssProperty::ShapeInside(_) => CssPropertyType::ShapeInside,
3999 CssProperty::ClipPath(_) => CssPropertyType::ClipPath,
4000 CssProperty::ShapeMargin(_) => CssPropertyType::ShapeMargin,
4001 CssProperty::ShapeImageThreshold(_) => CssPropertyType::ShapeImageThreshold,
4002 CssProperty::Content(_) => CssPropertyType::Content,
4003 CssProperty::CounterReset(_) => CssPropertyType::CounterReset,
4004 CssProperty::CounterIncrement(_) => CssPropertyType::CounterIncrement,
4005 CssProperty::ListStyleType(_) => CssPropertyType::ListStyleType,
4006 CssProperty::ListStylePosition(_) => CssPropertyType::ListStylePosition,
4007 CssProperty::StringSet(_) => CssPropertyType::StringSet,
4008 CssProperty::TableLayout(_) => CssPropertyType::TableLayout,
4009 CssProperty::BorderCollapse(_) => CssPropertyType::BorderCollapse,
4010 CssProperty::BorderSpacing(_) => CssPropertyType::BorderSpacing,
4011 CssProperty::CaptionSide(_) => CssPropertyType::CaptionSide,
4012 CssProperty::EmptyCells(_) => CssPropertyType::EmptyCells,
4013 CssProperty::FontWeight(_) => CssPropertyType::FontWeight,
4014 CssProperty::FontStyle(_) => CssPropertyType::FontStyle,
4015 }
4016 }
4017
4018 pub const fn none(prop_type: CssPropertyType) -> Self {
4021 css_property_from_type!(prop_type, None)
4022 }
4023 pub const fn auto(prop_type: CssPropertyType) -> Self {
4024 css_property_from_type!(prop_type, Auto)
4025 }
4026 pub const fn initial(prop_type: CssPropertyType) -> Self {
4027 css_property_from_type!(prop_type, Initial)
4028 }
4029 pub const fn inherit(prop_type: CssPropertyType) -> Self {
4030 css_property_from_type!(prop_type, Inherit)
4031 }
4032
4033 pub const fn text_color(input: StyleTextColor) -> Self {
4034 CssProperty::TextColor(CssPropertyValue::Exact(input))
4035 }
4036 pub const fn font_size(input: StyleFontSize) -> Self {
4037 CssProperty::FontSize(CssPropertyValue::Exact(input))
4038 }
4039 pub const fn font_family(input: StyleFontFamilyVec) -> Self {
4040 CssProperty::FontFamily(CssPropertyValue::Exact(input))
4041 }
4042 pub const fn font_weight(input: StyleFontWeight) -> Self {
4043 CssProperty::FontWeight(CssPropertyValue::Exact(input))
4044 }
4045 pub const fn font_style(input: StyleFontStyle) -> Self {
4046 CssProperty::FontStyle(CssPropertyValue::Exact(input))
4047 }
4048 pub const fn text_align(input: StyleTextAlign) -> Self {
4049 CssProperty::TextAlign(CssPropertyValue::Exact(input))
4050 }
4051 pub const fn text_justify(input: LayoutTextJustify) -> Self {
4052 CssProperty::TextJustify(CssPropertyValue::Exact(input))
4053 }
4054 pub const fn vertical_align(input: StyleVerticalAlign) -> Self {
4055 CssProperty::VerticalAlign(CssPropertyValue::Exact(input))
4056 }
4057 pub const fn letter_spacing(input: StyleLetterSpacing) -> Self {
4058 CssProperty::LetterSpacing(CssPropertyValue::Exact(input))
4059 }
4060 pub const fn text_indent(input: StyleTextIndent) -> Self {
4061 CssProperty::TextIndent(CssPropertyValue::Exact(input))
4062 }
4063 pub const fn line_height(input: StyleLineHeight) -> Self {
4064 CssProperty::LineHeight(CssPropertyValue::Exact(input))
4065 }
4066 pub const fn word_spacing(input: StyleWordSpacing) -> Self {
4067 CssProperty::WordSpacing(CssPropertyValue::Exact(input))
4068 }
4069 pub const fn tab_width(input: StyleTabWidth) -> Self {
4070 CssProperty::TabWidth(CssPropertyValue::Exact(input))
4071 }
4072 pub const fn cursor(input: StyleCursor) -> Self {
4073 CssProperty::Cursor(CssPropertyValue::Exact(input))
4074 }
4075 pub const fn user_select(input: StyleUserSelect) -> Self {
4076 CssProperty::UserSelect(CssPropertyValue::Exact(input))
4077 }
4078 pub const fn text_decoration(input: StyleTextDecoration) -> Self {
4079 CssProperty::TextDecoration(CssPropertyValue::Exact(input))
4080 }
4081 pub const fn display(input: LayoutDisplay) -> Self {
4082 CssProperty::Display(CssPropertyValue::Exact(input))
4083 }
4084 pub const fn box_sizing(input: LayoutBoxSizing) -> Self {
4085 CssProperty::BoxSizing(CssPropertyValue::Exact(input))
4086 }
4087 pub const fn width(input: LayoutWidth) -> Self {
4088 CssProperty::Width(CssPropertyValue::Exact(input))
4089 }
4090 pub const fn height(input: LayoutHeight) -> Self {
4091 CssProperty::Height(CssPropertyValue::Exact(input))
4092 }
4093 pub const fn min_width(input: LayoutMinWidth) -> Self {
4094 CssProperty::MinWidth(CssPropertyValue::Exact(input))
4095 }
4096 pub const fn caret_color(input: CaretColor) -> Self {
4097 CssProperty::CaretColor(CssPropertyValue::Exact(input))
4098 }
4099 pub const fn caret_width(input: CaretWidth) -> Self {
4100 CssProperty::CaretWidth(CssPropertyValue::Exact(input))
4101 }
4102 pub const fn caret_animation_duration(input: CaretAnimationDuration) -> Self {
4103 CssProperty::CaretAnimationDuration(CssPropertyValue::Exact(input))
4104 }
4105 pub const fn selection_background_color(input: SelectionBackgroundColor) -> Self {
4106 CssProperty::SelectionBackgroundColor(CssPropertyValue::Exact(input))
4107 }
4108 pub const fn selection_color(input: SelectionColor) -> Self {
4109 CssProperty::SelectionColor(CssPropertyValue::Exact(input))
4110 }
4111 pub const fn min_height(input: LayoutMinHeight) -> Self {
4112 CssProperty::MinHeight(CssPropertyValue::Exact(input))
4113 }
4114 pub const fn max_width(input: LayoutMaxWidth) -> Self {
4115 CssProperty::MaxWidth(CssPropertyValue::Exact(input))
4116 }
4117 pub const fn max_height(input: LayoutMaxHeight) -> Self {
4118 CssProperty::MaxHeight(CssPropertyValue::Exact(input))
4119 }
4120 pub const fn position(input: LayoutPosition) -> Self {
4121 CssProperty::Position(CssPropertyValue::Exact(input))
4122 }
4123 pub const fn top(input: LayoutTop) -> Self {
4124 CssProperty::Top(CssPropertyValue::Exact(input))
4125 }
4126 pub const fn right(input: LayoutRight) -> Self {
4127 CssProperty::Right(CssPropertyValue::Exact(input))
4128 }
4129 pub const fn left(input: LayoutLeft) -> Self {
4130 CssProperty::Left(CssPropertyValue::Exact(input))
4131 }
4132 pub const fn bottom(input: LayoutInsetBottom) -> Self {
4133 CssProperty::Bottom(CssPropertyValue::Exact(input))
4134 }
4135 pub const fn z_index(input: LayoutZIndex) -> Self {
4136 CssProperty::ZIndex(CssPropertyValue::Exact(input))
4137 }
4138 pub const fn flex_wrap(input: LayoutFlexWrap) -> Self {
4139 CssProperty::FlexWrap(CssPropertyValue::Exact(input))
4140 }
4141 pub const fn flex_direction(input: LayoutFlexDirection) -> Self {
4142 CssProperty::FlexDirection(CssPropertyValue::Exact(input))
4143 }
4144 pub const fn flex_grow(input: LayoutFlexGrow) -> Self {
4145 CssProperty::FlexGrow(CssPropertyValue::Exact(input))
4146 }
4147 pub const fn flex_shrink(input: LayoutFlexShrink) -> Self {
4148 CssProperty::FlexShrink(CssPropertyValue::Exact(input))
4149 }
4150 pub const fn justify_content(input: LayoutJustifyContent) -> Self {
4151 CssProperty::JustifyContent(CssPropertyValue::Exact(input))
4152 }
4153 pub const fn grid_auto_flow(input: LayoutGridAutoFlow) -> Self {
4154 CssProperty::GridAutoFlow(CssPropertyValue::Exact(input))
4155 }
4156 pub const fn justify_self(input: LayoutJustifySelf) -> Self {
4157 CssProperty::JustifySelf(CssPropertyValue::Exact(input))
4158 }
4159 pub const fn justify_items(input: LayoutJustifyItems) -> Self {
4160 CssProperty::JustifyItems(CssPropertyValue::Exact(input))
4161 }
4162 pub const fn gap(input: LayoutGap) -> Self {
4163 CssProperty::Gap(CssPropertyValue::Exact(input))
4164 }
4165 pub const fn grid_gap(input: LayoutGap) -> Self {
4166 CssProperty::GridGap(CssPropertyValue::Exact(input))
4167 }
4168 pub const fn align_self(input: LayoutAlignSelf) -> Self {
4169 CssProperty::AlignSelf(CssPropertyValue::Exact(input))
4170 }
4171 pub const fn font(input: StyleFontFamilyVec) -> Self {
4172 CssProperty::Font(StyleFontValue::Exact(input))
4173 }
4174 pub const fn align_items(input: LayoutAlignItems) -> Self {
4175 CssProperty::AlignItems(CssPropertyValue::Exact(input))
4176 }
4177 pub const fn align_content(input: LayoutAlignContent) -> Self {
4178 CssProperty::AlignContent(CssPropertyValue::Exact(input))
4179 }
4180 pub const fn background_content(input: StyleBackgroundContentVec) -> Self {
4181 CssProperty::BackgroundContent(CssPropertyValue::Exact(input))
4182 }
4183 pub const fn background_position(input: StyleBackgroundPositionVec) -> Self {
4184 CssProperty::BackgroundPosition(CssPropertyValue::Exact(input))
4185 }
4186 pub const fn background_size(input: StyleBackgroundSizeVec) -> Self {
4187 CssProperty::BackgroundSize(CssPropertyValue::Exact(input))
4188 }
4189 pub const fn background_repeat(input: StyleBackgroundRepeatVec) -> Self {
4190 CssProperty::BackgroundRepeat(CssPropertyValue::Exact(input))
4191 }
4192 pub const fn overflow_x(input: LayoutOverflow) -> Self {
4193 CssProperty::OverflowX(CssPropertyValue::Exact(input))
4194 }
4195 pub const fn overflow_y(input: LayoutOverflow) -> Self {
4196 CssProperty::OverflowY(CssPropertyValue::Exact(input))
4197 }
4198 pub const fn padding_top(input: LayoutPaddingTop) -> Self {
4199 CssProperty::PaddingTop(CssPropertyValue::Exact(input))
4200 }
4201 pub const fn padding_left(input: LayoutPaddingLeft) -> Self {
4202 CssProperty::PaddingLeft(CssPropertyValue::Exact(input))
4203 }
4204 pub const fn padding_right(input: LayoutPaddingRight) -> Self {
4205 CssProperty::PaddingRight(CssPropertyValue::Exact(input))
4206 }
4207 pub const fn padding_bottom(input: LayoutPaddingBottom) -> Self {
4208 CssProperty::PaddingBottom(CssPropertyValue::Exact(input))
4209 }
4210 pub const fn margin_top(input: LayoutMarginTop) -> Self {
4211 CssProperty::MarginTop(CssPropertyValue::Exact(input))
4212 }
4213 pub const fn margin_left(input: LayoutMarginLeft) -> Self {
4214 CssProperty::MarginLeft(CssPropertyValue::Exact(input))
4215 }
4216 pub const fn margin_right(input: LayoutMarginRight) -> Self {
4217 CssProperty::MarginRight(CssPropertyValue::Exact(input))
4218 }
4219 pub const fn margin_bottom(input: LayoutMarginBottom) -> Self {
4220 CssProperty::MarginBottom(CssPropertyValue::Exact(input))
4221 }
4222 pub const fn border_top_left_radius(input: StyleBorderTopLeftRadius) -> Self {
4223 CssProperty::BorderTopLeftRadius(CssPropertyValue::Exact(input))
4224 }
4225 pub const fn border_top_right_radius(input: StyleBorderTopRightRadius) -> Self {
4226 CssProperty::BorderTopRightRadius(CssPropertyValue::Exact(input))
4227 }
4228 pub const fn border_bottom_left_radius(input: StyleBorderBottomLeftRadius) -> Self {
4229 CssProperty::BorderBottomLeftRadius(CssPropertyValue::Exact(input))
4230 }
4231 pub const fn border_bottom_right_radius(input: StyleBorderBottomRightRadius) -> Self {
4232 CssProperty::BorderBottomRightRadius(CssPropertyValue::Exact(input))
4233 }
4234 pub const fn border_top_color(input: StyleBorderTopColor) -> Self {
4235 CssProperty::BorderTopColor(CssPropertyValue::Exact(input))
4236 }
4237 pub const fn border_right_color(input: StyleBorderRightColor) -> Self {
4238 CssProperty::BorderRightColor(CssPropertyValue::Exact(input))
4239 }
4240 pub const fn border_left_color(input: StyleBorderLeftColor) -> Self {
4241 CssProperty::BorderLeftColor(CssPropertyValue::Exact(input))
4242 }
4243 pub const fn border_bottom_color(input: StyleBorderBottomColor) -> Self {
4244 CssProperty::BorderBottomColor(CssPropertyValue::Exact(input))
4245 }
4246 pub const fn border_top_style(input: StyleBorderTopStyle) -> Self {
4247 CssProperty::BorderTopStyle(CssPropertyValue::Exact(input))
4248 }
4249 pub const fn border_right_style(input: StyleBorderRightStyle) -> Self {
4250 CssProperty::BorderRightStyle(CssPropertyValue::Exact(input))
4251 }
4252 pub const fn border_left_style(input: StyleBorderLeftStyle) -> Self {
4253 CssProperty::BorderLeftStyle(CssPropertyValue::Exact(input))
4254 }
4255 pub const fn border_bottom_style(input: StyleBorderBottomStyle) -> Self {
4256 CssProperty::BorderBottomStyle(CssPropertyValue::Exact(input))
4257 }
4258 pub const fn border_top_width(input: LayoutBorderTopWidth) -> Self {
4259 CssProperty::BorderTopWidth(CssPropertyValue::Exact(input))
4260 }
4261 pub const fn border_right_width(input: LayoutBorderRightWidth) -> Self {
4262 CssProperty::BorderRightWidth(CssPropertyValue::Exact(input))
4263 }
4264 pub const fn border_left_width(input: LayoutBorderLeftWidth) -> Self {
4265 CssProperty::BorderLeftWidth(CssPropertyValue::Exact(input))
4266 }
4267 pub const fn border_bottom_width(input: LayoutBorderBottomWidth) -> Self {
4268 CssProperty::BorderBottomWidth(CssPropertyValue::Exact(input))
4269 }
4270 pub const fn box_shadow_left(input: StyleBoxShadow) -> Self {
4271 CssProperty::BoxShadowLeft(CssPropertyValue::Exact(input))
4272 }
4273 pub const fn box_shadow_right(input: StyleBoxShadow) -> Self {
4274 CssProperty::BoxShadowRight(CssPropertyValue::Exact(input))
4275 }
4276 pub const fn box_shadow_top(input: StyleBoxShadow) -> Self {
4277 CssProperty::BoxShadowTop(CssPropertyValue::Exact(input))
4278 }
4279 pub const fn box_shadow_bottom(input: StyleBoxShadow) -> Self {
4280 CssProperty::BoxShadowBottom(CssPropertyValue::Exact(input))
4281 }
4282 pub const fn opacity(input: StyleOpacity) -> Self {
4283 CssProperty::Opacity(CssPropertyValue::Exact(input))
4284 }
4285 pub const fn visibility(input: StyleVisibility) -> Self {
4286 CssProperty::Visibility(CssPropertyValue::Exact(input))
4287 }
4288 pub const fn transform(input: StyleTransformVec) -> Self {
4289 CssProperty::Transform(CssPropertyValue::Exact(input))
4290 }
4291 pub const fn transform_origin(input: StyleTransformOrigin) -> Self {
4292 CssProperty::TransformOrigin(CssPropertyValue::Exact(input))
4293 }
4294 pub const fn perspective_origin(input: StylePerspectiveOrigin) -> Self {
4295 CssProperty::PerspectiveOrigin(CssPropertyValue::Exact(input))
4296 }
4297 pub const fn backface_visiblity(input: StyleBackfaceVisibility) -> Self {
4298 CssProperty::BackfaceVisibility(CssPropertyValue::Exact(input))
4299 }
4300
4301 pub const fn break_before(input: PageBreak) -> Self {
4303 CssProperty::BreakBefore(CssPropertyValue::Exact(input))
4304 }
4305 pub const fn break_after(input: PageBreak) -> Self {
4306 CssProperty::BreakAfter(CssPropertyValue::Exact(input))
4307 }
4308 pub const fn break_inside(input: BreakInside) -> Self {
4309 CssProperty::BreakInside(CssPropertyValue::Exact(input))
4310 }
4311 pub const fn orphans(input: Orphans) -> Self {
4312 CssProperty::Orphans(CssPropertyValue::Exact(input))
4313 }
4314 pub const fn widows(input: Widows) -> Self {
4315 CssProperty::Widows(CssPropertyValue::Exact(input))
4316 }
4317 pub const fn box_decoration_break(input: BoxDecorationBreak) -> Self {
4318 CssProperty::BoxDecorationBreak(CssPropertyValue::Exact(input))
4319 }
4320 pub const fn column_count(input: ColumnCount) -> Self {
4321 CssProperty::ColumnCount(CssPropertyValue::Exact(input))
4322 }
4323 pub const fn column_width(input: ColumnWidth) -> Self {
4324 CssProperty::ColumnWidth(CssPropertyValue::Exact(input))
4325 }
4326 pub const fn column_span(input: ColumnSpan) -> Self {
4327 CssProperty::ColumnSpan(CssPropertyValue::Exact(input))
4328 }
4329 pub const fn column_fill(input: ColumnFill) -> Self {
4330 CssProperty::ColumnFill(CssPropertyValue::Exact(input))
4331 }
4332 pub const fn column_rule_width(input: ColumnRuleWidth) -> Self {
4333 CssProperty::ColumnRuleWidth(CssPropertyValue::Exact(input))
4334 }
4335 pub const fn column_rule_style(input: ColumnRuleStyle) -> Self {
4336 CssProperty::ColumnRuleStyle(CssPropertyValue::Exact(input))
4337 }
4338 pub const fn column_rule_color(input: ColumnRuleColor) -> Self {
4339 CssProperty::ColumnRuleColor(CssPropertyValue::Exact(input))
4340 }
4341 pub const fn flow_into(input: FlowInto) -> Self {
4342 CssProperty::FlowInto(CssPropertyValue::Exact(input))
4343 }
4344 pub const fn flow_from(input: FlowFrom) -> Self {
4345 CssProperty::FlowFrom(CssPropertyValue::Exact(input))
4346 }
4347 pub const fn shape_outside(input: ShapeOutside) -> Self {
4348 CssProperty::ShapeOutside(CssPropertyValue::Exact(input))
4349 }
4350 pub const fn shape_inside(input: ShapeInside) -> Self {
4351 CssProperty::ShapeInside(CssPropertyValue::Exact(input))
4352 }
4353 pub const fn clip_path(input: ClipPath) -> Self {
4354 CssProperty::ClipPath(CssPropertyValue::Exact(input))
4355 }
4356 pub const fn shape_margin(input: ShapeMargin) -> Self {
4357 CssProperty::ShapeMargin(CssPropertyValue::Exact(input))
4358 }
4359 pub const fn shape_image_threshold(input: ShapeImageThreshold) -> Self {
4360 CssProperty::ShapeImageThreshold(CssPropertyValue::Exact(input))
4361 }
4362 pub const fn content(input: Content) -> Self {
4363 CssProperty::Content(CssPropertyValue::Exact(input))
4364 }
4365 pub const fn counter_reset(input: CounterReset) -> Self {
4366 CssProperty::CounterReset(CssPropertyValue::Exact(input))
4367 }
4368 pub const fn counter_increment(input: CounterIncrement) -> Self {
4369 CssProperty::CounterIncrement(CssPropertyValue::Exact(input))
4370 }
4371 pub const fn list_style_type(input: StyleListStyleType) -> Self {
4372 CssProperty::ListStyleType(CssPropertyValue::Exact(input))
4373 }
4374 pub const fn list_style_position(input: StyleListStylePosition) -> Self {
4375 CssProperty::ListStylePosition(CssPropertyValue::Exact(input))
4376 }
4377 pub const fn string_set(input: StringSet) -> Self {
4378 CssProperty::StringSet(CssPropertyValue::Exact(input))
4379 }
4380 pub const fn table_layout(input: LayoutTableLayout) -> Self {
4381 CssProperty::TableLayout(CssPropertyValue::Exact(input))
4382 }
4383 pub const fn border_collapse(input: StyleBorderCollapse) -> Self {
4384 CssProperty::BorderCollapse(CssPropertyValue::Exact(input))
4385 }
4386 pub const fn border_spacing(input: LayoutBorderSpacing) -> Self {
4387 CssProperty::BorderSpacing(CssPropertyValue::Exact(input))
4388 }
4389 pub const fn caption_side(input: StyleCaptionSide) -> Self {
4390 CssProperty::CaptionSide(CssPropertyValue::Exact(input))
4391 }
4392 pub const fn empty_cells(input: StyleEmptyCells) -> Self {
4393 CssProperty::EmptyCells(CssPropertyValue::Exact(input))
4394 }
4395
4396 pub const fn as_z_index(&self) -> Option<&LayoutZIndexValue> {
4397 match self {
4398 CssProperty::ZIndex(f) => Some(f),
4399 _ => None,
4400 }
4401 }
4402
4403 pub const fn as_flex_basis(&self) -> Option<&LayoutFlexBasisValue> {
4404 match self {
4405 CssProperty::FlexBasis(f) => Some(f),
4406 _ => None,
4407 }
4408 }
4409
4410 pub const fn as_column_gap(&self) -> Option<&LayoutColumnGapValue> {
4411 match self {
4412 CssProperty::ColumnGap(f) => Some(f),
4413 _ => None,
4414 }
4415 }
4416
4417 pub const fn as_row_gap(&self) -> Option<&LayoutRowGapValue> {
4418 match self {
4419 CssProperty::RowGap(f) => Some(f),
4420 _ => None,
4421 }
4422 }
4423
4424 pub const fn as_grid_template_columns(&self) -> Option<&LayoutGridTemplateColumnsValue> {
4425 match self {
4426 CssProperty::GridTemplateColumns(f) => Some(f),
4427 _ => None,
4428 }
4429 }
4430
4431 pub const fn as_grid_template_rows(&self) -> Option<&LayoutGridTemplateRowsValue> {
4432 match self {
4433 CssProperty::GridTemplateRows(f) => Some(f),
4434 _ => None,
4435 }
4436 }
4437
4438 pub const fn as_grid_auto_columns(&self) -> Option<&LayoutGridAutoColumnsValue> {
4439 match self {
4440 CssProperty::GridAutoColumns(f) => Some(f),
4441 _ => None,
4442 }
4443 }
4444
4445 pub const fn as_grid_auto_rows(&self) -> Option<&LayoutGridAutoRowsValue> {
4446 match self {
4447 CssProperty::GridAutoRows(f) => Some(f),
4448 _ => None,
4449 }
4450 }
4451
4452 pub const fn as_grid_column(&self) -> Option<&LayoutGridColumnValue> {
4453 match self {
4454 CssProperty::GridColumn(f) => Some(f),
4455 _ => None,
4456 }
4457 }
4458
4459 pub const fn as_grid_row(&self) -> Option<&LayoutGridRowValue> {
4460 match self {
4461 CssProperty::GridRow(f) => Some(f),
4462 _ => None,
4463 }
4464 }
4465
4466 pub const fn as_writing_mode(&self) -> Option<&LayoutWritingModeValue> {
4467 match self {
4468 CssProperty::WritingMode(f) => Some(f),
4469 _ => None,
4470 }
4471 }
4472
4473 pub const fn as_clear(&self) -> Option<&LayoutClearValue> {
4474 match self {
4475 CssProperty::Clear(f) => Some(f),
4476 _ => None,
4477 }
4478 }
4479
4480 pub const fn as_layout_text_justify(&self) -> Option<&LayoutTextJustifyValue> {
4481 match self {
4482 CssProperty::LayoutTextJustify(f) => Some(f),
4483 _ => None,
4484 }
4485 }
4486
4487 pub const fn as_scrollbar(&self) -> Option<&ScrollbarStyleValue> {
4488 match self {
4489 CssProperty::Scrollbar(f) => Some(f),
4490 _ => None,
4491 }
4492 }
4493
4494 pub const fn as_visibility(&self) -> Option<&StyleVisibilityValue> {
4495 match self {
4496 CssProperty::Visibility(f) => Some(f),
4497 _ => None,
4498 }
4499 }
4500
4501 pub const fn as_background_content(&self) -> Option<&StyleBackgroundContentVecValue> {
4502 match self {
4503 CssProperty::BackgroundContent(f) => Some(f),
4504 _ => None,
4505 }
4506 }
4507 pub const fn as_text_justify(&self) -> Option<&LayoutTextJustifyValue> {
4508 match self {
4509 CssProperty::TextJustify(f) => Some(f),
4510 _ => None,
4511 }
4512 }
4513 pub const fn as_caret_color(&self) -> Option<&CaretColorValue> {
4514 match self {
4515 CssProperty::CaretColor(f) => Some(f),
4516 _ => None,
4517 }
4518 }
4519 pub const fn as_caret_width(&self) -> Option<&CaretWidthValue> {
4520 match self {
4521 CssProperty::CaretWidth(f) => Some(f),
4522 _ => None,
4523 }
4524 }
4525 pub const fn as_caret_animation_duration(&self) -> Option<&CaretAnimationDurationValue> {
4526 match self {
4527 CssProperty::CaretAnimationDuration(f) => Some(f),
4528 _ => None,
4529 }
4530 }
4531 pub const fn as_selection_background_color(&self) -> Option<&SelectionBackgroundColorValue> {
4532 match self {
4533 CssProperty::SelectionBackgroundColor(f) => Some(f),
4534 _ => None,
4535 }
4536 }
4537 pub const fn as_selection_color(&self) -> Option<&SelectionColorValue> {
4538 match self {
4539 CssProperty::SelectionColor(f) => Some(f),
4540 _ => None,
4541 }
4542 }
4543 pub const fn as_selection_radius(&self) -> Option<&SelectionRadiusValue> {
4544 match self {
4545 CssProperty::SelectionRadius(f) => Some(f),
4546 _ => None,
4547 }
4548 }
4549 pub const fn as_background_position(&self) -> Option<&StyleBackgroundPositionVecValue> {
4550 match self {
4551 CssProperty::BackgroundPosition(f) => Some(f),
4552 _ => None,
4553 }
4554 }
4555 pub const fn as_background_size(&self) -> Option<&StyleBackgroundSizeVecValue> {
4556 match self {
4557 CssProperty::BackgroundSize(f) => Some(f),
4558 _ => None,
4559 }
4560 }
4561 pub const fn as_background_repeat(&self) -> Option<&StyleBackgroundRepeatVecValue> {
4562 match self {
4563 CssProperty::BackgroundRepeat(f) => Some(f),
4564 _ => None,
4565 }
4566 }
4567
4568 pub const fn as_grid_auto_flow(&self) -> Option<&LayoutGridAutoFlowValue> {
4569 match self {
4570 CssProperty::GridAutoFlow(f) => Some(f),
4571 _ => None,
4572 }
4573 }
4574 pub const fn as_justify_self(&self) -> Option<&LayoutJustifySelfValue> {
4575 match self {
4576 CssProperty::JustifySelf(f) => Some(f),
4577 _ => None,
4578 }
4579 }
4580 pub const fn as_justify_items(&self) -> Option<&LayoutJustifyItemsValue> {
4581 match self {
4582 CssProperty::JustifyItems(f) => Some(f),
4583 _ => None,
4584 }
4585 }
4586 pub const fn as_gap(&self) -> Option<&LayoutGapValue> {
4587 match self {
4588 CssProperty::Gap(f) => Some(f),
4589 _ => None,
4590 }
4591 }
4592 pub const fn as_grid_gap(&self) -> Option<&LayoutGapValue> {
4593 match self {
4594 CssProperty::GridGap(f) => Some(f),
4595 _ => None,
4596 }
4597 }
4598 pub const fn as_align_self(&self) -> Option<&LayoutAlignSelfValue> {
4599 match self {
4600 CssProperty::AlignSelf(f) => Some(f),
4601 _ => None,
4602 }
4603 }
4604 pub const fn as_font(&self) -> Option<&StyleFontValue> {
4605 match self {
4606 CssProperty::Font(f) => Some(f),
4607 _ => None,
4608 }
4609 }
4610 pub const fn as_font_size(&self) -> Option<&StyleFontSizeValue> {
4611 match self {
4612 CssProperty::FontSize(f) => Some(f),
4613 _ => None,
4614 }
4615 }
4616 pub const fn as_font_family(&self) -> Option<&StyleFontFamilyVecValue> {
4617 match self {
4618 CssProperty::FontFamily(f) => Some(f),
4619 _ => None,
4620 }
4621 }
4622 pub const fn as_font_weight(&self) -> Option<&StyleFontWeightValue> {
4623 match self {
4624 CssProperty::FontWeight(f) => Some(f),
4625 _ => None,
4626 }
4627 }
4628 pub const fn as_font_style(&self) -> Option<&StyleFontStyleValue> {
4629 match self {
4630 CssProperty::FontStyle(f) => Some(f),
4631 _ => None,
4632 }
4633 }
4634 pub const fn as_text_color(&self) -> Option<&StyleTextColorValue> {
4635 match self {
4636 CssProperty::TextColor(f) => Some(f),
4637 _ => None,
4638 }
4639 }
4640 pub const fn as_text_align(&self) -> Option<&StyleTextAlignValue> {
4641 match self {
4642 CssProperty::TextAlign(f) => Some(f),
4643 _ => None,
4644 }
4645 }
4646 pub const fn as_vertical_align(&self) -> Option<&StyleVerticalAlignValue> {
4647 match self {
4648 CssProperty::VerticalAlign(f) => Some(f),
4649 _ => None,
4650 }
4651 }
4652 pub const fn as_line_height(&self) -> Option<&StyleLineHeightValue> {
4653 match self {
4654 CssProperty::LineHeight(f) => Some(f),
4655 _ => None,
4656 }
4657 }
4658 pub const fn as_text_indent(&self) -> Option<&StyleTextIndentValue> {
4659 match self {
4660 CssProperty::TextIndent(f) => Some(f),
4661 _ => None,
4662 }
4663 }
4664 pub const fn as_initial_letter(&self) -> Option<&StyleInitialLetterValue> {
4665 match self {
4666 CssProperty::InitialLetter(f) => Some(f),
4667 _ => None,
4668 }
4669 }
4670 pub const fn as_line_clamp(&self) -> Option<&StyleLineClampValue> {
4671 match self {
4672 CssProperty::LineClamp(f) => Some(f),
4673 _ => None,
4674 }
4675 }
4676 pub const fn as_hanging_punctuation(&self) -> Option<&StyleHangingPunctuationValue> {
4677 match self {
4678 CssProperty::HangingPunctuation(f) => Some(f),
4679 _ => None,
4680 }
4681 }
4682 pub const fn as_text_combine_upright(&self) -> Option<&StyleTextCombineUprightValue> {
4683 match self {
4684 CssProperty::TextCombineUpright(f) => Some(f),
4685 _ => None,
4686 }
4687 }
4688 pub const fn as_exclusion_margin(&self) -> Option<&StyleExclusionMarginValue> {
4689 match self {
4690 CssProperty::ExclusionMargin(f) => Some(f),
4691 _ => None,
4692 }
4693 }
4694 pub const fn as_hyphenation_language(&self) -> Option<&StyleHyphenationLanguageValue> {
4695 match self {
4696 CssProperty::HyphenationLanguage(f) => Some(f),
4697 _ => None,
4698 }
4699 }
4700 pub const fn as_letter_spacing(&self) -> Option<&StyleLetterSpacingValue> {
4701 match self {
4702 CssProperty::LetterSpacing(f) => Some(f),
4703 _ => None,
4704 }
4705 }
4706 pub const fn as_word_spacing(&self) -> Option<&StyleWordSpacingValue> {
4707 match self {
4708 CssProperty::WordSpacing(f) => Some(f),
4709 _ => None,
4710 }
4711 }
4712 pub const fn as_tab_width(&self) -> Option<&StyleTabWidthValue> {
4713 match self {
4714 CssProperty::TabWidth(f) => Some(f),
4715 _ => None,
4716 }
4717 }
4718 pub const fn as_cursor(&self) -> Option<&StyleCursorValue> {
4719 match self {
4720 CssProperty::Cursor(f) => Some(f),
4721 _ => None,
4722 }
4723 }
4724 pub const fn as_box_shadow_left(&self) -> Option<&StyleBoxShadowValue> {
4725 match self {
4726 CssProperty::BoxShadowLeft(f) => Some(f),
4727 _ => None,
4728 }
4729 }
4730 pub const fn as_box_shadow_right(&self) -> Option<&StyleBoxShadowValue> {
4731 match self {
4732 CssProperty::BoxShadowRight(f) => Some(f),
4733 _ => None,
4734 }
4735 }
4736 pub const fn as_box_shadow_top(&self) -> Option<&StyleBoxShadowValue> {
4737 match self {
4738 CssProperty::BoxShadowTop(f) => Some(f),
4739 _ => None,
4740 }
4741 }
4742 pub const fn as_box_shadow_bottom(&self) -> Option<&StyleBoxShadowValue> {
4743 match self {
4744 CssProperty::BoxShadowBottom(f) => Some(f),
4745 _ => None,
4746 }
4747 }
4748 pub const fn as_border_top_color(&self) -> Option<&StyleBorderTopColorValue> {
4749 match self {
4750 CssProperty::BorderTopColor(f) => Some(f),
4751 _ => None,
4752 }
4753 }
4754 pub const fn as_border_left_color(&self) -> Option<&StyleBorderLeftColorValue> {
4755 match self {
4756 CssProperty::BorderLeftColor(f) => Some(f),
4757 _ => None,
4758 }
4759 }
4760 pub const fn as_border_right_color(&self) -> Option<&StyleBorderRightColorValue> {
4761 match self {
4762 CssProperty::BorderRightColor(f) => Some(f),
4763 _ => None,
4764 }
4765 }
4766 pub const fn as_border_bottom_color(&self) -> Option<&StyleBorderBottomColorValue> {
4767 match self {
4768 CssProperty::BorderBottomColor(f) => Some(f),
4769 _ => None,
4770 }
4771 }
4772 pub const fn as_border_top_style(&self) -> Option<&StyleBorderTopStyleValue> {
4773 match self {
4774 CssProperty::BorderTopStyle(f) => Some(f),
4775 _ => None,
4776 }
4777 }
4778 pub const fn as_border_left_style(&self) -> Option<&StyleBorderLeftStyleValue> {
4779 match self {
4780 CssProperty::BorderLeftStyle(f) => Some(f),
4781 _ => None,
4782 }
4783 }
4784 pub const fn as_border_right_style(&self) -> Option<&StyleBorderRightStyleValue> {
4785 match self {
4786 CssProperty::BorderRightStyle(f) => Some(f),
4787 _ => None,
4788 }
4789 }
4790 pub const fn as_border_bottom_style(&self) -> Option<&StyleBorderBottomStyleValue> {
4791 match self {
4792 CssProperty::BorderBottomStyle(f) => Some(f),
4793 _ => None,
4794 }
4795 }
4796 pub const fn as_border_top_left_radius(&self) -> Option<&StyleBorderTopLeftRadiusValue> {
4797 match self {
4798 CssProperty::BorderTopLeftRadius(f) => Some(f),
4799 _ => None,
4800 }
4801 }
4802 pub const fn as_border_top_right_radius(&self) -> Option<&StyleBorderTopRightRadiusValue> {
4803 match self {
4804 CssProperty::BorderTopRightRadius(f) => Some(f),
4805 _ => None,
4806 }
4807 }
4808 pub const fn as_border_bottom_left_radius(&self) -> Option<&StyleBorderBottomLeftRadiusValue> {
4809 match self {
4810 CssProperty::BorderBottomLeftRadius(f) => Some(f),
4811 _ => None,
4812 }
4813 }
4814 pub const fn as_border_bottom_right_radius(
4815 &self,
4816 ) -> Option<&StyleBorderBottomRightRadiusValue> {
4817 match self {
4818 CssProperty::BorderBottomRightRadius(f) => Some(f),
4819 _ => None,
4820 }
4821 }
4822 pub const fn as_opacity(&self) -> Option<&StyleOpacityValue> {
4823 match self {
4824 CssProperty::Opacity(f) => Some(f),
4825 _ => None,
4826 }
4827 }
4828 pub const fn as_transform(&self) -> Option<&StyleTransformVecValue> {
4829 match self {
4830 CssProperty::Transform(f) => Some(f),
4831 _ => None,
4832 }
4833 }
4834 pub const fn as_transform_origin(&self) -> Option<&StyleTransformOriginValue> {
4835 match self {
4836 CssProperty::TransformOrigin(f) => Some(f),
4837 _ => None,
4838 }
4839 }
4840 pub const fn as_perspective_origin(&self) -> Option<&StylePerspectiveOriginValue> {
4841 match self {
4842 CssProperty::PerspectiveOrigin(f) => Some(f),
4843 _ => None,
4844 }
4845 }
4846 pub const fn as_backface_visibility(&self) -> Option<&StyleBackfaceVisibilityValue> {
4847 match self {
4848 CssProperty::BackfaceVisibility(f) => Some(f),
4849 _ => None,
4850 }
4851 }
4852 pub const fn as_mix_blend_mode(&self) -> Option<&StyleMixBlendModeValue> {
4853 match self {
4854 CssProperty::MixBlendMode(f) => Some(f),
4855 _ => None,
4856 }
4857 }
4858 pub const fn as_filter(&self) -> Option<&StyleFilterVecValue> {
4859 match self {
4860 CssProperty::Filter(f) => Some(f),
4861 _ => None,
4862 }
4863 }
4864 pub const fn as_backdrop_filter(&self) -> Option<&StyleFilterVecValue> {
4865 match self {
4866 CssProperty::BackdropFilter(f) => Some(f),
4867 _ => None,
4868 }
4869 }
4870 pub const fn as_text_shadow(&self) -> Option<&StyleBoxShadowValue> {
4871 match self {
4872 CssProperty::TextShadow(f) => Some(f),
4873 _ => None,
4874 }
4875 }
4876
4877 pub const fn as_display(&self) -> Option<&LayoutDisplayValue> {
4880 match self {
4881 CssProperty::Display(f) => Some(f),
4882 _ => None,
4883 }
4884 }
4885 pub const fn as_float(&self) -> Option<&LayoutFloatValue> {
4886 match self {
4887 CssProperty::Float(f) => Some(f),
4888 _ => None,
4889 }
4890 }
4891 pub const fn as_box_sizing(&self) -> Option<&LayoutBoxSizingValue> {
4892 match self {
4893 CssProperty::BoxSizing(f) => Some(f),
4894 _ => None,
4895 }
4896 }
4897 pub const fn as_width(&self) -> Option<&LayoutWidthValue> {
4898 match self {
4899 CssProperty::Width(f) => Some(f),
4900 _ => None,
4901 }
4902 }
4903 pub const fn as_height(&self) -> Option<&LayoutHeightValue> {
4904 match self {
4905 CssProperty::Height(f) => Some(f),
4906 _ => None,
4907 }
4908 }
4909 pub const fn as_min_width(&self) -> Option<&LayoutMinWidthValue> {
4910 match self {
4911 CssProperty::MinWidth(f) => Some(f),
4912 _ => None,
4913 }
4914 }
4915 pub const fn as_min_height(&self) -> Option<&LayoutMinHeightValue> {
4916 match self {
4917 CssProperty::MinHeight(f) => Some(f),
4918 _ => None,
4919 }
4920 }
4921 pub const fn as_max_width(&self) -> Option<&LayoutMaxWidthValue> {
4922 match self {
4923 CssProperty::MaxWidth(f) => Some(f),
4924 _ => None,
4925 }
4926 }
4927 pub const fn as_max_height(&self) -> Option<&LayoutMaxHeightValue> {
4928 match self {
4929 CssProperty::MaxHeight(f) => Some(f),
4930 _ => None,
4931 }
4932 }
4933 pub const fn as_position(&self) -> Option<&LayoutPositionValue> {
4934 match self {
4935 CssProperty::Position(f) => Some(f),
4936 _ => None,
4937 }
4938 }
4939 pub const fn as_top(&self) -> Option<&LayoutTopValue> {
4940 match self {
4941 CssProperty::Top(f) => Some(f),
4942 _ => None,
4943 }
4944 }
4945 pub const fn as_bottom(&self) -> Option<&LayoutInsetBottomValue> {
4946 match self {
4947 CssProperty::Bottom(f) => Some(f),
4948 _ => None,
4949 }
4950 }
4951 pub const fn as_right(&self) -> Option<&LayoutRightValue> {
4952 match self {
4953 CssProperty::Right(f) => Some(f),
4954 _ => None,
4955 }
4956 }
4957 pub const fn as_left(&self) -> Option<&LayoutLeftValue> {
4958 match self {
4959 CssProperty::Left(f) => Some(f),
4960 _ => None,
4961 }
4962 }
4963 pub const fn as_padding_top(&self) -> Option<&LayoutPaddingTopValue> {
4964 match self {
4965 CssProperty::PaddingTop(f) => Some(f),
4966 _ => None,
4967 }
4968 }
4969 pub const fn as_padding_bottom(&self) -> Option<&LayoutPaddingBottomValue> {
4970 match self {
4971 CssProperty::PaddingBottom(f) => Some(f),
4972 _ => None,
4973 }
4974 }
4975 pub const fn as_padding_left(&self) -> Option<&LayoutPaddingLeftValue> {
4976 match self {
4977 CssProperty::PaddingLeft(f) => Some(f),
4978 _ => None,
4979 }
4980 }
4981 pub const fn as_padding_right(&self) -> Option<&LayoutPaddingRightValue> {
4982 match self {
4983 CssProperty::PaddingRight(f) => Some(f),
4984 _ => None,
4985 }
4986 }
4987 pub const fn as_margin_top(&self) -> Option<&LayoutMarginTopValue> {
4988 match self {
4989 CssProperty::MarginTop(f) => Some(f),
4990 _ => None,
4991 }
4992 }
4993 pub const fn as_margin_bottom(&self) -> Option<&LayoutMarginBottomValue> {
4994 match self {
4995 CssProperty::MarginBottom(f) => Some(f),
4996 _ => None,
4997 }
4998 }
4999 pub const fn as_margin_left(&self) -> Option<&LayoutMarginLeftValue> {
5000 match self {
5001 CssProperty::MarginLeft(f) => Some(f),
5002 _ => None,
5003 }
5004 }
5005 pub const fn as_margin_right(&self) -> Option<&LayoutMarginRightValue> {
5006 match self {
5007 CssProperty::MarginRight(f) => Some(f),
5008 _ => None,
5009 }
5010 }
5011 pub const fn as_border_top_width(&self) -> Option<&LayoutBorderTopWidthValue> {
5012 match self {
5013 CssProperty::BorderTopWidth(f) => Some(f),
5014 _ => None,
5015 }
5016 }
5017 pub const fn as_border_left_width(&self) -> Option<&LayoutBorderLeftWidthValue> {
5018 match self {
5019 CssProperty::BorderLeftWidth(f) => Some(f),
5020 _ => None,
5021 }
5022 }
5023 pub const fn as_border_right_width(&self) -> Option<&LayoutBorderRightWidthValue> {
5024 match self {
5025 CssProperty::BorderRightWidth(f) => Some(f),
5026 _ => None,
5027 }
5028 }
5029 pub const fn as_border_bottom_width(&self) -> Option<&LayoutBorderBottomWidthValue> {
5030 match self {
5031 CssProperty::BorderBottomWidth(f) => Some(f),
5032 _ => None,
5033 }
5034 }
5035 pub const fn as_overflow_x(&self) -> Option<&LayoutOverflowValue> {
5036 match self {
5037 CssProperty::OverflowX(f) => Some(f),
5038 _ => None,
5039 }
5040 }
5041 pub const fn as_overflow_y(&self) -> Option<&LayoutOverflowValue> {
5042 match self {
5043 CssProperty::OverflowY(f) => Some(f),
5044 _ => None,
5045 }
5046 }
5047 pub const fn as_flex_direction(&self) -> Option<&LayoutFlexDirectionValue> {
5048 match self {
5049 CssProperty::FlexDirection(f) => Some(f),
5050 _ => None,
5051 }
5052 }
5053 pub const fn as_direction(&self) -> Option<&StyleDirectionValue> {
5054 match self {
5055 CssProperty::Direction(f) => Some(f),
5056 _ => None,
5057 }
5058 }
5059 pub const fn as_user_select(&self) -> Option<&StyleUserSelectValue> {
5060 match self {
5061 CssProperty::UserSelect(f) => Some(f),
5062 _ => None,
5063 }
5064 }
5065 pub const fn as_text_decoration(&self) -> Option<&StyleTextDecorationValue> {
5066 match self {
5067 CssProperty::TextDecoration(f) => Some(f),
5068 _ => None,
5069 }
5070 }
5071 pub const fn as_hyphens(&self) -> Option<&StyleHyphensValue> {
5072 match self {
5073 CssProperty::Hyphens(f) => Some(f),
5074 _ => None,
5075 }
5076 }
5077 pub const fn as_white_space(&self) -> Option<&StyleWhiteSpaceValue> {
5078 match self {
5079 CssProperty::WhiteSpace(f) => Some(f),
5080 _ => None,
5081 }
5082 }
5083 pub const fn as_flex_wrap(&self) -> Option<&LayoutFlexWrapValue> {
5084 match self {
5085 CssProperty::FlexWrap(f) => Some(f),
5086 _ => None,
5087 }
5088 }
5089 pub const fn as_flex_grow(&self) -> Option<&LayoutFlexGrowValue> {
5090 match self {
5091 CssProperty::FlexGrow(f) => Some(f),
5092 _ => None,
5093 }
5094 }
5095 pub const fn as_flex_shrink(&self) -> Option<&LayoutFlexShrinkValue> {
5096 match self {
5097 CssProperty::FlexShrink(f) => Some(f),
5098 _ => None,
5099 }
5100 }
5101 pub const fn as_justify_content(&self) -> Option<&LayoutJustifyContentValue> {
5102 match self {
5103 CssProperty::JustifyContent(f) => Some(f),
5104 _ => None,
5105 }
5106 }
5107 pub const fn as_align_items(&self) -> Option<&LayoutAlignItemsValue> {
5108 match self {
5109 CssProperty::AlignItems(f) => Some(f),
5110 _ => None,
5111 }
5112 }
5113 pub const fn as_align_content(&self) -> Option<&LayoutAlignContentValue> {
5114 match self {
5115 CssProperty::AlignContent(f) => Some(f),
5116 _ => None,
5117 }
5118 }
5119 pub const fn as_break_before(&self) -> Option<&PageBreakValue> {
5120 match self {
5121 CssProperty::BreakBefore(f) => Some(f),
5122 _ => None,
5123 }
5124 }
5125 pub const fn as_break_after(&self) -> Option<&PageBreakValue> {
5126 match self {
5127 CssProperty::BreakAfter(f) => Some(f),
5128 _ => None,
5129 }
5130 }
5131 pub const fn as_break_inside(&self) -> Option<&BreakInsideValue> {
5132 match self {
5133 CssProperty::BreakInside(f) => Some(f),
5134 _ => None,
5135 }
5136 }
5137 pub const fn as_orphans(&self) -> Option<&OrphansValue> {
5138 match self {
5139 CssProperty::Orphans(f) => Some(f),
5140 _ => None,
5141 }
5142 }
5143 pub const fn as_widows(&self) -> Option<&WidowsValue> {
5144 match self {
5145 CssProperty::Widows(f) => Some(f),
5146 _ => None,
5147 }
5148 }
5149 pub const fn as_box_decoration_break(&self) -> Option<&BoxDecorationBreakValue> {
5150 match self {
5151 CssProperty::BoxDecorationBreak(f) => Some(f),
5152 _ => None,
5153 }
5154 }
5155 pub const fn as_column_count(&self) -> Option<&ColumnCountValue> {
5156 match self {
5157 CssProperty::ColumnCount(f) => Some(f),
5158 _ => None,
5159 }
5160 }
5161 pub const fn as_column_width(&self) -> Option<&ColumnWidthValue> {
5162 match self {
5163 CssProperty::ColumnWidth(f) => Some(f),
5164 _ => None,
5165 }
5166 }
5167 pub const fn as_column_span(&self) -> Option<&ColumnSpanValue> {
5168 match self {
5169 CssProperty::ColumnSpan(f) => Some(f),
5170 _ => None,
5171 }
5172 }
5173 pub const fn as_column_fill(&self) -> Option<&ColumnFillValue> {
5174 match self {
5175 CssProperty::ColumnFill(f) => Some(f),
5176 _ => None,
5177 }
5178 }
5179 pub const fn as_column_rule_width(&self) -> Option<&ColumnRuleWidthValue> {
5180 match self {
5181 CssProperty::ColumnRuleWidth(f) => Some(f),
5182 _ => None,
5183 }
5184 }
5185 pub const fn as_column_rule_style(&self) -> Option<&ColumnRuleStyleValue> {
5186 match self {
5187 CssProperty::ColumnRuleStyle(f) => Some(f),
5188 _ => None,
5189 }
5190 }
5191 pub const fn as_column_rule_color(&self) -> Option<&ColumnRuleColorValue> {
5192 match self {
5193 CssProperty::ColumnRuleColor(f) => Some(f),
5194 _ => None,
5195 }
5196 }
5197 pub const fn as_flow_into(&self) -> Option<&FlowIntoValue> {
5198 match self {
5199 CssProperty::FlowInto(f) => Some(f),
5200 _ => None,
5201 }
5202 }
5203 pub const fn as_flow_from(&self) -> Option<&FlowFromValue> {
5204 match self {
5205 CssProperty::FlowFrom(f) => Some(f),
5206 _ => None,
5207 }
5208 }
5209 pub const fn as_shape_outside(&self) -> Option<&ShapeOutsideValue> {
5210 match self {
5211 CssProperty::ShapeOutside(f) => Some(f),
5212 _ => None,
5213 }
5214 }
5215 pub const fn as_shape_inside(&self) -> Option<&ShapeInsideValue> {
5216 match self {
5217 CssProperty::ShapeInside(f) => Some(f),
5218 _ => None,
5219 }
5220 }
5221 pub const fn as_clip_path(&self) -> Option<&ClipPathValue> {
5222 match self {
5223 CssProperty::ClipPath(f) => Some(f),
5224 _ => None,
5225 }
5226 }
5227 pub const fn as_shape_margin(&self) -> Option<&ShapeMarginValue> {
5228 match self {
5229 CssProperty::ShapeMargin(f) => Some(f),
5230 _ => None,
5231 }
5232 }
5233 pub const fn as_shape_image_threshold(&self) -> Option<&ShapeImageThresholdValue> {
5234 match self {
5235 CssProperty::ShapeImageThreshold(f) => Some(f),
5236 _ => None,
5237 }
5238 }
5239 pub const fn as_content(&self) -> Option<&ContentValue> {
5240 match self {
5241 CssProperty::Content(f) => Some(f),
5242 _ => None,
5243 }
5244 }
5245 pub const fn as_counter_reset(&self) -> Option<&CounterResetValue> {
5246 match self {
5247 CssProperty::CounterReset(f) => Some(f),
5248 _ => None,
5249 }
5250 }
5251 pub const fn as_counter_increment(&self) -> Option<&CounterIncrementValue> {
5252 match self {
5253 CssProperty::CounterIncrement(f) => Some(f),
5254 _ => None,
5255 }
5256 }
5257 pub const fn as_list_style_type(&self) -> Option<&StyleListStyleTypeValue> {
5258 match self {
5259 CssProperty::ListStyleType(f) => Some(f),
5260 _ => None,
5261 }
5262 }
5263 pub const fn as_list_style_position(&self) -> Option<&StyleListStylePositionValue> {
5264 match self {
5265 CssProperty::ListStylePosition(f) => Some(f),
5266 _ => None,
5267 }
5268 }
5269 pub const fn as_string_set(&self) -> Option<&StringSetValue> {
5270 match self {
5271 CssProperty::StringSet(f) => Some(f),
5272 _ => None,
5273 }
5274 }
5275 pub const fn as_table_layout(&self) -> Option<&LayoutTableLayoutValue> {
5276 match self {
5277 CssProperty::TableLayout(f) => Some(f),
5278 _ => None,
5279 }
5280 }
5281 pub const fn as_border_collapse(&self) -> Option<&StyleBorderCollapseValue> {
5282 match self {
5283 CssProperty::BorderCollapse(f) => Some(f),
5284 _ => None,
5285 }
5286 }
5287 pub const fn as_border_spacing(&self) -> Option<&LayoutBorderSpacingValue> {
5288 match self {
5289 CssProperty::BorderSpacing(f) => Some(f),
5290 _ => None,
5291 }
5292 }
5293 pub const fn as_caption_side(&self) -> Option<&StyleCaptionSideValue> {
5294 match self {
5295 CssProperty::CaptionSide(f) => Some(f),
5296 _ => None,
5297 }
5298 }
5299 pub const fn as_empty_cells(&self) -> Option<&StyleEmptyCellsValue> {
5300 match self {
5301 CssProperty::EmptyCells(f) => Some(f),
5302 _ => None,
5303 }
5304 }
5305
5306 pub const fn as_scrollbar_width(&self) -> Option<&LayoutScrollbarWidthValue> {
5307 match self {
5308 CssProperty::ScrollbarWidth(f) => Some(f),
5309 _ => None,
5310 }
5311 }
5312 pub const fn as_scrollbar_color(&self) -> Option<&StyleScrollbarColorValue> {
5313 match self {
5314 CssProperty::ScrollbarColor(f) => Some(f),
5315 _ => None,
5316 }
5317 }
5318
5319 pub fn is_initial(&self) -> bool {
5320 use self::CssProperty::*;
5321 match self {
5322 CaretColor(c) => c.is_initial(),
5323 CaretWidth(c) => c.is_initial(),
5324 CaretAnimationDuration(c) => c.is_initial(),
5325 SelectionBackgroundColor(c) => c.is_initial(),
5326 SelectionColor(c) => c.is_initial(),
5327 SelectionRadius(c) => c.is_initial(),
5328 TextJustify(c) => c.is_initial(),
5329 LayoutTextJustify(_) => false,
5330 TextColor(c) => c.is_initial(),
5331 FontSize(c) => c.is_initial(),
5332 FontFamily(c) => c.is_initial(),
5333 TextAlign(c) => c.is_initial(),
5334 LetterSpacing(c) => c.is_initial(),
5335 TextIndent(c) => c.is_initial(),
5336 InitialLetter(c) => c.is_initial(),
5337 LineClamp(c) => c.is_initial(),
5338 HangingPunctuation(c) => c.is_initial(),
5339 TextCombineUpright(c) => c.is_initial(),
5340 ExclusionMargin(c) => c.is_initial(),
5341 HyphenationLanguage(c) => c.is_initial(),
5342 LineHeight(c) => c.is_initial(),
5343 WordSpacing(c) => c.is_initial(),
5344 TabWidth(c) => c.is_initial(),
5345 Cursor(c) => c.is_initial(),
5346 Display(c) => c.is_initial(),
5347 Float(c) => c.is_initial(),
5348 BoxSizing(c) => c.is_initial(),
5349 Width(c) => c.is_initial(),
5350 Height(c) => c.is_initial(),
5351 MinWidth(c) => c.is_initial(),
5352 MinHeight(c) => c.is_initial(),
5353 MaxWidth(c) => c.is_initial(),
5354 MaxHeight(c) => c.is_initial(),
5355 Position(c) => c.is_initial(),
5356 Top(c) => c.is_initial(),
5357 Right(c) => c.is_initial(),
5358 Left(c) => c.is_initial(),
5359 Bottom(c) => c.is_initial(),
5360 ZIndex(c) => c.is_initial(),
5361 FlexWrap(c) => c.is_initial(),
5362 FlexDirection(c) => c.is_initial(),
5363 FlexGrow(c) => c.is_initial(),
5364 FlexShrink(c) => c.is_initial(),
5365 FlexBasis(c) => c.is_initial(),
5366 JustifyContent(c) => c.is_initial(),
5367 AlignItems(c) => c.is_initial(),
5368 AlignContent(c) => c.is_initial(),
5369 ColumnGap(c) => c.is_initial(),
5370 RowGap(c) => c.is_initial(),
5371 GridTemplateColumns(c) => c.is_initial(),
5372 GridTemplateRows(c) => c.is_initial(),
5373 GridAutoFlow(c) => c.is_initial(),
5374 JustifySelf(c) => c.is_initial(),
5375 JustifyItems(c) => c.is_initial(),
5376 Gap(c) => c.is_initial(),
5377 GridGap(c) => c.is_initial(),
5378 AlignSelf(c) => c.is_initial(),
5379 Font(c) => c.is_initial(),
5380 GridAutoColumns(c) => c.is_initial(),
5381 GridAutoRows(c) => c.is_initial(),
5382 GridColumn(c) => c.is_initial(),
5383 GridRow(c) => c.is_initial(),
5384 WritingMode(c) => c.is_initial(),
5385 Clear(c) => c.is_initial(),
5386 BackgroundContent(c) => c.is_initial(),
5387 BackgroundPosition(c) => c.is_initial(),
5388 BackgroundSize(c) => c.is_initial(),
5389 BackgroundRepeat(c) => c.is_initial(),
5390 OverflowX(c) => c.is_initial(),
5391 OverflowY(c) => c.is_initial(),
5392 PaddingTop(c) => c.is_initial(),
5393 PaddingLeft(c) => c.is_initial(),
5394 PaddingRight(c) => c.is_initial(),
5395 PaddingBottom(c) => c.is_initial(),
5396 PaddingInlineStart(c) => c.is_initial(),
5397 PaddingInlineEnd(c) => c.is_initial(),
5398 MarginTop(c) => c.is_initial(),
5399 MarginLeft(c) => c.is_initial(),
5400 MarginRight(c) => c.is_initial(),
5401 MarginBottom(c) => c.is_initial(),
5402 BorderTopLeftRadius(c) => c.is_initial(),
5403 BorderTopRightRadius(c) => c.is_initial(),
5404 BorderBottomLeftRadius(c) => c.is_initial(),
5405 BorderBottomRightRadius(c) => c.is_initial(),
5406 BorderTopColor(c) => c.is_initial(),
5407 BorderRightColor(c) => c.is_initial(),
5408 BorderLeftColor(c) => c.is_initial(),
5409 BorderBottomColor(c) => c.is_initial(),
5410 BorderTopStyle(c) => c.is_initial(),
5411 BorderRightStyle(c) => c.is_initial(),
5412 BorderLeftStyle(c) => c.is_initial(),
5413 BorderBottomStyle(c) => c.is_initial(),
5414 BorderTopWidth(c) => c.is_initial(),
5415 BorderRightWidth(c) => c.is_initial(),
5416 BorderLeftWidth(c) => c.is_initial(),
5417 BorderBottomWidth(c) => c.is_initial(),
5418 BoxShadowLeft(c) => c.is_initial(),
5419 BoxShadowRight(c) => c.is_initial(),
5420 BoxShadowTop(c) => c.is_initial(),
5421 BoxShadowBottom(c) => c.is_initial(),
5422 Scrollbar(c) => c.is_initial(),
5423 ScrollbarWidth(c) => c.is_initial(),
5424 ScrollbarColor(c) => c.is_initial(),
5425 Opacity(c) => c.is_initial(),
5426 Visibility(c) => c.is_initial(),
5427 Transform(c) => c.is_initial(),
5428 TransformOrigin(c) => c.is_initial(),
5429 PerspectiveOrigin(c) => c.is_initial(),
5430 BackfaceVisibility(c) => c.is_initial(),
5431 MixBlendMode(c) => c.is_initial(),
5432 Filter(c) => c.is_initial(),
5433 BackdropFilter(c) => c.is_initial(),
5434 TextShadow(c) => c.is_initial(),
5435 WhiteSpace(c) => c.is_initial(),
5436 Direction(c) => c.is_initial(),
5437 UserSelect(c) => c.is_initial(),
5438 TextDecoration(c) => c.is_initial(),
5439 Hyphens(c) => c.is_initial(),
5440 BreakBefore(c) => c.is_initial(),
5441 BreakAfter(c) => c.is_initial(),
5442 BreakInside(c) => c.is_initial(),
5443 Orphans(c) => c.is_initial(),
5444 Widows(c) => c.is_initial(),
5445 BoxDecorationBreak(c) => c.is_initial(),
5446 ColumnCount(c) => c.is_initial(),
5447 ColumnWidth(c) => c.is_initial(),
5448 ColumnSpan(c) => c.is_initial(),
5449 ColumnFill(c) => c.is_initial(),
5450 ColumnRuleWidth(c) => c.is_initial(),
5451 ColumnRuleStyle(c) => c.is_initial(),
5452 ColumnRuleColor(c) => c.is_initial(),
5453 FlowInto(c) => c.is_initial(),
5454 FlowFrom(c) => c.is_initial(),
5455 ShapeOutside(c) => c.is_initial(),
5456 ShapeInside(c) => c.is_initial(),
5457 ClipPath(c) => c.is_initial(),
5458 ShapeMargin(c) => c.is_initial(),
5459 ShapeImageThreshold(c) => c.is_initial(),
5460 Content(c) => c.is_initial(),
5461 CounterReset(c) => c.is_initial(),
5462 CounterIncrement(c) => c.is_initial(),
5463 ListStyleType(c) => c.is_initial(),
5464 ListStylePosition(c) => c.is_initial(),
5465 StringSet(c) => c.is_initial(),
5466 TableLayout(c) => c.is_initial(),
5467 BorderCollapse(c) => c.is_initial(),
5468 BorderSpacing(c) => c.is_initial(),
5469 CaptionSide(c) => c.is_initial(),
5470 EmptyCells(c) => c.is_initial(),
5471 FontWeight(c) => c.is_initial(),
5472 FontStyle(c) => c.is_initial(),
5473 VerticalAlign(c) => c.is_initial(),
5474 }
5475 }
5476
5477 pub const fn const_none(prop_type: CssPropertyType) -> Self {
5478 css_property_from_type!(prop_type, None)
5479 }
5480 pub const fn const_auto(prop_type: CssPropertyType) -> Self {
5481 css_property_from_type!(prop_type, Auto)
5482 }
5483 pub const fn const_initial(prop_type: CssPropertyType) -> Self {
5484 css_property_from_type!(prop_type, Initial)
5485 }
5486 pub const fn const_inherit(prop_type: CssPropertyType) -> Self {
5487 css_property_from_type!(prop_type, Inherit)
5488 }
5489
5490 pub const fn const_text_color(input: StyleTextColor) -> Self {
5491 CssProperty::TextColor(StyleTextColorValue::Exact(input))
5492 }
5493 pub const fn const_font_size(input: StyleFontSize) -> Self {
5494 CssProperty::FontSize(StyleFontSizeValue::Exact(input))
5495 }
5496 pub const fn const_font_family(input: StyleFontFamilyVec) -> Self {
5497 CssProperty::FontFamily(StyleFontFamilyVecValue::Exact(input))
5498 }
5499 pub const fn const_text_align(input: StyleTextAlign) -> Self {
5500 CssProperty::TextAlign(StyleTextAlignValue::Exact(input))
5501 }
5502 pub const fn const_vertical_align(input: StyleVerticalAlign) -> Self {
5503 CssProperty::VerticalAlign(StyleVerticalAlignValue::Exact(input))
5504 }
5505 pub const fn const_letter_spacing(input: StyleLetterSpacing) -> Self {
5506 CssProperty::LetterSpacing(StyleLetterSpacingValue::Exact(input))
5507 }
5508 pub const fn const_text_indent(input: StyleTextIndent) -> Self {
5509 CssProperty::TextIndent(StyleTextIndentValue::Exact(input))
5510 }
5511 pub const fn const_line_height(input: StyleLineHeight) -> Self {
5512 CssProperty::LineHeight(StyleLineHeightValue::Exact(input))
5513 }
5514 pub const fn const_word_spacing(input: StyleWordSpacing) -> Self {
5515 CssProperty::WordSpacing(StyleWordSpacingValue::Exact(input))
5516 }
5517 pub const fn const_tab_width(input: StyleTabWidth) -> Self {
5518 CssProperty::TabWidth(StyleTabWidthValue::Exact(input))
5519 }
5520 pub const fn const_cursor(input: StyleCursor) -> Self {
5521 CssProperty::Cursor(StyleCursorValue::Exact(input))
5522 }
5523 pub const fn const_display(input: LayoutDisplay) -> Self {
5524 CssProperty::Display(LayoutDisplayValue::Exact(input))
5525 }
5526 pub const fn const_float(input: LayoutFloat) -> Self {
5527 CssProperty::Float(LayoutFloatValue::Exact(input))
5528 }
5529 pub const fn const_box_sizing(input: LayoutBoxSizing) -> Self {
5530 CssProperty::BoxSizing(LayoutBoxSizingValue::Exact(input))
5531 }
5532 pub const fn const_width(input: LayoutWidth) -> Self {
5533 CssProperty::Width(LayoutWidthValue::Exact(input))
5534 }
5535 pub const fn const_height(input: LayoutHeight) -> Self {
5536 CssProperty::Height(LayoutHeightValue::Exact(input))
5537 }
5538 pub const fn const_min_width(input: LayoutMinWidth) -> Self {
5539 CssProperty::MinWidth(LayoutMinWidthValue::Exact(input))
5540 }
5541 pub const fn const_min_height(input: LayoutMinHeight) -> Self {
5542 CssProperty::MinHeight(LayoutMinHeightValue::Exact(input))
5543 }
5544 pub const fn const_max_width(input: LayoutMaxWidth) -> Self {
5545 CssProperty::MaxWidth(LayoutMaxWidthValue::Exact(input))
5546 }
5547 pub const fn const_max_height(input: LayoutMaxHeight) -> Self {
5548 CssProperty::MaxHeight(LayoutMaxHeightValue::Exact(input))
5549 }
5550 pub const fn const_position(input: LayoutPosition) -> Self {
5551 CssProperty::Position(LayoutPositionValue::Exact(input))
5552 }
5553 pub const fn const_top(input: LayoutTop) -> Self {
5554 CssProperty::Top(LayoutTopValue::Exact(input))
5555 }
5556 pub const fn const_right(input: LayoutRight) -> Self {
5557 CssProperty::Right(LayoutRightValue::Exact(input))
5558 }
5559 pub const fn const_left(input: LayoutLeft) -> Self {
5560 CssProperty::Left(LayoutLeftValue::Exact(input))
5561 }
5562 pub const fn const_bottom(input: LayoutInsetBottom) -> Self {
5563 CssProperty::Bottom(LayoutInsetBottomValue::Exact(input))
5564 }
5565 pub const fn const_flex_wrap(input: LayoutFlexWrap) -> Self {
5566 CssProperty::FlexWrap(LayoutFlexWrapValue::Exact(input))
5567 }
5568 pub const fn const_flex_direction(input: LayoutFlexDirection) -> Self {
5569 CssProperty::FlexDirection(LayoutFlexDirectionValue::Exact(input))
5570 }
5571 pub const fn const_flex_grow(input: LayoutFlexGrow) -> Self {
5572 CssProperty::FlexGrow(LayoutFlexGrowValue::Exact(input))
5573 }
5574 pub const fn const_flex_shrink(input: LayoutFlexShrink) -> Self {
5575 CssProperty::FlexShrink(LayoutFlexShrinkValue::Exact(input))
5576 }
5577 pub const fn const_justify_content(input: LayoutJustifyContent) -> Self {
5578 CssProperty::JustifyContent(LayoutJustifyContentValue::Exact(input))
5579 }
5580 pub const fn const_align_items(input: LayoutAlignItems) -> Self {
5581 CssProperty::AlignItems(LayoutAlignItemsValue::Exact(input))
5582 }
5583 pub const fn const_align_content(input: LayoutAlignContent) -> Self {
5584 CssProperty::AlignContent(LayoutAlignContentValue::Exact(input))
5585 }
5586 pub const fn const_background_content(input: StyleBackgroundContentVec) -> Self {
5587 CssProperty::BackgroundContent(StyleBackgroundContentVecValue::Exact(input))
5588 }
5589 pub const fn const_background_position(input: StyleBackgroundPositionVec) -> Self {
5590 CssProperty::BackgroundPosition(StyleBackgroundPositionVecValue::Exact(input))
5591 }
5592 pub const fn const_background_size(input: StyleBackgroundSizeVec) -> Self {
5593 CssProperty::BackgroundSize(StyleBackgroundSizeVecValue::Exact(input))
5594 }
5595 pub const fn const_background_repeat(input: StyleBackgroundRepeatVec) -> Self {
5596 CssProperty::BackgroundRepeat(StyleBackgroundRepeatVecValue::Exact(input))
5597 }
5598 pub const fn const_overflow_x(input: LayoutOverflow) -> Self {
5599 CssProperty::OverflowX(LayoutOverflowValue::Exact(input))
5600 }
5601 pub const fn const_overflow_y(input: LayoutOverflow) -> Self {
5602 CssProperty::OverflowY(LayoutOverflowValue::Exact(input))
5603 }
5604 pub const fn const_padding_top(input: LayoutPaddingTop) -> Self {
5605 CssProperty::PaddingTop(LayoutPaddingTopValue::Exact(input))
5606 }
5607 pub const fn const_padding_left(input: LayoutPaddingLeft) -> Self {
5608 CssProperty::PaddingLeft(LayoutPaddingLeftValue::Exact(input))
5609 }
5610 pub const fn const_padding_right(input: LayoutPaddingRight) -> Self {
5611 CssProperty::PaddingRight(LayoutPaddingRightValue::Exact(input))
5612 }
5613 pub const fn const_padding_bottom(input: LayoutPaddingBottom) -> Self {
5614 CssProperty::PaddingBottom(LayoutPaddingBottomValue::Exact(input))
5615 }
5616 pub const fn const_margin_top(input: LayoutMarginTop) -> Self {
5617 CssProperty::MarginTop(LayoutMarginTopValue::Exact(input))
5618 }
5619 pub const fn const_margin_left(input: LayoutMarginLeft) -> Self {
5620 CssProperty::MarginLeft(LayoutMarginLeftValue::Exact(input))
5621 }
5622 pub const fn const_margin_right(input: LayoutMarginRight) -> Self {
5623 CssProperty::MarginRight(LayoutMarginRightValue::Exact(input))
5624 }
5625 pub const fn const_margin_bottom(input: LayoutMarginBottom) -> Self {
5626 CssProperty::MarginBottom(LayoutMarginBottomValue::Exact(input))
5627 }
5628 pub const fn const_border_top_left_radius(input: StyleBorderTopLeftRadius) -> Self {
5629 CssProperty::BorderTopLeftRadius(StyleBorderTopLeftRadiusValue::Exact(input))
5630 }
5631 pub const fn const_border_top_right_radius(input: StyleBorderTopRightRadius) -> Self {
5632 CssProperty::BorderTopRightRadius(StyleBorderTopRightRadiusValue::Exact(input))
5633 }
5634 pub const fn const_border_bottom_left_radius(input: StyleBorderBottomLeftRadius) -> Self {
5635 CssProperty::BorderBottomLeftRadius(StyleBorderBottomLeftRadiusValue::Exact(input))
5636 }
5637 pub const fn const_border_bottom_right_radius(input: StyleBorderBottomRightRadius) -> Self {
5638 CssProperty::BorderBottomRightRadius(StyleBorderBottomRightRadiusValue::Exact(input))
5639 }
5640 pub const fn const_border_top_color(input: StyleBorderTopColor) -> Self {
5641 CssProperty::BorderTopColor(StyleBorderTopColorValue::Exact(input))
5642 }
5643 pub const fn const_border_right_color(input: StyleBorderRightColor) -> Self {
5644 CssProperty::BorderRightColor(StyleBorderRightColorValue::Exact(input))
5645 }
5646 pub const fn const_border_left_color(input: StyleBorderLeftColor) -> Self {
5647 CssProperty::BorderLeftColor(StyleBorderLeftColorValue::Exact(input))
5648 }
5649 pub const fn const_border_bottom_color(input: StyleBorderBottomColor) -> Self {
5650 CssProperty::BorderBottomColor(StyleBorderBottomColorValue::Exact(input))
5651 }
5652 pub const fn const_border_top_style(input: StyleBorderTopStyle) -> Self {
5653 CssProperty::BorderTopStyle(StyleBorderTopStyleValue::Exact(input))
5654 }
5655 pub const fn const_border_right_style(input: StyleBorderRightStyle) -> Self {
5656 CssProperty::BorderRightStyle(StyleBorderRightStyleValue::Exact(input))
5657 }
5658 pub const fn const_border_left_style(input: StyleBorderLeftStyle) -> Self {
5659 CssProperty::BorderLeftStyle(StyleBorderLeftStyleValue::Exact(input))
5660 }
5661 pub const fn const_border_bottom_style(input: StyleBorderBottomStyle) -> Self {
5662 CssProperty::BorderBottomStyle(StyleBorderBottomStyleValue::Exact(input))
5663 }
5664 pub const fn const_border_top_width(input: LayoutBorderTopWidth) -> Self {
5665 CssProperty::BorderTopWidth(LayoutBorderTopWidthValue::Exact(input))
5666 }
5667 pub const fn const_border_right_width(input: LayoutBorderRightWidth) -> Self {
5668 CssProperty::BorderRightWidth(LayoutBorderRightWidthValue::Exact(input))
5669 }
5670 pub const fn const_border_left_width(input: LayoutBorderLeftWidth) -> Self {
5671 CssProperty::BorderLeftWidth(LayoutBorderLeftWidthValue::Exact(input))
5672 }
5673 pub const fn const_border_bottom_width(input: LayoutBorderBottomWidth) -> Self {
5674 CssProperty::BorderBottomWidth(LayoutBorderBottomWidthValue::Exact(input))
5675 }
5676 pub const fn const_box_shadow_left(input: StyleBoxShadow) -> Self {
5677 CssProperty::BoxShadowLeft(StyleBoxShadowValue::Exact(input))
5678 }
5679 pub const fn const_box_shadow_right(input: StyleBoxShadow) -> Self {
5680 CssProperty::BoxShadowRight(StyleBoxShadowValue::Exact(input))
5681 }
5682 pub const fn const_box_shadow_top(input: StyleBoxShadow) -> Self {
5683 CssProperty::BoxShadowTop(StyleBoxShadowValue::Exact(input))
5684 }
5685 pub const fn const_box_shadow_bottom(input: StyleBoxShadow) -> Self {
5686 CssProperty::BoxShadowBottom(StyleBoxShadowValue::Exact(input))
5687 }
5688 pub const fn const_opacity(input: StyleOpacity) -> Self {
5689 CssProperty::Opacity(StyleOpacityValue::Exact(input))
5690 }
5691 pub const fn const_transform(input: StyleTransformVec) -> Self {
5692 CssProperty::Transform(StyleTransformVecValue::Exact(input))
5693 }
5694 pub const fn const_transform_origin(input: StyleTransformOrigin) -> Self {
5695 CssProperty::TransformOrigin(StyleTransformOriginValue::Exact(input))
5696 }
5697 pub const fn const_perspective_origin(input: StylePerspectiveOrigin) -> Self {
5698 CssProperty::PerspectiveOrigin(StylePerspectiveOriginValue::Exact(input))
5699 }
5700 pub const fn const_backface_visiblity(input: StyleBackfaceVisibility) -> Self {
5701 CssProperty::BackfaceVisibility(StyleBackfaceVisibilityValue::Exact(input))
5702 }
5703 pub const fn const_break_before(input: PageBreak) -> Self {
5704 CssProperty::BreakBefore(PageBreakValue::Exact(input))
5705 }
5706 pub const fn const_break_after(input: PageBreak) -> Self {
5707 CssProperty::BreakAfter(PageBreakValue::Exact(input))
5708 }
5709 pub const fn const_break_inside(input: BreakInside) -> Self {
5710 CssProperty::BreakInside(BreakInsideValue::Exact(input))
5711 }
5712 pub const fn const_orphans(input: Orphans) -> Self {
5713 CssProperty::Orphans(OrphansValue::Exact(input))
5714 }
5715 pub const fn const_widows(input: Widows) -> Self {
5716 CssProperty::Widows(WidowsValue::Exact(input))
5717 }
5718 pub const fn const_box_decoration_break(input: BoxDecorationBreak) -> Self {
5719 CssProperty::BoxDecorationBreak(BoxDecorationBreakValue::Exact(input))
5720 }
5721 pub const fn const_column_count(input: ColumnCount) -> Self {
5722 CssProperty::ColumnCount(ColumnCountValue::Exact(input))
5723 }
5724 pub const fn const_column_width(input: ColumnWidth) -> Self {
5725 CssProperty::ColumnWidth(ColumnWidthValue::Exact(input))
5726 }
5727 pub const fn const_column_span(input: ColumnSpan) -> Self {
5728 CssProperty::ColumnSpan(ColumnSpanValue::Exact(input))
5729 }
5730 pub const fn const_column_fill(input: ColumnFill) -> Self {
5731 CssProperty::ColumnFill(ColumnFillValue::Exact(input))
5732 }
5733 pub const fn const_column_rule_width(input: ColumnRuleWidth) -> Self {
5734 CssProperty::ColumnRuleWidth(ColumnRuleWidthValue::Exact(input))
5735 }
5736 pub const fn const_column_rule_style(input: ColumnRuleStyle) -> Self {
5737 CssProperty::ColumnRuleStyle(ColumnRuleStyleValue::Exact(input))
5738 }
5739 pub const fn const_column_rule_color(input: ColumnRuleColor) -> Self {
5740 CssProperty::ColumnRuleColor(ColumnRuleColorValue::Exact(input))
5741 }
5742 pub const fn const_flow_into(input: FlowInto) -> Self {
5743 CssProperty::FlowInto(FlowIntoValue::Exact(input))
5744 }
5745 pub const fn const_flow_from(input: FlowFrom) -> Self {
5746 CssProperty::FlowFrom(FlowFromValue::Exact(input))
5747 }
5748 pub const fn const_shape_outside(input: ShapeOutside) -> Self {
5749 CssProperty::ShapeOutside(ShapeOutsideValue::Exact(input))
5750 }
5751 pub const fn const_shape_inside(input: ShapeInside) -> Self {
5752 CssProperty::ShapeInside(ShapeInsideValue::Exact(input))
5753 }
5754 pub const fn const_clip_path(input: ClipPath) -> Self {
5755 CssProperty::ClipPath(ClipPathValue::Exact(input))
5756 }
5757 pub const fn const_shape_margin(input: ShapeMargin) -> Self {
5758 CssProperty::ShapeMargin(ShapeMarginValue::Exact(input))
5759 }
5760 pub const fn const_shape_image_threshold(input: ShapeImageThreshold) -> Self {
5761 CssProperty::ShapeImageThreshold(ShapeImageThresholdValue::Exact(input))
5762 }
5763 pub const fn const_content(input: Content) -> Self {
5764 CssProperty::Content(ContentValue::Exact(input))
5765 }
5766 pub const fn const_counter_reset(input: CounterReset) -> Self {
5767 CssProperty::CounterReset(CounterResetValue::Exact(input))
5768 }
5769 pub const fn const_counter_increment(input: CounterIncrement) -> Self {
5770 CssProperty::CounterIncrement(CounterIncrementValue::Exact(input))
5771 }
5772 pub const fn const_list_style_type(input: StyleListStyleType) -> Self {
5773 CssProperty::ListStyleType(StyleListStyleTypeValue::Exact(input))
5774 }
5775 pub const fn const_list_style_position(input: StyleListStylePosition) -> Self {
5776 CssProperty::ListStylePosition(StyleListStylePositionValue::Exact(input))
5777 }
5778 pub const fn const_string_set(input: StringSet) -> Self {
5779 CssProperty::StringSet(StringSetValue::Exact(input))
5780 }
5781 pub const fn const_table_layout(input: LayoutTableLayout) -> Self {
5782 CssProperty::TableLayout(LayoutTableLayoutValue::Exact(input))
5783 }
5784 pub const fn const_border_collapse(input: StyleBorderCollapse) -> Self {
5785 CssProperty::BorderCollapse(StyleBorderCollapseValue::Exact(input))
5786 }
5787 pub const fn const_border_spacing(input: LayoutBorderSpacing) -> Self {
5788 CssProperty::BorderSpacing(LayoutBorderSpacingValue::Exact(input))
5789 }
5790 pub const fn const_caption_side(input: StyleCaptionSide) -> Self {
5791 CssProperty::CaptionSide(StyleCaptionSideValue::Exact(input))
5792 }
5793 pub const fn const_empty_cells(input: StyleEmptyCells) -> Self {
5794 CssProperty::EmptyCells(StyleEmptyCellsValue::Exact(input))
5795 }
5796}
5797
5798pub fn format_static_css_prop(prop: &CssProperty, tabs: usize) -> String {
5799 match prop {
5800 CssProperty::CaretColor(p) => format!(
5801 "CssProperty::CaretColor({})",
5802 print_css_property_value(p, tabs, "CaretColor")
5803 ),
5804 CssProperty::CaretWidth(p) => format!(
5805 "CssProperty::CaretWidth({})",
5806 print_css_property_value(p, tabs, "CaretWidth")
5807 ),
5808 CssProperty::CaretAnimationDuration(p) => format!(
5809 "CssProperty::CaretAnimationDuration({})",
5810 print_css_property_value(p, tabs, "CaretAnimationDuration")
5811 ),
5812 CssProperty::SelectionBackgroundColor(p) => format!(
5813 "CssProperty::SelectionBackgroundColor({})",
5814 print_css_property_value(p, tabs, "SelectionBackgroundColor")
5815 ),
5816 CssProperty::SelectionColor(p) => format!(
5817 "CssProperty::SelectionColor({})",
5818 print_css_property_value(p, tabs, "SelectionColor")
5819 ),
5820 CssProperty::SelectionRadius(p) => format!(
5821 "CssProperty::SelectionRadius({})",
5822 print_css_property_value(p, tabs, "SelectionRadius")
5823 ),
5824 CssProperty::TextJustify(p) => format!(
5825 "CssProperty::TextJustify({})",
5826 print_css_property_value(p, tabs, "LayoutTextJustify")
5827 ),
5828 CssProperty::LayoutTextJustify(j) => format!(
5829 "CssProperty::LayoutTextJustify({})",
5830 print_css_property_value(j, tabs, "LayoutText")
5831 ),
5832 CssProperty::TextColor(p) => format!(
5833 "CssProperty::TextColor({})",
5834 print_css_property_value(p, tabs, "StyleTextColor")
5835 ),
5836 CssProperty::FontSize(p) => format!(
5837 "CssProperty::FontSize({})",
5838 print_css_property_value(p, tabs, "StyleFontSize")
5839 ),
5840 CssProperty::FontFamily(p) => format!(
5841 "CssProperty::FontFamily({})",
5842 print_css_property_value(p, tabs, "StyleFontFamilyVec")
5843 ),
5844 CssProperty::TextAlign(p) => format!(
5845 "CssProperty::TextAlign({})",
5846 print_css_property_value(p, tabs, "StyleTextAlign")
5847 ),
5848 CssProperty::VerticalAlign(p) => format!(
5849 "CssProperty::VerticalAlign({})",
5850 print_css_property_value(p, tabs, "StyleVerticalAlign")
5851 ),
5852 CssProperty::LetterSpacing(p) => format!(
5853 "CssProperty::LetterSpacing({})",
5854 print_css_property_value(p, tabs, "StyleLetterSpacing")
5855 ),
5856 CssProperty::TextIndent(p) => format!(
5857 "CssProperty::TextIndent({})",
5858 print_css_property_value(p, tabs, "StyleTextIndent")
5859 ),
5860 CssProperty::InitialLetter(p) => format!(
5861 "CssProperty::InitialLetter({})",
5862 print_css_property_value(p, tabs, "StyleInitialLetter")
5863 ),
5864 CssProperty::LineClamp(p) => format!(
5865 "CssProperty::LineClamp({})",
5866 print_css_property_value(p, tabs, "StyleLineClamp")
5867 ),
5868 CssProperty::HangingPunctuation(p) => format!(
5869 "CssProperty::HangingPunctuation({})",
5870 print_css_property_value(p, tabs, "StyleHangingPunctuation")
5871 ),
5872 CssProperty::TextCombineUpright(p) => format!(
5873 "CssProperty::TextCombineUpright({})",
5874 print_css_property_value(p, tabs, "StyleTextCombineUpright")
5875 ),
5876 CssProperty::ExclusionMargin(p) => format!(
5877 "CssProperty::ExclusionMargin({})",
5878 print_css_property_value(p, tabs, "StyleExclusionMargin")
5879 ),
5880 CssProperty::HyphenationLanguage(p) => format!(
5881 "CssProperty::HyphenationLanguage({})",
5882 print_css_property_value(p, tabs, "StyleHyphenationLanguage")
5883 ),
5884 CssProperty::LineHeight(p) => format!(
5885 "CssProperty::LineHeight({})",
5886 print_css_property_value(p, tabs, "StyleLineHeight")
5887 ),
5888 CssProperty::WordSpacing(p) => format!(
5889 "CssProperty::WordSpacing({})",
5890 print_css_property_value(p, tabs, "StyleWordSpacing")
5891 ),
5892 CssProperty::TabWidth(p) => format!(
5893 "CssProperty::TabWidth({})",
5894 print_css_property_value(p, tabs, "StyleTabWidth")
5895 ),
5896 CssProperty::Cursor(p) => format!(
5897 "CssProperty::Cursor({})",
5898 print_css_property_value(p, tabs, "StyleCursor")
5899 ),
5900 CssProperty::Display(p) => format!(
5901 "CssProperty::Display({})",
5902 print_css_property_value(p, tabs, "LayoutDisplay")
5903 ),
5904 CssProperty::Float(p) => format!(
5905 "CssProperty::Float({})",
5906 print_css_property_value(p, tabs, "LayoutFloat")
5907 ),
5908 CssProperty::BoxSizing(p) => format!(
5909 "CssProperty::BoxSizing({})",
5910 print_css_property_value(p, tabs, "LayoutBoxSizing")
5911 ),
5912 CssProperty::Width(p) => format!(
5913 "CssProperty::Width({})",
5914 print_css_property_value(p, tabs, "LayoutWidth")
5915 ),
5916 CssProperty::Height(p) => format!(
5917 "CssProperty::Height({})",
5918 print_css_property_value(p, tabs, "LayoutHeight")
5919 ),
5920 CssProperty::MinWidth(p) => format!(
5921 "CssProperty::MinWidth({})",
5922 print_css_property_value(p, tabs, "LayoutMinWidth")
5923 ),
5924 CssProperty::MinHeight(p) => format!(
5925 "CssProperty::MinHeight({})",
5926 print_css_property_value(p, tabs, "LayoutMinHeight")
5927 ),
5928 CssProperty::MaxWidth(p) => format!(
5929 "CssProperty::MaxWidth({})",
5930 print_css_property_value(p, tabs, "LayoutMaxWidth")
5931 ),
5932 CssProperty::MaxHeight(p) => format!(
5933 "CssProperty::MaxHeight({})",
5934 print_css_property_value(p, tabs, "LayoutMaxHeight")
5935 ),
5936 CssProperty::Position(p) => format!(
5937 "CssProperty::Position({})",
5938 print_css_property_value(p, tabs, "LayoutPosition")
5939 ),
5940 CssProperty::Top(p) => format!(
5941 "CssProperty::Top({})",
5942 print_css_property_value(p, tabs, "LayoutTop")
5943 ),
5944 CssProperty::Right(p) => format!(
5945 "CssProperty::Right({})",
5946 print_css_property_value(p, tabs, "LayoutRight")
5947 ),
5948 CssProperty::Left(p) => format!(
5949 "CssProperty::Left({})",
5950 print_css_property_value(p, tabs, "LayoutLeft")
5951 ),
5952 CssProperty::Bottom(p) => format!(
5953 "CssProperty::Bottom({})",
5954 print_css_property_value(p, tabs, "LayoutInsetBottom")
5955 ),
5956 CssProperty::ZIndex(p) => format!(
5957 "CssProperty::ZIndex({})",
5958 print_css_property_value(p, tabs, "LayoutZIndex")
5959 ),
5960 CssProperty::FlexWrap(p) => format!(
5961 "CssProperty::FlexWrap({})",
5962 print_css_property_value(p, tabs, "LayoutFlexWrap")
5963 ),
5964 CssProperty::FlexDirection(p) => format!(
5965 "CssProperty::FlexDirection({})",
5966 print_css_property_value(p, tabs, "LayoutFlexDirection")
5967 ),
5968 CssProperty::FlexGrow(p) => format!(
5969 "CssProperty::FlexGrow({})",
5970 print_css_property_value(p, tabs, "LayoutFlexGrow")
5971 ),
5972 CssProperty::FlexShrink(p) => format!(
5973 "CssProperty::FlexShrink({})",
5974 print_css_property_value(p, tabs, "LayoutFlexShrink")
5975 ),
5976 CssProperty::JustifyContent(p) => format!(
5977 "CssProperty::JustifyContent({})",
5978 print_css_property_value(p, tabs, "LayoutJustifyContent")
5979 ),
5980 CssProperty::AlignItems(p) => format!(
5981 "CssProperty::AlignItems({})",
5982 print_css_property_value(p, tabs, "LayoutAlignItems")
5983 ),
5984 CssProperty::AlignContent(p) => format!(
5985 "CssProperty::AlignContent({})",
5986 print_css_property_value(p, tabs, "LayoutAlignContent")
5987 ),
5988 CssProperty::BackgroundContent(p) => format!(
5989 "CssProperty::BackgroundContent({})",
5990 print_css_property_value(p, tabs, "StyleBackgroundContentVec")
5991 ),
5992 CssProperty::BackgroundPosition(p) => format!(
5993 "CssProperty::BackgroundPosition({})",
5994 print_css_property_value(p, tabs, "StyleBackgroundPositionVec")
5995 ),
5996 CssProperty::BackgroundSize(p) => format!(
5997 "CssProperty::BackgroundSize({})",
5998 print_css_property_value(p, tabs, "StyleBackgroundSizeVec")
5999 ),
6000 CssProperty::BackgroundRepeat(p) => format!(
6001 "CssProperty::BackgroundRepeat({})",
6002 print_css_property_value(p, tabs, "StyleBackgroundRepeatVec")
6003 ),
6004 CssProperty::OverflowX(p) => format!(
6005 "CssProperty::OverflowX({})",
6006 print_css_property_value(p, tabs, "LayoutOverflow")
6007 ),
6008 CssProperty::OverflowY(p) => format!(
6009 "CssProperty::OverflowY({})",
6010 print_css_property_value(p, tabs, "LayoutOverflow")
6011 ),
6012 CssProperty::PaddingTop(p) => format!(
6013 "CssProperty::PaddingTop({})",
6014 print_css_property_value(p, tabs, "LayoutPaddingTop")
6015 ),
6016 CssProperty::PaddingLeft(p) => format!(
6017 "CssProperty::PaddingLeft({})",
6018 print_css_property_value(p, tabs, "LayoutPaddingLeft")
6019 ),
6020 CssProperty::PaddingRight(p) => format!(
6021 "CssProperty::PaddingRight({})",
6022 print_css_property_value(p, tabs, "LayoutPaddingRight")
6023 ),
6024 CssProperty::PaddingBottom(p) => format!(
6025 "CssProperty::PaddingBottom({})",
6026 print_css_property_value(p, tabs, "LayoutPaddingBottom")
6027 ),
6028 CssProperty::PaddingInlineStart(p) => format!(
6029 "CssProperty::PaddingInlineStart({})",
6030 print_css_property_value(p, tabs, "LayoutPaddingInlineStart")
6031 ),
6032 CssProperty::PaddingInlineEnd(p) => format!(
6033 "CssProperty::PaddingInlineEnd({})",
6034 print_css_property_value(p, tabs, "LayoutPaddingInlineEnd")
6035 ),
6036 CssProperty::MarginTop(p) => format!(
6037 "CssProperty::MarginTop({})",
6038 print_css_property_value(p, tabs, "LayoutMarginTop")
6039 ),
6040 CssProperty::MarginLeft(p) => format!(
6041 "CssProperty::MarginLeft({})",
6042 print_css_property_value(p, tabs, "LayoutMarginLeft")
6043 ),
6044 CssProperty::MarginRight(p) => format!(
6045 "CssProperty::MarginRight({})",
6046 print_css_property_value(p, tabs, "LayoutMarginRight")
6047 ),
6048 CssProperty::MarginBottom(p) => format!(
6049 "CssProperty::MarginBottom({})",
6050 print_css_property_value(p, tabs, "LayoutMarginBottom")
6051 ),
6052 CssProperty::BorderTopLeftRadius(p) => format!(
6053 "CssProperty::BorderTopLeftRadius({})",
6054 print_css_property_value(p, tabs, "StyleBorderTopLeftRadius")
6055 ),
6056 CssProperty::BorderTopRightRadius(p) => format!(
6057 "CssProperty::BorderTopRightRadius({})",
6058 print_css_property_value(p, tabs, "StyleBorderTopRightRadius")
6059 ),
6060 CssProperty::BorderBottomLeftRadius(p) => format!(
6061 "CssProperty::BorderBottomLeftRadius({})",
6062 print_css_property_value(p, tabs, "StyleBorderBottomLeftRadius")
6063 ),
6064 CssProperty::BorderBottomRightRadius(p) => format!(
6065 "CssProperty::BorderBottomRightRadius({})",
6066 print_css_property_value(p, tabs, "StyleBorderBottomRightRadius")
6067 ),
6068 CssProperty::BorderTopColor(p) => format!(
6069 "CssProperty::BorderTopColor({})",
6070 print_css_property_value(p, tabs, "StyleBorderTopColor")
6071 ),
6072 CssProperty::BorderRightColor(p) => format!(
6073 "CssProperty::BorderRightColor({})",
6074 print_css_property_value(p, tabs, "StyleBorderRightColor")
6075 ),
6076 CssProperty::BorderLeftColor(p) => format!(
6077 "CssProperty::BorderLeftColor({})",
6078 print_css_property_value(p, tabs, "StyleBorderLeftColor")
6079 ),
6080 CssProperty::BorderBottomColor(p) => format!(
6081 "CssProperty::BorderBottomColor({})",
6082 print_css_property_value(p, tabs, "StyleBorderBottomColor")
6083 ),
6084 CssProperty::BorderTopStyle(p) => format!(
6085 "CssProperty::BorderTopStyle({})",
6086 print_css_property_value(p, tabs, "StyleBorderTopStyle")
6087 ),
6088 CssProperty::BorderRightStyle(p) => format!(
6089 "CssProperty::BorderRightStyle({})",
6090 print_css_property_value(p, tabs, "StyleBorderRightStyle")
6091 ),
6092 CssProperty::BorderLeftStyle(p) => format!(
6093 "CssProperty::BorderLeftStyle({})",
6094 print_css_property_value(p, tabs, "StyleBorderLeftStyle")
6095 ),
6096 CssProperty::BorderBottomStyle(p) => format!(
6097 "CssProperty::BorderBottomStyle({})",
6098 print_css_property_value(p, tabs, "StyleBorderBottomStyle")
6099 ),
6100 CssProperty::BorderTopWidth(p) => format!(
6101 "CssProperty::BorderTopWidth({})",
6102 print_css_property_value(p, tabs, "LayoutBorderTopWidth")
6103 ),
6104 CssProperty::BorderRightWidth(p) => format!(
6105 "CssProperty::BorderRightWidth({})",
6106 print_css_property_value(p, tabs, "LayoutBorderRightWidth")
6107 ),
6108 CssProperty::BorderLeftWidth(p) => format!(
6109 "CssProperty::BorderLeftWidth({})",
6110 print_css_property_value(p, tabs, "LayoutBorderLeftWidth")
6111 ),
6112 CssProperty::BorderBottomWidth(p) => format!(
6113 "CssProperty::BorderBottomWidth({})",
6114 print_css_property_value(p, tabs, "LayoutBorderBottomWidth")
6115 ),
6116 CssProperty::BoxShadowLeft(p) => format!(
6117 "CssProperty::BoxShadowLeft({})",
6118 print_css_property_value(p, tabs, "StyleBoxShadow")
6119 ),
6120 CssProperty::BoxShadowRight(p) => format!(
6121 "CssProperty::BoxShadowRight({})",
6122 print_css_property_value(p, tabs, "StyleBoxShadow")
6123 ),
6124 CssProperty::BoxShadowTop(p) => format!(
6125 "CssProperty::BoxShadowTop({})",
6126 print_css_property_value(p, tabs, "StyleBoxShadow")
6127 ),
6128 CssProperty::BoxShadowBottom(p) => format!(
6129 "CssProperty::BoxShadowBottom({})",
6130 print_css_property_value(p, tabs, "StyleBoxShadow")
6131 ),
6132 CssProperty::ScrollbarWidth(p) => format!(
6133 "CssProperty::ScrollbarWidth({})",
6134 print_css_property_value(p, tabs, "LayoutScrollbarWidth")
6135 ),
6136 CssProperty::ScrollbarColor(p) => format!(
6137 "CssProperty::ScrollbarColor({})",
6138 print_css_property_value(p, tabs, "StyleScrollbarColor")
6139 ),
6140 CssProperty::Scrollbar(p) => format!(
6141 "CssProperty::Scrollbar({})",
6142 print_css_property_value(p, tabs, "Scrollbar")
6143 ),
6144 CssProperty::Opacity(p) => format!(
6145 "CssProperty::Opacity({})",
6146 print_css_property_value(p, tabs, "StyleOpacity")
6147 ),
6148 CssProperty::Visibility(p) => format!(
6149 "CssProperty::Visibility({})",
6150 print_css_property_value(p, tabs, "StyleVisibility")
6151 ),
6152 CssProperty::Transform(p) => format!(
6153 "CssProperty::Transform({})",
6154 print_css_property_value(p, tabs, "StyleTransformVec")
6155 ),
6156 CssProperty::TransformOrigin(p) => format!(
6157 "CssProperty::TransformOrigin({})",
6158 print_css_property_value(p, tabs, "StyleTransformOrigin")
6159 ),
6160 CssProperty::PerspectiveOrigin(p) => format!(
6161 "CssProperty::PerspectiveOrigin({})",
6162 print_css_property_value(p, tabs, "StylePerspectiveOrigin")
6163 ),
6164 CssProperty::BackfaceVisibility(p) => format!(
6165 "CssProperty::BackfaceVisibility({})",
6166 print_css_property_value(p, tabs, "StyleBackfaceVisibility")
6167 ),
6168 CssProperty::MixBlendMode(p) => format!(
6169 "CssProperty::MixBlendMode({})",
6170 print_css_property_value(p, tabs, "StyleMixBlendMode")
6171 ),
6172 CssProperty::Filter(p) => format!(
6173 "CssProperty::Filter({})",
6174 print_css_property_value(p, tabs, "StyleFilterVec")
6175 ),
6176 CssProperty::BackdropFilter(p) => format!(
6177 "CssProperty::Filter({})",
6178 print_css_property_value(p, tabs, "StyleFilterVec")
6179 ),
6180 CssProperty::TextShadow(p) => format!(
6181 "CssProperty::TextShadow({})",
6182 print_css_property_value(p, tabs, "StyleBoxShadow")
6183 ),
6184 CssProperty::Hyphens(p) => format!(
6185 "CssProperty::Hyphens({})",
6186 print_css_property_value(p, tabs, "StyleHyphens")
6187 ),
6188 CssProperty::Direction(p) => format!(
6189 "CssProperty::Direction({})",
6190 print_css_property_value(p, tabs, "Direction")
6191 ),
6192 CssProperty::UserSelect(p) => format!(
6193 "CssProperty::UserSelect({})",
6194 print_css_property_value(p, tabs, "StyleUserSelect")
6195 ),
6196 CssProperty::TextDecoration(p) => format!(
6197 "CssProperty::TextDecoration({})",
6198 print_css_property_value(p, tabs, "StyleTextDecoration")
6199 ),
6200 CssProperty::WhiteSpace(p) => format!(
6201 "CssProperty::WhiteSpace({})",
6202 print_css_property_value(p, tabs, "WhiteSpace")
6203 ),
6204 CssProperty::FlexBasis(p) => format!(
6205 "CssProperty::FlexBasis({})",
6206 print_css_property_value(p, tabs, "LayoutFlexBasis")
6207 ),
6208 CssProperty::ColumnGap(p) => format!(
6209 "CssProperty::ColumnGap({})",
6210 print_css_property_value(p, tabs, "LayoutColumnGap")
6211 ),
6212 CssProperty::RowGap(p) => format!(
6213 "CssProperty::RowGap({})",
6214 print_css_property_value(p, tabs, "LayoutRowGap")
6215 ),
6216 CssProperty::GridTemplateColumns(p) => format!(
6217 "CssProperty::GridTemplateColumns({})",
6218 print_css_property_value(p, tabs, "LayoutGridTemplateColumns")
6219 ),
6220 CssProperty::GridTemplateRows(p) => format!(
6221 "CssProperty::GridTemplateRows({})",
6222 print_css_property_value(p, tabs, "LayoutGridTemplateRows")
6223 ),
6224 CssProperty::GridAutoFlow(p) => format!(
6225 "CssProperty::GridAutoFlow({})",
6226 print_css_property_value(p, tabs, "LayoutGridAutoFlow")
6227 ),
6228 CssProperty::JustifySelf(p) => format!(
6229 "CssProperty::JustifySelf({})",
6230 print_css_property_value(p, tabs, "LayoutJustifySelf")
6231 ),
6232 CssProperty::JustifyItems(p) => format!(
6233 "CssProperty::JustifyItems({})",
6234 print_css_property_value(p, tabs, "LayoutJustifyItems")
6235 ),
6236 CssProperty::Gap(p) => format!(
6237 "CssProperty::Gap({})",
6238 print_css_property_value(p, tabs, "LayoutGap")
6239 ),
6240 CssProperty::GridGap(p) => format!(
6241 "CssProperty::GridGap({})",
6242 print_css_property_value(p, tabs, "LayoutGap")
6243 ),
6244 CssProperty::AlignSelf(p) => format!(
6245 "CssProperty::AlignSelf({})",
6246 print_css_property_value(p, tabs, "LayoutAlignSelf")
6247 ),
6248 CssProperty::Font(p) => format!(
6249 "CssProperty::Font({})",
6250 print_css_property_value(p, tabs, "StyleFontFamilyVec")
6251 ),
6252 CssProperty::GridAutoRows(p) => format!(
6253 "CssProperty::GridAutoRows({})",
6254 print_css_property_value(p, tabs, "LayoutGridAutoRows")
6255 ),
6256 CssProperty::GridAutoColumns(p) => format!(
6257 "CssProperty::GridAutoColumns({})",
6258 print_css_property_value(p, tabs, "LayoutGridAutoColumns")
6259 ),
6260 CssProperty::GridRow(p) => format!(
6261 "CssProperty::GridRow({})",
6262 print_css_property_value(p, tabs, "LayoutGridRow")
6263 ),
6264 CssProperty::GridColumn(p) => format!(
6265 "CssProperty::GridColumn({})",
6266 print_css_property_value(p, tabs, "LayoutGridColumn")
6267 ),
6268 CssProperty::WritingMode(p) => format!(
6269 "CssProperty::WritingMode({})",
6270 print_css_property_value(p, tabs, "LayoutWritingMode")
6271 ),
6272 CssProperty::Clear(p) => format!(
6273 "CssProperty::Clear({})",
6274 print_css_property_value(p, tabs, "LayoutClear")
6275 ),
6276 CssProperty::BreakBefore(p) => format!(
6277 "CssProperty::BreakBefore({})",
6278 print_css_property_value(p, tabs, "PageBreak")
6279 ),
6280 CssProperty::BreakAfter(p) => format!(
6281 "CssProperty::BreakAfter({})",
6282 print_css_property_value(p, tabs, "PageBreak")
6283 ),
6284 CssProperty::BreakInside(p) => format!(
6285 "CssProperty::BreakInside({})",
6286 print_css_property_value(p, tabs, "BreakInside")
6287 ),
6288 CssProperty::Orphans(p) => format!(
6289 "CssProperty::Orphans({})",
6290 print_css_property_value(p, tabs, "Orphans")
6291 ),
6292 CssProperty::Widows(p) => format!(
6293 "CssProperty::Widows({})",
6294 print_css_property_value(p, tabs, "Widows")
6295 ),
6296 CssProperty::BoxDecorationBreak(p) => format!(
6297 "CssProperty::BoxDecorationBreak({})",
6298 print_css_property_value(p, tabs, "BoxDecorationBreak")
6299 ),
6300 CssProperty::ColumnCount(p) => format!(
6301 "CssProperty::ColumnCount({})",
6302 print_css_property_value(p, tabs, "ColumnCount")
6303 ),
6304 CssProperty::ColumnWidth(p) => format!(
6305 "CssProperty::ColumnWidth({})",
6306 print_css_property_value(p, tabs, "ColumnWidth")
6307 ),
6308 CssProperty::ColumnSpan(p) => format!(
6309 "CssProperty::ColumnSpan({})",
6310 print_css_property_value(p, tabs, "ColumnSpan")
6311 ),
6312 CssProperty::ColumnFill(p) => format!(
6313 "CssProperty::ColumnFill({})",
6314 print_css_property_value(p, tabs, "ColumnFill")
6315 ),
6316 CssProperty::ColumnRuleWidth(p) => format!(
6317 "CssProperty::ColumnRuleWidth({})",
6318 print_css_property_value(p, tabs, "ColumnRuleWidth")
6319 ),
6320 CssProperty::ColumnRuleStyle(p) => format!(
6321 "CssProperty::ColumnRuleStyle({})",
6322 print_css_property_value(p, tabs, "ColumnRuleStyle")
6323 ),
6324 CssProperty::ColumnRuleColor(p) => format!(
6325 "CssProperty::ColumnRuleColor({})",
6326 print_css_property_value(p, tabs, "ColumnRuleColor")
6327 ),
6328 CssProperty::FlowInto(p) => format!(
6329 "CssProperty::FlowInto({})",
6330 print_css_property_value(p, tabs, "FlowInto")
6331 ),
6332 CssProperty::FlowFrom(p) => format!(
6333 "CssProperty::FlowFrom({})",
6334 print_css_property_value(p, tabs, "FlowFrom")
6335 ),
6336 CssProperty::ShapeOutside(p) => format!(
6337 "CssProperty::ShapeOutside({})",
6338 print_css_property_value(p, tabs, "ShapeOutside")
6339 ),
6340 CssProperty::ShapeInside(p) => format!(
6341 "CssProperty::ShapeInside({})",
6342 print_css_property_value(p, tabs, "ShapeInside")
6343 ),
6344 CssProperty::ClipPath(p) => format!(
6345 "CssProperty::ClipPath({})",
6346 print_css_property_value(p, tabs, "ClipPath")
6347 ),
6348 CssProperty::ShapeMargin(p) => format!(
6349 "CssProperty::ShapeMargin({})",
6350 print_css_property_value(p, tabs, "ShapeMargin")
6351 ),
6352 CssProperty::ShapeImageThreshold(p) => format!(
6353 "CssProperty::ShapeImageThreshold({})",
6354 print_css_property_value(p, tabs, "ShapeImageThreshold")
6355 ),
6356 CssProperty::Content(p) => format!(
6357 "CssProperty::Content({})",
6358 print_css_property_value(p, tabs, "Content")
6359 ),
6360 CssProperty::CounterReset(p) => format!(
6361 "CssProperty::CounterReset({})",
6362 print_css_property_value(p, tabs, "CounterReset")
6363 ),
6364 CssProperty::CounterIncrement(p) => format!(
6365 "CssProperty::CounterIncrement({})",
6366 print_css_property_value(p, tabs, "CounterIncrement")
6367 ),
6368 CssProperty::ListStyleType(p) => format!(
6369 "CssProperty::ListStyleType({})",
6370 print_css_property_value(p, tabs, "StyleListStyleType")
6371 ),
6372 CssProperty::ListStylePosition(p) => format!(
6373 "CssProperty::ListStylePosition({})",
6374 print_css_property_value(p, tabs, "StyleListStylePosition")
6375 ),
6376 CssProperty::StringSet(p) => format!(
6377 "CssProperty::StringSet({})",
6378 print_css_property_value(p, tabs, "StringSet")
6379 ),
6380 CssProperty::TableLayout(p) => format!(
6381 "CssProperty::TableLayout({})",
6382 print_css_property_value(p, tabs, "LayoutTableLayout")
6383 ),
6384 CssProperty::BorderCollapse(p) => format!(
6385 "CssProperty::BorderCollapse({})",
6386 print_css_property_value(p, tabs, "StyleBorderCollapse")
6387 ),
6388 CssProperty::BorderSpacing(p) => format!(
6389 "CssProperty::BorderSpacing({})",
6390 print_css_property_value(p, tabs, "LayoutBorderSpacing")
6391 ),
6392 CssProperty::CaptionSide(p) => format!(
6393 "CssProperty::CaptionSide({})",
6394 print_css_property_value(p, tabs, "StyleCaptionSide")
6395 ),
6396 CssProperty::EmptyCells(p) => format!(
6397 "CssProperty::EmptyCells({})",
6398 print_css_property_value(p, tabs, "StyleEmptyCells")
6399 ),
6400 CssProperty::FontWeight(p) => format!(
6401 "CssProperty::FontWeight({})",
6402 print_css_property_value(p, tabs, "StyleFontWeight")
6403 ),
6404 CssProperty::FontStyle(p) => format!(
6405 "CssProperty::FontStyle({})",
6406 print_css_property_value(p, tabs, "StyleFontStyle")
6407 ),
6408 }
6409}
6410
6411fn print_css_property_value<T: FormatAsRustCode>(
6412 prop_val: &CssPropertyValue<T>,
6413 tabs: usize,
6414 property_value_type: &'static str,
6415) -> String {
6416 match prop_val {
6417 CssPropertyValue::Auto => format!("{}Value::Auto", property_value_type),
6418 CssPropertyValue::None => format!("{}Value::None", property_value_type),
6419 CssPropertyValue::Initial => format!("{}Value::Initial", property_value_type),
6420 CssPropertyValue::Inherit => format!("{}Value::Inherit", property_value_type),
6421 CssPropertyValue::Revert => format!("{}Value::Revert", property_value_type),
6422 CssPropertyValue::Unset => format!("{}Value::Unset", property_value_type),
6423 CssPropertyValue::Exact(t) => format!(
6424 "{}Value::Exact({})",
6425 property_value_type,
6426 t.format_as_rust_code(tabs)
6427 ),
6428 }
6429}