1#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
5#[repr(u16)]
6pub enum PropertyId {
7 AbsolutePosition = 1,
9 ActiveState = 2,
11 AlignmentAdjust = 3,
13 AlignmentBaseline = 4,
15 AutoRestore = 5,
17 Azimuth = 6,
19 Background = 7,
21 BackgroundAttachment = 8,
23 BackgroundColor = 9,
25 BackgroundImage = 10,
27 BackgroundPosition = 11,
29 BackgroundPositionHorizontal = 12,
31 BackgroundPositionVertical = 13,
33 BackgroundRepeat = 14,
35 BaselineShift = 15,
37 BlankOrNotBlank = 16,
39 BlockProgressionDimension = 17,
41 Border = 18,
43 BorderAfterColor = 19,
45 BorderAfterPrecedence = 20,
47 BorderAfterStyle = 21,
49 BorderAfterWidth = 22,
51 BorderBeforeColor = 23,
53 BorderBeforePrecedence = 24,
55 BorderBeforeStyle = 25,
57 BorderBeforeWidth = 26,
59 BorderBottom = 27,
61 BorderBottomColor = 28,
63 BorderBottomStyle = 29,
65 BorderBottomWidth = 30,
67 BorderCollapse = 31,
69 BorderColor = 32,
71 BorderEndColor = 33,
73 BorderEndPrecedence = 34,
75 BorderEndStyle = 35,
77 BorderEndWidth = 36,
79 BorderLeft = 37,
81 BorderLeftColor = 38,
83 BorderLeftStyle = 39,
85 BorderLeftWidth = 40,
87 BorderRight = 41,
89 BorderRightColor = 42,
91 BorderRightStyle = 43,
93 BorderRightWidth = 44,
95 BorderSeparation = 45,
97 BorderSpacing = 46,
99 BorderStartColor = 47,
101 BorderStartPrecedence = 48,
103 BorderStartStyle = 49,
105 BorderStartWidth = 50,
107 BorderStyle = 51,
109 BorderTop = 52,
111 BorderTopColor = 53,
113 BorderTopStyle = 54,
115 BorderTopWidth = 55,
117 BorderWidth = 56,
119 Bottom = 57,
121 BreakAfter = 58,
123 BreakBefore = 59,
125 CaptionSide = 60,
127 CaseName = 61,
129 CaseTitle = 62,
131 ChangeBarClass = 63,
133 ChangeBarColor = 64,
135 ChangeBarOffset = 65,
137 ChangeBarPlacement = 66,
139 ChangeBarStyle = 67,
141 ChangeBarWidth = 68,
143 Character = 69,
145 Clear = 70,
147 Clip = 71,
149 Color = 72,
151 ColorProfileName = 73,
153 ColumnCount = 74,
155 ColumnGap = 75,
157 ColumnNumber = 76,
159 ColumnWidth = 77,
161 ContentHeight = 78,
163 ContentType = 79,
165 ContentWidth = 80,
167 Country = 81,
169 Cue = 82,
171 CueAfter = 83,
173 CueBefore = 84,
175 DestinationPlacementOffset = 85,
177 Direction = 86,
179 DisplayAlign = 87,
181 DominantBaseline = 88,
183 Elevation = 89,
185 EmptyCells = 90,
187 EndIndent = 91,
189 EndsRow = 92,
191 Extent = 93,
193 ExternalDestination = 94,
195 Float = 95,
197 FlowMapName = 96,
199 FlowMapReference = 97,
201 FlowName = 98,
203 FlowNameReference = 99,
205 Font = 100,
207 FontFamily = 101,
209 FontSelectionStrategy = 102,
211 FontSize = 103,
213 FontSizeAdjust = 104,
215 FontStretch = 105,
217 FontStyle = 106,
219 FontVariant = 107,
221 FontWeight = 108,
223 ForcePageCount = 109,
225 Format = 110,
227 GlyphOrientationHorizontal = 111,
229 GlyphOrientationVertical = 112,
231 GroupingSeparator = 113,
233 GroupingSize = 114,
235 Height = 115,
237 Hyphenate = 116,
239 HyphenationCharacter = 117,
241 HyphenationKeep = 118,
243 HyphenationLadderCount = 119,
245 HyphenationPushCharacterCount = 120,
247 HyphenationRemainCharacterCount = 121,
249 Id = 122,
251 IndicateDestination = 123,
253 IndexClass = 124,
255 IndexKey = 125,
257 InitialPageNumber = 126,
259 InlineProgressionDimension = 127,
261 InternalDestination = 128,
263 IntrinsicScaleValue = 129,
265 IntrusionDisplace = 130,
267 KeepTogether = 131,
269 KeepWithNext = 132,
271 KeepWithPrevious = 133,
273 Language = 134,
275 LastLineEndIndent = 135,
277 LeaderAlignment = 136,
279 LeaderLength = 137,
281 LeaderPattern = 138,
283 LeaderPatternWidth = 139,
285 Left = 140,
287 LetterSpacing = 141,
289 LetterValue = 142,
291 LinefeedTreatment = 143,
293 LineHeight = 144,
295 LineHeightShiftAdjustment = 145,
297 LineStackingStrategy = 146,
299 Margin = 147,
301 MarginBottom = 148,
303 MarginLeft = 149,
305 MarginRight = 150,
307 MarginTop = 151,
309 MarkerClassName = 152,
311 MasterName = 153,
313 MasterReference = 154,
315 MaxHeight = 155,
317 MaximumRepeats = 156,
319 MaxWidth = 157,
321 MergePagesAcrossIndexKeyReferences = 158,
323 MergeRangesAcrossIndexKeyReferences = 159,
325 MergeSequentialPageNumbers = 160,
327 MediaUsage = 161,
329 MinHeight = 162,
331 MinWidth = 163,
333 NumberColumnsRepeated = 164,
335 NumberColumnsSpanned = 165,
337 NumberRowsSpanned = 166,
339 OddOrEven = 167,
341 Orphans = 168,
343 Overflow = 169,
345 Padding = 170,
347 PaddingAfter = 171,
349 PaddingBefore = 172,
351 PaddingBottom = 173,
353 PaddingEnd = 174,
355 PaddingLeft = 175,
357 PaddingRight = 176,
359 PaddingStart = 177,
361 PaddingTop = 178,
363 PageBreakAfter = 179,
365 PageBreakBefore = 180,
367 PageBreakInside = 181,
369 PageCitationStrategy = 182,
371 PageHeight = 183,
373 PageNumberTreatment = 184,
375 PagePosition = 185,
377 PageWidth = 186,
379 Pause = 187,
381 PauseAfter = 188,
383 PauseBefore = 189,
385 Pitch = 190,
387 PitchRange = 191,
389 PlayDuring = 192,
391 Position = 193,
393 Precedence = 194,
395 ProvisionalDistanceBetweenStarts = 195,
397 ProvisionalLabelSeparation = 196,
399 ReferenceOrientation = 197,
401 RefId = 198,
403 RegionName = 199,
405 RegionNameReference = 200,
407 RefIndexKey = 201,
409 RelativeAlign = 202,
411 RelativePosition = 203,
413 RenderingIntent = 204,
415 RetrieveBoundary = 205,
417 RetrieveBoundaryWithinTable = 206,
419 RetrieveClassName = 207,
421 RetrievePosition = 208,
423 RetrievePositionWithinTable = 209,
425 Richness = 210,
427 Right = 211,
429 Role = 212,
431 RuleStyle = 213,
433 RuleThickness = 214,
435 Scaling = 215,
437 ScalingMethod = 216,
439 ScoreSpaces = 217,
441 Script = 218,
443 ShowDestination = 219,
445 Size = 220,
447 SourceDocument = 221,
449 SpaceAfter = 222,
451 SpaceBefore = 223,
453 SpaceEnd = 224,
455 SpaceStart = 225,
457 Span = 226,
459 Speak = 227,
461 SpeakHeader = 228,
463 SpeakNumeral = 229,
465 SpeakPunctuation = 230,
467 SpeechRate = 231,
469 Src = 232,
471 StartIndent = 233,
473 StartingState = 234,
475 StartsRow = 235,
477 Stress = 236,
479 SuppressAtLineBreak = 237,
481 SwitchTo = 238,
483 TableLayout = 239,
485 TableOmitFooterAtBreak = 240,
487 TableOmitHeaderAtBreak = 241,
489 TargetPresentationContext = 242,
491 TargetProcessingContext = 243,
493 TargetStylesheet = 244,
495 TextAlign = 245,
497 TextAlignLast = 246,
499 TextAltitude = 247,
501 TextDecoration = 248,
503 TextDepth = 249,
505 TextIndent = 250,
507 TextShadow = 251,
509 TextTransform = 252,
511 Top = 253,
513 TreatAsWordSpace = 254,
515 UnicodeBidi = 255,
517 VerticalAlign = 256,
519 Visibility = 257,
521 VoiceFamily = 258,
523 Volume = 259,
525 WhiteSpace = 260,
527 WhiteSpaceCollapse = 261,
529 WhiteSpaceTreatment = 262,
531 Widows = 263,
533 Width = 264,
535 WordSpacing = 265,
537 WrapOption = 266,
539 WritingMode = 267,
541 XmlLang = 268,
543 ZIndex = 269,
545 XWidowContentLimit = 270,
547 XOrphanContentLimit = 271,
549 XDisableColumnBalancing = 272,
551 XAltText = 273,
553 XXmlBase = 274,
555 XBorderBeforeRadiusStart = 275,
557 XBorderBeforeRadiusEnd = 276,
559 XBorderAfterRadiusStart = 277,
561 XBorderAfterRadiusEnd = 278,
563 XBorderStartRadiusBefore = 279,
565 XBorderStartRadiusAfter = 280,
567 XBorderEndRadiusBefore = 281,
569 XBorderEndRadiusAfter = 282,
571 XBorderRadius = 283,
573 XBorderBeforeStartRadius = 284,
575 XBorderBeforeEndRadius = 285,
577 XBorderAfterStartRadius = 286,
579 XBorderAfterEndRadius = 287,
581 XNumberConversionFeatures = 288,
583 XHeaderColumn = 289,
585 XLayer = 290,
587 XAutoToggle = 291,
589 XBackgroundImageWidth = 292,
591 XBackgroundImageHeight = 293,
593 XAbbreviation = 294,
595 Opacity = 295,
597}
598
599impl PropertyId {
600 pub fn name(self) -> &'static str {
602 match self {
603 PropertyId::AbsolutePosition => "absolute-position",
604 PropertyId::ActiveState => "active-state",
605 PropertyId::AlignmentAdjust => "alignment-adjust",
606 PropertyId::AlignmentBaseline => "alignment-baseline",
607 PropertyId::AutoRestore => "auto-restore",
608 PropertyId::Azimuth => "azimuth",
609 PropertyId::Background => "background",
610 PropertyId::BackgroundAttachment => "background-attachment",
611 PropertyId::BackgroundColor => "background-color",
612 PropertyId::BackgroundImage => "background-image",
613 PropertyId::BackgroundPosition => "background-position",
614 PropertyId::BackgroundPositionHorizontal => "background-position-horizontal",
615 PropertyId::BackgroundPositionVertical => "background-position-vertical",
616 PropertyId::BackgroundRepeat => "background-repeat",
617 PropertyId::BaselineShift => "baseline-shift",
618 PropertyId::BlankOrNotBlank => "blank-or-not-blank",
619 PropertyId::BlockProgressionDimension => "block-progression-dimension",
620 PropertyId::Border => "border",
621 PropertyId::BorderAfterColor => "border-after-color",
622 PropertyId::BorderAfterPrecedence => "border-after-precedence",
623 PropertyId::BorderAfterStyle => "border-after-style",
624 PropertyId::BorderAfterWidth => "border-after-width",
625 PropertyId::BorderBeforeColor => "border-before-color",
626 PropertyId::BorderBeforePrecedence => "border-before-precedence",
627 PropertyId::BorderBeforeStyle => "border-before-style",
628 PropertyId::BorderBeforeWidth => "border-before-width",
629 PropertyId::BorderBottom => "border-bottom",
630 PropertyId::BorderBottomColor => "border-bottom-color",
631 PropertyId::BorderBottomStyle => "border-bottom-style",
632 PropertyId::BorderBottomWidth => "border-bottom-width",
633 PropertyId::BorderCollapse => "border-collapse",
634 PropertyId::BorderColor => "border-color",
635 PropertyId::BorderEndColor => "border-end-color",
636 PropertyId::BorderEndPrecedence => "border-end-precedence",
637 PropertyId::BorderEndStyle => "border-end-style",
638 PropertyId::BorderEndWidth => "border-end-width",
639 PropertyId::BorderLeft => "border-left",
640 PropertyId::BorderLeftColor => "border-left-color",
641 PropertyId::BorderLeftStyle => "border-left-style",
642 PropertyId::BorderLeftWidth => "border-left-width",
643 PropertyId::BorderRight => "border-right",
644 PropertyId::BorderRightColor => "border-right-color",
645 PropertyId::BorderRightStyle => "border-right-style",
646 PropertyId::BorderRightWidth => "border-right-width",
647 PropertyId::BorderSeparation => "border-separation",
648 PropertyId::BorderSpacing => "border-spacing",
649 PropertyId::BorderStartColor => "border-start-color",
650 PropertyId::BorderStartPrecedence => "border-start-precedence",
651 PropertyId::BorderStartStyle => "border-start-style",
652 PropertyId::BorderStartWidth => "border-start-width",
653 PropertyId::BorderStyle => "border-style",
654 PropertyId::BorderTop => "border-top",
655 PropertyId::BorderTopColor => "border-top-color",
656 PropertyId::BorderTopStyle => "border-top-style",
657 PropertyId::BorderTopWidth => "border-top-width",
658 PropertyId::BorderWidth => "border-width",
659 PropertyId::Bottom => "bottom",
660 PropertyId::BreakAfter => "break-after",
661 PropertyId::BreakBefore => "break-before",
662 PropertyId::CaptionSide => "caption-side",
663 PropertyId::CaseName => "case-name",
664 PropertyId::CaseTitle => "case-title",
665 PropertyId::ChangeBarClass => "change-bar-class",
666 PropertyId::ChangeBarColor => "change-bar-color",
667 PropertyId::ChangeBarOffset => "change-bar-offset",
668 PropertyId::ChangeBarPlacement => "change-bar-placement",
669 PropertyId::ChangeBarStyle => "change-bar-style",
670 PropertyId::ChangeBarWidth => "change-bar-width",
671 PropertyId::Character => "character",
672 PropertyId::Clear => "clear",
673 PropertyId::Clip => "clip",
674 PropertyId::Color => "color",
675 PropertyId::ColorProfileName => "color-profile-name",
676 PropertyId::ColumnCount => "column-count",
677 PropertyId::ColumnGap => "column-gap",
678 PropertyId::ColumnNumber => "column-number",
679 PropertyId::ColumnWidth => "column-width",
680 PropertyId::ContentHeight => "content-height",
681 PropertyId::ContentType => "content-type",
682 PropertyId::ContentWidth => "content-width",
683 PropertyId::Country => "country",
684 PropertyId::Cue => "cue",
685 PropertyId::CueAfter => "cue-after",
686 PropertyId::CueBefore => "cue-before",
687 PropertyId::DestinationPlacementOffset => "destination-placement-offset",
688 PropertyId::Direction => "direction",
689 PropertyId::DisplayAlign => "display-align",
690 PropertyId::DominantBaseline => "dominant-baseline",
691 PropertyId::Elevation => "elevation",
692 PropertyId::EmptyCells => "empty-cells",
693 PropertyId::EndIndent => "end-indent",
694 PropertyId::EndsRow => "ends-row",
695 PropertyId::Extent => "extent",
696 PropertyId::ExternalDestination => "external-destination",
697 PropertyId::Float => "float",
698 PropertyId::FlowMapName => "flow-map-name",
699 PropertyId::FlowMapReference => "flow-map-reference",
700 PropertyId::FlowName => "flow-name",
701 PropertyId::FlowNameReference => "flow-name-reference",
702 PropertyId::Font => "font",
703 PropertyId::FontFamily => "font-family",
704 PropertyId::FontSelectionStrategy => "font-selection-strategy",
705 PropertyId::FontSize => "font-size",
706 PropertyId::FontSizeAdjust => "font-size-adjust",
707 PropertyId::FontStretch => "font-stretch",
708 PropertyId::FontStyle => "font-style",
709 PropertyId::FontVariant => "font-variant",
710 PropertyId::FontWeight => "font-weight",
711 PropertyId::ForcePageCount => "force-page-count",
712 PropertyId::Format => "format",
713 PropertyId::GlyphOrientationHorizontal => "glyph-orientation-horizontal",
714 PropertyId::GlyphOrientationVertical => "glyph-orientation-vertical",
715 PropertyId::GroupingSeparator => "grouping-separator",
716 PropertyId::GroupingSize => "grouping-size",
717 PropertyId::Height => "height",
718 PropertyId::Hyphenate => "hyphenate",
719 PropertyId::HyphenationCharacter => "hyphenation-character",
720 PropertyId::HyphenationKeep => "hyphenation-keep",
721 PropertyId::HyphenationLadderCount => "hyphenation-ladder-count",
722 PropertyId::HyphenationPushCharacterCount => "hyphenation-push-character-count",
723 PropertyId::HyphenationRemainCharacterCount => "hyphenation-remain-character-count",
724 PropertyId::Id => "id",
725 PropertyId::IndicateDestination => "indicate-destination",
726 PropertyId::IndexClass => "index-class",
727 PropertyId::IndexKey => "index-key",
728 PropertyId::InitialPageNumber => "initial-page-number",
729 PropertyId::InlineProgressionDimension => "inline-progression-dimension",
730 PropertyId::InternalDestination => "internal-destination",
731 PropertyId::IntrinsicScaleValue => "intrinsic-scale-value",
732 PropertyId::IntrusionDisplace => "intrusion-displace",
733 PropertyId::KeepTogether => "keep-together",
734 PropertyId::KeepWithNext => "keep-with-next",
735 PropertyId::KeepWithPrevious => "keep-with-previous",
736 PropertyId::Language => "language",
737 PropertyId::LastLineEndIndent => "last-line-end-indent",
738 PropertyId::LeaderAlignment => "leader-alignment",
739 PropertyId::LeaderLength => "leader-length",
740 PropertyId::LeaderPattern => "leader-pattern",
741 PropertyId::LeaderPatternWidth => "leader-pattern-width",
742 PropertyId::Left => "left",
743 PropertyId::LetterSpacing => "letter-spacing",
744 PropertyId::LetterValue => "letter-value",
745 PropertyId::LinefeedTreatment => "linefeed-treatment",
746 PropertyId::LineHeight => "line-height",
747 PropertyId::LineHeightShiftAdjustment => "line-height-shift-adjustment",
748 PropertyId::LineStackingStrategy => "line-stacking-strategy",
749 PropertyId::Margin => "margin",
750 PropertyId::MarginBottom => "margin-bottom",
751 PropertyId::MarginLeft => "margin-left",
752 PropertyId::MarginRight => "margin-right",
753 PropertyId::MarginTop => "margin-top",
754 PropertyId::MarkerClassName => "marker-class-name",
755 PropertyId::MasterName => "master-name",
756 PropertyId::MasterReference => "master-reference",
757 PropertyId::MaxHeight => "max-height",
758 PropertyId::MaximumRepeats => "maximum-repeats",
759 PropertyId::MaxWidth => "max-width",
760 PropertyId::MergePagesAcrossIndexKeyReferences => {
761 "merge-pages-across-index-key-references"
762 }
763 PropertyId::MergeRangesAcrossIndexKeyReferences => {
764 "merge-ranges-across-index-key-references"
765 }
766 PropertyId::MergeSequentialPageNumbers => "merge-sequential-page-numbers",
767 PropertyId::MediaUsage => "media-usage",
768 PropertyId::MinHeight => "min-height",
769 PropertyId::MinWidth => "min-width",
770 PropertyId::NumberColumnsRepeated => "number-columns-repeated",
771 PropertyId::NumberColumnsSpanned => "number-columns-spanned",
772 PropertyId::NumberRowsSpanned => "number-rows-spanned",
773 PropertyId::OddOrEven => "odd-or-even",
774 PropertyId::Orphans => "orphans",
775 PropertyId::Overflow => "overflow",
776 PropertyId::Padding => "padding",
777 PropertyId::PaddingAfter => "padding-after",
778 PropertyId::PaddingBefore => "padding-before",
779 PropertyId::PaddingBottom => "padding-bottom",
780 PropertyId::PaddingEnd => "padding-end",
781 PropertyId::PaddingLeft => "padding-left",
782 PropertyId::PaddingRight => "padding-right",
783 PropertyId::PaddingStart => "padding-start",
784 PropertyId::PaddingTop => "padding-top",
785 PropertyId::PageBreakAfter => "page-break-after",
786 PropertyId::PageBreakBefore => "page-break-before",
787 PropertyId::PageBreakInside => "page-break-inside",
788 PropertyId::PageCitationStrategy => "page-citation-strategy",
789 PropertyId::PageHeight => "page-height",
790 PropertyId::PageNumberTreatment => "page-number-treatment",
791 PropertyId::PagePosition => "page-position",
792 PropertyId::PageWidth => "page-width",
793 PropertyId::Pause => "pause",
794 PropertyId::PauseAfter => "pause-after",
795 PropertyId::PauseBefore => "pause-before",
796 PropertyId::Pitch => "pitch",
797 PropertyId::PitchRange => "pitch-range",
798 PropertyId::PlayDuring => "play-during",
799 PropertyId::Position => "position",
800 PropertyId::Precedence => "precedence",
801 PropertyId::ProvisionalDistanceBetweenStarts => "provisional-distance-between-starts",
802 PropertyId::ProvisionalLabelSeparation => "provisional-label-separation",
803 PropertyId::ReferenceOrientation => "reference-orientation",
804 PropertyId::RefId => "ref-id",
805 PropertyId::RegionName => "region-name",
806 PropertyId::RegionNameReference => "region-name-reference",
807 PropertyId::RefIndexKey => "ref-index-key",
808 PropertyId::RelativeAlign => "relative-align",
809 PropertyId::RelativePosition => "relative-position",
810 PropertyId::RenderingIntent => "rendering-intent",
811 PropertyId::RetrieveBoundary => "retrieve-boundary",
812 PropertyId::RetrieveBoundaryWithinTable => "retrieve-boundary-within-table",
813 PropertyId::RetrieveClassName => "retrieve-class-name",
814 PropertyId::RetrievePosition => "retrieve-position",
815 PropertyId::RetrievePositionWithinTable => "retrieve-position-within-table",
816 PropertyId::Richness => "richness",
817 PropertyId::Right => "right",
818 PropertyId::Role => "role",
819 PropertyId::RuleStyle => "rule-style",
820 PropertyId::RuleThickness => "rule-thickness",
821 PropertyId::Scaling => "scaling",
822 PropertyId::ScalingMethod => "scaling-method",
823 PropertyId::ScoreSpaces => "score-spaces",
824 PropertyId::Script => "script",
825 PropertyId::ShowDestination => "show-destination",
826 PropertyId::Size => "size",
827 PropertyId::SourceDocument => "source-document",
828 PropertyId::SpaceAfter => "space-after",
829 PropertyId::SpaceBefore => "space-before",
830 PropertyId::SpaceEnd => "space-end",
831 PropertyId::SpaceStart => "space-start",
832 PropertyId::Span => "span",
833 PropertyId::Speak => "speak",
834 PropertyId::SpeakHeader => "speak-header",
835 PropertyId::SpeakNumeral => "speak-numeral",
836 PropertyId::SpeakPunctuation => "speak-punctuation",
837 PropertyId::SpeechRate => "speech-rate",
838 PropertyId::Src => "src",
839 PropertyId::StartIndent => "start-indent",
840 PropertyId::StartingState => "starting-state",
841 PropertyId::StartsRow => "starts-row",
842 PropertyId::Stress => "stress",
843 PropertyId::SuppressAtLineBreak => "suppress-at-line-break",
844 PropertyId::SwitchTo => "switch-to",
845 PropertyId::TableLayout => "table-layout",
846 PropertyId::TableOmitFooterAtBreak => "table-omit-footer-at-break",
847 PropertyId::TableOmitHeaderAtBreak => "table-omit-header-at-break",
848 PropertyId::TargetPresentationContext => "target-presentation-context",
849 PropertyId::TargetProcessingContext => "target-processing-context",
850 PropertyId::TargetStylesheet => "target-stylesheet",
851 PropertyId::TextAlign => "text-align",
852 PropertyId::TextAlignLast => "text-align-last",
853 PropertyId::TextAltitude => "text-altitude",
854 PropertyId::TextDecoration => "text-decoration",
855 PropertyId::TextDepth => "text-depth",
856 PropertyId::TextIndent => "text-indent",
857 PropertyId::TextShadow => "text-shadow",
858 PropertyId::TextTransform => "text-transform",
859 PropertyId::Top => "top",
860 PropertyId::TreatAsWordSpace => "treat-as-word-space",
861 PropertyId::UnicodeBidi => "unicode-bidi",
862 PropertyId::VerticalAlign => "vertical-align",
863 PropertyId::Visibility => "visibility",
864 PropertyId::VoiceFamily => "voice-family",
865 PropertyId::Volume => "volume",
866 PropertyId::WhiteSpace => "white-space",
867 PropertyId::WhiteSpaceCollapse => "white-space-collapse",
868 PropertyId::WhiteSpaceTreatment => "white-space-treatment",
869 PropertyId::Widows => "widows",
870 PropertyId::Width => "width",
871 PropertyId::WordSpacing => "word-spacing",
872 PropertyId::WrapOption => "wrap-option",
873 PropertyId::WritingMode => "writing-mode",
874 PropertyId::XmlLang => "xml-lang",
875 PropertyId::ZIndex => "z-index",
876 PropertyId::XWidowContentLimit => "x-widow-content-limit",
877 PropertyId::XOrphanContentLimit => "x-orphan-content-limit",
878 PropertyId::XDisableColumnBalancing => "x-disable-column-balancing",
879 PropertyId::XAltText => "x-alt-text",
880 PropertyId::XXmlBase => "x-xml-base",
881 PropertyId::XBorderBeforeRadiusStart => "x-border-before-radius-start",
882 PropertyId::XBorderBeforeRadiusEnd => "x-border-before-radius-end",
883 PropertyId::XBorderAfterRadiusStart => "x-border-after-radius-start",
884 PropertyId::XBorderAfterRadiusEnd => "x-border-after-radius-end",
885 PropertyId::XBorderStartRadiusBefore => "x-border-start-radius-before",
886 PropertyId::XBorderStartRadiusAfter => "x-border-start-radius-after",
887 PropertyId::XBorderEndRadiusBefore => "x-border-end-radius-before",
888 PropertyId::XBorderEndRadiusAfter => "x-border-end-radius-after",
889 PropertyId::XBorderRadius => "x-border-radius",
890 PropertyId::XBorderBeforeStartRadius => "x-border-before-start-radius",
891 PropertyId::XBorderBeforeEndRadius => "x-border-before-end-radius",
892 PropertyId::XBorderAfterStartRadius => "x-border-after-start-radius",
893 PropertyId::XBorderAfterEndRadius => "x-border-after-end-radius",
894 PropertyId::XNumberConversionFeatures => "x-number-conversion-features",
895 PropertyId::XHeaderColumn => "x-header-column",
896 PropertyId::XLayer => "x-layer",
897 PropertyId::XAutoToggle => "x-auto-toggle",
898 PropertyId::XBackgroundImageWidth => "x-background-image-width",
899 PropertyId::XBackgroundImageHeight => "x-background-image-height",
900 PropertyId::XAbbreviation => "x-abbreviation",
901 PropertyId::Opacity => "opacity",
902 }
903 }
904
905 pub fn from_name(name: &str) -> Option<Self> {
907 match name {
908 "absolute-position" => Some(PropertyId::AbsolutePosition),
909 "active-state" => Some(PropertyId::ActiveState),
910 "alignment-adjust" => Some(PropertyId::AlignmentAdjust),
911 "alignment-baseline" => Some(PropertyId::AlignmentBaseline),
912 "auto-restore" => Some(PropertyId::AutoRestore),
913 "azimuth" => Some(PropertyId::Azimuth),
914 "background" => Some(PropertyId::Background),
915 "background-attachment" => Some(PropertyId::BackgroundAttachment),
916 "background-color" => Some(PropertyId::BackgroundColor),
917 "background-image" => Some(PropertyId::BackgroundImage),
918 "background-position" => Some(PropertyId::BackgroundPosition),
919 "background-position-horizontal" => Some(PropertyId::BackgroundPositionHorizontal),
920 "background-position-vertical" => Some(PropertyId::BackgroundPositionVertical),
921 "background-repeat" => Some(PropertyId::BackgroundRepeat),
922 "baseline-shift" => Some(PropertyId::BaselineShift),
923 "blank-or-not-blank" => Some(PropertyId::BlankOrNotBlank),
924 "block-progression-dimension" => Some(PropertyId::BlockProgressionDimension),
925 "border" => Some(PropertyId::Border),
926 "border-after-color" => Some(PropertyId::BorderAfterColor),
927 "border-after-precedence" => Some(PropertyId::BorderAfterPrecedence),
928 "border-after-style" => Some(PropertyId::BorderAfterStyle),
929 "border-after-width" => Some(PropertyId::BorderAfterWidth),
930 "border-before-color" => Some(PropertyId::BorderBeforeColor),
931 "border-before-precedence" => Some(PropertyId::BorderBeforePrecedence),
932 "border-before-style" => Some(PropertyId::BorderBeforeStyle),
933 "border-before-width" => Some(PropertyId::BorderBeforeWidth),
934 "border-bottom" => Some(PropertyId::BorderBottom),
935 "border-bottom-color" => Some(PropertyId::BorderBottomColor),
936 "border-bottom-style" => Some(PropertyId::BorderBottomStyle),
937 "border-bottom-width" => Some(PropertyId::BorderBottomWidth),
938 "border-collapse" => Some(PropertyId::BorderCollapse),
939 "border-color" => Some(PropertyId::BorderColor),
940 "border-end-color" => Some(PropertyId::BorderEndColor),
941 "border-end-precedence" => Some(PropertyId::BorderEndPrecedence),
942 "border-end-style" => Some(PropertyId::BorderEndStyle),
943 "border-end-width" => Some(PropertyId::BorderEndWidth),
944 "border-left" => Some(PropertyId::BorderLeft),
945 "border-left-color" => Some(PropertyId::BorderLeftColor),
946 "border-left-style" => Some(PropertyId::BorderLeftStyle),
947 "border-left-width" => Some(PropertyId::BorderLeftWidth),
948 "border-right" => Some(PropertyId::BorderRight),
949 "border-right-color" => Some(PropertyId::BorderRightColor),
950 "border-right-style" => Some(PropertyId::BorderRightStyle),
951 "border-right-width" => Some(PropertyId::BorderRightWidth),
952 "border-separation" => Some(PropertyId::BorderSeparation),
953 "border-spacing" => Some(PropertyId::BorderSpacing),
954 "border-start-color" => Some(PropertyId::BorderStartColor),
955 "border-start-precedence" => Some(PropertyId::BorderStartPrecedence),
956 "border-start-style" => Some(PropertyId::BorderStartStyle),
957 "border-start-width" => Some(PropertyId::BorderStartWidth),
958 "border-style" => Some(PropertyId::BorderStyle),
959 "border-top" => Some(PropertyId::BorderTop),
960 "border-top-color" => Some(PropertyId::BorderTopColor),
961 "border-top-style" => Some(PropertyId::BorderTopStyle),
962 "border-top-width" => Some(PropertyId::BorderTopWidth),
963 "border-width" => Some(PropertyId::BorderWidth),
964 "bottom" => Some(PropertyId::Bottom),
965 "break-after" => Some(PropertyId::BreakAfter),
966 "break-before" => Some(PropertyId::BreakBefore),
967 "caption-side" => Some(PropertyId::CaptionSide),
968 "case-name" => Some(PropertyId::CaseName),
969 "case-title" => Some(PropertyId::CaseTitle),
970 "change-bar-class" => Some(PropertyId::ChangeBarClass),
971 "change-bar-color" => Some(PropertyId::ChangeBarColor),
972 "change-bar-offset" => Some(PropertyId::ChangeBarOffset),
973 "change-bar-placement" => Some(PropertyId::ChangeBarPlacement),
974 "change-bar-style" => Some(PropertyId::ChangeBarStyle),
975 "change-bar-width" => Some(PropertyId::ChangeBarWidth),
976 "character" => Some(PropertyId::Character),
977 "clear" => Some(PropertyId::Clear),
978 "clip" => Some(PropertyId::Clip),
979 "color" => Some(PropertyId::Color),
980 "color-profile-name" => Some(PropertyId::ColorProfileName),
981 "column-count" => Some(PropertyId::ColumnCount),
982 "column-gap" => Some(PropertyId::ColumnGap),
983 "column-number" => Some(PropertyId::ColumnNumber),
984 "column-width" => Some(PropertyId::ColumnWidth),
985 "content-height" => Some(PropertyId::ContentHeight),
986 "content-type" => Some(PropertyId::ContentType),
987 "content-width" => Some(PropertyId::ContentWidth),
988 "country" => Some(PropertyId::Country),
989 "cue" => Some(PropertyId::Cue),
990 "cue-after" => Some(PropertyId::CueAfter),
991 "cue-before" => Some(PropertyId::CueBefore),
992 "destination-placement-offset" => Some(PropertyId::DestinationPlacementOffset),
993 "direction" => Some(PropertyId::Direction),
994 "display-align" => Some(PropertyId::DisplayAlign),
995 "dominant-baseline" => Some(PropertyId::DominantBaseline),
996 "elevation" => Some(PropertyId::Elevation),
997 "empty-cells" => Some(PropertyId::EmptyCells),
998 "end-indent" => Some(PropertyId::EndIndent),
999 "ends-row" => Some(PropertyId::EndsRow),
1000 "extent" => Some(PropertyId::Extent),
1001 "external-destination" => Some(PropertyId::ExternalDestination),
1002 "float" => Some(PropertyId::Float),
1003 "flow-map-name" => Some(PropertyId::FlowMapName),
1004 "flow-map-reference" => Some(PropertyId::FlowMapReference),
1005 "flow-name" => Some(PropertyId::FlowName),
1006 "flow-name-reference" => Some(PropertyId::FlowNameReference),
1007 "font" => Some(PropertyId::Font),
1008 "font-family" => Some(PropertyId::FontFamily),
1009 "font-selection-strategy" => Some(PropertyId::FontSelectionStrategy),
1010 "font-size" => Some(PropertyId::FontSize),
1011 "font-size-adjust" => Some(PropertyId::FontSizeAdjust),
1012 "font-stretch" => Some(PropertyId::FontStretch),
1013 "font-style" => Some(PropertyId::FontStyle),
1014 "font-variant" => Some(PropertyId::FontVariant),
1015 "font-weight" => Some(PropertyId::FontWeight),
1016 "force-page-count" => Some(PropertyId::ForcePageCount),
1017 "format" => Some(PropertyId::Format),
1018 "glyph-orientation-horizontal" => Some(PropertyId::GlyphOrientationHorizontal),
1019 "glyph-orientation-vertical" => Some(PropertyId::GlyphOrientationVertical),
1020 "grouping-separator" => Some(PropertyId::GroupingSeparator),
1021 "grouping-size" => Some(PropertyId::GroupingSize),
1022 "height" => Some(PropertyId::Height),
1023 "hyphenate" => Some(PropertyId::Hyphenate),
1024 "hyphenation-character" => Some(PropertyId::HyphenationCharacter),
1025 "hyphenation-keep" => Some(PropertyId::HyphenationKeep),
1026 "hyphenation-ladder-count" => Some(PropertyId::HyphenationLadderCount),
1027 "hyphenation-push-character-count" => Some(PropertyId::HyphenationPushCharacterCount),
1028 "hyphenation-remain-character-count" => {
1029 Some(PropertyId::HyphenationRemainCharacterCount)
1030 }
1031 "id" => Some(PropertyId::Id),
1032 "indicate-destination" => Some(PropertyId::IndicateDestination),
1033 "index-class" => Some(PropertyId::IndexClass),
1034 "index-key" => Some(PropertyId::IndexKey),
1035 "initial-page-number" => Some(PropertyId::InitialPageNumber),
1036 "inline-progression-dimension" => Some(PropertyId::InlineProgressionDimension),
1037 "internal-destination" => Some(PropertyId::InternalDestination),
1038 "intrinsic-scale-value" => Some(PropertyId::IntrinsicScaleValue),
1039 "intrusion-displace" => Some(PropertyId::IntrusionDisplace),
1040 "keep-together" => Some(PropertyId::KeepTogether),
1041 "keep-with-next" => Some(PropertyId::KeepWithNext),
1042 "keep-with-previous" => Some(PropertyId::KeepWithPrevious),
1043 "language" => Some(PropertyId::Language),
1044 "last-line-end-indent" => Some(PropertyId::LastLineEndIndent),
1045 "leader-alignment" => Some(PropertyId::LeaderAlignment),
1046 "leader-length" => Some(PropertyId::LeaderLength),
1047 "leader-pattern" => Some(PropertyId::LeaderPattern),
1048 "leader-pattern-width" => Some(PropertyId::LeaderPatternWidth),
1049 "left" => Some(PropertyId::Left),
1050 "letter-spacing" => Some(PropertyId::LetterSpacing),
1051 "letter-value" => Some(PropertyId::LetterValue),
1052 "linefeed-treatment" => Some(PropertyId::LinefeedTreatment),
1053 "line-height" => Some(PropertyId::LineHeight),
1054 "line-height-shift-adjustment" => Some(PropertyId::LineHeightShiftAdjustment),
1055 "line-stacking-strategy" => Some(PropertyId::LineStackingStrategy),
1056 "margin" => Some(PropertyId::Margin),
1057 "margin-bottom" => Some(PropertyId::MarginBottom),
1058 "margin-left" => Some(PropertyId::MarginLeft),
1059 "margin-right" => Some(PropertyId::MarginRight),
1060 "margin-top" => Some(PropertyId::MarginTop),
1061 "marker-class-name" => Some(PropertyId::MarkerClassName),
1062 "master-name" => Some(PropertyId::MasterName),
1063 "master-reference" => Some(PropertyId::MasterReference),
1064 "max-height" => Some(PropertyId::MaxHeight),
1065 "maximum-repeats" => Some(PropertyId::MaximumRepeats),
1066 "max-width" => Some(PropertyId::MaxWidth),
1067 "merge-pages-across-index-key-references" => {
1068 Some(PropertyId::MergePagesAcrossIndexKeyReferences)
1069 }
1070 "merge-ranges-across-index-key-references" => {
1071 Some(PropertyId::MergeRangesAcrossIndexKeyReferences)
1072 }
1073 "merge-sequential-page-numbers" => Some(PropertyId::MergeSequentialPageNumbers),
1074 "media-usage" => Some(PropertyId::MediaUsage),
1075 "min-height" => Some(PropertyId::MinHeight),
1076 "min-width" => Some(PropertyId::MinWidth),
1077 "number-columns-repeated" => Some(PropertyId::NumberColumnsRepeated),
1078 "number-columns-spanned" => Some(PropertyId::NumberColumnsSpanned),
1079 "number-rows-spanned" => Some(PropertyId::NumberRowsSpanned),
1080 "odd-or-even" => Some(PropertyId::OddOrEven),
1081 "orphans" => Some(PropertyId::Orphans),
1082 "overflow" => Some(PropertyId::Overflow),
1083 "padding" => Some(PropertyId::Padding),
1084 "padding-after" => Some(PropertyId::PaddingAfter),
1085 "padding-before" => Some(PropertyId::PaddingBefore),
1086 "padding-bottom" => Some(PropertyId::PaddingBottom),
1087 "padding-end" => Some(PropertyId::PaddingEnd),
1088 "padding-left" => Some(PropertyId::PaddingLeft),
1089 "padding-right" => Some(PropertyId::PaddingRight),
1090 "padding-start" => Some(PropertyId::PaddingStart),
1091 "padding-top" => Some(PropertyId::PaddingTop),
1092 "page-break-after" => Some(PropertyId::PageBreakAfter),
1093 "page-break-before" => Some(PropertyId::PageBreakBefore),
1094 "page-break-inside" => Some(PropertyId::PageBreakInside),
1095 "page-citation-strategy" => Some(PropertyId::PageCitationStrategy),
1096 "page-height" => Some(PropertyId::PageHeight),
1097 "page-number-treatment" => Some(PropertyId::PageNumberTreatment),
1098 "page-position" => Some(PropertyId::PagePosition),
1099 "page-width" => Some(PropertyId::PageWidth),
1100 "pause" => Some(PropertyId::Pause),
1101 "pause-after" => Some(PropertyId::PauseAfter),
1102 "pause-before" => Some(PropertyId::PauseBefore),
1103 "pitch" => Some(PropertyId::Pitch),
1104 "pitch-range" => Some(PropertyId::PitchRange),
1105 "play-during" => Some(PropertyId::PlayDuring),
1106 "position" => Some(PropertyId::Position),
1107 "precedence" => Some(PropertyId::Precedence),
1108 "provisional-distance-between-starts" => {
1109 Some(PropertyId::ProvisionalDistanceBetweenStarts)
1110 }
1111 "provisional-label-separation" => Some(PropertyId::ProvisionalLabelSeparation),
1112 "reference-orientation" => Some(PropertyId::ReferenceOrientation),
1113 "ref-id" => Some(PropertyId::RefId),
1114 "region-name" => Some(PropertyId::RegionName),
1115 "region-name-reference" => Some(PropertyId::RegionNameReference),
1116 "ref-index-key" => Some(PropertyId::RefIndexKey),
1117 "relative-align" => Some(PropertyId::RelativeAlign),
1118 "relative-position" => Some(PropertyId::RelativePosition),
1119 "rendering-intent" => Some(PropertyId::RenderingIntent),
1120 "retrieve-boundary" => Some(PropertyId::RetrieveBoundary),
1121 "retrieve-boundary-within-table" => Some(PropertyId::RetrieveBoundaryWithinTable),
1122 "retrieve-class-name" => Some(PropertyId::RetrieveClassName),
1123 "retrieve-position" => Some(PropertyId::RetrievePosition),
1124 "retrieve-position-within-table" => Some(PropertyId::RetrievePositionWithinTable),
1125 "richness" => Some(PropertyId::Richness),
1126 "right" => Some(PropertyId::Right),
1127 "role" => Some(PropertyId::Role),
1128 "rule-style" => Some(PropertyId::RuleStyle),
1129 "rule-thickness" => Some(PropertyId::RuleThickness),
1130 "scaling" => Some(PropertyId::Scaling),
1131 "scaling-method" => Some(PropertyId::ScalingMethod),
1132 "score-spaces" => Some(PropertyId::ScoreSpaces),
1133 "script" => Some(PropertyId::Script),
1134 "show-destination" => Some(PropertyId::ShowDestination),
1135 "size" => Some(PropertyId::Size),
1136 "source-document" => Some(PropertyId::SourceDocument),
1137 "space-after" => Some(PropertyId::SpaceAfter),
1138 "space-before" => Some(PropertyId::SpaceBefore),
1139 "space-end" => Some(PropertyId::SpaceEnd),
1140 "space-start" => Some(PropertyId::SpaceStart),
1141 "span" => Some(PropertyId::Span),
1142 "speak" => Some(PropertyId::Speak),
1143 "speak-header" => Some(PropertyId::SpeakHeader),
1144 "speak-numeral" => Some(PropertyId::SpeakNumeral),
1145 "speak-punctuation" => Some(PropertyId::SpeakPunctuation),
1146 "speech-rate" => Some(PropertyId::SpeechRate),
1147 "src" => Some(PropertyId::Src),
1148 "start-indent" => Some(PropertyId::StartIndent),
1149 "starting-state" => Some(PropertyId::StartingState),
1150 "starts-row" => Some(PropertyId::StartsRow),
1151 "stress" => Some(PropertyId::Stress),
1152 "suppress-at-line-break" => Some(PropertyId::SuppressAtLineBreak),
1153 "switch-to" => Some(PropertyId::SwitchTo),
1154 "table-layout" => Some(PropertyId::TableLayout),
1155 "table-omit-footer-at-break" => Some(PropertyId::TableOmitFooterAtBreak),
1156 "table-omit-header-at-break" => Some(PropertyId::TableOmitHeaderAtBreak),
1157 "target-presentation-context" => Some(PropertyId::TargetPresentationContext),
1158 "target-processing-context" => Some(PropertyId::TargetProcessingContext),
1159 "target-stylesheet" => Some(PropertyId::TargetStylesheet),
1160 "text-align" => Some(PropertyId::TextAlign),
1161 "text-align-last" => Some(PropertyId::TextAlignLast),
1162 "text-altitude" => Some(PropertyId::TextAltitude),
1163 "text-decoration" => Some(PropertyId::TextDecoration),
1164 "text-depth" => Some(PropertyId::TextDepth),
1165 "text-indent" => Some(PropertyId::TextIndent),
1166 "text-shadow" => Some(PropertyId::TextShadow),
1167 "text-transform" => Some(PropertyId::TextTransform),
1168 "top" => Some(PropertyId::Top),
1169 "treat-as-word-space" => Some(PropertyId::TreatAsWordSpace),
1170 "unicode-bidi" => Some(PropertyId::UnicodeBidi),
1171 "vertical-align" => Some(PropertyId::VerticalAlign),
1172 "visibility" => Some(PropertyId::Visibility),
1173 "voice-family" => Some(PropertyId::VoiceFamily),
1174 "volume" => Some(PropertyId::Volume),
1175 "white-space" => Some(PropertyId::WhiteSpace),
1176 "white-space-collapse" => Some(PropertyId::WhiteSpaceCollapse),
1177 "white-space-treatment" => Some(PropertyId::WhiteSpaceTreatment),
1178 "widows" => Some(PropertyId::Widows),
1179 "width" => Some(PropertyId::Width),
1180 "word-spacing" => Some(PropertyId::WordSpacing),
1181 "wrap-option" => Some(PropertyId::WrapOption),
1182 "writing-mode" => Some(PropertyId::WritingMode),
1183 "xml-lang" | "xml:lang" => Some(PropertyId::XmlLang),
1184 "z-index" => Some(PropertyId::ZIndex),
1185 "x-widow-content-limit" => Some(PropertyId::XWidowContentLimit),
1186 "x-orphan-content-limit" => Some(PropertyId::XOrphanContentLimit),
1187 "x-disable-column-balancing" => Some(PropertyId::XDisableColumnBalancing),
1188 "x-alt-text" => Some(PropertyId::XAltText),
1189 "x-xml-base" => Some(PropertyId::XXmlBase),
1190 "x-border-before-radius-start" => Some(PropertyId::XBorderBeforeRadiusStart),
1191 "x-border-before-radius-end" => Some(PropertyId::XBorderBeforeRadiusEnd),
1192 "x-border-after-radius-start" => Some(PropertyId::XBorderAfterRadiusStart),
1193 "x-border-after-radius-end" => Some(PropertyId::XBorderAfterRadiusEnd),
1194 "x-border-start-radius-before" => Some(PropertyId::XBorderStartRadiusBefore),
1195 "x-border-start-radius-after" => Some(PropertyId::XBorderStartRadiusAfter),
1196 "x-border-end-radius-before" => Some(PropertyId::XBorderEndRadiusBefore),
1197 "x-border-end-radius-after" => Some(PropertyId::XBorderEndRadiusAfter),
1198 "x-border-radius" => Some(PropertyId::XBorderRadius),
1199 "x-border-before-start-radius" => Some(PropertyId::XBorderBeforeStartRadius),
1200 "x-border-before-end-radius" => Some(PropertyId::XBorderBeforeEndRadius),
1201 "x-border-after-start-radius" => Some(PropertyId::XBorderAfterStartRadius),
1202 "x-border-after-end-radius" => Some(PropertyId::XBorderAfterEndRadius),
1203 "x-number-conversion-features" => Some(PropertyId::XNumberConversionFeatures),
1204 "x-header-column" => Some(PropertyId::XHeaderColumn),
1205 "x-layer" => Some(PropertyId::XLayer),
1206 "x-auto-toggle" => Some(PropertyId::XAutoToggle),
1207 "x-background-image-width" => Some(PropertyId::XBackgroundImageWidth),
1208 "x-background-image-height" => Some(PropertyId::XBackgroundImageHeight),
1209 "x-abbreviation" => Some(PropertyId::XAbbreviation),
1210 "opacity" => Some(PropertyId::Opacity),
1211 _ => None,
1212 }
1213 }
1214}
1215
1216#[cfg(test)]
1217mod tests {
1218 use super::*;
1219
1220 #[test]
1223 fn test_name_font_size() {
1224 assert_eq!(PropertyId::FontSize.name(), "font-size");
1225 }
1226
1227 #[test]
1228 fn test_name_font_family() {
1229 assert_eq!(PropertyId::FontFamily.name(), "font-family");
1230 }
1231
1232 #[test]
1233 fn test_name_font_weight() {
1234 assert_eq!(PropertyId::FontWeight.name(), "font-weight");
1235 }
1236
1237 #[test]
1238 fn test_name_font_style() {
1239 assert_eq!(PropertyId::FontStyle.name(), "font-style");
1240 }
1241
1242 #[test]
1243 fn test_name_color() {
1244 assert_eq!(PropertyId::Color.name(), "color");
1245 }
1246
1247 #[test]
1248 fn test_name_background_color() {
1249 assert_eq!(PropertyId::BackgroundColor.name(), "background-color");
1250 }
1251
1252 #[test]
1253 fn test_name_margin_top() {
1254 assert_eq!(PropertyId::MarginTop.name(), "margin-top");
1255 }
1256
1257 #[test]
1258 fn test_name_margin_left() {
1259 assert_eq!(PropertyId::MarginLeft.name(), "margin-left");
1260 }
1261
1262 #[test]
1263 fn test_name_margin_right() {
1264 assert_eq!(PropertyId::MarginRight.name(), "margin-right");
1265 }
1266
1267 #[test]
1268 fn test_name_margin_bottom() {
1269 assert_eq!(PropertyId::MarginBottom.name(), "margin-bottom");
1270 }
1271
1272 #[test]
1273 fn test_name_padding_top() {
1274 assert_eq!(PropertyId::PaddingTop.name(), "padding-top");
1275 }
1276
1277 #[test]
1278 fn test_name_border_top_width() {
1279 assert_eq!(PropertyId::BorderTopWidth.name(), "border-top-width");
1280 }
1281
1282 #[test]
1283 fn test_name_border_top_style() {
1284 assert_eq!(PropertyId::BorderTopStyle.name(), "border-top-style");
1285 }
1286
1287 #[test]
1288 fn test_name_border_top_color() {
1289 assert_eq!(PropertyId::BorderTopColor.name(), "border-top-color");
1290 }
1291
1292 #[test]
1293 fn test_name_text_align() {
1294 assert_eq!(PropertyId::TextAlign.name(), "text-align");
1295 }
1296
1297 #[test]
1298 fn test_name_text_indent() {
1299 assert_eq!(PropertyId::TextIndent.name(), "text-indent");
1300 }
1301
1302 #[test]
1303 fn test_name_line_height() {
1304 assert_eq!(PropertyId::LineHeight.name(), "line-height");
1305 }
1306
1307 #[test]
1308 fn test_name_width() {
1309 assert_eq!(PropertyId::Width.name(), "width");
1310 }
1311
1312 #[test]
1313 fn test_name_height() {
1314 assert_eq!(PropertyId::Height.name(), "height");
1315 }
1316
1317 #[test]
1318 fn test_name_opacity() {
1319 assert_eq!(PropertyId::Opacity.name(), "opacity");
1320 }
1321
1322 #[test]
1323 fn test_name_overflow() {
1324 assert_eq!(PropertyId::Overflow.name(), "overflow");
1325 }
1326
1327 #[test]
1328 fn test_name_visibility() {
1329 assert_eq!(PropertyId::Visibility.name(), "visibility");
1330 }
1331
1332 #[test]
1333 fn test_name_display_align() {
1334 assert_eq!(PropertyId::DisplayAlign.name(), "display-align");
1335 }
1336
1337 #[test]
1338 fn test_name_position() {
1339 assert_eq!(PropertyId::Position.name(), "position");
1340 }
1341
1342 #[test]
1343 fn test_name_z_index() {
1344 assert_eq!(PropertyId::ZIndex.name(), "z-index");
1345 }
1346
1347 #[test]
1348 fn test_name_direction() {
1349 assert_eq!(PropertyId::Direction.name(), "direction");
1350 }
1351
1352 #[test]
1353 fn test_name_writing_mode() {
1354 assert_eq!(PropertyId::WritingMode.name(), "writing-mode");
1355 }
1356
1357 #[test]
1358 fn test_name_column_count() {
1359 assert_eq!(PropertyId::ColumnCount.name(), "column-count");
1360 }
1361
1362 #[test]
1363 fn test_name_break_before() {
1364 assert_eq!(PropertyId::BreakBefore.name(), "break-before");
1365 }
1366
1367 #[test]
1368 fn test_name_break_after() {
1369 assert_eq!(PropertyId::BreakAfter.name(), "break-after");
1370 }
1371
1372 #[test]
1373 fn test_name_keep_with_next() {
1374 assert_eq!(PropertyId::KeepWithNext.name(), "keep-with-next");
1375 }
1376
1377 #[test]
1378 fn test_name_keep_with_previous() {
1379 assert_eq!(PropertyId::KeepWithPrevious.name(), "keep-with-previous");
1380 }
1381
1382 #[test]
1383 fn test_name_orphans() {
1384 assert_eq!(PropertyId::Orphans.name(), "orphans");
1385 }
1386
1387 #[test]
1388 fn test_name_widows() {
1389 assert_eq!(PropertyId::Widows.name(), "widows");
1390 }
1391
1392 #[test]
1393 fn test_name_hyphenate() {
1394 assert_eq!(PropertyId::Hyphenate.name(), "hyphenate");
1395 }
1396
1397 #[test]
1398 fn test_name_xml_lang() {
1399 assert_eq!(PropertyId::XmlLang.name(), "xml-lang");
1400 }
1401
1402 #[test]
1403 fn test_name_border_collapse() {
1404 assert_eq!(PropertyId::BorderCollapse.name(), "border-collapse");
1405 }
1406
1407 #[test]
1408 fn test_name_absolute_position() {
1409 assert_eq!(PropertyId::AbsolutePosition.name(), "absolute-position");
1410 }
1411
1412 #[test]
1415 fn test_from_name_font_size() {
1416 assert_eq!(
1417 PropertyId::from_name("font-size"),
1418 Some(PropertyId::FontSize)
1419 );
1420 }
1421
1422 #[test]
1423 fn test_from_name_font_family() {
1424 assert_eq!(
1425 PropertyId::from_name("font-family"),
1426 Some(PropertyId::FontFamily)
1427 );
1428 }
1429
1430 #[test]
1431 fn test_from_name_color() {
1432 assert_eq!(PropertyId::from_name("color"), Some(PropertyId::Color));
1433 }
1434
1435 #[test]
1436 fn test_from_name_background_color() {
1437 assert_eq!(
1438 PropertyId::from_name("background-color"),
1439 Some(PropertyId::BackgroundColor)
1440 );
1441 }
1442
1443 #[test]
1444 fn test_from_name_margin_top() {
1445 assert_eq!(
1446 PropertyId::from_name("margin-top"),
1447 Some(PropertyId::MarginTop)
1448 );
1449 }
1450
1451 #[test]
1452 fn test_from_name_padding_left() {
1453 assert_eq!(
1454 PropertyId::from_name("padding-left"),
1455 Some(PropertyId::PaddingLeft)
1456 );
1457 }
1458
1459 #[test]
1460 fn test_from_name_text_align() {
1461 assert_eq!(
1462 PropertyId::from_name("text-align"),
1463 Some(PropertyId::TextAlign)
1464 );
1465 }
1466
1467 #[test]
1468 fn test_from_name_line_height() {
1469 assert_eq!(
1470 PropertyId::from_name("line-height"),
1471 Some(PropertyId::LineHeight)
1472 );
1473 }
1474
1475 #[test]
1476 fn test_from_name_width() {
1477 assert_eq!(PropertyId::from_name("width"), Some(PropertyId::Width));
1478 }
1479
1480 #[test]
1481 fn test_from_name_height() {
1482 assert_eq!(PropertyId::from_name("height"), Some(PropertyId::Height));
1483 }
1484
1485 #[test]
1486 fn test_from_name_opacity() {
1487 assert_eq!(PropertyId::from_name("opacity"), Some(PropertyId::Opacity));
1488 }
1489
1490 #[test]
1491 fn test_from_name_overflow() {
1492 assert_eq!(
1493 PropertyId::from_name("overflow"),
1494 Some(PropertyId::Overflow)
1495 );
1496 }
1497
1498 #[test]
1499 fn test_from_name_unknown_returns_none() {
1500 assert_eq!(PropertyId::from_name("not-a-property"), None);
1501 }
1502
1503 #[test]
1504 fn test_from_name_empty_returns_none() {
1505 assert_eq!(PropertyId::from_name(""), None);
1506 }
1507
1508 #[test]
1509 fn test_from_name_case_sensitive() {
1510 assert_eq!(PropertyId::from_name("Font-Size"), None);
1512 assert_eq!(PropertyId::from_name("FONT-SIZE"), None);
1513 }
1514
1515 #[test]
1518 fn test_from_name_xml_lang_hyphen_alias() {
1519 assert_eq!(PropertyId::from_name("xml-lang"), Some(PropertyId::XmlLang));
1521 }
1522
1523 #[test]
1524 fn test_from_name_xml_lang_colon_alias() {
1525 assert_eq!(PropertyId::from_name("xml:lang"), Some(PropertyId::XmlLang));
1527 }
1528
1529 #[test]
1532 fn test_roundtrip_font_size() {
1533 let id = PropertyId::FontSize;
1534 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1535 }
1536
1537 #[test]
1538 fn test_roundtrip_color() {
1539 let id = PropertyId::Color;
1540 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1541 }
1542
1543 #[test]
1544 fn test_roundtrip_margin_top() {
1545 let id = PropertyId::MarginTop;
1546 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1547 }
1548
1549 #[test]
1550 fn test_roundtrip_border_top_style() {
1551 let id = PropertyId::BorderTopStyle;
1552 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1553 }
1554
1555 #[test]
1556 fn test_roundtrip_text_align() {
1557 let id = PropertyId::TextAlign;
1558 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1559 }
1560
1561 #[test]
1562 fn test_roundtrip_opacity() {
1563 let id = PropertyId::Opacity;
1564 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1565 }
1566
1567 #[test]
1568 fn test_roundtrip_writing_mode() {
1569 let id = PropertyId::WritingMode;
1570 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1571 }
1572
1573 #[test]
1574 fn test_roundtrip_break_before() {
1575 let id = PropertyId::BreakBefore;
1576 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1577 }
1578
1579 #[test]
1580 fn test_roundtrip_keep_with_next() {
1581 let id = PropertyId::KeepWithNext;
1582 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1583 }
1584
1585 #[test]
1586 fn test_roundtrip_hyphenate() {
1587 let id = PropertyId::Hyphenate;
1588 assert_eq!(PropertyId::from_name(id.name()), Some(id));
1589 }
1590
1591 #[test]
1594 fn test_discriminant_values_are_unique() {
1595 let ids = [
1597 PropertyId::FontSize,
1598 PropertyId::FontFamily,
1599 PropertyId::Color,
1600 PropertyId::MarginTop,
1601 PropertyId::MarginLeft,
1602 PropertyId::PaddingTop,
1603 PropertyId::TextAlign,
1604 PropertyId::LineHeight,
1605 PropertyId::Width,
1606 PropertyId::Height,
1607 PropertyId::Opacity,
1608 ];
1609
1610 let mut seen = std::collections::HashSet::new();
1611 for id in &ids {
1612 let discriminant = *id as u16;
1613 assert!(
1614 seen.insert(discriminant),
1615 "Duplicate discriminant {} for {:?}",
1616 discriminant,
1617 id
1618 );
1619 }
1620 }
1621
1622 #[test]
1623 fn test_absolute_position_discriminant_is_1() {
1624 assert_eq!(PropertyId::AbsolutePosition as u16, 1);
1625 }
1626
1627 #[test]
1628 fn test_opacity_is_last_or_high() {
1629 let discriminant = PropertyId::Opacity as u16;
1631 assert!(discriminant >= 1, "Opacity discriminant must be >= 1");
1632 assert!(discriminant <= 295, "Opacity discriminant must be <= 295");
1633 }
1634
1635 #[test]
1638 fn test_copy_semantics() {
1639 let id = PropertyId::FontSize;
1640 let copied = id;
1641 assert_eq!(id, copied);
1642 }
1643
1644 #[test]
1645 fn test_clone_semantics() {
1646 let id = PropertyId::Color;
1647 let cloned = id;
1648 assert_eq!(id, cloned);
1649 }
1650
1651 #[test]
1652 fn test_equality() {
1653 assert_eq!(PropertyId::FontSize, PropertyId::FontSize);
1654 assert_ne!(PropertyId::FontSize, PropertyId::FontFamily);
1655 }
1656
1657 #[test]
1658 fn test_hash_consistency() {
1659 use std::collections::HashMap;
1660
1661 let mut map = HashMap::new();
1662 map.insert(PropertyId::FontSize, "font-size");
1663 map.insert(PropertyId::Color, "color");
1664
1665 assert_eq!(map.get(&PropertyId::FontSize), Some(&"font-size"));
1666 assert_eq!(map.get(&PropertyId::Color), Some(&"color"));
1667 assert_eq!(map.get(&PropertyId::Opacity), None);
1668 }
1669
1670 #[test]
1671 fn test_debug_format() {
1672 let debug_str = format!("{:?}", PropertyId::FontSize);
1673 assert!(!debug_str.is_empty());
1674 assert!(debug_str.contains("FontSize") || !debug_str.is_empty());
1676 }
1677
1678 #[test]
1681 fn test_from_name_all_margin_sides() {
1682 assert_eq!(
1683 PropertyId::from_name("margin-top"),
1684 Some(PropertyId::MarginTop)
1685 );
1686 assert_eq!(
1687 PropertyId::from_name("margin-right"),
1688 Some(PropertyId::MarginRight)
1689 );
1690 assert_eq!(
1691 PropertyId::from_name("margin-bottom"),
1692 Some(PropertyId::MarginBottom)
1693 );
1694 assert_eq!(
1695 PropertyId::from_name("margin-left"),
1696 Some(PropertyId::MarginLeft)
1697 );
1698 }
1699
1700 #[test]
1701 fn test_from_name_all_padding_sides() {
1702 assert_eq!(
1703 PropertyId::from_name("padding-top"),
1704 Some(PropertyId::PaddingTop)
1705 );
1706 assert_eq!(
1707 PropertyId::from_name("padding-right"),
1708 Some(PropertyId::PaddingRight)
1709 );
1710 assert_eq!(
1711 PropertyId::from_name("padding-bottom"),
1712 Some(PropertyId::PaddingBottom)
1713 );
1714 assert_eq!(
1715 PropertyId::from_name("padding-left"),
1716 Some(PropertyId::PaddingLeft)
1717 );
1718 }
1719
1720 #[test]
1721 fn test_from_name_border_top_sides() {
1722 assert_eq!(
1723 PropertyId::from_name("border-top-width"),
1724 Some(PropertyId::BorderTopWidth)
1725 );
1726 assert_eq!(
1727 PropertyId::from_name("border-top-style"),
1728 Some(PropertyId::BorderTopStyle)
1729 );
1730 assert_eq!(
1731 PropertyId::from_name("border-top-color"),
1732 Some(PropertyId::BorderTopColor)
1733 );
1734 }
1735
1736 #[test]
1737 fn test_from_name_border_logical_sides() {
1738 assert_eq!(
1739 PropertyId::from_name("border-before-style"),
1740 Some(PropertyId::BorderBeforeStyle)
1741 );
1742 assert_eq!(
1743 PropertyId::from_name("border-after-style"),
1744 Some(PropertyId::BorderAfterStyle)
1745 );
1746 assert_eq!(
1747 PropertyId::from_name("border-start-style"),
1748 Some(PropertyId::BorderStartStyle)
1749 );
1750 assert_eq!(
1751 PropertyId::from_name("border-end-style"),
1752 Some(PropertyId::BorderEndStyle)
1753 );
1754 }
1755
1756 #[test]
1757 fn test_from_name_break_properties() {
1758 assert_eq!(
1759 PropertyId::from_name("break-before"),
1760 Some(PropertyId::BreakBefore)
1761 );
1762 assert_eq!(
1763 PropertyId::from_name("break-after"),
1764 Some(PropertyId::BreakAfter)
1765 );
1766 }
1767
1768 #[test]
1769 fn test_from_name_position_properties() {
1770 assert_eq!(PropertyId::from_name("top"), Some(PropertyId::Top));
1771 assert_eq!(PropertyId::from_name("bottom"), Some(PropertyId::Bottom));
1772 assert_eq!(PropertyId::from_name("left"), Some(PropertyId::Left));
1773 assert_eq!(PropertyId::from_name("right"), Some(PropertyId::Right));
1774 }
1775
1776 #[test]
1777 fn test_from_name_font_properties() {
1778 assert_eq!(
1779 PropertyId::from_name("font-size"),
1780 Some(PropertyId::FontSize)
1781 );
1782 assert_eq!(
1783 PropertyId::from_name("font-weight"),
1784 Some(PropertyId::FontWeight)
1785 );
1786 assert_eq!(
1787 PropertyId::from_name("font-style"),
1788 Some(PropertyId::FontStyle)
1789 );
1790 assert_eq!(
1791 PropertyId::from_name("font-family"),
1792 Some(PropertyId::FontFamily)
1793 );
1794 assert_eq!(
1795 PropertyId::from_name("font-variant"),
1796 Some(PropertyId::FontVariant)
1797 );
1798 }
1799
1800 #[test]
1801 fn test_from_name_table_properties() {
1802 assert_eq!(
1803 PropertyId::from_name("border-collapse"),
1804 Some(PropertyId::BorderCollapse)
1805 );
1806 assert_eq!(
1807 PropertyId::from_name("table-layout"),
1808 Some(PropertyId::TableLayout)
1809 );
1810 assert_eq!(
1811 PropertyId::from_name("empty-cells"),
1812 Some(PropertyId::EmptyCells)
1813 );
1814 }
1815
1816 #[test]
1817 fn test_from_name_hyphenation_properties() {
1818 assert_eq!(
1819 PropertyId::from_name("hyphenate"),
1820 Some(PropertyId::Hyphenate)
1821 );
1822 assert_eq!(
1823 PropertyId::from_name("hyphenation-character"),
1824 Some(PropertyId::HyphenationCharacter)
1825 );
1826 assert_eq!(
1827 PropertyId::from_name("hyphenation-push-character-count"),
1828 Some(PropertyId::HyphenationPushCharacterCount)
1829 );
1830 assert_eq!(
1831 PropertyId::from_name("hyphenation-remain-character-count"),
1832 Some(PropertyId::HyphenationRemainCharacterCount)
1833 );
1834 }
1835
1836 #[test]
1839 fn test_name_is_nonempty_for_key_properties() {
1840 let properties = [
1841 PropertyId::AbsolutePosition,
1842 PropertyId::Color,
1843 PropertyId::FontSize,
1844 PropertyId::FontFamily,
1845 PropertyId::FontWeight,
1846 PropertyId::FontStyle,
1847 PropertyId::LineHeight,
1848 PropertyId::TextAlign,
1849 PropertyId::TextIndent,
1850 PropertyId::MarginTop,
1851 PropertyId::PaddingLeft,
1852 PropertyId::BorderTopStyle,
1853 PropertyId::Width,
1854 PropertyId::Height,
1855 PropertyId::Opacity,
1856 PropertyId::Overflow,
1857 PropertyId::Visibility,
1858 PropertyId::Direction,
1859 PropertyId::WritingMode,
1860 PropertyId::Orphans,
1861 PropertyId::Widows,
1862 PropertyId::BreakBefore,
1863 PropertyId::BreakAfter,
1864 PropertyId::Hyphenate,
1865 PropertyId::XmlLang,
1866 ];
1867
1868 for prop in &properties {
1869 let name = prop.name();
1870 assert!(!name.is_empty(), "Property {:?} has empty name", prop);
1871 assert!(
1872 name.chars()
1873 .all(|c| c.is_ascii_lowercase() || c == '-' || c == ':'),
1874 "Property {:?} name '{}' contains unexpected characters",
1875 prop,
1876 name
1877 );
1878 }
1879 }
1880}