mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
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:
committed by
Andreas Kling
parent
d95ae629ee
commit
aacf9b08ed
Notes:
github-actions[bot]
2024-11-14 18:51:20 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/aacf9b08ed8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2346
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const defaultStyleIframe = document.createElement("iframe");
|
||||
document.body.appendChild(defaultStyleIframe);
|
||||
|
||||
const defaultStyle = getComputedStyle(defaultStyleIframe.contentDocument.body);
|
||||
|
||||
const stylePrototype = Object.getPrototypeOf(defaultStyle);
|
||||
const supportedProperties = Object.getOwnPropertyNames(stylePrototype);
|
||||
|
||||
println("All supported properties and their default values exposed from CSSStyleDeclaration from getComputedStyle:");
|
||||
for (const supportedProperty of supportedProperties) {
|
||||
println(`'${supportedProperty}': '${defaultStyle[supportedProperty]}'`);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user