ladybird/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl
Luke Wilde aacf9b08ed 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.
2024-11-14 19:50:22 +01:00

24 lines
836 B
Text

#import <CSS/GeneratedCSSStyleProperties.idl>
// https://drafts.csswg.org/cssom/#cssstyledeclaration
[Exposed=Window]
interface CSSStyleDeclaration {
[CEReactions] attribute CSSOMString cssText;
readonly attribute unsigned long length;
getter CSSOMString item(unsigned long index);
CSSOMString getPropertyValue(CSSOMString property);
CSSOMString getPropertyPriority(CSSOMString property);
[CEReactions] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, optional [LegacyNullToEmptyString] CSSOMString priority = "");
[CEReactions] CSSOMString removeProperty(CSSOMString property);
readonly attribute CSSRule? parentRule;
[CEReactions, LegacyNullToEmptyString] attribute CSSOMString cssFloat;
};
CSSStyleDeclaration includes GeneratedCSSStyleProperties;