|
@@ -46,6 +46,11 @@ static bool type_name_is_enum(StringView type_name)
|
|
|
"url"sv);
|
|
|
}
|
|
|
|
|
|
+static bool is_legacy_alias(JsonObject const& property)
|
|
|
+{
|
|
|
+ return property.has_string("legacy-alias-for"sv);
|
|
|
+}
|
|
|
+
|
|
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|
|
{
|
|
|
StringView generated_header_path;
|
|
@@ -143,6 +148,9 @@ enum class PropertyID {
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ // Legacy aliases don't get a PropertyID
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
bool inherited = value.as_object().get_bool("inherited"sv).value_or(false);
|
|
|
if (value.as_object().has("longhands"sv)) {
|
|
|
if (inherited)
|
|
@@ -305,6 +313,8 @@ bool property_accepts_@css_type_name@(PropertyID property_id, [[maybe_unused]] @
|
|
|
|
|
|
properties.for_each_member([&](auto& name, JsonValue const& value) -> void {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
if (auto maybe_valid_types = value.as_object().get_array("valid-types"sv); maybe_valid_types.has_value() && !maybe_valid_types->is_empty()) {
|
|
|
for (auto valid_type : maybe_valid_types->values()) {
|
|
|
auto type_and_range = valid_type.as_string().split_view(' ');
|
|
@@ -406,8 +416,12 @@ Optional<PropertyID> property_id_from_camel_case_string(StringView string)
|
|
|
|
|
|
auto member_generator = generator.fork();
|
|
|
member_generator.set("name", name);
|
|
|
- member_generator.set("name:titlecase", title_casify(name));
|
|
|
member_generator.set("name:camelcase", camel_casify(name));
|
|
|
+ if (auto legacy_alias_for = value.as_object().get_byte_string("legacy-alias-for"sv); legacy_alias_for.has_value()) {
|
|
|
+ member_generator.set("name:titlecase", title_casify(legacy_alias_for.value()));
|
|
|
+ } else {
|
|
|
+ member_generator.set("name:titlecase", title_casify(name));
|
|
|
+ }
|
|
|
member_generator.append(R"~~~(
|
|
|
if (string.equals_ignoring_ascii_case("@name:camelcase@"sv))
|
|
|
return PropertyID::@name:titlecase@;
|
|
@@ -429,7 +443,11 @@ Optional<PropertyID> property_id_from_string(StringView string)
|
|
|
|
|
|
auto member_generator = generator.fork();
|
|
|
member_generator.set("name", name);
|
|
|
- member_generator.set("name:titlecase", title_casify(name));
|
|
|
+ if (auto legacy_alias_for = value.as_object().get_byte_string("legacy-alias-for"sv); legacy_alias_for.has_value()) {
|
|
|
+ member_generator.set("name:titlecase", title_casify(legacy_alias_for.value()));
|
|
|
+ } else {
|
|
|
+ member_generator.set("name:titlecase", title_casify(name));
|
|
|
+ }
|
|
|
member_generator.append(R"~~~(
|
|
|
if (Infra::is_ascii_case_insensitive_match(string, "@name@"sv))
|
|
|
return PropertyID::@name:titlecase@;
|
|
@@ -446,6 +464,8 @@ FlyString const& string_from_property_id(PropertyID property_id) {
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
|
|
|
auto member_generator = generator.fork();
|
|
|
member_generator.set("name", name);
|
|
@@ -472,6 +492,8 @@ FlyString const& camel_case_string_from_property_id(PropertyID property_id) {
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
|
|
|
auto member_generator = generator.fork();
|
|
|
member_generator.set("name", name);
|
|
@@ -500,6 +522,9 @@ AnimationType animation_type_from_longhand_property(PropertyID property_id)
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
+
|
|
|
auto member_generator = generator.fork();
|
|
|
member_generator.set("name:titlecase", title_casify(name));
|
|
|
|
|
@@ -542,6 +567,9 @@ bool is_animatable_property(PropertyID property_id)
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
+
|
|
|
if (is_animatable_property(properties, name)) {
|
|
|
auto member_generator = generator.fork();
|
|
|
member_generator.set("name:titlecase", title_casify(name));
|
|
@@ -574,6 +602,8 @@ bool property_affects_layout(PropertyID property_id)
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
|
|
|
bool affects_layout = true;
|
|
|
if (value.as_object().has("affects-layout"sv))
|
|
@@ -602,6 +632,8 @@ bool property_affects_stacking_context(PropertyID property_id)
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
|
|
|
bool affects_stacking_context = false;
|
|
|
if (value.as_object().has("affects-stacking-context"sv))
|
|
@@ -663,6 +695,8 @@ NonnullRefPtr<CSSStyleValue> property_initial_value(JS::Realm& context_realm, Pr
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
output_initial_value_code(name, value.as_object());
|
|
|
});
|
|
|
|
|
@@ -679,6 +713,9 @@ bool property_has_quirk(PropertyID property_id, Quirk quirk)
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
+
|
|
|
if (value.as_object().has("quirks"sv)) {
|
|
|
auto quirks_value = value.as_object().get_array("quirks"sv);
|
|
|
VERIFY(quirks_value.has_value());
|
|
@@ -723,6 +760,9 @@ bool property_accepts_type(PropertyID property_id, ValueType value_type)
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
auto& object = value.as_object();
|
|
|
+ if (is_legacy_alias(object))
|
|
|
+ return;
|
|
|
+
|
|
|
if (auto maybe_valid_types = object.get_array("valid-types"sv); maybe_valid_types.has_value() && !maybe_valid_types->is_empty()) {
|
|
|
auto& valid_types = maybe_valid_types.value();
|
|
|
auto property_generator = generator.fork();
|
|
@@ -813,6 +853,8 @@ bool property_accepts_keyword(PropertyID property_id, Keyword keyword)
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
auto& object = value.as_object();
|
|
|
+ if (is_legacy_alias(object))
|
|
|
+ return;
|
|
|
|
|
|
auto property_generator = generator.fork();
|
|
|
property_generator.set("name:titlecase", title_casify(name));
|
|
@@ -867,6 +909,9 @@ Optional<ValueType> property_resolves_percentages_relative_to(PropertyID propert
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
+
|
|
|
if (auto resolved_type = value.as_object().get_byte_string("percentages-resolve-to"sv); resolved_type.has_value()) {
|
|
|
auto property_generator = generator.fork();
|
|
|
property_generator.set("name:titlecase", title_casify(name));
|
|
@@ -891,6 +936,9 @@ size_t property_maximum_value_count(PropertyID property_id)
|
|
|
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
VERIFY(value.is_object());
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
+
|
|
|
if (value.as_object().has("max-values"sv)) {
|
|
|
JsonValue max_values = value.as_object().get("max-values"sv).release_value();
|
|
|
VERIFY(max_values.is_integer<size_t>());
|
|
@@ -926,6 +974,9 @@ bool property_is_shorthand(PropertyID property_id)
|
|
|
switch (property_id) {
|
|
|
)~~~");
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
+
|
|
|
if (value.as_object().has("longhands"sv)) {
|
|
|
auto property_generator = generator.fork();
|
|
|
property_generator.set("name:titlecase", title_casify(name));
|
|
@@ -949,6 +1000,9 @@ Vector<PropertyID> longhands_for_shorthand(PropertyID property_id)
|
|
|
switch (property_id) {
|
|
|
)~~~");
|
|
|
properties.for_each_member([&](auto& name, auto& value) {
|
|
|
+ if (is_legacy_alias(value.as_object()))
|
|
|
+ return;
|
|
|
+
|
|
|
if (value.as_object().has("longhands"sv)) {
|
|
|
auto longhands = value.as_object().get("longhands"sv);
|
|
|
VERIFY(longhands.has_value() && longhands->is_array());
|