mirror of
https://github.com/RGBCube/serenity
synced 2025-05-29 11:55:10 +00:00
CodeGenerators: Replace uses of JsonObject::get_deprecated()/get_ptr()
This commit is contained in:
parent
77e15ff4da
commit
ad9b2043dd
9 changed files with 323 additions and 326 deletions
|
@ -230,9 +230,9 @@ bool is_inherited_property(PropertyID property_id)
|
|||
|
||||
bool inherited = false;
|
||||
if (value.as_object().has("inherited"sv)) {
|
||||
auto& inherited_value = value.as_object().get_deprecated("inherited"sv);
|
||||
VERIFY(inherited_value.is_bool());
|
||||
inherited = inherited_value.as_bool();
|
||||
auto inherited_value = value.as_object().get_bool("inherited"sv);
|
||||
VERIFY(inherited_value.has_value());
|
||||
inherited = inherited_value.value();
|
||||
}
|
||||
|
||||
if (inherited) {
|
||||
|
@ -261,7 +261,7 @@ bool property_affects_layout(PropertyID property_id)
|
|||
|
||||
bool affects_layout = true;
|
||||
if (value.as_object().has("affects-layout"sv))
|
||||
affects_layout = value.as_object().get_deprecated("affects-layout"sv).to_bool();
|
||||
affects_layout = value.as_object().get_bool("affects-layout"sv).value_or(false);
|
||||
|
||||
if (affects_layout) {
|
||||
auto member_generator = generator.fork();
|
||||
|
@ -289,7 +289,7 @@ bool property_affects_stacking_context(PropertyID property_id)
|
|||
|
||||
bool affects_stacking_context = false;
|
||||
if (value.as_object().has("affects-stacking-context"sv))
|
||||
affects_stacking_context = value.as_object().get_deprecated("affects-stacking-context"sv).to_bool();
|
||||
affects_stacking_context = value.as_object().get_bool("affects-stacking-context"sv).value_or(false);
|
||||
|
||||
if (affects_stacking_context) {
|
||||
auto member_generator = generator.fork();
|
||||
|
@ -326,9 +326,9 @@ NonnullRefPtr<StyleValue> property_initial_value(PropertyID property_id)
|
|||
dbgln("No initial value specified for property '{}'", name);
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
auto& initial_value = object.get_deprecated("initial"sv);
|
||||
VERIFY(initial_value.is_string());
|
||||
auto initial_value_string = initial_value.as_string();
|
||||
auto initial_value = object.get_deprecated_string("initial"sv);
|
||||
VERIFY(initial_value.has_value());
|
||||
auto& initial_value_string = initial_value.value();
|
||||
|
||||
auto member_generator = generator.fork();
|
||||
member_generator.set("name:titlecase", title_casify(name));
|
||||
|
@ -370,9 +370,9 @@ bool property_has_quirk(PropertyID property_id, Quirk quirk)
|
|||
properties.for_each_member([&](auto& name, auto& value) {
|
||||
VERIFY(value.is_object());
|
||||
if (value.as_object().has("quirks"sv)) {
|
||||
auto& quirks_value = value.as_object().get_deprecated("quirks"sv);
|
||||
VERIFY(quirks_value.is_array());
|
||||
auto& quirks = quirks_value.as_array();
|
||||
auto quirks_value = value.as_object().get_array("quirks"sv);
|
||||
VERIFY(quirks_value.has_value());
|
||||
auto& quirks = quirks_value.value();
|
||||
|
||||
if (!quirks.is_empty()) {
|
||||
auto property_generator = generator.fork();
|
||||
|
@ -461,9 +461,9 @@ bool property_accepts_value(PropertyID property_id, StyleValue& style_value)
|
|||
};
|
||||
|
||||
if (has_valid_types) {
|
||||
auto valid_types_value = object.get_deprecated("valid-types"sv);
|
||||
VERIFY(valid_types_value.is_array());
|
||||
auto valid_types = valid_types_value.as_array();
|
||||
auto valid_types_value = object.get_array("valid-types"sv);
|
||||
VERIFY(valid_types_value.has_value());
|
||||
auto& valid_types = valid_types_value.value();
|
||||
if (!valid_types.is_empty()) {
|
||||
for (auto& type : valid_types.values()) {
|
||||
VERIFY(type.is_string());
|
||||
|
@ -536,9 +536,9 @@ bool property_accepts_value(PropertyID property_id, StyleValue& style_value)
|
|||
}
|
||||
|
||||
if (has_valid_identifiers) {
|
||||
auto valid_identifiers_value = object.get_deprecated("valid-identifiers"sv);
|
||||
VERIFY(valid_identifiers_value.is_array());
|
||||
auto valid_identifiers = valid_identifiers_value.as_array();
|
||||
auto valid_identifiers_value = object.get_array("valid-identifiers"sv);
|
||||
VERIFY(valid_identifiers_value.has_value());
|
||||
auto& valid_identifiers = valid_identifiers_value.value();
|
||||
if (!valid_identifiers.is_empty()) {
|
||||
property_generator.append(R"~~~(
|
||||
switch (style_value.to_identifier()) {
|
||||
|
@ -581,11 +581,11 @@ size_t property_maximum_value_count(PropertyID property_id)
|
|||
properties.for_each_member([&](auto& name, auto& value) {
|
||||
VERIFY(value.is_object());
|
||||
if (value.as_object().has("max-values"sv)) {
|
||||
auto max_values = value.as_object().get_deprecated("max-values"sv);
|
||||
VERIFY(max_values.is_number() && !max_values.is_double());
|
||||
auto max_values = value.as_object().get("max-values"sv);
|
||||
VERIFY(max_values.has_value() && max_values->is_number() && !max_values->is_double());
|
||||
auto property_generator = generator.fork();
|
||||
property_generator.set("name:titlecase", title_casify(name));
|
||||
property_generator.set("max_values", max_values.to_deprecated_string());
|
||||
property_generator.set("max_values", max_values->to_deprecated_string());
|
||||
property_generator.append(R"~~~(
|
||||
case PropertyID::@name:titlecase@:
|
||||
return @max_values@;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue