1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 01:07:44 +00:00

Userland: Prefer _string over _short_string

As `_string` can't fail anymore (since 3434412), there are no real
benefits to use the short variant in most cases.
This commit is contained in:
Lucas CHOLLET 2023-08-07 22:26:17 -04:00 committed by Andreas Kling
parent a5edc9cdfc
commit 3f35ffb648
198 changed files with 684 additions and 684 deletions

View file

@ -34,40 +34,40 @@ static void ensure_caps()
if (caps)
return;
caps = new HashMap<String, char const*>;
caps->set("DC"_short_string, "\033[%p1%dP");
caps->set("IC"_short_string, "\033[%p1%d@");
caps->set("ce"_short_string, "\033[K");
caps->set("cl"_short_string, "\033[H\033[J");
caps->set("cr"_short_string, "\015");
caps->set("dc"_short_string, "\033[P");
caps->set("ei"_short_string, "");
caps->set("ic"_short_string, "");
caps->set("im"_short_string, "");
caps->set("kd"_short_string, "\033[B");
caps->set("kl"_short_string, "\033[D");
caps->set("kr"_short_string, "\033[C");
caps->set("ku"_short_string, "\033[A");
caps->set("ks"_short_string, "");
caps->set("ke"_short_string, "");
caps->set("le"_short_string, "\033[D");
caps->set("mm"_short_string, "");
caps->set("mo"_short_string, "");
caps->set("pc"_short_string, "");
caps->set("up"_short_string, "\033[A");
caps->set("vb"_short_string, "");
caps->set("am"_short_string, "");
caps->set("@7"_short_string, "");
caps->set("kH"_short_string, "");
caps->set("kI"_short_string, "\033[L");
caps->set("kh"_short_string, "\033[H");
caps->set("vs"_short_string, "");
caps->set("ve"_short_string, "");
caps->set("E3"_short_string, "");
caps->set("kD"_short_string, "");
caps->set("nd"_short_string, "\033[C");
caps->set("DC"_string, "\033[%p1%dP");
caps->set("IC"_string, "\033[%p1%d@");
caps->set("ce"_string, "\033[K");
caps->set("cl"_string, "\033[H\033[J");
caps->set("cr"_string, "\015");
caps->set("dc"_string, "\033[P");
caps->set("ei"_string, "");
caps->set("ic"_string, "");
caps->set("im"_string, "");
caps->set("kd"_string, "\033[B");
caps->set("kl"_string, "\033[D");
caps->set("kr"_string, "\033[C");
caps->set("ku"_string, "\033[A");
caps->set("ks"_string, "");
caps->set("ke"_string, "");
caps->set("le"_string, "\033[D");
caps->set("mm"_string, "");
caps->set("mo"_string, "");
caps->set("pc"_string, "");
caps->set("up"_string, "\033[A");
caps->set("vb"_string, "");
caps->set("am"_string, "");
caps->set("@7"_string, "");
caps->set("kH"_string, "");
caps->set("kI"_string, "\033[L");
caps->set("kh"_string, "\033[H");
caps->set("vs"_string, "");
caps->set("ve"_string, "");
caps->set("E3"_string, "");
caps->set("kD"_string, "");
caps->set("nd"_string, "\033[C");
caps->set("co"_short_string, "80");
caps->set("li"_short_string, "25");
caps->set("co"_string, "80");
caps->set("li"_string, "25");
}
// Unfortunately, tgetstr() doesn't accept a size argument for the buffer

View file

@ -196,9 +196,9 @@ ErrorOr<String> Move::to_algebraic() const
{
if (piece.type == Type::King && from.file == 4) {
if (to.file == 2)
return "O-O-O"_short_string;
return "O-O-O"_string;
if (to.file == 6)
return "O-O"_short_string;
return "O-O"_string;
}
StringBuilder builder;

View file

@ -21,7 +21,7 @@ ErrorOr<NonnullOwnPtr<UCICommand>> UCICommand::from_string(StringView command)
ErrorOr<String> UCICommand::to_string() const
{
return "uci\n"_short_string;
return "uci\n"_string;
}
ErrorOr<NonnullOwnPtr<DebugCommand>> DebugCommand::from_string(StringView command)
@ -244,7 +244,7 @@ ErrorOr<NonnullOwnPtr<StopCommand>> StopCommand::from_string(StringView command)
ErrorOr<String> StopCommand::to_string() const
{
return "stop\n"_short_string;
return "stop\n"_string;
}
ErrorOr<NonnullOwnPtr<IdCommand>> IdCommand::from_string(StringView command)
@ -291,7 +291,7 @@ ErrorOr<NonnullOwnPtr<UCIOkCommand>> UCIOkCommand::from_string(StringView comman
ErrorOr<String> UCIOkCommand::to_string() const
{
return "uciok\n"_short_string;
return "uciok\n"_string;
}
ErrorOr<NonnullOwnPtr<ReadyOkCommand>> ReadyOkCommand::from_string(StringView command)
@ -519,7 +519,7 @@ ErrorOr<NonnullOwnPtr<QuitCommand>> QuitCommand::from_string(StringView command)
ErrorOr<String> QuitCommand::to_string() const
{
return "quit\n"_short_string;
return "quit\n"_string;
}
ErrorOr<NonnullOwnPtr<UCINewGameCommand>> UCINewGameCommand::from_string(StringView command)

View file

@ -124,7 +124,7 @@ ErrorOr<String> Process::get_name()
return String::from_utf8(StringView { progname, strlen(progname) });
#else
// FIXME: Implement Process::get_name() for other platforms.
return "???"_short_string;
return "???"_string;
#endif
}

View file

@ -150,7 +150,7 @@ ErrorOr<String> UnsignedBigInteger::to_base(u16 N) const
{
VERIFY(N <= 36);
if (*this == UnsignedBigInteger { 0 })
return "0"_short_string;
return "0"_string;
StringBuilder builder;
UnsignedBigInteger temp(*this);

View file

@ -12,9 +12,9 @@ namespace DSP::Effects {
Delay::Delay(NonnullRefPtr<Transport> transport)
: EffectProcessor(move(transport))
, m_delay_decay("Decay"_short_string, 0.01, 0.99, 0.33, Logarithmic::No)
, m_delay_decay("Decay"_string, 0.01, 0.99, 0.33, Logarithmic::No)
, m_delay_time("Delay Time"_string, 3, 2000, 900, Logarithmic::Yes)
, m_dry_gain("Dry"_short_string, 0, 1, 0.9, Logarithmic::No)
, m_dry_gain("Dry"_string, 0, 1, 0.9, Logarithmic::No)
{
m_parameters.append(m_delay_decay);
@ -59,9 +59,9 @@ void Delay::process_impl(Signal const& input_signal, Signal& output_signal)
Mastering::Mastering(NonnullRefPtr<Transport> transport)
: EffectProcessor(move(transport))
, m_pan("Pan"_short_string, -1, 1, 0, Logarithmic::No)
, m_volume("Volume"_short_string, 0, 1, 1, Logarithmic::No)
, m_muted("Mute"_short_string, false)
, m_pan("Pan"_string, -1, 1, 0, Logarithmic::No)
, m_volume("Volume"_string, 0, 1, 1, Logarithmic::No)
, m_muted("Mute"_string, false)
{
m_parameters.append(m_muted);
m_parameters.append(m_volume);

View file

@ -20,10 +20,10 @@ namespace DSP::Synthesizers {
Classic::Classic(NonnullRefPtr<Transport> transport)
: DSP::SynthesizerProcessor(move(transport))
, m_waveform("Waveform"_string, Waveform::Saw)
, m_attack("Attack"_short_string, 0.01, 2000, 5, Logarithmic::Yes)
, m_decay("Decay"_short_string, 0.01, 20'000, 80, Logarithmic::Yes)
, m_sustain("Sustain"_short_string, 0.001, 1, 0.725, Logarithmic::No)
, m_release("Release"_short_string, 0.01, 6'000, 120, Logarithmic::Yes)
, m_attack("Attack"_string, 0.01, 2000, 5, Logarithmic::Yes)
, m_decay("Decay"_string, 0.01, 20'000, 80, Logarithmic::Yes)
, m_sustain("Sustain"_string, 0.001, 1, 0.725, Logarithmic::No)
, m_release("Release"_string, 0.01, 6'000, 120, Logarithmic::Yes)
{
m_parameters.append(m_waveform);
m_parameters.append(m_attack);

View file

@ -213,7 +213,7 @@ void ColorPicker::build_ui()
auto& tab_widget = root_container->add<GUI::TabWidget>();
auto& tab_palette = tab_widget.add_tab<Widget>("Palette"_short_string);
auto& tab_palette = tab_widget.add_tab<Widget>("Palette"_string);
tab_palette.set_layout<VerticalBoxLayout>(4, 4);
build_ui_palette(tab_palette);
@ -229,7 +229,7 @@ void ColorPicker::build_ui()
button_container.add_spacer().release_value_but_fixme_should_propagate_errors();
auto& ok_button = button_container.add<DialogButton>();
ok_button.set_text("OK"_short_string);
ok_button.set_text("OK"_string);
ok_button.on_click = [this](auto) {
if (on_color_changed)
on_color_changed(m_color);
@ -238,7 +238,7 @@ void ColorPicker::build_ui()
ok_button.set_default(true);
auto& cancel_button = button_container.add<DialogButton>();
cancel_button.set_text("Cancel"_short_string);
cancel_button.set_text("Cancel"_string);
cancel_button.on_click = [this](auto) {
if (on_color_changed)
on_color_changed(m_original_color);
@ -337,7 +337,7 @@ void ColorPicker::build_ui_custom(Widget& root_container)
auto& html_label = html_container.add<GUI::Label>();
html_label.set_text_alignment(Gfx::TextAlignment::CenterLeft);
html_label.set_preferred_width(48);
html_label.set_text("HTML:"_short_string);
html_label.set_text("HTML:"_string);
m_html_text = html_container.add<GUI::TextBox>();
m_html_text->set_text(m_color_has_alpha_channel ? m_color.to_deprecated_string() : m_color.to_deprecated_string_without_alpha());
@ -393,16 +393,16 @@ void ColorPicker::build_ui_custom(Widget& root_container)
};
if (component == Red) {
rgb_label.set_text("Red:"_short_string);
rgb_label.set_text("Red:"_string);
m_red_spinbox = spinbox;
} else if (component == Green) {
rgb_label.set_text("Green:"_short_string);
rgb_label.set_text("Green:"_string);
m_green_spinbox = spinbox;
} else if (component == Blue) {
rgb_label.set_text("Blue:"_short_string);
rgb_label.set_text("Blue:"_string);
m_blue_spinbox = spinbox;
} else if (component == Alpha) {
rgb_label.set_text("Alpha:"_short_string);
rgb_label.set_text("Alpha:"_string);
m_alpha_spinbox = spinbox;
}
};

View file

@ -257,7 +257,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, StringView filename, St
};
auto& cancel_button = *widget->find_descendant_of_type_named<GUI::Button>("cancel_button");
cancel_button.set_text("Cancel"_short_string);
cancel_button.set_text("Cancel"_string);
cancel_button.on_click = [this](auto) {
done(ExecResult::Cancel);
};

View file

@ -62,11 +62,11 @@ private:
case Mode::Open:
case Mode::OpenMultiple:
case Mode::OpenFolder:
return "Open"_short_string;
return "Open"_string;
case Mode::Save:
return "Save"_short_string;
return "Save"_string;
default:
return "OK"_short_string;
return "OK"_string;
}
}

View file

@ -768,19 +768,19 @@ ErrorOr<String> FileSystemModel::column_name(int column) const
case Column::Icon:
return String {};
case Column::Name:
return "Name"_short_string;
return "Name"_string;
case Column::Size:
return "Size"_short_string;
return "Size"_string;
case Column::User:
return "User"_short_string;
return "User"_string;
case Column::Group:
return "Group"_short_string;
return "Group"_string;
case Column::Permissions:
return "Mode"_short_string;
return "Mode"_string;
case Column::ModificationTime:
return "Modified"_string;
case Column::Inode:
return "Inode"_short_string;
return "Inode"_string;
case Column::SymlinkTarget:
return "Symlink target"_string;
}

View file

@ -37,7 +37,7 @@ IncrementalSearchBanner::IncrementalSearchBanner(TextEditor& editor)
};
m_close_button = find_descendant_of_type_named<Button>("incremental_search_banner_close_button");
m_close_button->set_text("\xE2\x9D\x8C"_short_string);
m_close_button->set_text("\xE2\x9D\x8C"_string);
m_close_button->on_click = [this](auto) {
hide();
};

View file

@ -161,7 +161,7 @@ ErrorOr<void> InputBox::build()
TRY(button_container->try_set_layout<HorizontalBoxLayout>(0, 6));
TRY(button_container->add_spacer());
m_ok_button = TRY(button_container->try_add<DialogButton>("OK"_short_string));
m_ok_button = TRY(button_container->try_add<DialogButton>("OK"_string));
m_ok_button->on_click = [this](auto) {
if (m_spinbox)
m_spinbox->set_value_from_current_text();
@ -169,7 +169,7 @@ ErrorOr<void> InputBox::build()
};
m_ok_button->set_default(true);
m_cancel_button = TRY(button_container->try_add<DialogButton>("Cancel"_short_string));
m_cancel_button = TRY(button_container->try_add<DialogButton>("Cancel"_string));
m_cancel_button->on_click = [this](auto) { done(ExecResult::Cancel); };
auto guarantee_width = [this, button_container] {

View file

@ -75,7 +75,7 @@ public:
{
if constexpr (IsTwoDimensional)
return m_column_names[index];
return "Data"_short_string;
return "Data"_string;
}
virtual Variant data(ModelIndex const& index, ModelRole role) const override

View file

@ -91,9 +91,9 @@ ErrorOr<Dialog::ExecResult> MessageBox::try_ask_about_unsaved_changes(Window* pa
if (path.is_empty())
box->m_yes_button->set_text("Save As..."_string);
else
box->m_yes_button->set_text("Save"_short_string);
box->m_no_button->set_text("Discard"_short_string);
box->m_cancel_button->set_text("Cancel"_short_string);
box->m_yes_button->set_text("Save"_string);
box->m_no_button->set_text("Discard"_string);
box->m_cancel_button->set_text("Cancel"_string);
return box->exec();
}
@ -181,13 +181,13 @@ ErrorOr<void> MessageBox::build()
TRY(button_container->add_spacer());
if (should_include_ok_button())
m_ok_button = TRY(add_button("OK"_short_string, ExecResult::OK));
m_ok_button = TRY(add_button("OK"_string, ExecResult::OK));
if (should_include_yes_button())
m_yes_button = TRY(add_button("Yes"_short_string, ExecResult::Yes));
m_yes_button = TRY(add_button("Yes"_string, ExecResult::Yes));
if (should_include_no_button())
m_no_button = TRY(add_button("No"_short_string, ExecResult::No));
m_no_button = TRY(add_button("No"_string, ExecResult::No));
if (should_include_cancel_button())
m_cancel_button = TRY(add_button("Cancel"_short_string, ExecResult::Cancel));
m_cancel_button = TRY(add_button("Cancel"_string, ExecResult::Cancel));
TRY(button_container->add_spacer());
return {};

View file

@ -61,7 +61,7 @@ ProcessChooser::ProcessChooser(StringView window_title, String button_label, Gfx
auto index = m_table_view->selection().first();
set_pid_from_index_and_close(index);
};
auto& cancel_button = button_container.add<GUI::Button>("Cancel"_short_string);
auto& cancel_button = button_container.add<GUI::Button>("Cancel"_string);
cancel_button.set_fixed_width(80);
cancel_button.on_click = [this](auto) {
done(ExecResult::Cancel);

View file

@ -23,7 +23,7 @@ public:
pid_t pid() const { return m_pid; }
private:
ProcessChooser(StringView window_title = "Process Chooser"sv, String button_label = "Select"_short_string, Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr);
ProcessChooser(StringView window_title = "Process Chooser"sv, String button_label = "Select"_string, Gfx::Bitmap const* window_icon = nullptr, GUI::Window* parent_window = nullptr);
void set_pid_from_index_and_close(ModelIndex const&);

View file

@ -51,11 +51,11 @@ ErrorOr<String> RunningProcessesModel::column_name(int column_index) const
case Column::Icon:
return String {};
case Column::PID:
return "PID"_short_string;
return "PID"_string;
case Column::UID:
return "UID"_short_string;
return "UID"_string;
case Column::Name:
return "Name"_short_string;
return "Name"_string;
}
VERIFY_NOT_REACHED();
}

View file

@ -51,19 +51,19 @@ ErrorOr<NonnullRefPtr<SettingsWindow>> SettingsWindow::create(DeprecatedString t
TRY(button_container->add_spacer());
window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>("OK"_short_string));
window->m_ok_button = TRY(button_container->try_add<GUI::DialogButton>("OK"_string));
window->m_ok_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) {
window->apply_settings();
GUI::Application::the()->quit();
};
window->m_cancel_button = TRY(button_container->try_add<GUI::DialogButton>("Cancel"_short_string));
window->m_cancel_button = TRY(button_container->try_add<GUI::DialogButton>("Cancel"_string));
window->m_cancel_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) {
window->cancel_settings();
GUI::Application::the()->quit();
};
window->m_apply_button = TRY(button_container->try_add<GUI::DialogButton>("Apply"_short_string));
window->m_apply_button = TRY(button_container->try_add<GUI::DialogButton>("Apply"_string));
window->m_apply_button->set_enabled(false);
window->m_apply_button->on_click = [window = window->make_weak_ptr<SettingsWindow>()](auto) {
window->apply_settings();

View file

@ -41,12 +41,12 @@ ErrorOr<void> WizardDialog::build()
nav_container_widget->set_fixed_height(42);
TRY(nav_container_widget->add_spacer());
m_back_button = TRY(nav_container_widget->try_add<DialogButton>("< Back"_short_string));
m_back_button = TRY(nav_container_widget->try_add<DialogButton>("< Back"_string));
m_back_button->on_click = [&](auto) {
pop_page();
};
m_next_button = TRY(nav_container_widget->try_add<DialogButton>("Next >"_short_string));
m_next_button = TRY(nav_container_widget->try_add<DialogButton>("Next >"_string));
m_next_button->on_click = [&](auto) {
VERIFY(has_pages());
@ -63,7 +63,7 @@ ErrorOr<void> WizardDialog::build()
auto button_spacer = TRY(nav_container_widget->try_add<Widget>());
button_spacer->set_fixed_width(10);
m_cancel_button = TRY(nav_container_widget->try_add<DialogButton>("Cancel"_short_string));
m_cancel_button = TRY(nav_container_widget->try_add<DialogButton>("Cancel"_string));
m_cancel_button->on_click = [&](auto) {
handle_cancel();
};
@ -128,11 +128,11 @@ void WizardDialog::update_navigation()
if (has_pages()) {
m_next_button->set_enabled(current_page().is_final_page() || current_page().can_go_next());
if (current_page().is_final_page())
m_next_button->set_text("Finish"_short_string);
m_next_button->set_text("Finish"_string);
else
m_next_button->set_text("Next >"_short_string);
m_next_button->set_text("Next >"_string);
} else {
m_next_button->set_text("Next >"_short_string);
m_next_button->set_text("Next >"_string);
m_next_button->set_enabled(false);
}
}

View file

@ -115,7 +115,7 @@ ErrorOr<void> PNGWriter::add_png_header()
ErrorOr<void> PNGWriter::add_IHDR_chunk(u32 width, u32 height, u8 bit_depth, PNG::ColorType color_type, u8 compression_method, u8 filter_method, u8 interlace_method)
{
PNGChunk png_chunk { "IHDR"_short_string };
PNGChunk png_chunk { "IHDR"_string };
TRY(png_chunk.add_as_big_endian(width));
TRY(png_chunk.add_as_big_endian(height));
TRY(png_chunk.add_u8(bit_depth));
@ -130,7 +130,7 @@ ErrorOr<void> PNGWriter::add_IHDR_chunk(u32 width, u32 height, u8 bit_depth, PNG
ErrorOr<void> PNGWriter::add_iCCP_chunk(ReadonlyBytes icc_data)
{
// https://www.w3.org/TR/png/#11iCCP
PNGChunk chunk { "iCCP"_short_string };
PNGChunk chunk { "iCCP"_string };
TRY(chunk.add("embedded profile"sv.bytes()));
TRY(chunk.add_u8(0)); // \0-terminate profile name
@ -144,7 +144,7 @@ ErrorOr<void> PNGWriter::add_iCCP_chunk(ReadonlyBytes icc_data)
ErrorOr<void> PNGWriter::add_IEND_chunk()
{
PNGChunk png_chunk { "IEND"_short_string };
PNGChunk png_chunk { "IEND"_string };
TRY(add_chunk(png_chunk));
return {};
}
@ -169,7 +169,7 @@ static_assert(AssertSize<Pixel, 4>());
ErrorOr<void> PNGWriter::add_IDAT_chunk(Gfx::Bitmap const& bitmap)
{
PNGChunk png_chunk { "IDAT"_short_string };
PNGChunk png_chunk { "IDAT"_string };
TRY(png_chunk.reserve(bitmap.size_in_bytes()));
ByteBuffer uncompressed_block_data;

View file

@ -46,7 +46,7 @@ static ThrowCompletionOr<NonnullGCPtr<AsyncGenerator>> async_generator_validate(
// 4. If generator.[[GeneratorBrand]] is not generatorBrand, throw a TypeError exception.
if (async_generator.generator_brand() != generator_brand)
return vm.throw_completion<TypeError>(ErrorType::GeneratorBrandMismatch, async_generator.generator_brand().value_or("emp"_short_string), generator_brand.value_or("emp"_short_string));
return vm.throw_completion<TypeError>(ErrorType::GeneratorBrandMismatch, async_generator.generator_brand().value_or("emp"_string), generator_brand.value_or("emp"_string));
// 5. Return unused.
return async_generator;

View file

@ -1233,7 +1233,7 @@ ThrowCompletionOr<RawFormatResult> to_raw_fixed(VM& vm, MathematicalValue const&
// 7. If n = 0, let m be "0". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).
result.formatted_string = n.is_zero()
? "0"_short_string
? "0"_string
: MUST_OR_THROW_OOM(n.to_string(vm));
// 8. If f ≠ 0, then

View file

@ -450,9 +450,9 @@ JS_DEFINE_NATIVE_FUNCTION(NumberPrototype::to_string)
if (number_value.is_negative_infinity())
return MUST_OR_THROW_OOM(PrimitiveString::create(vm, "-Infinity"sv));
if (number_value.is_nan())
return PrimitiveString::create(vm, "NaN"_short_string);
return PrimitiveString::create(vm, "NaN"_string);
if (number_value.is_positive_zero() || number_value.is_negative_zero())
return PrimitiveString::create(vm, "0"_short_string);
return PrimitiveString::create(vm, "0"_string);
double number = number_value.as_double();
bool negative = number < 0;

View file

@ -638,7 +638,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match_all)
auto string = TRY(this_object.to_utf16_string(vm));
// 4. Let rx be ? RegExpCreate(regexp, "g").
auto rx = TRY(regexp_create(vm, regexp, PrimitiveString::create(vm, "g"_short_string)));
auto rx = TRY(regexp_create(vm, regexp, PrimitiveString::create(vm, "g"_string)));
// 5. Return ? Invoke(rx, @@matchAll, « S »).
return TRY(Value(rx).invoke(vm, vm.well_known_symbol_match_all(), PrimitiveString::create(vm, move(string))));
@ -655,7 +655,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::normalize)
// 3. If form is undefined, let f be "NFC".
if (auto form_value = vm.argument(0); form_value.is_undefined()) {
form = "NFC"_short_string;
form = "NFC"_string;
}
// 4. Else, let f be ? ToString(form).
else {

View file

@ -1269,7 +1269,7 @@ ThrowCompletionOr<ISODateTime> parse_iso_date_time(VM& vm, ParseResult const& pa
}
// 7. Let yearMV be ! ToIntegerOrInfinity(CodePointsToString(year)).
auto year_mv = *normalized_year.value_or("0"_short_string).to_number<i32>();
auto year_mv = *normalized_year.value_or("0"_string).to_number<i32>();
// 8. If month is empty, then
// a. Let monthMV be 1.

View file

@ -824,7 +824,7 @@ ThrowCompletionOr<ISODateRecord> iso_date_from_fields(VM& vm, Object const& fiel
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "year", "day" »).
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields,
{ "day"_short_string,
{ "day"_string,
"month"_string,
"monthCode"_string,
"year"_string },
@ -890,7 +890,7 @@ ThrowCompletionOr<ISOMonthDay> iso_month_day_from_fields(VM& vm, Object const& f
// 2. Set fields to ? PrepareTemporalFields(fields, « "day", "month", "monthCode", "year" », « "day" »).
auto* prepared_fields = TRY(prepare_temporal_fields(vm, fields,
{ "day"_short_string,
{ "day"_string,
"month"_string,
"monthCode"_string,
"year"_string },

View file

@ -216,7 +216,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::date_until)
// 8. If largestUnit is "auto", set largestUnit to "day".
if (largest_unit == "auto")
largest_unit = "day"_short_string;
largest_unit = "day"_string;
// 9. Let result be DifferenceISODate(one.[[ISOYear]], one.[[ISOMonth]], one.[[ISODay]], two.[[ISOYear]], two.[[ISOMonth]], two.[[ISODay]], largestUnit).
auto result = difference_iso_date(vm, one->iso_year(), one->iso_month(), one->iso_day(), two->iso_year(), two->iso_month(), two->iso_day(), *largest_unit);

View file

@ -267,7 +267,7 @@ ThrowCompletionOr<String> temporal_instant_to_string(VM& vm, Instant& instant, V
// 8. If timeZone is undefined, then
if (time_zone.is_undefined()) {
// a. Let timeZoneString be "Z".
time_zone_string = "Z"_short_string;
time_zone_string = "Z"_string;
}
// 9. Else,
else {

View file

@ -82,7 +82,7 @@ ErrorOr<NonnullRefPtr<PageNode const>> Node::try_create_from_query(Vector<String
ErrorOr<NonnullRefPtr<Node const>> Node::try_find_from_help_url(URL const& url)
{
if (url.host() != "man"_short_string)
if (url.host() != "man"_string)
return Error::from_string_view("Bad help operation"sv);
if (url.path_segment_count() < 2)
return Error::from_string_view("Bad help page URL"sv);

View file

@ -22,19 +22,19 @@ ErrorOr<String> state_or_property_to_string_value(StateAndProperties state_or_pr
value = aria_data.aria_atomic_or_default(default_value.get<bool>());
else
value = aria_data.aria_atomic_or_default();
return value ? "true"_short_string : "false"_short_string;
return value ? "true"_string : "false"_string;
}
case StateAndProperties::AriaAutoComplete: {
auto value = aria_data.aria_auto_complete_or_default();
switch (value) {
case AriaAutocomplete::None:
return "none"_short_string;
return "none"_string;
case AriaAutocomplete::List:
return "list"_short_string;
return "list"_string;
case AriaAutocomplete::Both:
return "both"_short_string;
return "both"_string;
case AriaAutocomplete::Inline:
return "inline"_short_string;
return "inline"_string;
}
VERIFY_NOT_REACHED();
}
@ -54,19 +54,19 @@ ErrorOr<String> state_or_property_to_string_value(StateAndProperties state_or_pr
auto value = aria_data.aria_current_or_default();
switch (value) {
case AriaCurrent::False:
return "false"_short_string;
return "false"_string;
case AriaCurrent::True:
return "true"_short_string;
return "true"_string;
case AriaCurrent::Date:
return "date"_short_string;
return "date"_string;
case AriaCurrent::Location:
return "location"_string;
case AriaCurrent::Page:
return "page"_short_string;
return "page"_string;
case AriaCurrent::Step:
return "step"_short_string;
return "step"_string;
case AriaCurrent::Time:
return "time"_short_string;
return "time"_string;
}
VERIFY_NOT_REACHED();
}
@ -77,7 +77,7 @@ ErrorOr<String> state_or_property_to_string_value(StateAndProperties state_or_pr
return value.has_value() ? String::from_deprecated_string(value.value()) : String::from_utf8(""sv);
}
case StateAndProperties::AriaDisabled:
return aria_data.aria_disabled_or_default() ? "true"_short_string : "false"_short_string;
return aria_data.aria_disabled_or_default() ? "true"_string : "false"_string;
case StateAndProperties::AriaDropEffect: {
StringBuilder builder;
auto value = aria_data.aria_drop_effect_or_default();
@ -126,19 +126,19 @@ ErrorOr<String> state_or_property_to_string_value(StateAndProperties state_or_pr
auto value = aria_data.aria_has_popup_or_default();
switch (value) {
case AriaHasPopup::False:
return "false"_short_string;
return "false"_string;
case AriaHasPopup::True:
return "true"_short_string;
return "true"_string;
case AriaHasPopup::Menu:
return "menu"_short_string;
return "menu"_string;
case AriaHasPopup::Listbox:
return "listbox"_string;
case AriaHasPopup::Tree:
return "tree"_short_string;
return "tree"_string;
case AriaHasPopup::Grid:
return "grid"_short_string;
return "grid"_string;
case AriaHasPopup::Dialog:
return "dialog"_short_string;
return "dialog"_string;
}
VERIFY_NOT_REACHED();
}
@ -148,13 +148,13 @@ ErrorOr<String> state_or_property_to_string_value(StateAndProperties state_or_pr
auto value = aria_data.aria_invalid_or_default();
switch (value) {
case AriaInvalid::Grammar:
return "grammar"_short_string;
return "grammar"_string;
case AriaInvalid::False:
return "false"_short_string;
return "false"_string;
case AriaInvalid::Spelling:
return "spelling"_string;
case AriaInvalid::True:
return "true"_short_string;
return "true"_string;
}
VERIFY_NOT_REACHED();
}
@ -177,18 +177,18 @@ ErrorOr<String> state_or_property_to_string_value(StateAndProperties state_or_pr
case AriaLive::Assertive:
return "assertive"_string;
case AriaLive::Off:
return "off"_short_string;
return "off"_string;
case AriaLive::Polite:
return "polite"_short_string;
return "polite"_string;
}
VERIFY_NOT_REACHED();
}
case StateAndProperties::AriaModal:
return aria_data.aria_modal_or_default() ? "true"_short_string : "false"_short_string;
return aria_data.aria_modal_or_default() ? "true"_string : "false"_string;
case StateAndProperties::AriaMultiLine:
return aria_data.aria_multi_line_or_default() ? "true"_short_string : "false"_short_string;
return aria_data.aria_multi_line_or_default() ? "true"_string : "false"_string;
case StateAndProperties::AriaMultiSelectable:
return aria_data.aria_multi_selectable_or_default() ? "true"_short_string : "false"_short_string;
return aria_data.aria_multi_selectable_or_default() ? "true"_string : "false"_string;
case StateAndProperties::AriaOrientation: {
AriaOrientation value;
if (default_value.has<AriaOrientation>())
@ -215,7 +215,7 @@ ErrorOr<String> state_or_property_to_string_value(StateAndProperties state_or_pr
case StateAndProperties::AriaPressed:
return ARIA::tristate_to_string(aria_data.aria_pressed_or_default());
case StateAndProperties::AriaReadOnly:
return aria_data.aria_read_only_or_default() ? "true"_short_string : "false"_short_string;
return aria_data.aria_read_only_or_default() ? "true"_string : "false"_string;
case StateAndProperties::AriaRelevant: {
StringBuilder builder;
auto value = aria_data.aria_relevant_or_default();
@ -269,9 +269,9 @@ ErrorOr<String> state_or_property_to_string_value(StateAndProperties state_or_pr
case AriaSort::Descending:
return "descending"_string;
case AriaSort::None:
return "none"_short_string;
return "none"_string;
case AriaSort::Other:
return "other"_short_string;
return "other"_string;
}
VERIFY_NOT_REACHED();
}
@ -297,13 +297,13 @@ ErrorOr<String> tristate_to_string(Tristate value)
{
switch (value) {
case Tristate::False:
return "false"_short_string;
return "false"_string;
case Tristate::True:
return "true"_short_string;
return "true"_string;
case Tristate::Undefined:
return "undefined"_string;
case Tristate::Mixed:
return "mixed"_short_string;
return "mixed"_string;
}
VERIFY_NOT_REACHED();
}
@ -320,8 +320,8 @@ ErrorOr<String> optional_bool_to_string(Optional<bool> value)
if (!value.has_value())
return "undefined"_string;
if (value.value())
return "true"_short_string;
return "false"_short_string;
return "true"_string;
return "false"_string;
}
ErrorOr<String> optional_number_to_string(Optional<f64> value)

View file

@ -49,29 +49,29 @@ ErrorOr<String> Token::to_string() const
case Type::Dimension:
return String::formatted("{}{}", m_number_value.value(), dimension_unit());
case Type::Whitespace:
return " "_short_string;
return " "_string;
case Type::CDO:
return "<!--"_string;
case Type::CDC:
return "-->"_short_string;
return "-->"_string;
case Type::Colon:
return ":"_short_string;
return ":"_string;
case Type::Semicolon:
return ";"_short_string;
return ";"_string;
case Type::Comma:
return ","_short_string;
return ","_string;
case Type::OpenSquare:
return "["_short_string;
return "["_string;
case Type::CloseSquare:
return "]"_short_string;
return "]"_string;
case Type::OpenParen:
return "("_short_string;
return "("_string;
case Type::CloseParen:
return ")"_short_string;
return ")"_string;
case Type::OpenCurly:
return "{"_short_string;
return "{"_string;
case Type::CloseCurly:
return "}"_short_string;
return "}"_string;
case Type::Invalid:
default:
VERIFY_NOT_REACHED();

View file

@ -993,9 +993,9 @@ ErrorOr<String> ConstantCalculationNode::to_string() const
{
switch (m_constant) {
case CalculationNode::ConstantType::E:
return "e"_short_string;
return "e"_string;
case CalculationNode::ConstantType::Pi:
return "pi"_short_string;
return "pi"_string;
case CalculationNode::ConstantType::Infinity:
return "infinity"_string;
case CalculationNode::ConstantType::MinusInfinity:

View file

@ -731,7 +731,7 @@ void dump_font_face_rule(StringBuilder& builder, CSS::CSSFontFaceRule const& rul
builder.append("sources:\n"sv);
for (auto const& source : font_face.sources()) {
indent(builder, indent_levels + 2);
builder.appendff("url={}, format={}\n", source.url, source.format.value_or("???"_short_string));
builder.appendff("url={}, format={}\n", source.url, source.format.value_or("???"_string));
}
indent(builder, indent_levels + 1);

View file

@ -56,7 +56,7 @@ ErrorOr<bool> tao_check(Infrastructure::Request const& request, Infrastructure::
auto values = TRY(response.header_list()->get_decode_and_split("Timing-Allow-Origin"sv.bytes()));
// 3. If values contains "*", then return success.
if (values.has_value() && values->contains_slow("*"_short_string))
if (values.has_value() && values->contains_slow("*"_string))
return true;
// 4. If values contains the result of serializing a request origin with request, then return success.

View file

@ -1142,7 +1142,7 @@ WebIDL::ExceptionOr<void> BrowsingContext::navigate(
} else {
// Otherwise let navigation id be the result of generating a random UUID. [UUID]
// FIXME: Generate a UUID.
navigation_id = "FIXME"_short_string;
navigation_id = "FIXME"_string;
}
}

View file

@ -46,7 +46,7 @@ String MimeType::description() const
String const& MimeType::suffixes() const
{
// The MimeType interface's suffixes getter steps are to return "pdf".
static String suffixes_string = "pdf"_short_string;
static String suffixes_string = "pdf"_string;
return suffixes_string;
}

View file

@ -15,7 +15,7 @@ namespace Web::IntersectionObserver {
struct IntersectionObserverInit {
Optional<Variant<JS::Handle<DOM::Element>, JS::Handle<DOM::Document>>> root;
String root_margin { "0px"_short_string };
String root_margin { "0px"_string };
Variant<double, Vector<double>> threshold { 0 };
};

View file

@ -267,7 +267,7 @@ ErrorOr<MimeSniff::MimeType> XMLHttpRequest::get_response_mime_type() const
// 2. If mimeType is failure, then set mimeType to text/xml.
if (!mime_type.has_value())
return MimeSniff::MimeType::create("text"_string, "xml"_short_string);
return MimeSniff::MimeType::create("text"_string, "xml"_string);
// 3. Return mimeType.
return mime_type.release_value();

View file

@ -36,9 +36,9 @@ ErrorOr<String> AriaPropertiesStateModel::column_name(int column_index) const
{
switch (column_index) {
case Column::PropertyName:
return "Name"_short_string;
return "Name"_string;
case Column::PropertyValue:
return "Value"_short_string;
return "Value"_string;
default:
return Error::from_string_view("Unexpected column index"sv);
}

View file

@ -34,9 +34,9 @@ ErrorOr<String> StylePropertiesModel::column_name(int column_index) const
{
switch (column_index) {
case Column::PropertyName:
return "Name"_short_string;
return "Name"_string;
case Column::PropertyValue:
return "Value"_short_string;
return "Value"_string;
default:
VERIFY_NOT_REACHED();
}