AK+Everywhere: Remove the null state of DeprecatedString

This commit removes DeprecatedString's "null" state, and replaces all
its users with one of the following:
- A normal, empty DeprecatedString
- Optional<DeprecatedString>

Note that null states of DeprecatedFlyString/StringView/etc are *not*
affected by this commit. However, DeprecatedString::empty() is now
considered equal to a null StringView.
This commit is contained in:
Ali Mohammad Pur 2023-10-10 15:00:58 +03:30 committed by Ali Mohammad Pur
parent daf6d8173c
commit aeee98b3a1
Notes: sideshowbarker 2024-07-16 20:21:48 +09:00
189 changed files with 597 additions and 652 deletions

View file

@ -24,19 +24,19 @@ HTMLSlotElement::HTMLSlotElement(DOM::Document& document, DOM::QualifiedName qua
return;
// 2. If value is null and oldValue is the empty string, then return.
if (value.is_null() && old_value == DeprecatedString::empty())
if (!value.has_value() && old_value == DeprecatedString::empty())
return;
// 3. If value is the empty string and oldValue is null, then return.
if (value == DeprecatedString::empty() && old_value.is_null())
if (value == DeprecatedString::empty() && !old_value.has_value())
return;
// 4. If value is null or the empty string, then set elements name to the empty string.
if (value.is_empty())
if (!value.has_value())
set_slot_name({});
// 5. Otherwise, set elements name to value.
else
set_slot_name(MUST(String::from_deprecated_string(value)));
set_slot_name(MUST(String::from_deprecated_string(*value)));
// 6. Run assign slottables for a tree with elements root.
DOM::assign_slottables_for_a_tree(root());