LibWeb: Generate IDL attributes for all supported CSS properties

The CSSOM spec tells us to potentially add up to three different IDL
attributes to CSSStyleDeclaration for every CSS property we support:
- A camelCased attribute, where a dash indicates the next character
  should be uppercase
- A camelCased attribute for every -webkit- prefixed property, with the
  first letter always being lowercase
- A dashed-attribute for every property with a dash in it.

Additionally, every attribute must have the CEReactions and
LegacyNullToEmptyString extended attributes specified on it.

Since we specify every property we support with Properties.json, we can
use that file to generate the IDL file and it's implementation.

We import it from the Build directory with the help of multiple import
base paths. Then, we add it to CSSStyleDeclaration via the mixin
functionality and inheriting the generated class in
CSSStyleDeclaration.
This commit is contained in:
Luke Wilde 2024-11-14 16:57:14 +00:00 committed by Andreas Kling
commit aacf9b08ed
Notes: github-actions[bot] 2024-11-14 18:51:20 +00:00
12 changed files with 909 additions and 60 deletions

View file

@ -0,0 +1,573 @@
All supported properties and their default values exposed from CSSStyleDeclaration from getComputedStyle:
'cssText': ''
'length': '201'
'parentRule': 'null'
'cssFloat': 'none'
'WebkitAlignContent': 'normal'
'webkitAlignContent': 'normal'
'-webkit-align-content': 'normal'
'WebkitAlignItems': 'normal'
'webkitAlignItems': 'normal'
'-webkit-align-items': 'normal'
'WebkitAlignSelf': 'auto'
'webkitAlignSelf': 'auto'
'-webkit-align-self': 'auto'
'WebkitAnimation': 'none auto ease 1 normal running 0s none'
'webkitAnimation': 'none auto ease 1 normal running 0s none'
'-webkit-animation': 'none auto ease 1 normal running 0s none'
'WebkitAnimationDelay': '0s'
'webkitAnimationDelay': '0s'
'-webkit-animation-delay': '0s'
'WebkitAnimationDirection': 'normal'
'webkitAnimationDirection': 'normal'
'-webkit-animation-direction': 'normal'
'WebkitAnimationDuration': 'auto'
'webkitAnimationDuration': 'auto'
'-webkit-animation-duration': 'auto'
'WebkitAnimationFillMode': 'none'
'webkitAnimationFillMode': 'none'
'-webkit-animation-fill-mode': 'none'
'WebkitAnimationIterationCount': '1'
'webkitAnimationIterationCount': '1'
'-webkit-animation-iteration-count': '1'
'WebkitAnimationName': 'none'
'webkitAnimationName': 'none'
'-webkit-animation-name': 'none'
'WebkitAnimationPlayState': 'running'
'webkitAnimationPlayState': 'running'
'-webkit-animation-play-state': 'running'
'WebkitAnimationTimingFunction': 'ease'
'webkitAnimationTimingFunction': 'ease'
'-webkit-animation-timing-function': 'ease'
'WebkitAppearance': 'auto'
'webkitAppearance': 'auto'
'-webkit-appearance': 'auto'
'WebkitBackgroundClip': 'border-box'
'webkitBackgroundClip': 'border-box'
'-webkit-background-clip': 'border-box'
'WebkitBackgroundOrigin': 'padding-box'
'webkitBackgroundOrigin': 'padding-box'
'-webkit-background-origin': 'padding-box'
'WebkitBackgroundSize': 'auto auto'
'webkitBackgroundSize': 'auto auto'
'-webkit-background-size': 'auto auto'
'WebkitBorderBottomLeftRadius': '0px'
'webkitBorderBottomLeftRadius': '0px'
'-webkit-border-bottom-left-radius': '0px'
'WebkitBorderBottomRightRadius': '0px'
'webkitBorderBottomRightRadius': '0px'
'-webkit-border-bottom-right-radius': '0px'
'WebkitBorderRadius': '0px 0px 0px 0px'
'webkitBorderRadius': '0px 0px 0px 0px'
'-webkit-border-radius': '0px 0px 0px 0px'
'WebkitBorderTopLeftRadius': '0px'
'webkitBorderTopLeftRadius': '0px'
'-webkit-border-top-left-radius': '0px'
'WebkitBorderTopRightRadius': '0px'
'webkitBorderTopRightRadius': '0px'
'-webkit-border-top-right-radius': '0px'
'WebkitBoxShadow': 'none'
'webkitBoxShadow': 'none'
'-webkit-box-shadow': 'none'
'WebkitBoxSizing': 'content-box'
'webkitBoxSizing': 'content-box'
'-webkit-box-sizing': 'content-box'
'WebkitFlex': '0 1 auto'
'webkitFlex': '0 1 auto'
'-webkit-flex': '0 1 auto'
'WebkitFlexBasis': 'auto'
'webkitFlexBasis': 'auto'
'-webkit-flex-basis': 'auto'
'WebkitFlexDirection': 'row'
'webkitFlexDirection': 'row'
'-webkit-flex-direction': 'row'
'WebkitFlexFlow': 'row nowrap'
'webkitFlexFlow': 'row nowrap'
'-webkit-flex-flow': 'row nowrap'
'WebkitFlexGrow': '0'
'webkitFlexGrow': '0'
'-webkit-flex-grow': '0'
'WebkitFlexShrink': '1'
'webkitFlexShrink': '1'
'-webkit-flex-shrink': '1'
'WebkitFlexWrap': 'nowrap'
'webkitFlexWrap': 'nowrap'
'-webkit-flex-wrap': 'nowrap'
'WebkitJustifyContent': 'normal'
'webkitJustifyContent': 'normal'
'-webkit-justify-content': 'normal'
'WebkitMask': 'none'
'webkitMask': 'none'
'-webkit-mask': 'none'
'WebkitOrder': '0'
'webkitOrder': '0'
'-webkit-order': '0'
'WebkitTextFillColor': 'rgb(0, 0, 0)'
'webkitTextFillColor': 'rgb(0, 0, 0)'
'-webkit-text-fill-color': 'rgb(0, 0, 0)'
'WebkitTransform': 'none'
'webkitTransform': 'none'
'-webkit-transform': 'none'
'WebkitTransformOrigin': '50% 50%'
'webkitTransformOrigin': '50% 50%'
'-webkit-transform-origin': '50% 50%'
'WebkitTransition': 'all 0s ease 0s'
'webkitTransition': 'all 0s ease 0s'
'-webkit-transition': 'all 0s ease 0s'
'WebkitTransitionDelay': '0s'
'webkitTransitionDelay': '0s'
'-webkit-transition-delay': '0s'
'WebkitTransitionDuration': '0s'
'webkitTransitionDuration': '0s'
'-webkit-transition-duration': '0s'
'WebkitTransitionProperty': 'all'
'webkitTransitionProperty': 'all'
'-webkit-transition-property': 'all'
'WebkitTransitionTimingFunction': 'ease'
'webkitTransitionTimingFunction': 'ease'
'-webkit-transition-timing-function': 'ease'
'accentColor': 'auto'
'accent-color': 'auto'
'alignContent': 'normal'
'align-content': 'normal'
'alignItems': 'normal'
'align-items': 'normal'
'alignSelf': 'auto'
'align-self': 'auto'
'animation': 'none auto ease 1 normal running 0s none'
'animationDelay': '0s'
'animation-delay': '0s'
'animationDirection': 'normal'
'animation-direction': 'normal'
'animationDuration': 'auto'
'animation-duration': 'auto'
'animationFillMode': 'none'
'animation-fill-mode': 'none'
'animationIterationCount': '1'
'animation-iteration-count': '1'
'animationName': 'none'
'animation-name': 'none'
'animationPlayState': 'running'
'animation-play-state': 'running'
'animationTimingFunction': 'ease'
'animation-timing-function': 'ease'
'appearance': 'auto'
'aspectRatio': 'auto'
'aspect-ratio': 'auto'
'backdropFilter': 'none'
'backdrop-filter': 'none'
'background': 'scroll border-box rgba(0, 0, 0, 0) none padding-box left 0% top 0% repeat repeat auto auto'
'backgroundAttachment': 'scroll'
'background-attachment': 'scroll'
'backgroundClip': 'border-box'
'background-clip': 'border-box'
'backgroundColor': 'rgba(0, 0, 0, 0)'
'background-color': 'rgba(0, 0, 0, 0)'
'backgroundImage': 'none'
'background-image': 'none'
'backgroundOrigin': 'padding-box'
'background-origin': 'padding-box'
'backgroundPosition': 'left 0% top 0%'
'background-position': 'left 0% top 0%'
'backgroundPositionX': 'left 0%'
'background-position-x': 'left 0%'
'backgroundPositionY': 'top 0%'
'background-position-y': 'top 0%'
'backgroundRepeat': 'repeat repeat'
'background-repeat': 'repeat repeat'
'backgroundSize': 'auto auto'
'background-size': 'auto auto'
'border': 'medium none rgb(0, 0, 0)'
'borderBottom': 'medium none rgb(0, 0, 0)'
'border-bottom': 'medium none rgb(0, 0, 0)'
'borderBottomColor': 'rgb(0, 0, 0)'
'border-bottom-color': 'rgb(0, 0, 0)'
'borderBottomLeftRadius': '0px'
'border-bottom-left-radius': '0px'
'borderBottomRightRadius': '0px'
'border-bottom-right-radius': '0px'
'borderBottomStyle': 'none'
'border-bottom-style': 'none'
'borderBottomWidth': 'medium'
'border-bottom-width': 'medium'
'borderCollapse': 'separate'
'border-collapse': 'separate'
'borderColor': 'rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0)'
'border-color': 'rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0) rgb(0, 0, 0)'
'borderLeft': 'medium none rgb(0, 0, 0)'
'border-left': 'medium none rgb(0, 0, 0)'
'borderLeftColor': 'rgb(0, 0, 0)'
'border-left-color': 'rgb(0, 0, 0)'
'borderLeftStyle': 'none'
'border-left-style': 'none'
'borderLeftWidth': 'medium'
'border-left-width': 'medium'
'borderRadius': '0px 0px 0px 0px'
'border-radius': '0px 0px 0px 0px'
'borderRight': 'medium none rgb(0, 0, 0)'
'border-right': 'medium none rgb(0, 0, 0)'
'borderRightColor': 'rgb(0, 0, 0)'
'border-right-color': 'rgb(0, 0, 0)'
'borderRightStyle': 'none'
'border-right-style': 'none'
'borderRightWidth': 'medium'
'border-right-width': 'medium'
'borderSpacing': '0px'
'border-spacing': '0px'
'borderStyle': 'none none none none'
'border-style': 'none none none none'
'borderTop': 'medium none rgb(0, 0, 0)'
'border-top': 'medium none rgb(0, 0, 0)'
'borderTopColor': 'rgb(0, 0, 0)'
'border-top-color': 'rgb(0, 0, 0)'
'borderTopLeftRadius': '0px'
'border-top-left-radius': '0px'
'borderTopRightRadius': '0px'
'border-top-right-radius': '0px'
'borderTopStyle': 'none'
'border-top-style': 'none'
'borderTopWidth': 'medium'
'border-top-width': 'medium'
'borderWidth': 'medium medium medium medium'
'border-width': 'medium medium medium medium'
'bottom': 'auto'
'boxShadow': 'none'
'box-shadow': 'none'
'boxSizing': 'content-box'
'box-sizing': 'content-box'
'captionSide': 'top'
'caption-side': 'top'
'clear': 'none'
'clip': 'auto'
'clipPath': 'none'
'clip-path': 'none'
'clipRule': 'nonzero'
'clip-rule': 'nonzero'
'color': 'rgb(0, 0, 0)'
'columnCount': 'auto'
'column-count': 'auto'
'columnGap': 'normal'
'column-gap': 'normal'
'columnSpan': 'none'
'column-span': 'none'
'columnWidth': 'auto'
'column-width': 'auto'
'columns': 'auto auto'
'content': 'normal'
'contentVisibility': 'visible'
'content-visibility': 'visible'
'counterIncrement': 'none'
'counter-increment': 'none'
'counterReset': 'none'
'counter-reset': 'none'
'counterSet': 'none'
'counter-set': 'none'
'cursor': 'auto'
'cx': '0px'
'cy': '0px'
'direction': 'ltr'
'display': 'block'
'fill': 'rgb(0, 0, 0)'
'fillOpacity': '1'
'fill-opacity': '1'
'fillRule': 'nonzero'
'fill-rule': 'nonzero'
'filter': 'none'
'flex': '0 1 auto'
'flexBasis': 'auto'
'flex-basis': 'auto'
'flexDirection': 'row'
'flex-direction': 'row'
'flexFlow': 'row nowrap'
'flex-flow': 'row nowrap'
'flexGrow': '0'
'flex-grow': '0'
'flexShrink': '1'
'flex-shrink': '1'
'flexWrap': 'nowrap'
'flex-wrap': 'nowrap'
'float': 'none'
'font': 'serif 16px normal normal normal 400 normal'
'fontFamily': 'serif'
'font-family': 'serif'
'fontFeatureSettings': 'normal'
'font-feature-settings': 'normal'
'fontLanguageOverride': 'normal'
'font-language-override': 'normal'
'fontSize': '16px'
'font-size': '16px'
'fontStretch': 'normal'
'font-stretch': 'normal'
'fontStyle': 'normal'
'font-style': 'normal'
'fontVariant': 'normal'
'font-variant': 'normal'
'fontVariationSettings': 'normal'
'font-variation-settings': 'normal'
'fontWeight': '400'
'font-weight': '400'
'fontWidth': 'normal'
'font-width': 'normal'
'gap': 'normal normal'
'grid': 'none auto auto'
'gridArea': 'auto auto auto auto'
'grid-area': 'auto auto auto auto'
'gridAutoColumns': 'auto'
'grid-auto-columns': 'auto'
'gridAutoFlow': 'row'
'grid-auto-flow': 'row'
'gridAutoRows': 'auto'
'grid-auto-rows': 'auto'
'gridColumn': 'auto auto'
'grid-column': 'auto auto'
'gridColumnEnd': 'auto'
'grid-column-end': 'auto'
'gridColumnGap': 'normal'
'grid-column-gap': 'normal'
'gridColumnStart': 'auto'
'grid-column-start': 'auto'
'gridGap': 'normal normal'
'grid-gap': 'normal normal'
'gridRow': 'auto auto'
'grid-row': 'auto auto'
'gridRowEnd': 'auto'
'grid-row-end': 'auto'
'gridRowGap': 'normal'
'grid-row-gap': 'normal'
'gridRowStart': 'auto'
'grid-row-start': 'auto'
'gridTemplate': 'none auto auto'
'grid-template': 'none auto auto'
'gridTemplateAreas': 'none'
'grid-template-areas': 'none'
'gridTemplateColumns': 'auto'
'grid-template-columns': 'auto'
'gridTemplateRows': 'auto'
'grid-template-rows': 'auto'
'height': '0px'
'imageRendering': 'auto'
'image-rendering': 'auto'
'inlineSize': 'auto'
'inline-size': 'auto'
'inset': 'auto auto auto auto'
'insetBlock': 'auto auto auto auto'
'inset-block': 'auto auto auto auto'
'insetBlockEnd': 'auto'
'inset-block-end': 'auto'
'insetBlockStart': 'auto'
'inset-block-start': 'auto'
'insetInline': 'auto auto auto auto'
'inset-inline': 'auto auto auto auto'
'insetInlineEnd': 'auto'
'inset-inline-end': 'auto'
'insetInlineStart': 'auto'
'inset-inline-start': 'auto'
'justifyContent': 'normal'
'justify-content': 'normal'
'justifyItems': 'legacy'
'justify-items': 'legacy'
'justifySelf': 'auto'
'justify-self': 'auto'
'left': 'auto'
'letterSpacing': 'normal'
'letter-spacing': 'normal'
'lineHeight': 'normal'
'line-height': 'normal'
'listStyle': 'disc outside none'
'list-style': 'disc outside none'
'listStyleImage': 'none'
'list-style-image': 'none'
'listStylePosition': 'outside'
'list-style-position': 'outside'
'listStyleType': 'disc'
'list-style-type': 'disc'
'margin': '8px 8px 8px 8px'
'marginBlock': '8px 8px 8px 8px'
'margin-block': '8px 8px 8px 8px'
'marginBlockEnd': '8px'
'margin-block-end': '8px'
'marginBlockStart': '8px'
'margin-block-start': '8px'
'marginBottom': '8px'
'margin-bottom': '8px'
'marginInline': '8px 8px 8px 8px'
'margin-inline': '8px 8px 8px 8px'
'marginInlineEnd': '8px'
'margin-inline-end': '8px'
'marginInlineStart': '8px'
'margin-inline-start': '8px'
'marginLeft': '8px'
'margin-left': '8px'
'marginRight': '8px'
'margin-right': '8px'
'marginTop': '8px'
'margin-top': '8px'
'mask': 'none'
'maskType': 'luminance'
'mask-type': 'luminance'
'mathDepth': '0'
'math-depth': '0'
'mathShift': 'normal'
'math-shift': 'normal'
'mathStyle': 'normal'
'math-style': 'normal'
'maxHeight': 'none'
'max-height': 'none'
'maxInlineSize': 'none'
'max-inline-size': 'none'
'maxWidth': 'none'
'max-width': 'none'
'minHeight': 'auto'
'min-height': 'auto'
'minInlineSize': '0px'
'min-inline-size': '0px'
'minWidth': 'auto'
'min-width': 'auto'
'objectFit': 'fill'
'object-fit': 'fill'
'objectPosition': 'left 50% top 50%'
'object-position': 'left 50% top 50%'
'opacity': '1'
'order': '0'
'outline': 'rgb(0, 0, 0) none medium'
'outlineColor': 'rgb(0, 0, 0)'
'outline-color': 'rgb(0, 0, 0)'
'outlineOffset': '0px'
'outline-offset': '0px'
'outlineStyle': 'none'
'outline-style': 'none'
'outlineWidth': 'medium'
'outline-width': 'medium'
'overflow': 'visible visible'
'overflowX': 'visible'
'overflow-x': 'visible'
'overflowY': 'visible'
'overflow-y': 'visible'
'padding': '0px 0px 0px 0px'
'paddingBlock': '0px 0px 0px 0px'
'padding-block': '0px 0px 0px 0px'
'paddingBlockEnd': '0px'
'padding-block-end': '0px'
'paddingBlockStart': '0px'
'padding-block-start': '0px'
'paddingBottom': '0px'
'padding-bottom': '0px'
'paddingInline': '0px 0px 0px 0px'
'padding-inline': '0px 0px 0px 0px'
'paddingInlineEnd': '0px'
'padding-inline-end': '0px'
'paddingInlineStart': '0px'
'padding-inline-start': '0px'
'paddingLeft': '0px'
'padding-left': '0px'
'paddingRight': '0px'
'padding-right': '0px'
'paddingTop': '0px'
'padding-top': '0px'
'placeContent': 'normal normal'
'place-content': 'normal normal'
'placeItems': 'normal legacy'
'place-items': 'normal legacy'
'placeSelf': 'auto auto'
'place-self': 'auto auto'
'pointerEvents': 'auto'
'pointer-events': 'auto'
'position': 'static'
'quotes': 'auto'
'r': '0px'
'right': 'auto'
'rotate': 'none'
'rowGap': 'normal'
'row-gap': 'normal'
'rx': 'auto'
'ry': 'auto'
'scrollbarGutter': 'auto'
'scrollbar-gutter': 'auto'
'scrollbarWidth': 'auto'
'scrollbar-width': 'auto'
'stopColor': 'rgb(0, 0, 0)'
'stop-color': 'rgb(0, 0, 0)'
'stopOpacity': '1'
'stop-opacity': '1'
'stroke': 'none'
'strokeLinecap': 'butt'
'stroke-linecap': 'butt'
'strokeLinejoin': 'miter'
'stroke-linejoin': 'miter'
'strokeMiterlimit': '4'
'stroke-miterlimit': '4'
'strokeOpacity': '1'
'stroke-opacity': '1'
'strokeWidth': '1px'
'stroke-width': '1px'
'tabSize': '8'
'tab-size': '8'
'tableLayout': 'auto'
'table-layout': 'auto'
'textAlign': 'start'
'text-align': 'start'
'textAnchor': 'start'
'text-anchor': 'start'
'textDecoration': 'rgb(0, 0, 0) none solid auto'
'text-decoration': 'rgb(0, 0, 0) none solid auto'
'textDecorationColor': 'rgb(0, 0, 0)'
'text-decoration-color': 'rgb(0, 0, 0)'
'textDecorationLine': 'none'
'text-decoration-line': 'none'
'textDecorationStyle': 'solid'
'text-decoration-style': 'solid'
'textDecorationThickness': 'auto'
'text-decoration-thickness': 'auto'
'textIndent': '0px'
'text-indent': '0px'
'textJustify': 'auto'
'text-justify': 'auto'
'textOverflow': 'clip'
'text-overflow': 'clip'
'textShadow': 'none'
'text-shadow': 'none'
'textTransform': 'none'
'text-transform': 'none'
'top': 'auto'
'transform': 'none'
'transformBox': 'view-box'
'transform-box': 'view-box'
'transformOrigin': '50% 50%'
'transform-origin': '50% 50%'
'transition': 'all 0s ease 0s'
'transitionDelay': '0s'
'transition-delay': '0s'
'transitionDuration': '0s'
'transition-duration': '0s'
'transitionProperty': 'all'
'transition-property': 'all'
'transitionTimingFunction': 'ease'
'transition-timing-function': 'ease'
'unicodeBidi': 'normal'
'unicode-bidi': 'normal'
'userSelect': 'auto'
'user-select': 'auto'
'verticalAlign': 'baseline'
'vertical-align': 'baseline'
'visibility': 'visible'
'whiteSpace': 'normal'
'white-space': 'normal'
'width': '284px'
'wordBreak': 'normal'
'word-break': 'normal'
'wordSpacing': 'normal'
'word-spacing': 'normal'
'wordWrap': 'normal'
'word-wrap': 'normal'
'writingMode': 'horizontal-tb'
'writing-mode': 'horizontal-tb'
'x': '0px'
'y': '0px'
'zIndex': 'auto'
'z-index': 'auto'
'getPropertyPriority': 'function getPropertyPriority() { [native code] }'
'getPropertyValue': 'function getPropertyValue() { [native code] }'
'removeProperty': 'function removeProperty() { [native code] }'
'item': 'function item() { [native code] }'
'setProperty': 'function setProperty() { [native code] }'
'constructor': 'function CSSStyleDeclaration() { [native code] }'