diff --git a/AK/DeprecatedFlyString.cpp b/AK/DeprecatedFlyString.cpp index 84e6fc9c7a7..bb302df90b5 100644 --- a/AK/DeprecatedFlyString.cpp +++ b/AK/DeprecatedFlyString.cpp @@ -107,9 +107,9 @@ Optional DeprecatedFlyString::to_float(TrimWhitespace trim_whitespace) co } #endif -bool DeprecatedFlyString::equals_ignoring_case(StringView other) const +bool DeprecatedFlyString::equals_ignoring_ascii_case(StringView other) const { - return StringUtils::equals_ignoring_case(view(), other); + return StringUtils::equals_ignoring_ascii_case(view(), other); } bool DeprecatedFlyString::starts_with(StringView str, CaseSensitivity case_sensitivity) const diff --git a/AK/DeprecatedFlyString.h b/AK/DeprecatedFlyString.h index 395cb1496e5..76d924da09f 100644 --- a/AK/DeprecatedFlyString.h +++ b/AK/DeprecatedFlyString.h @@ -78,7 +78,7 @@ public: Optional to_float(TrimWhitespace = TrimWhitespace::Yes) const; #endif - bool equals_ignoring_case(StringView) const; + bool equals_ignoring_ascii_case(StringView) const; bool starts_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; bool ends_with(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; diff --git a/AK/DeprecatedString.cpp b/AK/DeprecatedString.cpp index 437b27a71ab..ac1a07a7eeb 100644 --- a/AK/DeprecatedString.cpp +++ b/AK/DeprecatedString.cpp @@ -346,9 +346,9 @@ bool DeprecatedString::contains(char needle, CaseSensitivity case_sensitivity) c return StringUtils::contains(*this, StringView(&needle, 1), case_sensitivity); } -bool DeprecatedString::equals_ignoring_case(StringView other) const +bool DeprecatedString::equals_ignoring_ascii_case(StringView other) const { - return StringUtils::equals_ignoring_case(view(), other); + return StringUtils::equals_ignoring_ascii_case(view(), other); } DeprecatedString DeprecatedString::reverse() const diff --git a/AK/DeprecatedString.h b/AK/DeprecatedString.h index 9f6091404d7..21952cd4b27 100644 --- a/AK/DeprecatedString.h +++ b/AK/DeprecatedString.h @@ -148,7 +148,7 @@ public: return trimmed_view; } - [[nodiscard]] bool equals_ignoring_case(StringView) const; + [[nodiscard]] bool equals_ignoring_ascii_case(StringView) const; [[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; [[nodiscard]] bool contains(char, CaseSensitivity = CaseSensitivity::CaseSensitive) const; @@ -310,14 +310,14 @@ public: } template - [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of_ignoring_case(Ts&&... strings) const + [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of_ignoring_ascii_case(Ts&&... strings) const { return (... || [this, &strings]() -> bool { if constexpr (requires(Ts a) { a.view()->StringView; }) - return this->equals_ignoring_case(forward(strings.view())); + return this->equals_ignoring_ascii_case(forward(strings.view())); else - return this->equals_ignoring_case(forward(strings)); + return this->equals_ignoring_ascii_case(forward(strings)); }()); } @@ -330,9 +330,10 @@ struct Traits : public GenericTraits { static unsigned hash(DeprecatedString const& s) { return s.impl() ? s.impl()->hash() : 0; } }; +// FIXME: Rename this to indicate that it's about ASCII-only case insensitivity. struct CaseInsensitiveStringTraits : public Traits { static unsigned hash(DeprecatedString const& s) { return s.impl() ? s.impl()->case_insensitive_hash() : 0; } - static bool equals(DeprecatedString const& a, DeprecatedString const& b) { return a.equals_ignoring_case(b); } + static bool equals(DeprecatedString const& a, DeprecatedString const& b) { return a.equals_ignoring_ascii_case(b); } }; DeprecatedString escape_html_entities(StringView html); diff --git a/AK/FlyString.cpp b/AK/FlyString.cpp index 648b8cf492c..d745768ade9 100644 --- a/AK/FlyString.cpp +++ b/AK/FlyString.cpp @@ -182,8 +182,7 @@ bool FlyString::equals_ignoring_ascii_case(FlyString const& other) const { if (*this == other) return true; - // FIXME: Rename StringUtils::equals_ignoring_case to equals_ignoring_ascii_case. - return StringUtils::equals_ignoring_case(bytes_as_string_view(), other.bytes_as_string_view()); + return StringUtils::equals_ignoring_ascii_case(bytes_as_string_view(), other.bytes_as_string_view()); } } diff --git a/AK/StringUtils.cpp b/AK/StringUtils.cpp index b7b6dd030fc..35730bfd349 100644 --- a/AK/StringUtils.cpp +++ b/AK/StringUtils.cpp @@ -254,7 +254,7 @@ template Optional convert_to_floating_point(StringView str, TrimWhitespa template Optional convert_to_floating_point(StringView str, TrimWhitespace); #endif -bool equals_ignoring_case(StringView a, StringView b) +bool equals_ignoring_ascii_case(StringView a, StringView b) { if (a.length() != b.length()) return false; diff --git a/AK/StringUtils.h b/AK/StringUtils.h index 8f7fb2f4905..591340b9930 100644 --- a/AK/StringUtils.h +++ b/AK/StringUtils.h @@ -79,7 +79,7 @@ Optional convert_to_uint_from_octal(StringView, TrimWhitespace = TrimWhitespa template Optional convert_to_floating_point(StringView, TrimWhitespace = TrimWhitespace::Yes); #endif -bool equals_ignoring_case(StringView, StringView); +bool equals_ignoring_ascii_case(StringView, StringView); bool ends_with(StringView a, StringView b, CaseSensitivity); bool starts_with(StringView, StringView, CaseSensitivity); bool contains(StringView, StringView, CaseSensitivity); diff --git a/AK/StringView.cpp b/AK/StringView.cpp index 4252dcea352..66d8d54ab27 100644 --- a/AK/StringView.cpp +++ b/AK/StringView.cpp @@ -170,9 +170,9 @@ bool StringView::contains(StringView needle, CaseSensitivity case_sensitivity) c return StringUtils::contains(*this, needle, case_sensitivity); } -bool StringView::equals_ignoring_case(StringView other) const +bool StringView::equals_ignoring_ascii_case(StringView other) const { - return StringUtils::equals_ignoring_case(*this, other); + return StringUtils::equals_ignoring_ascii_case(*this, other); } #ifndef KERNEL diff --git a/AK/StringView.h b/AK/StringView.h index dd6fe9540ec..aeccf623c4a 100644 --- a/AK/StringView.h +++ b/AK/StringView.h @@ -104,7 +104,7 @@ public: [[nodiscard]] bool contains(char) const; [[nodiscard]] bool contains(u32) const; [[nodiscard]] bool contains(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive) const; - [[nodiscard]] bool equals_ignoring_case(StringView other) const; + [[nodiscard]] bool equals_ignoring_ascii_case(StringView) const; [[nodiscard]] StringView trim(StringView characters, TrimMode mode = TrimMode::Both) const { return StringUtils::trim(*this, characters, mode); } [[nodiscard]] StringView trim_whitespace(TrimMode mode = TrimMode::Both) const { return StringUtils::trim_whitespace(*this, mode); } @@ -337,14 +337,14 @@ public: } template - [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of_ignoring_case(Ts&&... strings) const + [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of_ignoring_ascii_case(Ts&&... strings) const { return (... || [this, &strings]() -> bool { if constexpr (requires(Ts a) { a.view()->StringView; }) - return this->equals_ignoring_case(forward(strings.view())); + return this->equals_ignoring_ascii_case(forward(strings.view())); else - return this->equals_ignoring_case(forward(strings)); + return this->equals_ignoring_ascii_case(forward(strings)); }()); } @@ -359,6 +359,7 @@ struct Traits : public GenericTraits { static unsigned hash(StringView s) { return s.hash(); } }; +// FIXME: Rename this to indicate that it's about ASCII-only case insensitivity. struct CaseInsensitiveStringViewTraits : public Traits { static unsigned hash(StringView s) { @@ -366,7 +367,7 @@ struct CaseInsensitiveStringViewTraits : public Traits { return 0; return case_insensitive_string_hash(s.characters_without_null_termination(), s.length()); } - static bool equals(StringView const& a, StringView const& b) { return a.equals_ignoring_case(b); } + static bool equals(StringView const& a, StringView const& b) { return a.equals_ignoring_ascii_case(b); } }; } diff --git a/AK/URLParser.cpp b/AK/URLParser.cpp index 50eec3d1672..ee949c2a920 100644 --- a/AK/URLParser.cpp +++ b/AK/URLParser.cpp @@ -108,12 +108,12 @@ constexpr bool is_normalized_windows_drive_letter(StringView input) constexpr bool is_single_dot_path_segment(StringView input) { - return input == "."sv || input.equals_ignoring_case("%2e"sv); + return input == "."sv || input.equals_ignoring_ascii_case("%2e"sv); } constexpr bool is_double_dot_path_segment(StringView input) { - return input == ".."sv || input.equals_ignoring_case(".%2e"sv) || input.equals_ignoring_case("%2e."sv) || input.equals_ignoring_case("%2e%2e"sv); + return input == ".."sv || input.equals_ignoring_ascii_case(".%2e"sv) || input.equals_ignoring_ascii_case("%2e."sv) || input.equals_ignoring_ascii_case("%2e%2e"sv); } // https://url.spec.whatwg.org/#string-percent-encode-after-encoding diff --git a/Ladybird/RequestManagerQt.cpp b/Ladybird/RequestManagerQt.cpp index 81b9640f419..e6a97d2f150 100644 --- a/Ladybird/RequestManagerQt.cpp +++ b/Ladybird/RequestManagerQt.cpp @@ -24,7 +24,7 @@ void RequestManagerQt::reply_finished(QNetworkReply* reply) RefPtr RequestManagerQt::start_request(DeprecatedString const& method, AK::URL const& url, HashMap const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy) { - if (!url.scheme().is_one_of_ignoring_case("http"sv, "https"sv)) { + if (!url.scheme().is_one_of_ignoring_ascii_case("http"sv, "https"sv)) { return nullptr; } auto request_or_error = Request::create(*m_qnam, method, url, request_headers, request_body, proxy); @@ -58,15 +58,15 @@ ErrorOr> RequestManagerQt::Request::cre request.setRawHeader(QByteArray(it.key.characters()), QByteArray(it.value.characters())); } - if (method.equals_ignoring_case("head"sv)) { + if (method.equals_ignoring_ascii_case("head"sv)) { reply = qnam.head(request); - } else if (method.equals_ignoring_case("get"sv)) { + } else if (method.equals_ignoring_ascii_case("get"sv)) { reply = qnam.get(request); - } else if (method.equals_ignoring_case("post"sv)) { + } else if (method.equals_ignoring_ascii_case("post"sv)) { reply = qnam.post(request, QByteArray((char const*)request_body.data(), request_body.size())); - } else if (method.equals_ignoring_case("put"sv)) { + } else if (method.equals_ignoring_ascii_case("put"sv)) { reply = qnam.put(request, QByteArray((char const*)request_body.data(), request_body.size())); - } else if (method.equals_ignoring_case("delete"sv)) { + } else if (method.equals_ignoring_ascii_case("delete"sv)) { reply = qnam.deleteResource(request); } else { reply = qnam.sendCustomRequest(request, QByteArray(method.characters()), QByteArray((char const*)request_body.data(), request_body.size())); @@ -91,7 +91,7 @@ void RequestManagerQt::Request::did_finish() for (auto& it : m_reply.rawHeaderPairs()) { auto name = DeprecatedString(it.first.data(), it.first.length()); auto value = DeprecatedString(it.second.data(), it.second.length()); - if (name.equals_ignoring_case("set-cookie"sv)) { + if (name.equals_ignoring_ascii_case("set-cookie"sv)) { // NOTE: Qt may have bundled multiple Set-Cookie headers into a single one. // We have to extract the full list of cookies via QNetworkReply::header(). auto set_cookie_list = m_reply.header(QNetworkRequest::SetCookieHeader).value>(); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp index 9674c374245..168a6f49041 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSPropertyID.cpp @@ -171,7 +171,7 @@ PropertyID property_id_from_camel_case_string(StringView string) member_generator.set("name:titlecase", title_casify(name)); member_generator.set("name:camelcase", camel_casify(name)); member_generator.append(R"~~~( - if (string.equals_ignoring_case("@name:camelcase@"sv)) + if (string.equals_ignoring_ascii_case("@name:camelcase@"sv)) return PropertyID::@name:titlecase@; )~~~"); }); diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSTransformFunctions.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSTransformFunctions.cpp index 9276061b12a..e64a546733e 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSTransformFunctions.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/GenerateCSSTransformFunctions.cpp @@ -121,7 +121,7 @@ Optional transform_function_from_string(StringView name) member_generator.set("name", name); member_generator.set("name:titlecase", title_casify_transform_function(name)); member_generator.append(R"~~~( - if (name.equals_ignoring_case("@name@"sv)) + if (name.equals_ignoring_ascii_case("@name@"sv)) return TransformFunction::@name:titlecase@; )~~~"); }); diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index f0d1cf794b7..5d9c8487b58 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -171,7 +171,7 @@ void MailWidget::on_window_close() IMAP::MultiPartBodyStructureData const* MailWidget::look_for_alternative_body_structure(IMAP::MultiPartBodyStructureData const& current_body_structure, Vector& position_stack) const { - if (current_body_structure.media_type.equals_ignoring_case("ALTERNATIVE"sv)) + if (current_body_structure.media_type.equals_ignoring_ascii_case("ALTERNATIVE"sv)) return ¤t_body_structure; u32 structure_index = 1; @@ -227,7 +227,7 @@ Vector MailWidget::get_alternatives(IMAP::MultiPartBody bool MailWidget::is_supported_alternative(Alternative const& alternative) const { - return alternative.body_structure.type.equals_ignoring_case("text"sv) && (alternative.body_structure.subtype.equals_ignoring_case("plain"sv) || alternative.body_structure.subtype.equals_ignoring_case("html"sv)); + return alternative.body_structure.type.equals_ignoring_ascii_case("text"sv) && (alternative.body_structure.subtype.equals_ignoring_ascii_case("plain"sv) || alternative.body_structure.subtype.equals_ignoring_ascii_case("html"sv)); } void MailWidget::selected_mailbox() @@ -302,7 +302,7 @@ void MailWidget::selected_mailbox() if (!data_item.section->headers.has_value()) return false; auto header_iterator = data_item.section->headers->find_if([&search_header](auto& header) { - return header.equals_ignoring_case(search_header); + return header.equals_ignoring_ascii_case(search_header); }); return header_iterator != data_item.section->headers->end(); }; @@ -493,13 +493,13 @@ void MailWidget::selected_email_to_load() // FIXME: String uses char internally, so 8bit shouldn't be stored in it. // However, it works for now. - if (selected_alternative_encoding.equals_ignoring_case("7bit"sv) || selected_alternative_encoding.equals_ignoring_case("8bit"sv)) { + if (selected_alternative_encoding.equals_ignoring_ascii_case("7bit"sv) || selected_alternative_encoding.equals_ignoring_ascii_case("8bit"sv)) { decoded_data = encoded_data; - } else if (selected_alternative_encoding.equals_ignoring_case("base64"sv)) { + } else if (selected_alternative_encoding.equals_ignoring_ascii_case("base64"sv)) { auto decoded_base64 = decode_base64(encoded_data); if (!decoded_base64.is_error()) decoded_data = decoded_base64.release_value(); - } else if (selected_alternative_encoding.equals_ignoring_case("quoted-printable"sv)) { + } else if (selected_alternative_encoding.equals_ignoring_ascii_case("quoted-printable"sv)) { decoded_data = IMAP::decode_quoted_printable(encoded_data).release_value_but_fixme_should_propagate_errors(); } else { dbgln("Mail: Unimplemented decoder for encoding: {}", selected_alternative_encoding); diff --git a/Userland/Demos/CatDog/CatDog.cpp b/Userland/Demos/CatDog/CatDog.cpp index 70c9dd3cf59..8f8bc9a9d4e 100644 --- a/Userland/Demos/CatDog/CatDog.cpp +++ b/Userland/Demos/CatDog/CatDog.cpp @@ -75,13 +75,13 @@ CatDog::State CatDog::special_application_states() const auto proc_info = maybe_proc_info.release_value(); auto maybe_paint_program = proc_info.processes.first_matching([](auto& process) { - return process.name.equals_ignoring_case("pixelpaint"sv) || process.name.equals_ignoring_case("fonteditor"sv); + return process.name.equals_ignoring_ascii_case("pixelpaint"sv) || process.name.equals_ignoring_ascii_case("fonteditor"sv); }); if (maybe_paint_program.has_value()) return State::Artist; auto maybe_inspector_program = proc_info.processes.first_matching([](auto& process) { - return process.name.equals_ignoring_case("inspector"sv) || process.name.equals_ignoring_case("systemmonitor"sv) || process.name.equals_ignoring_case("profiler"sv); + return process.name.equals_ignoring_ascii_case("inspector"sv) || process.name.equals_ignoring_ascii_case("systemmonitor"sv) || process.name.equals_ignoring_ascii_case("profiler"sv); }); if (maybe_inspector_program.has_value()) return State::Inspector; diff --git a/Userland/DevTools/SQLStudio/MainWidget.cpp b/Userland/DevTools/SQLStudio/MainWidget.cpp index b142acbb6e1..35e4091ea58 100644 --- a/Userland/DevTools/SQLStudio/MainWidget.cpp +++ b/Userland/DevTools/SQLStudio/MainWidget.cpp @@ -477,7 +477,7 @@ void MainWidget::drop_event(GUI::DropEvent& drop_event) for (auto& url : urls) { auto& scheme = url.scheme(); - if (!scheme.equals_ignoring_case("file"sv)) + if (!scheme.equals_ignoring_ascii_case("file"sv)) continue; auto lexical_path = LexicalPath(url.path()); diff --git a/Userland/Games/Minesweeper/Field.h b/Userland/Games/Minesweeper/Field.h index d6fca9ad238..4a3e574a7fb 100644 --- a/Userland/Games/Minesweeper/Field.h +++ b/Userland/Games/Minesweeper/Field.h @@ -78,16 +78,16 @@ public: if (difficulty_string.matches("beginner"sv)) return Difficulty::Beginner; - if (difficulty_string.equals_ignoring_case("intermediate"sv)) + if (difficulty_string.equals_ignoring_ascii_case("intermediate"sv)) return Difficulty::Intermediate; - if (difficulty_string.equals_ignoring_case("expert"sv)) + if (difficulty_string.equals_ignoring_ascii_case("expert"sv)) return Difficulty::Expert; - if (difficulty_string.equals_ignoring_case("madwoman"sv)) + if (difficulty_string.equals_ignoring_ascii_case("madwoman"sv)) return Difficulty::Madwoman; - if (difficulty_string.equals_ignoring_case("custom"sv)) + if (difficulty_string.equals_ignoring_ascii_case("custom"sv)) return Difficulty::Custom; return {}; diff --git a/Userland/Libraries/LibCMake/Token.cpp b/Userland/Libraries/LibCMake/Token.cpp index 68bf98b9f4e..7cc30ca0710 100644 --- a/Userland/Libraries/LibCMake/Token.cpp +++ b/Userland/Libraries/LibCMake/Token.cpp @@ -10,39 +10,39 @@ namespace CMake { Optional control_keyword_from_string(StringView value) { - if (value.equals_ignoring_case("if"sv)) + if (value.equals_ignoring_ascii_case("if"sv)) return ControlKeywordType::If; - if (value.equals_ignoring_case("elseif"sv)) + if (value.equals_ignoring_ascii_case("elseif"sv)) return ControlKeywordType::ElseIf; - if (value.equals_ignoring_case("else"sv)) + if (value.equals_ignoring_ascii_case("else"sv)) return ControlKeywordType::Else; - if (value.equals_ignoring_case("endif"sv)) + if (value.equals_ignoring_ascii_case("endif"sv)) return ControlKeywordType::EndIf; - if (value.equals_ignoring_case("foreach"sv)) + if (value.equals_ignoring_ascii_case("foreach"sv)) return ControlKeywordType::ForEach; - if (value.equals_ignoring_case("endforeach"sv)) + if (value.equals_ignoring_ascii_case("endforeach"sv)) return ControlKeywordType::EndForEach; - if (value.equals_ignoring_case("while"sv)) + if (value.equals_ignoring_ascii_case("while"sv)) return ControlKeywordType::While; - if (value.equals_ignoring_case("endwhile"sv)) + if (value.equals_ignoring_ascii_case("endwhile"sv)) return ControlKeywordType::EndWhile; - if (value.equals_ignoring_case("break"sv)) + if (value.equals_ignoring_ascii_case("break"sv)) return ControlKeywordType::Break; - if (value.equals_ignoring_case("continue"sv)) + if (value.equals_ignoring_ascii_case("continue"sv)) return ControlKeywordType::Continue; - if (value.equals_ignoring_case("return"sv)) + if (value.equals_ignoring_ascii_case("return"sv)) return ControlKeywordType::Return; - if (value.equals_ignoring_case("macro"sv)) + if (value.equals_ignoring_ascii_case("macro"sv)) return ControlKeywordType::Macro; - if (value.equals_ignoring_case("endmacro"sv)) + if (value.equals_ignoring_ascii_case("endmacro"sv)) return ControlKeywordType::EndMacro; - if (value.equals_ignoring_case("function"sv)) + if (value.equals_ignoring_ascii_case("function"sv)) return ControlKeywordType::Function; - if (value.equals_ignoring_case("endfunction"sv)) + if (value.equals_ignoring_ascii_case("endfunction"sv)) return ControlKeywordType::EndFunction; - if (value.equals_ignoring_case("block"sv)) + if (value.equals_ignoring_ascii_case("block"sv)) return ControlKeywordType::Block; - if (value.equals_ignoring_case("endblock"sv)) + if (value.equals_ignoring_ascii_case("endblock"sv)) return ControlKeywordType::EndBlock; return {}; } diff --git a/Userland/Libraries/LibCore/ConfigFile.cpp b/Userland/Libraries/LibCore/ConfigFile.cpp index 7da3e9bc9e0..a6101870276 100644 --- a/Userland/Libraries/LibCore/ConfigFile.cpp +++ b/Userland/Libraries/LibCore/ConfigFile.cpp @@ -153,7 +153,7 @@ DeprecatedString ConfigFile::read_entry(DeprecatedString const& group, Deprecate bool ConfigFile::read_bool_entry(DeprecatedString const& group, DeprecatedString const& key, bool default_value) const { auto value = read_entry(group, key, default_value ? "true" : "false"); - return value == "1" || value.equals_ignoring_case("true"sv); + return value == "1" || value.equals_ignoring_ascii_case("true"sv); } void ConfigFile::write_entry(DeprecatedString const& group, DeprecatedString const& key, DeprecatedString const& value) diff --git a/Userland/Libraries/LibGfx/Color.cpp b/Userland/Libraries/LibGfx/Color.cpp index b21b3bb4e00..2777644fe65 100644 --- a/Userland/Libraries/LibGfx/Color.cpp +++ b/Userland/Libraries/LibGfx/Color.cpp @@ -249,11 +249,11 @@ Optional Color::from_string(StringView string) { 0x000000, nullptr } }; - if (string.equals_ignoring_case("transparent"sv)) + if (string.equals_ignoring_ascii_case("transparent"sv)) return Color::from_argb(0x00000000); for (size_t i = 0; !web_colors[i].name.is_null(); ++i) { - if (string.equals_ignoring_case(web_colors[i].name)) + if (string.equals_ignoring_ascii_case(web_colors[i].name)) return Color::from_rgb(web_colors[i].color); } diff --git a/Userland/Libraries/LibHTTP/Job.cpp b/Userland/Libraries/LibHTTP/Job.cpp index 8bacd97d39d..4914734ff1a 100644 --- a/Userland/Libraries/LibHTTP/Job.cpp +++ b/Userland/Libraries/LibHTTP/Job.cpp @@ -323,7 +323,7 @@ void Job::on_socket_connected() // responds with nothing (content-length = 0 with normal encoding); if that's the case, // quit early as we won't be reading anything anyway. if (auto result = m_headers.get("Content-Length"sv).value_or(""sv).to_uint(); result.has_value()) { - if (result.value() == 0 && !m_headers.get("Transfer-Encoding"sv).value_or(""sv).view().trim_whitespace().equals_ignoring_case("chunked"sv)) + if (result.value() == 0 && !m_headers.get("Transfer-Encoding"sv).value_or(""sv).view().trim_whitespace().equals_ignoring_ascii_case("chunked"sv)) return finish_up(); } // There's also the possibility that the server responds with 204 (No Content), @@ -357,7 +357,7 @@ void Job::on_socket_connected() return deferred_invoke([this] { did_fail(Core::NetworkJob::Error::ProtocolFailed); }); } auto value = line.substring(name.length() + 2, line.length() - name.length() - 2); - if (name.equals_ignoring_case("Set-Cookie"sv)) { + if (name.equals_ignoring_ascii_case("Set-Cookie"sv)) { dbgln_if(JOB_DEBUG, "Job: Received Set-Cookie header: '{}'", value); m_set_cookie_headers.append(move(value)); @@ -375,11 +375,11 @@ void Job::on_socket_connected() } else { m_headers.set(name, value); } - if (name.equals_ignoring_case("Content-Encoding"sv)) { + if (name.equals_ignoring_ascii_case("Content-Encoding"sv)) { // Assume that any content-encoding means that we can't decode it as a stream :( dbgln_if(JOB_DEBUG, "Content-Encoding {} detected, cannot stream output :(", value); m_can_stream_response = false; - } else if (name.equals_ignoring_case("Content-Length"sv)) { + } else if (name.equals_ignoring_ascii_case("Content-Length"sv)) { auto length = value.to_uint(); if (length.has_value()) m_content_length = length.value(); @@ -472,7 +472,7 @@ void Job::on_socket_connected() auto encoding = transfer_encoding.value().trim_whitespace(); dbgln_if(JOB_DEBUG, "Job: This content has transfer encoding '{}'", encoding); - if (encoding.equals_ignoring_case("chunked"sv)) { + if (encoding.equals_ignoring_ascii_case("chunked"sv)) { m_current_chunk_remaining_size = -1; goto read_chunk_size; } else { @@ -629,7 +629,7 @@ void Job::finish_up() // If the server responded with "Connection: close", close the connection // as the server may or may not want to close the socket. Also, if this is // a legacy HTTP server (1.0 or older), assume close is the default value. - if (auto result = response->headers().get("Connection"sv); result.has_value() ? result->equals_ignoring_case("close"sv) : m_legacy_connection) + if (auto result = response->headers().get("Connection"sv); result.has_value() ? result->equals_ignoring_ascii_case("close"sv) : m_legacy_connection) shutdown(ShutdownMode::CloseSocket); did_finish(response); }); diff --git a/Userland/Libraries/LibIDL/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp index 089815bfb6c..7948b0e8fe2 100644 --- a/Userland/Libraries/LibIDL/IDLParser.cpp +++ b/Userland/Libraries/LibIDL/IDLParser.cpp @@ -197,7 +197,7 @@ NonnullRefPtr Parser::parse_type() auto name = lexer.consume_until([](auto ch) { return !is_ascii_alphanumeric(ch) && ch != '_'; }); - if (name.equals_ignoring_case("long"sv)) { + if (name.equals_ignoring_ascii_case("long"sv)) { consume_whitespace(); if (lexer.consume_specific("long"sv)) name = "long long"sv; diff --git a/Userland/Libraries/LibIMAP/Parser.cpp b/Userland/Libraries/LibIMAP/Parser.cpp index d41e3c53d16..6b97c434c32 100644 --- a/Userland/Libraries/LibIMAP/Parser.cpp +++ b/Userland/Libraries/LibIMAP/Parser.cpp @@ -417,7 +417,7 @@ BodyStructure Parser::parse_one_part_body() consume(" "sv); auto subtype = parse_string(); consume(" "sv); - if (type.equals_ignoring_case("TEXT"sv)) { + if (type.equals_ignoring_ascii_case("TEXT"sv)) { // body-type-text auto params = parse_body_fields_params(); consume(" "sv); @@ -479,7 +479,7 @@ BodyStructure Parser::parse_one_part_body() } return BodyStructure(move(data)); - } else if (type.equals_ignoring_case("MESSAGE"sv) && subtype.equals_ignoring_case("RFC822"sv)) { + } else if (type.equals_ignoring_ascii_case("MESSAGE"sv) && subtype.equals_ignoring_ascii_case("RFC822"sv)) { // body-type-message auto params = parse_body_fields_params(); consume(" "sv); @@ -701,13 +701,13 @@ StringView Parser::consume_until_end_of_line() FetchCommand::DataItem Parser::parse_fetch_data_item() { auto msg_attr = consume_while([](u8 x) { return is_ascii_alpha(x) != 0; }); - if (msg_attr.equals_ignoring_case("BODY"sv) && try_consume("["sv)) { + if (msg_attr.equals_ignoring_ascii_case("BODY"sv) && try_consume("["sv)) { auto data_item = FetchCommand::DataItem { .type = FetchCommand::DataItemType::BodySection, .section = { {} } }; auto section_type = consume_while([](u8 x) { return x != ']' && x != ' '; }); - if (section_type.equals_ignoring_case("HEADER.FIELDS"sv)) { + if (section_type.equals_ignoring_ascii_case("HEADER.FIELDS"sv)) { data_item.section->type = FetchCommand::DataItem::SectionType::HeaderFields; data_item.section->headers = Vector(); consume(" "sv); @@ -716,7 +716,7 @@ FetchCommand::DataItem Parser::parse_fetch_data_item() data_item.section->headers->append(header); } consume("]"sv); - } else if (section_type.equals_ignoring_case("HEADER.FIELDS.NOT"sv)) { + } else if (section_type.equals_ignoring_ascii_case("HEADER.FIELDS.NOT"sv)) { data_item.section->type = FetchCommand::DataItem::SectionType::HeaderFieldsNot; data_item.section->headers = Vector(); consume(" ("sv); @@ -736,14 +736,14 @@ FetchCommand::DataItem Parser::parse_fetch_data_item() continue; } auto atom = parse_atom(); - if (atom.equals_ignoring_case("MIME"sv)) { + if (atom.equals_ignoring_ascii_case("MIME"sv)) { data_item.section->ends_with_mime = true; continue; } } - } else if (section_type.equals_ignoring_case("TEXT"sv)) { + } else if (section_type.equals_ignoring_ascii_case("TEXT"sv)) { data_item.section->type = FetchCommand::DataItem::SectionType::Text; - } else if (section_type.equals_ignoring_case("HEADER"sv)) { + } else if (section_type.equals_ignoring_ascii_case("HEADER"sv)) { data_item.section->type = FetchCommand::DataItem::SectionType::Header; } else { dbgln("Unmatched section type {}", section_type); @@ -757,23 +757,23 @@ FetchCommand::DataItem Parser::parse_fetch_data_item() } try_consume(" "sv); return data_item; - } else if (msg_attr.equals_ignoring_case("FLAGS"sv)) { + } else if (msg_attr.equals_ignoring_ascii_case("FLAGS"sv)) { return FetchCommand::DataItem { .type = FetchCommand::DataItemType::Flags }; - } else if (msg_attr.equals_ignoring_case("UID"sv)) { + } else if (msg_attr.equals_ignoring_ascii_case("UID"sv)) { return FetchCommand::DataItem { .type = FetchCommand::DataItemType::UID }; - } else if (msg_attr.equals_ignoring_case("INTERNALDATE"sv)) { + } else if (msg_attr.equals_ignoring_ascii_case("INTERNALDATE"sv)) { return FetchCommand::DataItem { .type = FetchCommand::DataItemType::InternalDate }; - } else if (msg_attr.equals_ignoring_case("ENVELOPE"sv)) { + } else if (msg_attr.equals_ignoring_ascii_case("ENVELOPE"sv)) { return FetchCommand::DataItem { .type = FetchCommand::DataItemType::Envelope }; - } else if (msg_attr.equals_ignoring_case("BODY"sv) || msg_attr.equals_ignoring_case("BODYSTRUCTURE"sv)) { + } else if (msg_attr.equals_ignoring_ascii_case("BODY"sv) || msg_attr.equals_ignoring_ascii_case("BODYSTRUCTURE"sv)) { return FetchCommand::DataItem { .type = FetchCommand::DataItemType::BodyStructure }; diff --git a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp index 97ec602c5e6..f403d32c5c9 100644 --- a/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/GlobalObject.cpp @@ -314,7 +314,7 @@ JS_DEFINE_NATIVE_FUNCTION(GlobalObject::parse_int) // 10. If stripPrefix is true, then if (strip_prefix) { // a. If the length of S is at least 2 and the first two code units of S are either "0x" or "0X", then - if (trimmed_view.length() >= 2 && trimmed_view.substring_view(0, 2).equals_ignoring_case("0x"sv)) { + if (trimmed_view.length() >= 2 && trimmed_view.substring_view(0, 2).equals_ignoring_ascii_case("0x"sv)) { // i. Remove the first two code units from S. trimmed_view = trimmed_view.substring_view(2); diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp index 1bd99978322..f16dfa0ff0a 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/Calendar.cpp @@ -41,7 +41,7 @@ bool is_builtin_calendar(StringView identifier) // 2. If calendars contains the ASCII-lowercase of id, return true. for (auto calendar : calendars) { - if (calendar.equals_ignoring_case(identifier)) + if (calendar.equals_ignoring_ascii_case(identifier)) return true; } diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp index afeac4f4860..7e4f14c68f7 100644 --- a/Userland/Libraries/LibLine/Editor.cpp +++ b/Userland/Libraries/LibLine/Editor.cpp @@ -54,16 +54,16 @@ Configuration Configuration::from_config(StringView libname) configuration.set(flags); - if (refresh.equals_ignoring_case("lazy"sv)) + if (refresh.equals_ignoring_ascii_case("lazy"sv)) configuration.set(Configuration::Lazy); - else if (refresh.equals_ignoring_case("eager"sv)) + else if (refresh.equals_ignoring_ascii_case("eager"sv)) configuration.set(Configuration::Eager); - if (operation.equals_ignoring_case("full"sv)) + if (operation.equals_ignoring_ascii_case("full"sv)) configuration.set(Configuration::OperationMode::Full); - else if (operation.equals_ignoring_case("noescapesequences"sv)) + else if (operation.equals_ignoring_ascii_case("noescapesequences"sv)) configuration.set(Configuration::OperationMode::NoEscapeSequences); - else if (operation.equals_ignoring_case("noninteractive"sv)) + else if (operation.equals_ignoring_ascii_case("noninteractive"sv)) configuration.set(Configuration::OperationMode::NonInteractive); else configuration.set(Configuration::OperationMode::Unset); diff --git a/Userland/Libraries/LibRegex/RegexMatch.h b/Userland/Libraries/LibRegex/RegexMatch.h index 4f6882c2440..307d9d6c782 100644 --- a/Userland/Libraries/LibRegex/RegexMatch.h +++ b/Userland/Libraries/LibRegex/RegexMatch.h @@ -517,7 +517,7 @@ public: return m_view.visit( [&](StringView view) { return other.m_view.visit( - [&](StringView other_view) { return view.equals_ignoring_case(other_view); }, + [&](StringView other_view) { return view.equals_ignoring_ascii_case(other_view); }, [](auto&) -> bool { TODO(); }); }, [&](Utf16View view) { diff --git a/Userland/Libraries/LibSQL/Value.cpp b/Userland/Libraries/LibSQL/Value.cpp index 1cbb2be685b..606fbb878f6 100644 --- a/Userland/Libraries/LibSQL/Value.cpp +++ b/Userland/Libraries/LibSQL/Value.cpp @@ -245,9 +245,9 @@ Optional Value::to_bool() const return m_value->visit( [](DeprecatedString const& value) -> Optional { - if (value.equals_ignoring_case("true"sv) || value.equals_ignoring_case("t"sv)) + if (value.equals_ignoring_ascii_case("true"sv) || value.equals_ignoring_ascii_case("t"sv)) return true; - if (value.equals_ignoring_case("false"sv) || value.equals_ignoring_case("f"sv)) + if (value.equals_ignoring_ascii_case("false"sv) || value.equals_ignoring_ascii_case("f"sv)) return false; return {}; }, diff --git a/Userland/Libraries/LibTextCodec/Decoder.cpp b/Userland/Libraries/LibTextCodec/Decoder.cpp index 958e7f08394..fcb50a6768c 100644 --- a/Userland/Libraries/LibTextCodec/Decoder.cpp +++ b/Userland/Libraries/LibTextCodec/Decoder.cpp @@ -34,29 +34,29 @@ Optional decoder_for(StringView a_encoding) { auto encoding = get_standardized_encoding(a_encoding); if (encoding.has_value()) { - if (encoding.value().equals_ignoring_case("windows-1252"sv)) + if (encoding.value().equals_ignoring_ascii_case("windows-1252"sv)) return s_latin1_decoder; - if (encoding.value().equals_ignoring_case("utf-8"sv)) + if (encoding.value().equals_ignoring_ascii_case("utf-8"sv)) return s_utf8_decoder; - if (encoding.value().equals_ignoring_case("utf-16be"sv)) + if (encoding.value().equals_ignoring_ascii_case("utf-16be"sv)) return s_utf16be_decoder; - if (encoding.value().equals_ignoring_case("utf-16le"sv)) + if (encoding.value().equals_ignoring_ascii_case("utf-16le"sv)) return s_utf16le_decoder; - if (encoding.value().equals_ignoring_case("iso-8859-2"sv)) + if (encoding.value().equals_ignoring_ascii_case("iso-8859-2"sv)) return s_latin2_decoder; - if (encoding.value().equals_ignoring_case("windows-1255"sv)) + if (encoding.value().equals_ignoring_ascii_case("windows-1255"sv)) return s_hebrew_decoder; - if (encoding.value().equals_ignoring_case("windows-1251"sv)) + if (encoding.value().equals_ignoring_ascii_case("windows-1251"sv)) return s_cyrillic_decoder; - if (encoding.value().equals_ignoring_case("koi8-r"sv)) + if (encoding.value().equals_ignoring_ascii_case("koi8-r"sv)) return s_koi8r_decoder; - if (encoding.value().equals_ignoring_case("iso-8859-15"sv)) + if (encoding.value().equals_ignoring_ascii_case("iso-8859-15"sv)) return s_latin9_decoder; - if (encoding.value().equals_ignoring_case("macintosh"sv)) + if (encoding.value().equals_ignoring_ascii_case("macintosh"sv)) return s_mac_roman_decoder; - if (encoding.value().equals_ignoring_case("windows-1254"sv)) + if (encoding.value().equals_ignoring_ascii_case("windows-1254"sv)) return s_turkish_decoder; - if (encoding.value().equals_ignoring_case("x-user-defined"sv)) + if (encoding.value().equals_ignoring_ascii_case("x-user-defined"sv)) return s_x_user_defined_decoder; } dbgln("TextCodec: No decoder implemented for encoding '{}'", a_encoding); @@ -68,87 +68,87 @@ Optional get_standardized_encoding(StringView encoding) { encoding = encoding.trim_whitespace(); - if (encoding.is_one_of_ignoring_case("unicode-1-1-utf-8"sv, "unicode11utf8"sv, "unicode20utf8"sv, "utf-8"sv, "utf8"sv, "x-unicode20utf8"sv)) + if (encoding.is_one_of_ignoring_ascii_case("unicode-1-1-utf-8"sv, "unicode11utf8"sv, "unicode20utf8"sv, "utf-8"sv, "utf8"sv, "x-unicode20utf8"sv)) return "UTF-8"sv; - if (encoding.is_one_of_ignoring_case("866"sv, "cp866"sv, "csibm866"sv, "ibm866"sv)) + if (encoding.is_one_of_ignoring_ascii_case("866"sv, "cp866"sv, "csibm866"sv, "ibm866"sv)) return "IBM866"sv; - if (encoding.is_one_of_ignoring_case("csisolatin2"sv, "iso-8859-2"sv, "iso-ir-101"sv, "iso8859-2"sv, "iso88592"sv, "iso_8859-2"sv, "iso_8859-2:1987"sv, "l2"sv, "latin2"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csisolatin2"sv, "iso-8859-2"sv, "iso-ir-101"sv, "iso8859-2"sv, "iso88592"sv, "iso_8859-2"sv, "iso_8859-2:1987"sv, "l2"sv, "latin2"sv)) return "ISO-8859-2"sv; - if (encoding.is_one_of_ignoring_case("csisolatin3"sv, "iso-8859-3"sv, "iso-ir-109"sv, "iso8859-3"sv, "iso88593"sv, "iso_8859-3"sv, "iso_8859-3:1988"sv, "l3"sv, "latin3"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csisolatin3"sv, "iso-8859-3"sv, "iso-ir-109"sv, "iso8859-3"sv, "iso88593"sv, "iso_8859-3"sv, "iso_8859-3:1988"sv, "l3"sv, "latin3"sv)) return "ISO-8859-3"sv; - if (encoding.is_one_of_ignoring_case("csisolatin4"sv, "iso-8859-4"sv, "iso-ir-110"sv, "iso8859-4"sv, "iso88594"sv, "iso_8859-4"sv, "iso_8859-4:1989"sv, "l4"sv, "latin4"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csisolatin4"sv, "iso-8859-4"sv, "iso-ir-110"sv, "iso8859-4"sv, "iso88594"sv, "iso_8859-4"sv, "iso_8859-4:1989"sv, "l4"sv, "latin4"sv)) return "ISO-8859-4"sv; - if (encoding.is_one_of_ignoring_case("csisolatincyrillic"sv, "cyrillic"sv, "iso-8859-5"sv, "iso-ir-144"sv, "iso8859-5"sv, "iso88595"sv, "iso_8859-5"sv, "iso_8859-5:1988"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csisolatincyrillic"sv, "cyrillic"sv, "iso-8859-5"sv, "iso-ir-144"sv, "iso8859-5"sv, "iso88595"sv, "iso_8859-5"sv, "iso_8859-5:1988"sv)) return "ISO-8859-5"sv; - if (encoding.is_one_of_ignoring_case("arabic"sv, "asmo-708"sv, "csiso88596e"sv, "csiso88596i"sv, "csisolatinarabic"sv, "ecma-114"sv, "iso-8859-6"sv, "iso-8859-6-e"sv, "iso-8859-6-i"sv, "iso-ir-127"sv, "iso8859-6"sv, "iso88596"sv, "iso_8859-6"sv, "iso_8859-6:1987"sv)) + if (encoding.is_one_of_ignoring_ascii_case("arabic"sv, "asmo-708"sv, "csiso88596e"sv, "csiso88596i"sv, "csisolatinarabic"sv, "ecma-114"sv, "iso-8859-6"sv, "iso-8859-6-e"sv, "iso-8859-6-i"sv, "iso-ir-127"sv, "iso8859-6"sv, "iso88596"sv, "iso_8859-6"sv, "iso_8859-6:1987"sv)) return "ISO-8859-6"sv; - if (encoding.is_one_of_ignoring_case("csisolatingreek"sv, "ecma-118"sv, "elot_928"sv, "greek"sv, "greek8"sv, "iso-8859-7"sv, "iso-ir-126"sv, "iso8859-7"sv, "iso88597"sv, "iso_8859-7"sv, "iso_8859-7:1987"sv, "sun_eu_greek"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csisolatingreek"sv, "ecma-118"sv, "elot_928"sv, "greek"sv, "greek8"sv, "iso-8859-7"sv, "iso-ir-126"sv, "iso8859-7"sv, "iso88597"sv, "iso_8859-7"sv, "iso_8859-7:1987"sv, "sun_eu_greek"sv)) return "ISO-8859-7"sv; - if (encoding.is_one_of_ignoring_case("csiso88598e"sv, "csisolatinhebrew"sv, "hebrew"sv, "iso-8859-8"sv, "iso-8859-8-e"sv, "iso-ir-138"sv, "iso8859-8"sv, "iso88598"sv, "iso_8859-8"sv, "iso_8859-8:1988"sv, "visual"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csiso88598e"sv, "csisolatinhebrew"sv, "hebrew"sv, "iso-8859-8"sv, "iso-8859-8-e"sv, "iso-ir-138"sv, "iso8859-8"sv, "iso88598"sv, "iso_8859-8"sv, "iso_8859-8:1988"sv, "visual"sv)) return "ISO-8859-8"sv; - if (encoding.is_one_of_ignoring_case("csiso88598i"sv, "iso-8859-8-i"sv, "logical"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csiso88598i"sv, "iso-8859-8-i"sv, "logical"sv)) return "ISO-8859-8-I"sv; - if (encoding.is_one_of_ignoring_case("csisolatin6"sv, "iso8859-10"sv, "iso-ir-157"sv, "iso8859-10"sv, "iso885910"sv, "l6"sv, "latin6"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csisolatin6"sv, "iso8859-10"sv, "iso-ir-157"sv, "iso8859-10"sv, "iso885910"sv, "l6"sv, "latin6"sv)) return "ISO-8859-10"sv; - if (encoding.is_one_of_ignoring_case("iso-8859-13"sv, "iso8859-13"sv, "iso885913"sv)) + if (encoding.is_one_of_ignoring_ascii_case("iso-8859-13"sv, "iso8859-13"sv, "iso885913"sv)) return "ISO-8859-13"sv; - if (encoding.is_one_of_ignoring_case("iso-8859-14"sv, "iso8859-14"sv, "iso885914"sv)) + if (encoding.is_one_of_ignoring_ascii_case("iso-8859-14"sv, "iso8859-14"sv, "iso885914"sv)) return "ISO-8859-14"sv; - if (encoding.is_one_of_ignoring_case("csisolatin9"sv, "iso-8859-15"sv, "iso8859-15"sv, "iso885915"sv, "iso_8859-15"sv, "l9"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csisolatin9"sv, "iso-8859-15"sv, "iso8859-15"sv, "iso885915"sv, "iso_8859-15"sv, "l9"sv)) return "ISO-8859-15"sv; - if (encoding.is_one_of_ignoring_case("iso-8859-16"sv)) + if (encoding.is_one_of_ignoring_ascii_case("iso-8859-16"sv)) return "ISO-8859-16"sv; - if (encoding.is_one_of_ignoring_case("cskoi8r"sv, "koi"sv, "koi8"sv, "koi8-r"sv, "koi8_r"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cskoi8r"sv, "koi"sv, "koi8"sv, "koi8-r"sv, "koi8_r"sv)) return "KOI8-R"sv; - if (encoding.is_one_of_ignoring_case("koi8-ru"sv, "koi8-u"sv)) + if (encoding.is_one_of_ignoring_ascii_case("koi8-ru"sv, "koi8-u"sv)) return "KOI8-U"sv; - if (encoding.is_one_of_ignoring_case("csmacintosh"sv, "mac"sv, "macintosh"sv, "x-mac-roman"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csmacintosh"sv, "mac"sv, "macintosh"sv, "x-mac-roman"sv)) return "macintosh"sv; - if (encoding.is_one_of_ignoring_case("dos-874"sv, "iso-8859-11"sv, "iso8859-11"sv, "iso885911"sv, "tis-620"sv, "windows-874"sv)) + if (encoding.is_one_of_ignoring_ascii_case("dos-874"sv, "iso-8859-11"sv, "iso8859-11"sv, "iso885911"sv, "tis-620"sv, "windows-874"sv)) return "windows-874"sv; - if (encoding.is_one_of_ignoring_case("cp1250"sv, "windows-1250"sv, "x-cp1250"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cp1250"sv, "windows-1250"sv, "x-cp1250"sv)) return "windows-1250"sv; - if (encoding.is_one_of_ignoring_case("cp1251"sv, "windows-1251"sv, "x-cp1251"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cp1251"sv, "windows-1251"sv, "x-cp1251"sv)) return "windows-1251"sv; - if (encoding.is_one_of_ignoring_case("ansi_x3.4-1968"sv, "ascii"sv, "cp1252"sv, "cp819"sv, "csisolatin1"sv, "ibm819"sv, "iso-8859-1"sv, "iso-ir-100"sv, "iso8859-1"sv, "iso88591"sv, "iso_8859-1"sv, "iso_8859-1:1987"sv, "l1"sv, "latin1"sv, "us-ascii"sv, "windows-1252"sv, "x-cp1252"sv)) + if (encoding.is_one_of_ignoring_ascii_case("ansi_x3.4-1968"sv, "ascii"sv, "cp1252"sv, "cp819"sv, "csisolatin1"sv, "ibm819"sv, "iso-8859-1"sv, "iso-ir-100"sv, "iso8859-1"sv, "iso88591"sv, "iso_8859-1"sv, "iso_8859-1:1987"sv, "l1"sv, "latin1"sv, "us-ascii"sv, "windows-1252"sv, "x-cp1252"sv)) return "windows-1252"sv; - if (encoding.is_one_of_ignoring_case("cp1253"sv, "windows-1253"sv, "x-cp1253"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cp1253"sv, "windows-1253"sv, "x-cp1253"sv)) return "windows-1253"sv; - if (encoding.is_one_of_ignoring_case("cp1254"sv, "csisolatin5"sv, "iso-8859-9"sv, "iso-ir-148"sv, "iso-8859-9"sv, "iso-88599"sv, "iso_8859-9"sv, "iso_8859-9:1989"sv, "l5"sv, "latin5"sv, "windows-1254"sv, "x-cp1254"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cp1254"sv, "csisolatin5"sv, "iso-8859-9"sv, "iso-ir-148"sv, "iso-8859-9"sv, "iso-88599"sv, "iso_8859-9"sv, "iso_8859-9:1989"sv, "l5"sv, "latin5"sv, "windows-1254"sv, "x-cp1254"sv)) return "windows-1254"sv; - if (encoding.is_one_of_ignoring_case("cp1255"sv, "windows-1255"sv, "x-cp1255"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cp1255"sv, "windows-1255"sv, "x-cp1255"sv)) return "windows-1255"sv; - if (encoding.is_one_of_ignoring_case("cp1256"sv, "windows-1256"sv, "x-cp1256"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cp1256"sv, "windows-1256"sv, "x-cp1256"sv)) return "windows-1256"sv; - if (encoding.is_one_of_ignoring_case("cp1257"sv, "windows-1257"sv, "x-cp1257"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cp1257"sv, "windows-1257"sv, "x-cp1257"sv)) return "windows-1257"sv; - if (encoding.is_one_of_ignoring_case("cp1258"sv, "windows-1258"sv, "x-cp1258"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cp1258"sv, "windows-1258"sv, "x-cp1258"sv)) return "windows-1258"sv; - if (encoding.is_one_of_ignoring_case("x-mac-cyrillic"sv, "x-mac-ukrainian"sv)) + if (encoding.is_one_of_ignoring_ascii_case("x-mac-cyrillic"sv, "x-mac-ukrainian"sv)) return "x-mac-cyrillic"sv; - if (encoding.is_one_of_ignoring_case("koi8-r"sv, "koi8r"sv)) + if (encoding.is_one_of_ignoring_ascii_case("koi8-r"sv, "koi8r"sv)) return "koi8-r"sv; - if (encoding.is_one_of_ignoring_case("chinese"sv, "csgb2312"sv, "csiso58gb231280"sv, "gb2312"sv, "gb_2312"sv, "gb_2312-80"sv, "gbk"sv, "iso-ir-58"sv, "x-gbk"sv)) + if (encoding.is_one_of_ignoring_ascii_case("chinese"sv, "csgb2312"sv, "csiso58gb231280"sv, "gb2312"sv, "gb_2312"sv, "gb_2312-80"sv, "gbk"sv, "iso-ir-58"sv, "x-gbk"sv)) return "GBK"sv; - if (encoding.is_one_of_ignoring_case("gb18030"sv)) + if (encoding.is_one_of_ignoring_ascii_case("gb18030"sv)) return "gb18030"sv; - if (encoding.is_one_of_ignoring_case("big5"sv, "big5-hkscs"sv, "cn-big5"sv, "csbig5"sv, "x-x-big5"sv)) + if (encoding.is_one_of_ignoring_ascii_case("big5"sv, "big5-hkscs"sv, "cn-big5"sv, "csbig5"sv, "x-x-big5"sv)) return "Big5"sv; - if (encoding.is_one_of_ignoring_case("cseucpkdfmtjapanese"sv, "euc-jp"sv, "x-euc-jp"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cseucpkdfmtjapanese"sv, "euc-jp"sv, "x-euc-jp"sv)) return "EUC-JP"sv; - if (encoding.is_one_of_ignoring_case("csiso2022jp"sv, "iso-2022-jp"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csiso2022jp"sv, "iso-2022-jp"sv)) return "ISO-2022-JP"sv; - if (encoding.is_one_of_ignoring_case("csshiftjis"sv, "ms932"sv, "ms_kanji"sv, "shift-jis"sv, "shift_jis"sv, "sjis"sv, "windows-31j"sv, "x-sjis"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csshiftjis"sv, "ms932"sv, "ms_kanji"sv, "shift-jis"sv, "shift_jis"sv, "sjis"sv, "windows-31j"sv, "x-sjis"sv)) return "Shift_JIS"sv; - if (encoding.is_one_of_ignoring_case("cseuckr"sv, "csksc56011987"sv, "euc-kr"sv, "iso-ir-149"sv, "korean"sv, "ks_c_5601-1987"sv, "ks_c_5601-1989"sv, "ksc5601"sv, "ksc_5601"sv, "windows-949"sv)) + if (encoding.is_one_of_ignoring_ascii_case("cseuckr"sv, "csksc56011987"sv, "euc-kr"sv, "iso-ir-149"sv, "korean"sv, "ks_c_5601-1987"sv, "ks_c_5601-1989"sv, "ksc5601"sv, "ksc_5601"sv, "windows-949"sv)) return "EUC-KR"sv; - if (encoding.is_one_of_ignoring_case("csiso2022kr"sv, "hz-gb-2312"sv, "iso-2022-cn"sv, "iso-2022-cn-ext"sv, "iso-2022-kr"sv, "replacement"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csiso2022kr"sv, "hz-gb-2312"sv, "iso-2022-cn"sv, "iso-2022-cn-ext"sv, "iso-2022-kr"sv, "replacement"sv)) return "replacement"sv; - if (encoding.is_one_of_ignoring_case("unicodefffe"sv, "utf-16be"sv)) + if (encoding.is_one_of_ignoring_ascii_case("unicodefffe"sv, "utf-16be"sv)) return "UTF-16BE"sv; - if (encoding.is_one_of_ignoring_case("csunicode"sv, "iso-10646-ucs-2"sv, "ucs-2"sv, "unicode"sv, "unicodefeff"sv, "utf-16"sv, "utf-16le"sv)) + if (encoding.is_one_of_ignoring_ascii_case("csunicode"sv, "iso-10646-ucs-2"sv, "ucs-2"sv, "unicode"sv, "unicodefeff"sv, "utf-16"sv, "utf-16le"sv)) return "UTF-16LE"sv; - if (encoding.is_one_of_ignoring_case("x-user-defined"sv)) + if (encoding.is_one_of_ignoring_ascii_case("x-user-defined"sv)) return "x-user-defined"sv; dbgln("TextCodec: Unrecognized encoding: {}", encoding); diff --git a/Userland/Libraries/LibTimeZone/TimeZone.cpp b/Userland/Libraries/LibTimeZone/TimeZone.cpp index 57717e31190..e687510bd09 100644 --- a/Userland/Libraries/LibTimeZone/TimeZone.cpp +++ b/Userland/Libraries/LibTimeZone/TimeZone.cpp @@ -154,7 +154,7 @@ ReadonlySpan __attribute__((weak)) all_time_zones() Optional __attribute__((weak)) time_zone_from_string([[maybe_unused]] StringView time_zone) { #if !ENABLE_TIME_ZONE_DATA - if (time_zone.equals_ignoring_case("UTC"sv)) + if (time_zone.equals_ignoring_ascii_case("UTC"sv)) return TimeZone::UTC; #endif return {}; diff --git a/Userland/Libraries/LibWeb/ARIA/Roles.cpp b/Userland/Libraries/LibWeb/ARIA/Roles.cpp index 0748563ae09..823959c96ec 100644 --- a/Userland/Libraries/LibWeb/ARIA/Roles.cpp +++ b/Userland/Libraries/LibWeb/ARIA/Roles.cpp @@ -28,13 +28,13 @@ StringView role_name(Role role) Optional role_from_string(StringView role_name) { // Note: "switch" is mapped to Role::switch_ (due to C++ keyword clash) -#define __ENUMERATE_ARIA_ROLE(name) \ - if constexpr (Role::name == Role::switch_) { \ - if (role_name.equals_ignoring_case("switch"sv)) \ - return Role::switch_; \ - } else { \ - if (role_name.equals_ignoring_case(#name##sv)) \ - return Role::name; \ +#define __ENUMERATE_ARIA_ROLE(name) \ + if constexpr (Role::name == Role::switch_) { \ + if (role_name.equals_ignoring_ascii_case("switch"sv)) \ + return Role::switch_; \ + } else { \ + if (role_name.equals_ignoring_ascii_case(#name##sv)) \ + return Role::name; \ } ENUMERATE_ARIA_ROLES #undef __ENUMERATE_ARIA_ROLE diff --git a/Userland/Libraries/LibWeb/CSS/Angle.cpp b/Userland/Libraries/LibWeb/CSS/Angle.cpp index f1d1d4357d0..ea07b52aada 100644 --- a/Userland/Libraries/LibWeb/CSS/Angle.cpp +++ b/Userland/Libraries/LibWeb/CSS/Angle.cpp @@ -84,13 +84,16 @@ StringView Angle::unit_name() const Optional Angle::unit_from_name(StringView name) { - if (name.equals_ignoring_case("deg"sv)) { + if (name.equals_ignoring_ascii_case("deg"sv)) { return Type::Deg; - } else if (name.equals_ignoring_case("grad"sv)) { + } + if (name.equals_ignoring_ascii_case("grad"sv)) { return Type::Grad; - } else if (name.equals_ignoring_case("rad"sv)) { + } + if (name.equals_ignoring_ascii_case("rad"sv)) { return Type::Rad; - } else if (name.equals_ignoring_case("turn"sv)) { + } + if (name.equals_ignoring_ascii_case("turn"sv)) { return Type::Turn; } return {}; diff --git a/Userland/Libraries/LibWeb/CSS/Frequency.cpp b/Userland/Libraries/LibWeb/CSS/Frequency.cpp index ac44811d3bd..5a0b828ead4 100644 --- a/Userland/Libraries/LibWeb/CSS/Frequency.cpp +++ b/Userland/Libraries/LibWeb/CSS/Frequency.cpp @@ -75,9 +75,9 @@ StringView Frequency::unit_name() const Optional Frequency::unit_from_name(StringView name) { - if (name.equals_ignoring_case("hz"sv)) { + if (name.equals_ignoring_ascii_case("hz"sv)) { return Type::Hz; - } else if (name.equals_ignoring_case("khz"sv)) { + } else if (name.equals_ignoring_ascii_case("khz"sv)) { return Type::kHz; } return {}; diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index 738839ff430..53ed6c88ff7 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -164,35 +164,35 @@ char const* Length::unit_name() const Optional Length::unit_from_name(StringView name) { - if (name.equals_ignoring_case("px"sv)) { + if (name.equals_ignoring_ascii_case("px"sv)) { return Length::Type::Px; - } else if (name.equals_ignoring_case("pt"sv)) { + } else if (name.equals_ignoring_ascii_case("pt"sv)) { return Length::Type::Pt; - } else if (name.equals_ignoring_case("pc"sv)) { + } else if (name.equals_ignoring_ascii_case("pc"sv)) { return Length::Type::Pc; - } else if (name.equals_ignoring_case("mm"sv)) { + } else if (name.equals_ignoring_ascii_case("mm"sv)) { return Length::Type::Mm; - } else if (name.equals_ignoring_case("rem"sv)) { + } else if (name.equals_ignoring_ascii_case("rem"sv)) { return Length::Type::Rem; - } else if (name.equals_ignoring_case("em"sv)) { + } else if (name.equals_ignoring_ascii_case("em"sv)) { return Length::Type::Em; - } else if (name.equals_ignoring_case("ex"sv)) { + } else if (name.equals_ignoring_ascii_case("ex"sv)) { return Length::Type::Ex; - } else if (name.equals_ignoring_case("ch"sv)) { + } else if (name.equals_ignoring_ascii_case("ch"sv)) { return Length::Type::Ch; - } else if (name.equals_ignoring_case("vw"sv)) { + } else if (name.equals_ignoring_ascii_case("vw"sv)) { return Length::Type::Vw; - } else if (name.equals_ignoring_case("vh"sv)) { + } else if (name.equals_ignoring_ascii_case("vh"sv)) { return Length::Type::Vh; - } else if (name.equals_ignoring_case("vmax"sv)) { + } else if (name.equals_ignoring_ascii_case("vmax"sv)) { return Length::Type::Vmax; - } else if (name.equals_ignoring_case("vmin"sv)) { + } else if (name.equals_ignoring_ascii_case("vmin"sv)) { return Length::Type::Vmin; - } else if (name.equals_ignoring_case("cm"sv)) { + } else if (name.equals_ignoring_ascii_case("cm"sv)) { return Length::Type::Cm; - } else if (name.equals_ignoring_case("in"sv)) { + } else if (name.equals_ignoring_ascii_case("in"sv)) { return Length::Type::In; - } else if (name.equals_ignoring_case("Q"sv)) { + } else if (name.equals_ignoring_ascii_case("Q"sv)) { return Length::Type::Q; } diff --git a/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp b/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp index 801141793a0..edf98938b41 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp @@ -393,51 +393,51 @@ ErrorOr serialize_a_media_query_list(Vector> c bool is_media_feature_name(StringView name) { // MEDIAQUERIES-4 - https://www.w3.org/TR/mediaqueries-4/#media-descriptor-table - if (name.equals_ignoring_case("any-hover"sv)) + if (name.equals_ignoring_ascii_case("any-hover"sv)) return true; - if (name.equals_ignoring_case("any-pointer"sv)) + if (name.equals_ignoring_ascii_case("any-pointer"sv)) return true; - if (name.equals_ignoring_case("aspect-ratio"sv)) + if (name.equals_ignoring_ascii_case("aspect-ratio"sv)) return true; - if (name.equals_ignoring_case("color"sv)) + if (name.equals_ignoring_ascii_case("color"sv)) return true; - if (name.equals_ignoring_case("color-gamut"sv)) + if (name.equals_ignoring_ascii_case("color-gamut"sv)) return true; - if (name.equals_ignoring_case("color-index"sv)) + if (name.equals_ignoring_ascii_case("color-index"sv)) return true; - if (name.equals_ignoring_case("device-aspect-ratio"sv)) + if (name.equals_ignoring_ascii_case("device-aspect-ratio"sv)) return true; - if (name.equals_ignoring_case("device-height"sv)) + if (name.equals_ignoring_ascii_case("device-height"sv)) return true; - if (name.equals_ignoring_case("device-width"sv)) + if (name.equals_ignoring_ascii_case("device-width"sv)) return true; - if (name.equals_ignoring_case("grid"sv)) + if (name.equals_ignoring_ascii_case("grid"sv)) return true; - if (name.equals_ignoring_case("height"sv)) + if (name.equals_ignoring_ascii_case("height"sv)) return true; - if (name.equals_ignoring_case("hover"sv)) + if (name.equals_ignoring_ascii_case("hover"sv)) return true; - if (name.equals_ignoring_case("monochrome"sv)) + if (name.equals_ignoring_ascii_case("monochrome"sv)) return true; - if (name.equals_ignoring_case("orientation"sv)) + if (name.equals_ignoring_ascii_case("orientation"sv)) return true; - if (name.equals_ignoring_case("overflow-block"sv)) + if (name.equals_ignoring_ascii_case("overflow-block"sv)) return true; - if (name.equals_ignoring_case("overflow-inline"sv)) + if (name.equals_ignoring_ascii_case("overflow-inline"sv)) return true; - if (name.equals_ignoring_case("pointer"sv)) + if (name.equals_ignoring_ascii_case("pointer"sv)) return true; - if (name.equals_ignoring_case("resolution"sv)) + if (name.equals_ignoring_ascii_case("resolution"sv)) return true; - if (name.equals_ignoring_case("scan"sv)) + if (name.equals_ignoring_ascii_case("scan"sv)) return true; - if (name.equals_ignoring_case("update"sv)) + if (name.equals_ignoring_ascii_case("update"sv)) return true; - if (name.equals_ignoring_case("width"sv)) + if (name.equals_ignoring_ascii_case("width"sv)) return true; // MEDIAQUERIES-5 - https://www.w3.org/TR/mediaqueries-5/#media-descriptor-table - if (name.equals_ignoring_case("prefers-color-scheme"sv)) + if (name.equals_ignoring_ascii_case("prefers-color-scheme"sv)) return true; // FIXME: Add other level 5 feature names @@ -446,27 +446,27 @@ bool is_media_feature_name(StringView name) MediaQuery::MediaType media_type_from_string(StringView name) { - if (name.equals_ignoring_case("all"sv)) + if (name.equals_ignoring_ascii_case("all"sv)) return MediaQuery::MediaType::All; - if (name.equals_ignoring_case("aural"sv)) + if (name.equals_ignoring_ascii_case("aural"sv)) return MediaQuery::MediaType::Aural; - if (name.equals_ignoring_case("braille"sv)) + if (name.equals_ignoring_ascii_case("braille"sv)) return MediaQuery::MediaType::Braille; - if (name.equals_ignoring_case("embossed"sv)) + if (name.equals_ignoring_ascii_case("embossed"sv)) return MediaQuery::MediaType::Embossed; - if (name.equals_ignoring_case("handheld"sv)) + if (name.equals_ignoring_ascii_case("handheld"sv)) return MediaQuery::MediaType::Handheld; - if (name.equals_ignoring_case("print"sv)) + if (name.equals_ignoring_ascii_case("print"sv)) return MediaQuery::MediaType::Print; - if (name.equals_ignoring_case("projection"sv)) + if (name.equals_ignoring_ascii_case("projection"sv)) return MediaQuery::MediaType::Projection; - if (name.equals_ignoring_case("screen"sv)) + if (name.equals_ignoring_ascii_case("screen"sv)) return MediaQuery::MediaType::Screen; - if (name.equals_ignoring_case("speech"sv)) + if (name.equals_ignoring_ascii_case("speech"sv)) return MediaQuery::MediaType::Speech; - if (name.equals_ignoring_case("tty"sv)) + if (name.equals_ignoring_ascii_case("tty"sv)) return MediaQuery::MediaType::TTY; - if (name.equals_ignoring_case("tv"sv)) + if (name.equals_ignoring_ascii_case("tv"sv)) return MediaQuery::MediaType::TV; return MediaQuery::MediaType::Unknown; } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 0dafea1438a..55ac5ed0407 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -360,9 +360,9 @@ Parser::ParseErrorOr Parser::parse_attribute_simple_se auto const& case_sensitivity_part = attribute_tokens.next_token(); if (case_sensitivity_part.is(Token::Type::Ident)) { auto case_sensitivity = case_sensitivity_part.token().ident(); - if (case_sensitivity.equals_ignoring_case("i"sv)) { + if (case_sensitivity.equals_ignoring_ascii_case("i"sv)) { simple_selector.attribute().case_type = Selector::SimpleSelector::Attribute::CaseType::CaseInsensitiveMatch; - } else if (case_sensitivity.equals_ignoring_case("s"sv)) { + } else if (case_sensitivity.equals_ignoring_ascii_case("s"sv)) { simple_selector.attribute().case_type = Selector::SimpleSelector::Attribute::CaseType::CaseSensitiveMatch; } else { dbgln_if(CSS_PARSER_DEBUG, "Expected a \"i\" or \"s\" attribute selector case sensitivity identifier, got: '{}'", case_sensitivity_part.to_debug_string()); @@ -443,39 +443,39 @@ Parser::ParseErrorOr Parser::parse_pseudo_simple_selec }; }; - if (pseudo_name.equals_ignoring_case("active"sv)) + if (pseudo_name.equals_ignoring_ascii_case("active"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Active); - if (pseudo_name.equals_ignoring_case("checked"sv)) + if (pseudo_name.equals_ignoring_ascii_case("checked"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Checked); - if (pseudo_name.equals_ignoring_case("disabled"sv)) + if (pseudo_name.equals_ignoring_ascii_case("disabled"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Disabled); - if (pseudo_name.equals_ignoring_case("empty"sv)) + if (pseudo_name.equals_ignoring_ascii_case("empty"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Empty); - if (pseudo_name.equals_ignoring_case("enabled"sv)) + if (pseudo_name.equals_ignoring_ascii_case("enabled"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Enabled); - if (pseudo_name.equals_ignoring_case("first-child"sv)) + if (pseudo_name.equals_ignoring_ascii_case("first-child"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FirstChild); - if (pseudo_name.equals_ignoring_case("first-of-type"sv)) + if (pseudo_name.equals_ignoring_ascii_case("first-of-type"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FirstOfType); - if (pseudo_name.equals_ignoring_case("focus"sv)) + if (pseudo_name.equals_ignoring_ascii_case("focus"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Focus); - if (pseudo_name.equals_ignoring_case("focus-within"sv)) + if (pseudo_name.equals_ignoring_ascii_case("focus-within"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::FocusWithin); - if (pseudo_name.equals_ignoring_case("hover"sv)) + if (pseudo_name.equals_ignoring_ascii_case("hover"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Hover); - if (pseudo_name.equals_ignoring_case("last-child"sv)) + if (pseudo_name.equals_ignoring_ascii_case("last-child"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::LastChild); - if (pseudo_name.equals_ignoring_case("last-of-type"sv)) + if (pseudo_name.equals_ignoring_ascii_case("last-of-type"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::LastOfType); - if (pseudo_name.equals_ignoring_case("link"sv)) + if (pseudo_name.equals_ignoring_ascii_case("link"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Link); - if (pseudo_name.equals_ignoring_case("only-child"sv)) + if (pseudo_name.equals_ignoring_ascii_case("only-child"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::OnlyChild); - if (pseudo_name.equals_ignoring_case("only-of-type"sv)) + if (pseudo_name.equals_ignoring_ascii_case("only-of-type"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::OnlyOfType); - if (pseudo_name.equals_ignoring_case("root"sv)) + if (pseudo_name.equals_ignoring_ascii_case("root"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Root); - if (pseudo_name.equals_ignoring_case("visited"sv)) + if (pseudo_name.equals_ignoring_ascii_case("visited"sv)) return make_pseudo_class_selector(Selector::SimpleSelector::PseudoClass::Type::Visited); // Single-colon syntax allowed for ::after, ::before, ::first-letter and ::first-line for compatibility. @@ -523,7 +523,7 @@ Parser::ParseErrorOr Parser::parse_pseudo_simple_selec // Parse the `of ` syntax auto const& maybe_of = tokens.next_token(); - if (!(maybe_of.is(Token::Type::Ident) && maybe_of.token().ident().equals_ignoring_case("of"sv))) + if (!(maybe_of.is(Token::Type::Ident) && maybe_of.token().ident().equals_ignoring_ascii_case("of"sv))) return ParseError::SyntaxError; tokens.skip_whitespace(); @@ -543,8 +543,8 @@ Parser::ParseErrorOr Parser::parse_pseudo_simple_selec }; auto const& pseudo_function = pseudo_class_token.function(); - if (pseudo_function.name().equals_ignoring_case("is"sv) - || pseudo_function.name().equals_ignoring_case("where"sv)) { + if (pseudo_function.name().equals_ignoring_ascii_case("is"sv) + || pseudo_function.name().equals_ignoring_ascii_case("where"sv)) { auto function_token_stream = TokenStream(pseudo_function.values()); // NOTE: Because it's forgiving, even complete garbage will parse OK as an empty selector-list. auto argument_selector_list = MUST(parse_a_selector_list(function_token_stream, SelectorType::Standalone, SelectorParsingMode::Forgiving)); @@ -552,13 +552,13 @@ Parser::ParseErrorOr Parser::parse_pseudo_simple_selec return Selector::SimpleSelector { .type = Selector::SimpleSelector::Type::PseudoClass, .value = Selector::SimpleSelector::PseudoClass { - .type = pseudo_function.name().equals_ignoring_case("is"sv) + .type = pseudo_function.name().equals_ignoring_ascii_case("is"sv) ? Selector::SimpleSelector::PseudoClass::Type::Is : Selector::SimpleSelector::PseudoClass::Type::Where, .argument_selector_list = move(argument_selector_list) } }; } - if (pseudo_function.name().equals_ignoring_case("not"sv)) { + if (pseudo_function.name().equals_ignoring_ascii_case("not"sv)) { auto function_token_stream = TokenStream(pseudo_function.values()); auto not_selector = TRY(parse_a_selector_list(function_token_stream, SelectorType::Standalone)); @@ -569,7 +569,7 @@ Parser::ParseErrorOr Parser::parse_pseudo_simple_selec .argument_selector_list = move(not_selector) } }; } - if (pseudo_function.name().equals_ignoring_case("lang"sv)) { + if (pseudo_function.name().equals_ignoring_ascii_case("lang"sv)) { if (pseudo_function.values().is_empty()) { dbgln_if(CSS_PARSER_DEBUG, "Empty :lang() selector"); return ParseError::SyntaxError; @@ -584,13 +584,13 @@ Parser::ParseErrorOr Parser::parse_pseudo_simple_selec .languages = move(languages) } }; } - if (pseudo_function.name().equals_ignoring_case("nth-child"sv)) + if (pseudo_function.name().equals_ignoring_ascii_case("nth-child"sv)) return parse_nth_child_selector(Selector::SimpleSelector::PseudoClass::Type::NthChild, pseudo_function.values(), true); - if (pseudo_function.name().equals_ignoring_case("nth-last-child"sv)) + if (pseudo_function.name().equals_ignoring_ascii_case("nth-last-child"sv)) return parse_nth_child_selector(Selector::SimpleSelector::PseudoClass::Type::NthLastChild, pseudo_function.values(), true); - if (pseudo_function.name().equals_ignoring_case("nth-of-type"sv)) + if (pseudo_function.name().equals_ignoring_ascii_case("nth-of-type"sv)) return parse_nth_child_selector(Selector::SimpleSelector::PseudoClass::Type::NthOfType, pseudo_function.values(), false); - if (pseudo_function.name().equals_ignoring_case("nth-last-of-type"sv)) + if (pseudo_function.name().equals_ignoring_ascii_case("nth-last-of-type"sv)) return parse_nth_child_selector(Selector::SimpleSelector::PseudoClass::Type::NthLastOfType, pseudo_function.values(), false); dbgln_if(CSS_PARSER_DEBUG, "Unrecognized pseudo-class function: ':{}'()", pseudo_function.name()); @@ -720,11 +720,11 @@ NonnullRefPtr Parser::parse_media_query(TokenStream& return {}; auto ident = token.token().ident(); - if (ident.equals_ignoring_case("not"sv)) { + if (ident.equals_ignoring_ascii_case("not"sv)) { transaction.commit(); return true; } - if (ident.equals_ignoring_case("only"sv)) { + if (ident.equals_ignoring_ascii_case("only"sv)) { transaction.commit(); return false; } @@ -771,7 +771,7 @@ NonnullRefPtr Parser::parse_media_query(TokenStream& return media_query; // `[ and ]?` - if (auto maybe_and = tokens.next_token(); maybe_and.is(Token::Type::Ident) && maybe_and.token().ident().equals_ignoring_case("and"sv)) { + if (auto maybe_and = tokens.next_token(); maybe_and.is(Token::Type::Ident) && maybe_and.token().ident().equals_ignoring_ascii_case("and"sv)) { if (auto media_condition = parse_media_condition(tokens, MediaCondition::AllowOr::No)) { tokens.skip_whitespace(); if (tokens.has_next_token()) @@ -800,7 +800,7 @@ OwnPtr Parser::parse_media_condition(TokenStream tokens.skip_whitespace(); auto& first_token = tokens.next_token(); - if (first_token.is(Token::Type::Ident) && first_token.token().ident().equals_ignoring_case("not"sv)) { + if (first_token.is(Token::Type::Ident) && first_token.token().ident().equals_ignoring_ascii_case("not"sv)) { if (auto child_condition = parse_media_condition(tokens, MediaCondition::AllowOr::Yes)) { local_transaction.commit(); return MediaCondition::from_not(child_condition.release_nonnull()); @@ -815,7 +815,7 @@ OwnPtr Parser::parse_media_condition(TokenStream tokens.skip_whitespace(); auto& first = tokens.next_token(); - if (first.is(Token::Type::Ident) && first.token().ident().equals_ignoring_case(combinator)) { + if (first.is(Token::Type::Ident) && first.token().ident().equals_ignoring_ascii_case(combinator)) { tokens.skip_whitespace(); if (auto media_in_parens = parse_media_in_parens(tokens)) { local_transaction.commit(); @@ -1296,7 +1296,7 @@ OwnPtr Parser::parse_supports_condition(TokenStream` - if (peeked_token.is(Token::Type::Ident) && peeked_token.token().ident().equals_ignoring_case("not"sv)) { + if (peeked_token.is(Token::Type::Ident) && peeked_token.token().ident().equals_ignoring_ascii_case("not"sv)) { tokens.next_token(); tokens.skip_whitespace(); auto child = parse_supports_in_parens(tokens); @@ -1318,9 +1318,9 @@ OwnPtr Parser::parse_supports_condition(TokenStream Parser::parse_supports_feature(TokenStream` - if (first_token.is_function() && first_token.function().name().equals_ignoring_case("selector"sv)) { + if (first_token.is_function() && first_token.function().name().equals_ignoring_ascii_case("selector"sv)) { // FIXME: Parsing and then converting back to a string is weird. StringBuilder builder; for (auto const& item : first_token.function().values()) @@ -2291,7 +2291,7 @@ Optional Parser::parse_url_function(ComponentValue const& component_val auto url_string = component_value.token().url(); return convert_string_to_url(url_string); } - if (component_value.is_function() && component_value.function().name().equals_ignoring_case("url"sv)) { + if (component_value.is_function() && component_value.function().name().equals_ignoring_ascii_case("url"sv)) { auto const& function_values = component_value.function().values(); // FIXME: Handle url-modifiers. https://www.w3.org/TR/css-values-4/#url-modifiers for (size_t i = 0; i < function_values.size(); ++i) { @@ -2453,7 +2453,7 @@ RefPtr Parser::parse_linear_gradient_function(ComponentValue const& repeating_gradient = GradientRepeating::Yes; }); - if (!function_name.equals_ignoring_case("linear-gradient"sv)) + if (!function_name.equals_ignoring_ascii_case("linear-gradient"sv)) return {}; // linear-gradient() = linear-gradient([ | to ]?, ) @@ -2470,13 +2470,13 @@ RefPtr Parser::parse_linear_gradient_function(ComponentValue const& : SideOrCorner::Top; auto to_side = [](StringView value) -> Optional { - if (value.equals_ignoring_case("top"sv)) + if (value.equals_ignoring_ascii_case("top"sv)) return SideOrCorner::Top; - if (value.equals_ignoring_case("bottom"sv)) + if (value.equals_ignoring_ascii_case("bottom"sv)) return SideOrCorner::Bottom; - if (value.equals_ignoring_case("left"sv)) + if (value.equals_ignoring_ascii_case("left"sv)) return SideOrCorner::Left; - if (value.equals_ignoring_case("right"sv)) + if (value.equals_ignoring_ascii_case("right"sv)) return SideOrCorner::Right; return {}; }; @@ -2486,7 +2486,7 @@ RefPtr Parser::parse_linear_gradient_function(ComponentValue const& return false; if (gradient_type == GradientType::WebKit) return to_side(token.token().ident()).has_value(); - return token.token().ident().equals_ignoring_case("to"sv); + return token.token().ident().equals_ignoring_ascii_case("to"sv); }; auto const& first_param = tokens.peek_token(); @@ -2574,7 +2574,7 @@ RefPtr Parser::parse_conic_gradient_function(ComponentValue const& c repeating_gradient = GradientRepeating::Yes; }); - if (!function_name.equals_ignoring_case("conic-gradient"sv)) + if (!function_name.equals_ignoring_ascii_case("conic-gradient"sv)) return {}; TokenStream tokens { component_value.function().values() }; @@ -2595,7 +2595,7 @@ RefPtr Parser::parse_conic_gradient_function(ComponentValue const& c while (token.is(Token::Type::Ident)) { auto consume_identifier = [&](auto identifier) { auto token_string = token.token().ident(); - if (token_string.equals_ignoring_case(identifier)) { + if (token_string.equals_ignoring_ascii_case(identifier)) { (void)tokens.next_token(); tokens.skip_whitespace(); return true; @@ -2677,7 +2677,7 @@ RefPtr Parser::parse_radial_gradient_function(ComponentValue const& repeating_gradient = GradientRepeating::Yes; }); - if (!function_name.equals_ignoring_case("radial-gradient"sv)) + if (!function_name.equals_ignoring_ascii_case("radial-gradient"sv)) return {}; TokenStream tokens { component_value.function().values() }; @@ -2705,21 +2705,21 @@ RefPtr Parser::parse_radial_gradient_function(ComponentValue const& if (!token.is(Token::Type::Ident)) return {}; auto ident = token.token().ident(); - if (ident.equals_ignoring_case("circle"sv)) + if (ident.equals_ignoring_ascii_case("circle"sv)) return commit_value(EndingShape::Circle, transaction); - if (ident.equals_ignoring_case("ellipse"sv)) + if (ident.equals_ignoring_ascii_case("ellipse"sv)) return commit_value(EndingShape::Ellipse, transaction); return {}; }; auto parse_extent_keyword = [](StringView keyword) -> Optional { - if (keyword.equals_ignoring_case("closest-corner"sv)) + if (keyword.equals_ignoring_ascii_case("closest-corner"sv)) return Extent::ClosestCorner; - if (keyword.equals_ignoring_case("closest-side"sv)) + if (keyword.equals_ignoring_ascii_case("closest-side"sv)) return Extent::ClosestSide; - if (keyword.equals_ignoring_case("farthest-corner"sv)) + if (keyword.equals_ignoring_ascii_case("farthest-corner"sv)) return Extent::FarthestCorner; - if (keyword.equals_ignoring_case("farthest-side"sv)) + if (keyword.equals_ignoring_ascii_case("farthest-side"sv)) return Extent::FarthestSide; return {}; }; @@ -2786,7 +2786,7 @@ RefPtr Parser::parse_radial_gradient_function(ComponentValue const& return {}; auto& token = tokens.peek_token(); - if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_case("at"sv)) { + if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_ascii_case("at"sv)) { (void)tokens.next_token(); auto position = parse_position(tokens); if (!position.has_value()) @@ -2817,37 +2817,37 @@ Optional Parser::parse_position(TokenStream& toke return {}; auto parse_horizontal_preset = [&](auto ident) -> Optional { - if (ident.equals_ignoring_case("left"sv)) + if (ident.equals_ignoring_ascii_case("left"sv)) return PositionValue::HorizontalPreset::Left; - if (ident.equals_ignoring_case("center"sv)) + if (ident.equals_ignoring_ascii_case("center"sv)) return PositionValue::HorizontalPreset::Center; - if (ident.equals_ignoring_case("right"sv)) + if (ident.equals_ignoring_ascii_case("right"sv)) return PositionValue::HorizontalPreset::Right; return {}; }; auto parse_vertical_preset = [&](auto ident) -> Optional { - if (ident.equals_ignoring_case("top"sv)) + if (ident.equals_ignoring_ascii_case("top"sv)) return PositionValue::VerticalPreset::Top; - if (ident.equals_ignoring_case("center"sv)) + if (ident.equals_ignoring_ascii_case("center"sv)) return PositionValue::VerticalPreset::Center; - if (ident.equals_ignoring_case("bottom"sv)) + if (ident.equals_ignoring_ascii_case("bottom"sv)) return PositionValue::VerticalPreset::Bottom; return {}; }; auto parse_horizontal_edge = [&](auto ident) -> Optional { - if (ident.equals_ignoring_case("left"sv)) + if (ident.equals_ignoring_ascii_case("left"sv)) return PositionValue::HorizontalEdge::Left; - if (ident.equals_ignoring_case("right"sv)) + if (ident.equals_ignoring_ascii_case("right"sv)) return PositionValue::HorizontalEdge::Right; return {}; }; auto parse_vertical_edge = [&](auto ident) -> Optional { - if (ident.equals_ignoring_case("top"sv)) + if (ident.equals_ignoring_ascii_case("top"sv)) return PositionValue::VerticalEdge::Top; - if (ident.equals_ignoring_case("bottom"sv)) + if (ident.equals_ignoring_ascii_case("bottom"sv)) return PositionValue::VerticalEdge::Bottom; return {}; }; @@ -3028,7 +3028,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr rule) if (rule->is_at_rule()) { if (has_ignored_vendor_prefix(rule->at_rule_name())) return {}; - if (rule->at_rule_name().equals_ignoring_case("font-face"sv)) { + if (rule->at_rule_name().equals_ignoring_ascii_case("font-face"sv)) { if (!rule->block() || !rule->block()->is_curly()) { dbgln_if(CSS_PARSER_DEBUG, "@font-face rule is malformed."); return {}; @@ -3036,7 +3036,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr rule) TokenStream tokens { rule->block()->values() }; return parse_font_face_rule(tokens); } - if (rule->at_rule_name().equals_ignoring_case("import"sv) && !rule->prelude().is_empty()) { + if (rule->at_rule_name().equals_ignoring_ascii_case("import"sv) && !rule->prelude().is_empty()) { Optional url; for (auto const& token : rule->prelude()) { if (token.is(Token::Type::Whitespace)) @@ -3058,7 +3058,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr rule) dbgln_if(CSS_PARSER_DEBUG, "Unable to parse url from @import rule"); return {}; } - if (rule->at_rule_name().equals_ignoring_case("media"sv)) { + if (rule->at_rule_name().equals_ignoring_ascii_case("media"sv)) { auto media_query_tokens = TokenStream { rule->prelude() }; auto media_query_list = parse_a_media_query_list(media_query_tokens); if (media_query_list.is_empty() || !rule->block()) @@ -3075,7 +3075,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr rule) auto rule_list = CSSRuleList::create(m_context.realm(), child_rules).release_value_but_fixme_should_propagate_errors(); return CSSMediaRule::create(m_context.realm(), media_list, rule_list).release_value_but_fixme_should_propagate_errors(); } - if (rule->at_rule_name().equals_ignoring_case("supports"sv)) { + if (rule->at_rule_name().equals_ignoring_ascii_case("supports"sv)) { auto supports_tokens = TokenStream { rule->prelude() }; auto supports = parse_a_supports(supports_tokens); if (!supports) { @@ -3205,11 +3205,11 @@ RefPtr Parser::parse_builtin_value(ComponentValue const& component_v { if (component_value.is(Token::Type::Ident)) { auto ident = component_value.token().ident(); - if (ident.equals_ignoring_case("inherit"sv)) + if (ident.equals_ignoring_ascii_case("inherit"sv)) return InheritStyleValue::the(); - if (ident.equals_ignoring_case("initial"sv)) + if (ident.equals_ignoring_ascii_case("initial"sv)) return InitialStyleValue::the(); - if (ident.equals_ignoring_case("unset"sv)) + if (ident.equals_ignoring_ascii_case("unset"sv)) return UnsetStyleValue::the(); // FIXME: Implement `revert` and `revert-layer` keywords, from Cascade4 and Cascade5 respectively } @@ -3258,10 +3258,10 @@ RefPtr Parser::parse_dynamic_value(ComponentValue const& component_v if (component_value.is_function()) { auto const& function = component_value.function(); - if (function.name().equals_ignoring_case("calc"sv)) + if (function.name().equals_ignoring_ascii_case("calc"sv)) return parse_calculated_value(function.values()); - if (function.name().equals_ignoring_case("var"sv)) { + if (function.name().equals_ignoring_ascii_case("var"sv)) { // Declarations using `var()` should already be parsed as an UnresolvedStyleValue before this point. VERIFY_NOT_REACHED(); } @@ -3321,7 +3321,7 @@ Optional Parser::parse_length(ComponentValue const& component_value) return dimension->length(); // FIXME: auto isn't a length! - if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto"sv)) + if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_ascii_case("auto"sv)) return Length::make_auto(); return {}; @@ -3414,7 +3414,7 @@ Optional Parser::parse_unicode_range(TokenStream& // All options start with 'u'/'U'. auto const& u = tokens.next_token(); - if (!(u.is(Token::Type::Ident) && u.token().ident().equals_ignoring_case("u"sv))) { + if (!(u.is(Token::Type::Ident) && u.token().ident().equals_ignoring_ascii_case("u"sv))) { dbgln_if(CSS_PARSER_DEBUG, "CSSParser: does not start with 'u'"); return {}; } @@ -3628,7 +3628,7 @@ RefPtr Parser::parse_dimension_value(ComponentValue const& component if (component_value.is(Token::Type::Number) && !(m_context.in_quirks_mode() && property_has_quirk(m_context.current_property_id(), Quirk::UnitlessLength))) return {}; - if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto"sv)) + if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_ascii_case("auto"sv)) return LengthStyleValue::create(Length::make_auto()); auto dimension = parse_dimension(component_value); @@ -3728,8 +3728,8 @@ Optional Parser::parse_rgb_or_hsl_color(StringView function_name, Vector< if (tokens.has_next_token()) return {}; - if (function_name.equals_ignoring_case("rgb"sv) - || function_name.equals_ignoring_case("rgba"sv)) { + if (function_name.equals_ignoring_ascii_case("rgb"sv) + || function_name.equals_ignoring_ascii_case("rgba"sv)) { // https://www.w3.org/TR/css-color-4/#rgb-functions @@ -3760,8 +3760,8 @@ Optional Parser::parse_rgb_or_hsl_color(StringView function_name, Vector< return Color(r_val, g_val, b_val, a_val); } - } else if (function_name.equals_ignoring_case("hsl"sv) - || function_name.equals_ignoring_case("hsla"sv)) { + } else if (function_name.equals_ignoring_ascii_case("hsl"sv) + || function_name.equals_ignoring_ascii_case("hsla"sv)) { // https://www.w3.org/TR/css-color-4/#the-hsl-notation @@ -3812,7 +3812,7 @@ RefPtr Parser::parse_rect_value(ComponentValue const& component_valu if (!component_value.is_function()) return {}; auto const& function = component_value.function(); - if (!function.name().equals_ignoring_case("rect"sv)) + if (!function.name().equals_ignoring_ascii_case("rect"sv)) return {}; Vector params; @@ -3842,7 +3842,7 @@ RefPtr Parser::parse_rect_value(ComponentValue const& component_valu // , , , and may either have a value or 'auto'. // Negative lengths are permitted. auto current_token = tokens.next_token().token(); - if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("auto"sv)) { + if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto"sv)) { params.append(Length::make_auto()); } else { auto maybe_length = parse_length(current_token); @@ -4732,7 +4732,7 @@ RefPtr Parser::parse_single_shadow_value(TokenStream } if (allow_inset_keyword == AllowInsetKeyword::Yes - && token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_case("inset"sv)) { + && token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_ascii_case("inset"sv)) { if (placement.has_value()) return nullptr; placement = ShadowPlacement::Inner; @@ -4870,25 +4870,25 @@ RefPtr Parser::parse_filter_value_list_value(Vector }; auto parse_filter_function_name = [&](auto name) -> Optional { - if (name.equals_ignoring_case("blur"sv)) + if (name.equals_ignoring_ascii_case("blur"sv)) return FilterToken::Blur; - if (name.equals_ignoring_case("brightness"sv)) + if (name.equals_ignoring_ascii_case("brightness"sv)) return FilterToken::Brightness; - if (name.equals_ignoring_case("contrast"sv)) + if (name.equals_ignoring_ascii_case("contrast"sv)) return FilterToken::Contrast; - if (name.equals_ignoring_case("drop-shadow"sv)) + if (name.equals_ignoring_ascii_case("drop-shadow"sv)) return FilterToken::DropShadow; - if (name.equals_ignoring_case("grayscale"sv)) + if (name.equals_ignoring_ascii_case("grayscale"sv)) return FilterToken::Grayscale; - if (name.equals_ignoring_case("hue-rotate"sv)) + if (name.equals_ignoring_ascii_case("hue-rotate"sv)) return FilterToken::HueRotate; - if (name.equals_ignoring_case("invert"sv)) + if (name.equals_ignoring_ascii_case("invert"sv)) return FilterToken::Invert; - if (name.equals_ignoring_case("opacity"sv)) + if (name.equals_ignoring_ascii_case("opacity"sv)) return FilterToken::Opacity; - if (name.equals_ignoring_case("saturate"sv)) + if (name.equals_ignoring_ascii_case("saturate"sv)) return FilterToken::Saturate; - if (name.equals_ignoring_case("sepia"sv)) + if (name.equals_ignoring_ascii_case("sepia"sv)) return FilterToken::Sepia; return {}; }; @@ -5323,7 +5323,7 @@ CSSRule* Parser::parse_font_face_rule(TokenStream& tokens) } auto const& declaration = declaration_or_at_rule.declaration(); - if (declaration.name().equals_ignoring_case("font-family"sv)) { + if (declaration.name().equals_ignoring_ascii_case("font-family"sv)) { // FIXME: This is very similar to, but different from, the logic in parse_font_family_value(). // Ideally they could share code. Vector font_family_parts; @@ -5367,14 +5367,14 @@ CSSRule* Parser::parse_font_face_rule(TokenStream& tokens) font_family = String::join(' ', font_family_parts).release_value_but_fixme_should_propagate_errors(); continue; } - if (declaration.name().equals_ignoring_case("src"sv)) { + if (declaration.name().equals_ignoring_ascii_case("src"sv)) { TokenStream token_stream { declaration.values() }; Vector supported_sources = parse_font_face_src(token_stream); if (!supported_sources.is_empty()) src = move(supported_sources); continue; } - if (declaration.name().equals_ignoring_case("unicode-range"sv)) { + if (declaration.name().equals_ignoring_ascii_case("unicode-range"sv)) { Vector unicode_ranges; bool unicode_range_invalid = false; TokenStream all_tokens { declaration.values() }; @@ -5418,7 +5418,7 @@ Vector Parser::parse_font_face_src(TokenStream // Format-name table: https://www.w3.org/TR/css-fonts-4/#font-format-definitions auto font_format_is_supported = [](StringView name) { // The spec requires us to treat opentype and truetype as synonymous. - if (name.is_one_of_ignoring_case("opentype"sv, "truetype"sv, "woff"sv)) + if (name.is_one_of_ignoring_ascii_case("opentype"sv, "truetype"sv, "woff"sv)) return true; return false; }; @@ -5450,7 +5450,7 @@ Vector Parser::parse_font_face_src(TokenStream } auto const& function = maybe_function.function(); - if (function.name().equals_ignoring_case("format"sv)) { + if (function.name().equals_ignoring_ascii_case("format"sv)) { TokenStream format_tokens { function.values() }; format_tokens.skip_whitespace(); auto const& format_name_token = format_tokens.next_token(); @@ -5700,7 +5700,7 @@ RefPtr Parser::parse_transform_value(Vector const& c tokens.skip_whitespace(); auto const& part = tokens.next_token(); - if (part.is(Token::Type::Ident) && part.token().ident().equals_ignoring_case("none"sv)) { + if (part.is(Token::Type::Ident) && part.token().ident().equals_ignoring_ascii_case("none"sv)) { if (!transformations.is_empty()) return nullptr; tokens.skip_whitespace(); @@ -5950,16 +5950,16 @@ Optional Parser::parse_grid_size(ComponentValue const& component_ if (component_value.is_function()) return {}; auto token = component_value.token(); - if (token.is(Token::Type::Dimension) && token.dimension_unit().equals_ignoring_case("fr"sv)) { + if (token.is(Token::Type::Dimension) && token.dimension_unit().equals_ignoring_ascii_case("fr"sv)) { float numeric_value = token.dimension_value(); if (numeric_value) return GridSize(numeric_value); } - if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("auto"sv)) + if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("auto"sv)) return GridSize::make_auto(); - if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("max-content"sv)) + if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("max-content"sv)) return GridSize(GridSize::Type::MaxContent); - if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("min-content"sv)) + if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("min-content"sv)) return GridSize(GridSize::Type::MinContent); auto dimension = parse_dimension(token); if (!dimension.has_value()) @@ -6029,9 +6029,9 @@ Optional Parser::parse_repeat(Vector const& com auto repeat_count = 0; if (current_token.is(Token::Type::Number) && current_token.number().is_integer() && current_token.number_value() > 0) repeat_count = current_token.number_value(); - else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("auto-fill"sv)) + else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto-fill"sv)) is_auto_fill = true; - else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_case("auto-fit"sv)) + else if (current_token.is(Token::Type::Ident) && current_token.ident().equals_ignoring_ascii_case("auto-fit"sv)) is_auto_fit = true; // The second argument is a track list, which is repeated that number of times. @@ -6113,13 +6113,13 @@ Optional Parser::parse_track_sizing_function(ComponentVa { if (token.is_function()) { auto const& function_token = token.function(); - if (function_token.name().equals_ignoring_case("repeat"sv)) { + if (function_token.name().equals_ignoring_ascii_case("repeat"sv)) { auto maybe_repeat = parse_repeat(function_token.values()); if (maybe_repeat.has_value()) return CSS::ExplicitGridTrack(maybe_repeat.value()); else return {}; - } else if (function_token.name().equals_ignoring_case("minmax"sv)) { + } else if (function_token.name().equals_ignoring_ascii_case("minmax"sv)) { auto maybe_min_max_value = parse_min_max(function_token.values()); if (maybe_min_max_value.has_value()) return CSS::ExplicitGridTrack(maybe_min_max_value.value()); @@ -6127,7 +6127,7 @@ Optional Parser::parse_track_sizing_function(ComponentVa return {}; } return {}; - } else if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_case("auto"sv)) { + } else if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_ascii_case("auto"sv)) { return CSS::ExplicitGridTrack(GridSize(Length::make_auto())); } else if (token.is_block()) { return {}; @@ -6189,12 +6189,12 @@ RefPtr Parser::parse_grid_track_placement(Vector con // [ && ? ] | // [ span && [ || ] ] auto is_auto = [](Token token) -> bool { - if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("auto"sv)) + if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("auto"sv)) return true; return false; }; auto is_span = [](Token token) -> bool { - if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_case("span"sv)) + if (token.is(Token::Type::Ident) && token.ident().equals_ignoring_ascii_case("span"sv)) return true; return false; }; @@ -6206,7 +6206,7 @@ RefPtr Parser::parse_grid_track_placement(Vector con }; auto is_line_name = [](Token token) -> bool { // The additionally excludes the keywords span and auto. - if (token.is(Token::Type::Ident) && !token.ident().equals_ignoring_case("span"sv) && !token.ident().equals_ignoring_case("auto"sv)) + if (token.is(Token::Type::Ident) && !token.ident().equals_ignoring_ascii_case("span"sv) && !token.ident().equals_ignoring_ascii_case("auto"sv)) return true; return false; }; @@ -6410,7 +6410,7 @@ RefPtr Parser::parse_grid_template_areas_value(Vector> Parser::parse_css_value(PropertyID property_id, TokenStream& tokens) { auto function_contains_var_or_attr = [](Function const& function, auto&& recurse) -> bool { - if (function.name().equals_ignoring_case("var"sv) || function.name().equals_ignoring_case("attr"sv)) + if (function.name().equals_ignoring_ascii_case("var"sv) || function.name().equals_ignoring_ascii_case("attr"sv)) return true; for (auto const& token : function.values()) { if (token.is_function() && recurse(token.function(), recurse)) @@ -6685,16 +6685,16 @@ Optional Parser::parse_a_n_plus_b_patt }; auto is_n = [](ComponentValue const& value) -> bool { - return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("n"sv); + return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_ascii_case("n"sv); }; auto is_ndash = [](ComponentValue const& value) -> bool { - return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("n-"sv); + return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_ascii_case("n-"sv); }; auto is_dashn = [](ComponentValue const& value) -> bool { - return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("-n"sv); + return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_ascii_case("-n"sv); }; auto is_dashndash = [](ComponentValue const& value) -> bool { - return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_case("-n-"sv); + return value.is(Token::Type::Ident) && value.token().ident().equals_ignoring_ascii_case("-n-"sv); }; auto is_delim = [](ComponentValue const& value, u32 delim) -> bool { return value.is(Token::Type::Delim) && value.token().delim() == delim; @@ -6707,7 +6707,7 @@ Optional Parser::parse_a_n_plus_b_patt return false; if (!value.token().number().is_integer()) return false; - if (!value.token().dimension_unit().equals_ignoring_case("n"sv)) + if (!value.token().dimension_unit().equals_ignoring_ascii_case("n"sv)) return false; return true; }; @@ -6716,7 +6716,7 @@ Optional Parser::parse_a_n_plus_b_patt return false; if (!value.token().number().is_integer()) return false; - if (!value.token().dimension_unit().equals_ignoring_case("n-"sv)) + if (!value.token().dimension_unit().equals_ignoring_ascii_case("n-"sv)) return false; return true; }; @@ -6779,11 +6779,11 @@ Optional Parser::parse_a_n_plus_b_patt // odd | even if (first_value.is(Token::Type::Ident)) { auto ident = first_value.token().ident(); - if (ident.equals_ignoring_case("odd"sv)) { + if (ident.equals_ignoring_ascii_case("odd"sv)) { transaction.commit(); return Selector::SimpleSelector::ANPlusBPattern { 2, 1 }; } - if (ident.equals_ignoring_case("even"sv)) { + if (ident.equals_ignoring_ascii_case("even"sv)) { transaction.commit(); return Selector::SimpleSelector::ANPlusBPattern { 2, 0 }; } @@ -7263,9 +7263,9 @@ bool Parser::has_ignored_vendor_prefix(StringView string) bool Parser::is_builtin(StringView name) { - return name.equals_ignoring_case("inherit"sv) - || name.equals_ignoring_case("initial"sv) - || name.equals_ignoring_case("unset"sv); + return name.equals_ignoring_ascii_case("inherit"sv) + || name.equals_ignoring_ascii_case("initial"sv) + || name.equals_ignoring_ascii_case("unset"sv); } RefPtr Parser::parse_calculated_value(Badge, ParsingContext const& context, Vector const& tokens) diff --git a/Userland/Libraries/LibWeb/CSS/PreferredColorScheme.cpp b/Userland/Libraries/LibWeb/CSS/PreferredColorScheme.cpp index 9efb8a64cb5..5c4c94b34a1 100644 --- a/Userland/Libraries/LibWeb/CSS/PreferredColorScheme.cpp +++ b/Userland/Libraries/LibWeb/CSS/PreferredColorScheme.cpp @@ -10,9 +10,9 @@ namespace Web::CSS { PreferredColorScheme preferred_color_scheme_from_string(StringView value) { - if (value.equals_ignoring_case("light"sv)) + if (value.equals_ignoring_ascii_case("light"sv)) return PreferredColorScheme::Light; - if (value.equals_ignoring_case("dark"sv)) + if (value.equals_ignoring_ascii_case("dark"sv)) return PreferredColorScheme::Dark; return PreferredColorScheme::Auto; } diff --git a/Userland/Libraries/LibWeb/CSS/Resolution.cpp b/Userland/Libraries/LibWeb/CSS/Resolution.cpp index 8c23bc46db7..8963ad4b7e3 100644 --- a/Userland/Libraries/LibWeb/CSS/Resolution.cpp +++ b/Userland/Libraries/LibWeb/CSS/Resolution.cpp @@ -54,11 +54,11 @@ StringView Resolution::unit_name() const Optional Resolution::unit_from_name(StringView name) { - if (name.equals_ignoring_case("dpi"sv)) { + if (name.equals_ignoring_ascii_case("dpi"sv)) { return Type::Dpi; - } else if (name.equals_ignoring_case("dpcm"sv)) { + } else if (name.equals_ignoring_ascii_case("dpcm"sv)) { return Type::Dpcm; - } else if (name.equals_ignoring_case("dppx"sv)) { + } else if (name.equals_ignoring_ascii_case("dppx"sv)) { return Type::Dppx; } return {}; diff --git a/Userland/Libraries/LibWeb/CSS/Selector.cpp b/Userland/Libraries/LibWeb/CSS/Selector.cpp index d0f21139b59..25c13c9ac14 100644 --- a/Userland/Libraries/LibWeb/CSS/Selector.cpp +++ b/Userland/Libraries/LibWeb/CSS/Selector.cpp @@ -345,21 +345,21 @@ ErrorOr serialize_a_group_of_selectors(Vector> c Optional pseudo_element_from_string(StringView name) { - if (name.equals_ignoring_case("after"sv)) { + if (name.equals_ignoring_ascii_case("after"sv)) { return Selector::PseudoElement::After; - } else if (name.equals_ignoring_case("before"sv)) { + } else if (name.equals_ignoring_ascii_case("before"sv)) { return Selector::PseudoElement::Before; - } else if (name.equals_ignoring_case("first-letter"sv)) { + } else if (name.equals_ignoring_ascii_case("first-letter"sv)) { return Selector::PseudoElement::FirstLetter; - } else if (name.equals_ignoring_case("first-line"sv)) { + } else if (name.equals_ignoring_ascii_case("first-line"sv)) { return Selector::PseudoElement::FirstLine; - } else if (name.equals_ignoring_case("marker"sv)) { + } else if (name.equals_ignoring_ascii_case("marker"sv)) { return Selector::PseudoElement::Marker; - } else if (name.equals_ignoring_case("-webkit-progress-bar"sv)) { + } else if (name.equals_ignoring_ascii_case("-webkit-progress-bar"sv)) { return Selector::PseudoElement::ProgressBar; - } else if (name.equals_ignoring_case("-webkit-progress-value"sv)) { + } else if (name.equals_ignoring_ascii_case("-webkit-progress-value"sv)) { return Selector::PseudoElement::ProgressValue; - } else if (name.equals_ignoring_case("placeholder"sv)) { + } else if (name.equals_ignoring_ascii_case("placeholder"sv)) { return Selector::PseudoElement::Placeholder; } return {}; diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 41aa85a22a4..bac89b5606b 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -618,7 +618,7 @@ bool StyleComputer::expand_variables(DOM::Element& element, StringView property_ dest.empend(value); continue; } - if (!value.function().name().equals_ignoring_case("var"sv)) { + if (!value.function().name().equals_ignoring_ascii_case("var"sv)) { auto const& source_function = value.function(); Vector function_values; Parser::TokenStream source_function_contents { source_function.values() }; @@ -683,7 +683,7 @@ bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView p while (source.has_next_token()) { auto const& value = source.next_token(); if (value.is_function()) { - if (value.function().name().equals_ignoring_case("attr"sv)) { + if (value.function().name().equals_ignoring_ascii_case("attr"sv)) { // https://drafts.csswg.org/css-values-5/#attr-substitution Parser::TokenStream attr_contents { value.function().values() }; attr_contents.skip_whitespace(); @@ -720,7 +720,7 @@ bool StyleComputer::expand_unresolved_values(DOM::Element& element, StringView p return false; } - if (value.function().name().equals_ignoring_case("calc"sv)) { + if (value.function().name().equals_ignoring_ascii_case("calc"sv)) { auto const& calc_function = value.function(); if (auto calc_value = CSS::Parser::Parser::parse_calculated_value({}, Parser::ParsingContext { document() }, calc_function.values())) { switch (calc_value->resolved_type()) { diff --git a/Userland/Libraries/LibWeb/CSS/Time.cpp b/Userland/Libraries/LibWeb/CSS/Time.cpp index 55f9c38262d..d6eddaf5ecc 100644 --- a/Userland/Libraries/LibWeb/CSS/Time.cpp +++ b/Userland/Libraries/LibWeb/CSS/Time.cpp @@ -75,9 +75,9 @@ StringView Time::unit_name() const Optional Time::unit_from_name(StringView name) { - if (name.equals_ignoring_case("s"sv)) { + if (name.equals_ignoring_ascii_case("s"sv)) { return Type::S; - } else if (name.equals_ignoring_case("ms"sv)) { + } else if (name.equals_ignoring_ascii_case("ms"sv)) { return Type::Ms; } return {}; diff --git a/Userland/Libraries/LibWeb/Cookie/Cookie.cpp b/Userland/Libraries/LibWeb/Cookie/Cookie.cpp index bbef4fb5c68..3d4305f6ca4 100644 --- a/Userland/Libraries/LibWeb/Cookie/Cookie.cpp +++ b/Userland/Libraries/LibWeb/Cookie/Cookie.cpp @@ -50,11 +50,11 @@ StringView same_site_to_string(SameSite same_site) SameSite same_site_from_string(StringView same_site_mode) { - if (same_site_mode.equals_ignoring_case("None"sv)) + if (same_site_mode.equals_ignoring_ascii_case("None"sv)) return SameSite::None; - if (same_site_mode.equals_ignoring_case("Strict"sv)) + if (same_site_mode.equals_ignoring_ascii_case("Strict"sv)) return SameSite::Strict; - if (same_site_mode.equals_ignoring_case("Lax"sv)) + if (same_site_mode.equals_ignoring_ascii_case("Lax"sv)) return SameSite::Lax; return SameSite::Default; } diff --git a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp index 0d6102b114a..ee61556e822 100644 --- a/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp +++ b/Userland/Libraries/LibWeb/Cookie/ParsedCookie.cpp @@ -133,19 +133,19 @@ void parse_attributes(ParsedCookie& parsed_cookie, StringView unparsed_attribute void process_attribute(ParsedCookie& parsed_cookie, StringView attribute_name, StringView attribute_value) { - if (attribute_name.equals_ignoring_case("Expires"sv)) { + if (attribute_name.equals_ignoring_ascii_case("Expires"sv)) { on_expires_attribute(parsed_cookie, attribute_value); - } else if (attribute_name.equals_ignoring_case("Max-Age"sv)) { + } else if (attribute_name.equals_ignoring_ascii_case("Max-Age"sv)) { on_max_age_attribute(parsed_cookie, attribute_value); - } else if (attribute_name.equals_ignoring_case("Domain"sv)) { + } else if (attribute_name.equals_ignoring_ascii_case("Domain"sv)) { on_domain_attribute(parsed_cookie, attribute_value); - } else if (attribute_name.equals_ignoring_case("Path"sv)) { + } else if (attribute_name.equals_ignoring_ascii_case("Path"sv)) { on_path_attribute(parsed_cookie, attribute_value); - } else if (attribute_name.equals_ignoring_case("Secure"sv)) { + } else if (attribute_name.equals_ignoring_ascii_case("Secure"sv)) { on_secure_attribute(parsed_cookie); - } else if (attribute_name.equals_ignoring_case("HttpOnly"sv)) { + } else if (attribute_name.equals_ignoring_ascii_case("HttpOnly"sv)) { on_http_only_attribute(parsed_cookie); - } else if (attribute_name.equals_ignoring_case("SameSite"sv)) { + } else if (attribute_name.equals_ignoring_ascii_case("SameSite"sv)) { on_same_site_attribute(parsed_cookie, attribute_value); } } @@ -279,7 +279,7 @@ Optional