mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Generate pseudo-element code from JSON
Initially, this generates the enum and to/from-string functions. The JSON itself contains more data than that, but it's unused for now.
This commit is contained in:
parent
0ed2e71801
commit
ffa1dba96a
Notes:
github-actions[bot]
2025-03-24 09:51:30 +00:00
Author: https://github.com/AtkinsSJ
Commit: ffa1dba96a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4021
14 changed files with 244 additions and 106 deletions
|
@ -103,3 +103,14 @@ inline String css_property_to_idl_attribute(StringView property_name, bool lower
|
|||
// 5. Return output.
|
||||
return MUST(output.to_string());
|
||||
}
|
||||
|
||||
inline StringView underlying_type_for_enum(size_t member_count)
|
||||
{
|
||||
if (member_count <= NumericLimits<u8>::max())
|
||||
return "u8"sv;
|
||||
if (member_count <= NumericLimits<u16>::max())
|
||||
return "u16"sv;
|
||||
if (member_count <= NumericLimits<u32>::max())
|
||||
return "u32"sv;
|
||||
return "u64"sv;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue