mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
This commit is contained in:
parent
03cc45e5a2
commit
a504ac3e2a
Notes:
sideshowbarker
2024-07-17 18:13:59 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a504ac3e2a
76 changed files with 480 additions and 476 deletions
|
@ -107,9 +107,9 @@ Optional<float> 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
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
Optional<float> 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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<typename... Ts>
|
||||
[[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<Ts>(strings.view()));
|
||||
return this->equals_ignoring_ascii_case(forward<Ts>(strings.view()));
|
||||
else
|
||||
return this->equals_ignoring_case(forward<Ts>(strings));
|
||||
return this->equals_ignoring_ascii_case(forward<Ts>(strings));
|
||||
}());
|
||||
}
|
||||
|
||||
|
@ -330,9 +330,10 @@ struct Traits<DeprecatedString> : public GenericTraits<DeprecatedString> {
|
|||
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<DeprecatedString> {
|
||||
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);
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ template Optional<double> convert_to_floating_point(StringView str, TrimWhitespa
|
|||
template Optional<float> 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;
|
||||
|
|
|
@ -79,7 +79,7 @@ Optional<T> convert_to_uint_from_octal(StringView, TrimWhitespace = TrimWhitespa
|
|||
template<typename T>
|
||||
Optional<T> 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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<typename... Ts>
|
||||
[[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<Ts>(strings.view()));
|
||||
return this->equals_ignoring_ascii_case(forward<Ts>(strings.view()));
|
||||
else
|
||||
return this->equals_ignoring_case(forward<Ts>(strings));
|
||||
return this->equals_ignoring_ascii_case(forward<Ts>(strings));
|
||||
}());
|
||||
}
|
||||
|
||||
|
@ -359,6 +359,7 @@ struct Traits<StringView> : public GenericTraits<StringView> {
|
|||
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<StringView> {
|
||||
static unsigned hash(StringView s)
|
||||
{
|
||||
|
@ -366,7 +367,7 @@ struct CaseInsensitiveStringViewTraits : public Traits<StringView> {
|
|||
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); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,7 +24,7 @@ void RequestManagerQt::reply_finished(QNetworkReply* reply)
|
|||
|
||||
RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(DeprecatedString const& method, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> 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<NonnullRefPtr<RequestManagerQt::Request>> 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<QList<QNetworkCookie>>();
|
||||
|
|
|
@ -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@;
|
||||
)~~~");
|
||||
});
|
||||
|
|
|
@ -121,7 +121,7 @@ Optional<TransformFunction> 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@;
|
||||
)~~~");
|
||||
});
|
||||
|
|
|
@ -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<u32>& 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::Alternative> 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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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 {};
|
||||
|
|
|
@ -10,39 +10,39 @@ namespace CMake {
|
|||
|
||||
Optional<ControlKeywordType> 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 {};
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -249,11 +249,11 @@ Optional<Color> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -197,7 +197,7 @@ NonnullRefPtr<Type const> 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;
|
||||
|
|
|
@ -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<DeprecatedString>();
|
||||
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<DeprecatedString>();
|
||||
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
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -245,9 +245,9 @@ Optional<bool> Value::to_bool() const
|
|||
|
||||
return m_value->visit(
|
||||
[](DeprecatedString const& value) -> Optional<bool> {
|
||||
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 {};
|
||||
},
|
||||
|
|
|
@ -34,29 +34,29 @@ Optional<Decoder&> 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<StringView> 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);
|
||||
|
|
|
@ -154,7 +154,7 @@ ReadonlySpan<StringView> __attribute__((weak)) all_time_zones()
|
|||
Optional<TimeZone> __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 {};
|
||||
|
|
|
@ -30,10 +30,10 @@ Optional<Role> 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)) \
|
||||
if (role_name.equals_ignoring_ascii_case("switch"sv)) \
|
||||
return Role::switch_; \
|
||||
} else { \
|
||||
if (role_name.equals_ignoring_case(#name##sv)) \
|
||||
if (role_name.equals_ignoring_ascii_case(#name##sv)) \
|
||||
return Role::name; \
|
||||
}
|
||||
ENUMERATE_ARIA_ROLES
|
||||
|
|
|
@ -84,13 +84,16 @@ StringView Angle::unit_name() const
|
|||
|
||||
Optional<Angle::Type> 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 {};
|
||||
|
|
|
@ -75,9 +75,9 @@ StringView Frequency::unit_name() const
|
|||
|
||||
Optional<Frequency::Type> 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 {};
|
||||
|
|
|
@ -164,35 +164,35 @@ char const* Length::unit_name() const
|
|||
|
||||
Optional<Length::Type> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -393,51 +393,51 @@ ErrorOr<String> serialize_a_media_query_list(Vector<NonnullRefPtr<MediaQuery>> 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;
|
||||
}
|
||||
|
|
|
@ -360,9 +360,9 @@ Parser::ParseErrorOr<Selector::SimpleSelector> 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<Selector::SimpleSelector> 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<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
|
|||
|
||||
// Parse the `of <selector-list>` 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<Selector::SimpleSelector> 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<Selector::SimpleSelector> 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<Selector::SimpleSelector> 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<Selector::SimpleSelector> 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<MediaQuery> Parser::parse_media_query(TokenStream<ComponentValue>&
|
|||
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<MediaQuery> Parser::parse_media_query(TokenStream<ComponentValue>&
|
|||
return media_query;
|
||||
|
||||
// `[ and <media-condition-without-or> ]?`
|
||||
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<MediaCondition> Parser::parse_media_condition(TokenStream<ComponentValue>
|
|||
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<MediaCondition> Parser::parse_media_condition(TokenStream<ComponentValue>
|
|||
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<Supports::Condition> Parser::parse_supports_condition(TokenStream<Compone
|
|||
|
||||
auto const& peeked_token = tokens.peek_token();
|
||||
// `not <supports-in-parens>`
|
||||
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<Supports::Condition> Parser::parse_supports_condition(TokenStream<Compone
|
|||
if (!token.is(Token::Type::Ident))
|
||||
return {};
|
||||
auto ident = token.token().ident();
|
||||
if (ident.equals_ignoring_case("and"sv))
|
||||
if (ident.equals_ignoring_ascii_case("and"sv))
|
||||
return Supports::Condition::Type::And;
|
||||
if (ident.equals_ignoring_case("or"sv))
|
||||
if (ident.equals_ignoring_ascii_case("or"sv))
|
||||
return Supports::Condition::Type::Or;
|
||||
return {};
|
||||
};
|
||||
|
@ -1415,7 +1415,7 @@ Optional<Supports::Feature> Parser::parse_supports_feature(TokenStream<Component
|
|||
}
|
||||
|
||||
// `<supports-selector-fn>`
|
||||
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<AK::URL> 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<StyleValue> 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([ <angle> | to <side-or-corner> ]?, <color-stop-list>)
|
||||
|
@ -2470,13 +2470,13 @@ RefPtr<StyleValue> Parser::parse_linear_gradient_function(ComponentValue const&
|
|||
: SideOrCorner::Top;
|
||||
|
||||
auto to_side = [](StringView value) -> Optional<SideOrCorner> {
|
||||
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<StyleValue> 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<StyleValue> 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<StyleValue> 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<StyleValue> 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<StyleValue> 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<Extent> {
|
||||
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<StyleValue> 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<PositionValue> Parser::parse_position(TokenStream<ComponentValue>& toke
|
|||
return {};
|
||||
|
||||
auto parse_horizontal_preset = [&](auto ident) -> Optional<PositionValue::HorizontalPreset> {
|
||||
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<PositionValue::VerticalPreset> {
|
||||
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<PositionValue::HorizontalEdge> {
|
||||
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<PositionValue::VerticalEdge> {
|
||||
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> 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> 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<AK::URL> url;
|
||||
for (auto const& token : rule->prelude()) {
|
||||
if (token.is(Token::Type::Whitespace))
|
||||
|
@ -3058,7 +3058,7 @@ CSSRule* Parser::convert_to_rule(NonnullRefPtr<Rule> 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> 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<StyleValue> 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<StyleValue> 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<Length> 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<UnicodeRange> Parser::parse_unicode_range(TokenStream<ComponentValue>&
|
|||
|
||||
// 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: <urange> does not start with 'u'");
|
||||
return {};
|
||||
}
|
||||
|
@ -3628,7 +3628,7 @@ RefPtr<StyleValue> 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<Color> 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<Color> 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<StyleValue> 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<Length, 4> params;
|
||||
|
@ -3842,7 +3842,7 @@ RefPtr<StyleValue> Parser::parse_rect_value(ComponentValue const& component_valu
|
|||
// <top>, <right>, <bottom>, and <left> may either have a <length> 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<StyleValue> Parser::parse_single_shadow_value(TokenStream<ComponentValue>
|
|||
}
|
||||
|
||||
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<StyleValue> Parser::parse_filter_value_list_value(Vector<ComponentValue>
|
|||
};
|
||||
|
||||
auto parse_filter_function_name = [&](auto name) -> Optional<FilterToken> {
|
||||
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<ComponentValue>& 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<DeprecatedString> font_family_parts;
|
||||
|
@ -5367,14 +5367,14 @@ CSSRule* Parser::parse_font_face_rule(TokenStream<ComponentValue>& 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<FontFace::Source> 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<UnicodeRange> unicode_ranges;
|
||||
bool unicode_range_invalid = false;
|
||||
TokenStream all_tokens { declaration.values() };
|
||||
|
@ -5418,7 +5418,7 @@ Vector<FontFace::Source> Parser::parse_font_face_src(TokenStream<ComponentValue>
|
|||
// 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<FontFace::Source> Parser::parse_font_face_src(TokenStream<ComponentValue>
|
|||
}
|
||||
|
||||
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<StyleValue> Parser::parse_transform_value(Vector<ComponentValue> 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<CSS::GridSize> 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<CSS::GridRepeat> Parser::parse_repeat(Vector<ComponentValue> 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<CSS::ExplicitGridTrack> 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<CSS::ExplicitGridTrack> 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<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con
|
|||
// [ <integer> && <custom-ident>? ] |
|
||||
// [ span && [ <integer> || <custom-ident> ] ]
|
||||
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<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con
|
|||
};
|
||||
auto is_line_name = [](Token token) -> bool {
|
||||
// The <custom-ident> 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<StyleValue> Parser::parse_grid_template_areas_value(Vector<ComponentValue
|
|||
Parser::ParseErrorOr<NonnullRefPtr<StyleValue>> Parser::parse_css_value(PropertyID property_id, TokenStream<ComponentValue>& 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<Selector::SimpleSelector::ANPlusBPattern> 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<Selector::SimpleSelector::ANPlusBPattern> 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<Selector::SimpleSelector::ANPlusBPattern> 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<Selector::SimpleSelector::ANPlusBPattern> 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<CalculatedStyleValue> Parser::parse_calculated_value(Badge<StyleComputer>, ParsingContext const& context, Vector<ComponentValue> const& tokens)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ StringView Resolution::unit_name() const
|
|||
|
||||
Optional<Resolution::Type> 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 {};
|
||||
|
|
|
@ -345,21 +345,21 @@ ErrorOr<String> serialize_a_group_of_selectors(Vector<NonnullRefPtr<Selector>> c
|
|||
|
||||
Optional<Selector::PseudoElement> 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 {};
|
||||
|
|
|
@ -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<Parser::ComponentValue> 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()) {
|
||||
|
|
|
@ -75,9 +75,9 @@ StringView Time::unit_name() const
|
|||
|
||||
Optional<Time::Type> 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 {};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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<Time> parse_date_time(StringView date_string)
|
|||
|
||||
auto parse_month = [&](StringView token) {
|
||||
for (unsigned i = 0; i < 12; ++i) {
|
||||
if (token.equals_ignoring_case(short_month_names[i])) {
|
||||
if (token.equals_ignoring_ascii_case(short_month_names[i])) {
|
||||
month = i + 1;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -55,13 +55,13 @@ JS::NonnullGCPtr<JS::Promise> SubtleCrypto::digest(String const& algorithm, JS::
|
|||
// FIXME: This is way more generic than it needs to be right now, so we simplify it.
|
||||
::Crypto::Hash::HashKind hash_kind;
|
||||
auto algorithm_as_string_view = algorithm.bytes_as_string_view();
|
||||
if (algorithm_as_string_view.equals_ignoring_case("SHA-1"sv)) {
|
||||
if (algorithm_as_string_view.equals_ignoring_ascii_case("SHA-1"sv)) {
|
||||
hash_kind = ::Crypto::Hash::HashKind::SHA1;
|
||||
} else if (algorithm_as_string_view.equals_ignoring_case("SHA-256"sv)) {
|
||||
} else if (algorithm_as_string_view.equals_ignoring_ascii_case("SHA-256"sv)) {
|
||||
hash_kind = ::Crypto::Hash::HashKind::SHA256;
|
||||
} else if (algorithm_as_string_view.equals_ignoring_case("SHA-384"sv)) {
|
||||
} else if (algorithm_as_string_view.equals_ignoring_ascii_case("SHA-384"sv)) {
|
||||
hash_kind = ::Crypto::Hash::HashKind::SHA384;
|
||||
} else if (algorithm_as_string_view.equals_ignoring_case("SHA-512"sv)) {
|
||||
} else if (algorithm_as_string_view.equals_ignoring_ascii_case("SHA-512"sv)) {
|
||||
hash_kind = ::Crypto::Hash::HashKind::SHA512;
|
||||
}
|
||||
// 4. If an error occurred, return a Promise rejected with normalizedAlgorithm.
|
||||
|
|
|
@ -266,15 +266,15 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> create_element(Document& document
|
|||
if (lowercase_tag_name == SVG::TagNames::svg)
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGSVGElement>(realm, document, move(qualified_name)));
|
||||
// FIXME: Support SVG's mixedCase tag names properly.
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::clipPath))
|
||||
if (lowercase_tag_name.equals_ignoring_ascii_case(SVG::TagNames::clipPath))
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGClipPathElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name == SVG::TagNames::circle)
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGCircleElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::defs))
|
||||
if (lowercase_tag_name.equals_ignoring_ascii_case(SVG::TagNames::defs))
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGDefsElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name == SVG::TagNames::ellipse)
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGEllipseElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name.equals_ignoring_case(SVG::TagNames::foreignObject))
|
||||
if (lowercase_tag_name.equals_ignoring_ascii_case(SVG::TagNames::foreignObject))
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGForeignObjectElement>(realm, document, move(qualified_name)));
|
||||
if (lowercase_tag_name == SVG::TagNames::line)
|
||||
return MUST_OR_THROW_OOM(realm.heap().allocate<SVG::SVGLineElement>(realm, document, move(qualified_name)));
|
||||
|
|
|
@ -153,7 +153,7 @@ Attr const* NamedNodeMap::get_attribute(StringView qualified_name, size_t* item_
|
|||
// 2. Return the first attribute in element’s attribute list whose qualified name is qualifiedName; otherwise null.
|
||||
for (auto const& attribute : m_attributes) {
|
||||
if (compare_as_lowercase) {
|
||||
if (attribute->name().equals_ignoring_case(qualified_name))
|
||||
if (attribute->name().equals_ignoring_ascii_case(qualified_name))
|
||||
return attribute.ptr();
|
||||
} else {
|
||||
if (attribute->name() == qualified_name)
|
||||
|
|
|
@ -1829,7 +1829,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::
|
|||
bool is_in_header_names = false;
|
||||
|
||||
for (auto const& allowed_header_name : header_names) {
|
||||
if (StringView { allowed_header_name }.equals_ignoring_case(header.name)) {
|
||||
if (StringView { allowed_header_name }.equals_ignoring_ascii_case(header.name)) {
|
||||
is_in_header_names = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1850,7 +1850,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::
|
|||
bool is_in_header_names = false;
|
||||
|
||||
for (auto const& header_name : header_names) {
|
||||
if (StringView { unsafe_name }.equals_ignoring_case(header_name)) {
|
||||
if (StringView { unsafe_name }.equals_ignoring_ascii_case(header_name)) {
|
||||
is_in_header_names = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ WebIDL::ExceptionOr<Vector<String>> Headers::get_set_cookie()
|
|||
// 2. Return the values of all headers in this’s header list whose name is a byte-case-insensitive match for
|
||||
// `Set-Cookie`, in order.
|
||||
for (auto const& header : *m_header_list) {
|
||||
if (StringView { header.name }.equals_ignoring_case("Set-Cookie"sv))
|
||||
if (StringView { header.name }.equals_ignoring_ascii_case("Set-Cookie"sv))
|
||||
TRY_OR_THROW_OOM(vm, values.try_append(TRY_OR_THROW_OOM(vm, String::from_utf8(header.value))));
|
||||
}
|
||||
return values;
|
||||
|
|
|
@ -28,7 +28,7 @@ template<typename T>
|
|||
requires(IsSameIgnoringCV<T, u8>) struct CaseInsensitiveBytesTraits : public Traits<Span<T>> {
|
||||
static constexpr bool equals(Span<T> const& a, Span<T> const& b)
|
||||
{
|
||||
return StringView { a }.equals_ignoring_case(StringView { b });
|
||||
return StringView { a }.equals_ignoring_ascii_case(StringView { b });
|
||||
}
|
||||
|
||||
static constexpr unsigned hash(Span<T> const& span)
|
||||
|
@ -57,7 +57,7 @@ bool HeaderList::contains(ReadonlyBytes name) const
|
|||
{
|
||||
// A header list list contains a header name name if list contains a header whose name is a byte-case-insensitive match for name.
|
||||
return any_of(*this, [&](auto const& header) {
|
||||
return StringView { header.name }.equals_ignoring_case(name);
|
||||
return StringView { header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ ErrorOr<Optional<ByteBuffer>> HeaderList::get(ReadonlyBytes name) const
|
|||
ByteBuffer buffer;
|
||||
auto first = true;
|
||||
for (auto const& header : *this) {
|
||||
if (!StringView { header.name }.equals_ignoring_case(name))
|
||||
if (!StringView { header.name }.equals_ignoring_ascii_case(name))
|
||||
continue;
|
||||
if (first) {
|
||||
first = false;
|
||||
|
@ -172,7 +172,7 @@ ErrorOr<void> HeaderList::append(Header header)
|
|||
// NOTE: This reuses the casing of the name of the header already in list, if any. If there are multiple matched headers their names will all be identical.
|
||||
if (contains(name)) {
|
||||
auto matching_header = first_matching([&](auto const& existing_header) {
|
||||
return StringView { existing_header.name }.equals_ignoring_case(name);
|
||||
return StringView { existing_header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
name.overwrite(0, matching_header->name.data(), matching_header->name.size());
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ void HeaderList::delete_(ReadonlyBytes name)
|
|||
{
|
||||
// To delete a header name name from a header list list, remove all headers whose name is a byte-case-insensitive match for name from list.
|
||||
remove_all_matching([&](auto const& header) {
|
||||
return StringView { header.name }.equals_ignoring_case(name);
|
||||
return StringView { header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -203,7 +203,7 @@ ErrorOr<void> HeaderList::set(Header header)
|
|||
// 1. If list contains name, then set the value of the first such header to value and remove the others.
|
||||
if (contains(name)) {
|
||||
auto matching_index = find_if([&](auto const& existing_header) {
|
||||
return StringView { existing_header.name }.equals_ignoring_case(name);
|
||||
return StringView { existing_header.name }.equals_ignoring_ascii_case(name);
|
||||
}).index();
|
||||
auto& matching_header = at(matching_index);
|
||||
matching_header.value = TRY(ByteBuffer::copy(value));
|
||||
|
@ -212,7 +212,7 @@ ErrorOr<void> HeaderList::set(Header header)
|
|||
ScopeGuard increment_i = [&]() { i++; };
|
||||
if (i <= matching_index)
|
||||
return false;
|
||||
return StringView { existing_header.name }.equals_ignoring_case(name);
|
||||
return StringView { existing_header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
}
|
||||
// 2. Otherwise, append header (name, value) to list.
|
||||
|
@ -234,7 +234,7 @@ ErrorOr<void> HeaderList::combine(Header header)
|
|||
// 1. If list contains name, then set the value of the first such header to its value, followed by 0x2C 0x20, followed by value.
|
||||
if (contains(name)) {
|
||||
auto matching_header = first_matching([&](auto const& existing_header) {
|
||||
return StringView { existing_header.name }.equals_ignoring_case(name);
|
||||
return StringView { existing_header.name }.equals_ignoring_ascii_case(name);
|
||||
});
|
||||
TRY(matching_header->value.try_append(0x2c));
|
||||
TRY(matching_header->value.try_append(0x20));
|
||||
|
@ -270,7 +270,7 @@ ErrorOr<Vector<Header>> HeaderList::sort_and_combine() const
|
|||
// 1. Let values be a list of all values of headers in list whose name is a byte-case-insensitive match for name, in order.
|
||||
// 2. For each value of values:
|
||||
for (auto const& [header_name, value] : *this) {
|
||||
if (StringView { header_name }.equals_ignoring_case(name)) {
|
||||
if (StringView { header_name }.equals_ignoring_ascii_case(name)) {
|
||||
// 1. Append (name, value) to headers.
|
||||
auto header = TRY(Header::from_string_pair(name, value));
|
||||
TRY(headers.try_append(move(header)));
|
||||
|
@ -473,14 +473,14 @@ bool is_cors_safelisted_request_header(Header const& header)
|
|||
auto name = StringView { header.name };
|
||||
|
||||
// `accept`
|
||||
if (name.equals_ignoring_case("accept"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("accept"sv)) {
|
||||
// If value contains a CORS-unsafe request-header byte, then return false.
|
||||
if (any_of(value.span(), is_cors_unsafe_request_header_byte))
|
||||
return false;
|
||||
}
|
||||
// `accept-language`
|
||||
// `content-language`
|
||||
else if (name.is_one_of_ignoring_case("accept-language"sv, "content-language"sv)) {
|
||||
else if (name.is_one_of_ignoring_ascii_case("accept-language"sv, "content-language"sv)) {
|
||||
// If value contains a byte that is not in the range 0x30 (0) to 0x39 (9), inclusive, is not in the range 0x41 (A) to 0x5A (Z), inclusive, is not in the range 0x61 (a) to 0x7A (z), inclusive, and is not 0x20 (SP), 0x2A (*), 0x2C (,), 0x2D (-), 0x2E (.), 0x3B (;), or 0x3D (=), then return false.
|
||||
if (any_of(value.span(), [](auto byte) {
|
||||
return !(is_ascii_digit(byte) || is_ascii_alpha(byte) || " *,-.;="sv.contains(static_cast<char>(byte)));
|
||||
|
@ -488,7 +488,7 @@ bool is_cors_safelisted_request_header(Header const& header)
|
|||
return false;
|
||||
}
|
||||
// `content-type`
|
||||
else if (name.equals_ignoring_case("content-type"sv)) {
|
||||
else if (name.equals_ignoring_ascii_case("content-type"sv)) {
|
||||
// 1. If value contains a CORS-unsafe request-header byte, then return false.
|
||||
if (any_of(value.span(), is_cors_unsafe_request_header_byte))
|
||||
return false;
|
||||
|
@ -505,7 +505,7 @@ bool is_cors_safelisted_request_header(Header const& header)
|
|||
return false;
|
||||
}
|
||||
// `range`
|
||||
else if (name.equals_ignoring_case("range"sv)) {
|
||||
else if (name.equals_ignoring_ascii_case("range"sv)) {
|
||||
// 1. Let rangeValue be the result of parsing a single range header value given value.
|
||||
auto range_value = parse_single_range_header_value(value);
|
||||
|
||||
|
@ -579,7 +579,7 @@ ErrorOr<OrderedHashTable<ByteBuffer>> get_cors_unsafe_header_names(HeaderList co
|
|||
bool is_cors_non_wildcard_request_header_name(ReadonlyBytes header_name)
|
||||
{
|
||||
// A CORS non-wildcard request-header name is a header name that is a byte-case-insensitive match for `Authorization`.
|
||||
return StringView { header_name }.equals_ignoring_case("Authorization"sv);
|
||||
return StringView { header_name }.equals_ignoring_ascii_case("Authorization"sv);
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#privileged-no-cors-request-header-name
|
||||
|
@ -587,7 +587,7 @@ bool is_privileged_no_cors_request_header_name(ReadonlyBytes header_name)
|
|||
{
|
||||
// A privileged no-CORS request-header name is a header name that is a byte-case-insensitive match for one of
|
||||
// - `Range`.
|
||||
return StringView { header_name }.equals_ignoring_case("Range"sv);
|
||||
return StringView { header_name }.equals_ignoring_ascii_case("Range"sv);
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name
|
||||
|
@ -602,7 +602,7 @@ bool is_cors_safelisted_response_header_name(ReadonlyBytes header_name, Span<Rea
|
|||
// - `Last-Modified`
|
||||
// - `Pragma`
|
||||
// - Any item in list that is not a forbidden response-header name.
|
||||
return StringView { header_name }.is_one_of_ignoring_case(
|
||||
return StringView { header_name }.is_one_of_ignoring_ascii_case(
|
||||
"Cache-Control"sv,
|
||||
"Content-Language"sv,
|
||||
"Content-Length"sv,
|
||||
|
@ -611,7 +611,7 @@ bool is_cors_safelisted_response_header_name(ReadonlyBytes header_name, Span<Rea
|
|||
"Last-Modified"sv,
|
||||
"Pragma"sv)
|
||||
|| any_of(list, [&](auto list_header_name) {
|
||||
return StringView { header_name }.equals_ignoring_case(list_header_name)
|
||||
return StringView { header_name }.equals_ignoring_ascii_case(list_header_name)
|
||||
&& !is_forbidden_response_header_name(list_header_name);
|
||||
});
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ bool is_no_cors_safelisted_request_header_name(ReadonlyBytes header_name)
|
|||
// - `Accept-Language`
|
||||
// - `Content-Language`
|
||||
// - `Content-Type`
|
||||
return StringView { header_name }.is_one_of_ignoring_case(
|
||||
return StringView { header_name }.is_one_of_ignoring_ascii_case(
|
||||
"Accept"sv,
|
||||
"Accept-Language"sv,
|
||||
"Content-Language"sv,
|
||||
|
@ -653,7 +653,7 @@ ErrorOr<bool> is_forbidden_request_header(Header const& header)
|
|||
// 1. If name is a byte-case-insensitive match for one of:
|
||||
// [...]
|
||||
// then return true.
|
||||
if (name.is_one_of_ignoring_case(
|
||||
if (name.is_one_of_ignoring_ascii_case(
|
||||
"Accept-Charset"sv,
|
||||
"Accept-Encoding"sv,
|
||||
"Access-Control-Request-Headers"sv,
|
||||
|
@ -688,7 +688,7 @@ ErrorOr<bool> is_forbidden_request_header(Header const& header)
|
|||
// - `X-HTTP-Method-Override`
|
||||
// - `X-Method-Override`
|
||||
// then:
|
||||
if (name.is_one_of_ignoring_case(
|
||||
if (name.is_one_of_ignoring_ascii_case(
|
||||
"X-HTTP-Method"sv,
|
||||
"X-HTTP-Method-Override"sv,
|
||||
"X-Method"sv)) {
|
||||
|
@ -710,7 +710,7 @@ bool is_forbidden_response_header_name(ReadonlyBytes header_name)
|
|||
// A forbidden response-header name is a header name that is a byte-case-insensitive match for one of:
|
||||
// - `Set-Cookie`
|
||||
// - `Set-Cookie2`
|
||||
return StringView { header_name }.is_one_of_ignoring_case(
|
||||
return StringView { header_name }.is_one_of_ignoring_ascii_case(
|
||||
"Set-Cookie"sv,
|
||||
"Set-Cookie2"sv);
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ bool is_request_body_header_name(ReadonlyBytes header_name)
|
|||
// - `Content-Language`
|
||||
// - `Content-Location`
|
||||
// - `Content-Type`
|
||||
return StringView { header_name }.is_one_of_ignoring_case(
|
||||
return StringView { header_name }.is_one_of_ignoring_ascii_case(
|
||||
"Content-Encoding"sv,
|
||||
"Content-Language"sv,
|
||||
"Content-Location"sv,
|
||||
|
@ -754,7 +754,7 @@ ErrorOr<Variant<Vector<ByteBuffer>, ExtractHeaderParseFailure, Empty>> extract_h
|
|||
|
||||
// 4. For each header header list contains whose name is name:
|
||||
for (auto const& header : list) {
|
||||
if (!StringView { header.name }.equals_ignoring_case(name))
|
||||
if (!StringView { header.name }.equals_ignoring_ascii_case(name))
|
||||
continue;
|
||||
|
||||
// 1. Let extract be the result of extracting header values from header.
|
||||
|
|
|
@ -32,7 +32,7 @@ bool is_cors_safelisted_method(ReadonlyBytes method)
|
|||
bool is_forbidden_method(ReadonlyBytes method)
|
||||
{
|
||||
// A forbidden method is a method that is a byte-case-insensitive match for `CONNECT`, `TRACE`, or `TRACK`.
|
||||
return StringView { method }.is_one_of_ignoring_case("CONNECT"sv, "TRACE"sv, "TRACK"sv);
|
||||
return StringView { method }.is_one_of_ignoring_ascii_case("CONNECT"sv, "TRACE"sv, "TRACK"sv);
|
||||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-method-normalize
|
||||
|
@ -40,7 +40,7 @@ ErrorOr<ByteBuffer> normalize_method(ReadonlyBytes method)
|
|||
{
|
||||
// To normalize a method, if it is a byte-case-insensitive match for `DELETE`, `GET`, `HEAD`, `OPTIONS`, `POST`, or `PUT`, byte-uppercase it.
|
||||
auto bytes = TRY(ByteBuffer::copy(method));
|
||||
if (StringView { method }.is_one_of_ignoring_case("DELETE"sv, "GET"sv, "HEAD"sv, "OPTIONS"sv, "POST"sv, "PUT"sv))
|
||||
if (StringView { method }.is_one_of_ignoring_ascii_case("DELETE"sv, "GET"sv, "HEAD"sv, "OPTIONS"sv, "POST"sv, "PUT"sv))
|
||||
Infra::byte_uppercase(bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
|
|
@ -30,15 +30,15 @@ JS::ThrowCompletionOr<void> HTMLBodyElement::initialize(JS::Realm& realm)
|
|||
void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("bgcolor"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("bgcolor"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
|
||||
} else if (name.equals_ignoring_case("text"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("text"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
|
||||
} else if (name.equals_ignoring_case("background"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
VERIFY(m_background_style_value);
|
||||
style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value);
|
||||
}
|
||||
|
@ -48,19 +48,19 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
void HTMLBodyElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
|
||||
{
|
||||
HTMLElement::parse_attribute(name, value);
|
||||
if (name.equals_ignoring_case("link"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("link"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_link_color(color.value());
|
||||
} else if (name.equals_ignoring_case("alink"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("alink"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_active_link_color(color.value());
|
||||
} else if (name.equals_ignoring_case("vlink"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("vlink"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
document().set_visited_link_color(color.value());
|
||||
} else if (name.equals_ignoring_case("background"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("background"sv)) {
|
||||
m_background_style_value = CSS::ImageStyleValue::create(document().parse_url(value));
|
||||
m_background_style_value->on_animate = [this] {
|
||||
if (layout_node()) {
|
||||
|
|
|
@ -64,7 +64,7 @@ DeprecatedString HTMLButtonElement::type() const
|
|||
auto value = attribute(HTML::AttributeNames::type);
|
||||
|
||||
#define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, _) \
|
||||
if (value.equals_ignoring_case(#keyword##sv)) \
|
||||
if (value.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return #keyword;
|
||||
ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
|
||||
|
@ -78,7 +78,7 @@ HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
|
|||
auto value = attribute(HTML::AttributeNames::type);
|
||||
|
||||
#define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(keyword, state) \
|
||||
if (value.equals_ignoring_case(#keyword##sv)) \
|
||||
if (value.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return HTMLButtonElement::TypeAttributeState::state;
|
||||
ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
|
||||
|
|
|
@ -64,7 +64,7 @@ DeprecatedString HTMLElement::dir() const
|
|||
{
|
||||
auto dir = attribute(HTML::AttributeNames::dir);
|
||||
#define __ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTE(keyword) \
|
||||
if (dir.equals_ignoring_case(#keyword##sv)) \
|
||||
if (dir.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return #keyword##sv;
|
||||
ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTE
|
||||
|
@ -81,10 +81,10 @@ HTMLElement::ContentEditableState HTMLElement::content_editable_state() const
|
|||
{
|
||||
auto contenteditable = attribute(HTML::AttributeNames::contenteditable);
|
||||
// "true", an empty string or a missing value map to the "true" state.
|
||||
if ((!contenteditable.is_null() && contenteditable.is_empty()) || contenteditable.equals_ignoring_case("true"sv))
|
||||
if ((!contenteditable.is_null() && contenteditable.is_empty()) || contenteditable.equals_ignoring_ascii_case("true"sv))
|
||||
return ContentEditableState::True;
|
||||
// "false" maps to the "false" state.
|
||||
if (contenteditable.equals_ignoring_case("false"sv))
|
||||
if (contenteditable.equals_ignoring_ascii_case("false"sv))
|
||||
return ContentEditableState::False;
|
||||
// Having no such attribute or an invalid value maps to the "inherit" state.
|
||||
return ContentEditableState::Inherit;
|
||||
|
@ -121,15 +121,15 @@ DeprecatedString HTMLElement::content_editable() const
|
|||
// https://html.spec.whatwg.org/multipage/interaction.html#contenteditable
|
||||
WebIDL::ExceptionOr<void> HTMLElement::set_content_editable(DeprecatedString const& content_editable)
|
||||
{
|
||||
if (content_editable.equals_ignoring_case("inherit"sv)) {
|
||||
if (content_editable.equals_ignoring_ascii_case("inherit"sv)) {
|
||||
remove_attribute(HTML::AttributeNames::contenteditable);
|
||||
return {};
|
||||
}
|
||||
if (content_editable.equals_ignoring_case("true"sv)) {
|
||||
if (content_editable.equals_ignoring_ascii_case("true"sv)) {
|
||||
MUST(set_attribute(HTML::AttributeNames::contenteditable, "true"));
|
||||
return {};
|
||||
}
|
||||
if (content_editable.equals_ignoring_case("false"sv)) {
|
||||
if (content_editable.equals_ignoring_ascii_case("false"sv)) {
|
||||
MUST(set_attribute(HTML::AttributeNames::contenteditable, "false"));
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ JS::ThrowCompletionOr<void> HTMLFontElement::initialize(JS::Realm& realm)
|
|||
void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("color"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("color"sv)) {
|
||||
auto color = Color::from_string(value);
|
||||
if (color.has_value())
|
||||
style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
|
||||
|
|
|
@ -233,7 +233,7 @@ static bool is_form_control(DOM::Element const& element)
|
|||
}
|
||||
|
||||
if (is<HTMLInputElement>(element)
|
||||
&& !element.get_attribute(HTML::AttributeNames::type).equals_ignoring_case("image"sv)) {
|
||||
&& !element.get_attribute(HTML::AttributeNames::type).equals_ignoring_ascii_case("image"sv)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLHeadingElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
{
|
||||
HTMLElement::apply_presentational_hints(style);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("align"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "left"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left));
|
||||
else if (value == "right"sv)
|
||||
|
|
|
@ -431,7 +431,7 @@ void HTMLInputElement::parse_attribute(DeprecatedFlyString const& name, Deprecat
|
|||
HTMLInputElement::TypeAttributeState HTMLInputElement::parse_type_attribute(StringView type)
|
||||
{
|
||||
#define __ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTE(keyword, state) \
|
||||
if (type.equals_ignoring_case(#keyword##sv)) \
|
||||
if (type.equals_ignoring_ascii_case(#keyword##sv)) \
|
||||
return HTMLInputElement::TypeAttributeState::state;
|
||||
ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTES
|
||||
#undef __ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTE
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLParagraphElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
{
|
||||
HTMLElement::apply_presentational_hints(style);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("align"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "left"sv)
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::Left));
|
||||
else if (value == "right"sv)
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) con
|
|||
HTMLElement::apply_presentational_hints(style);
|
||||
|
||||
for_each_attribute([&](auto const& name, auto const&) {
|
||||
if (name.equals_ignoring_case(HTML::AttributeNames::wrap))
|
||||
if (name.equals_ignoring_ascii_case(HTML::AttributeNames::wrap))
|
||||
style.set_property(CSS::PropertyID::WhiteSpace, CSS::IdentifierStyleValue::create(CSS::ValueID::PreWrap));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLTableCaptionElement::apply_presentational_hints(CSS::StyleProperties& s
|
|||
{
|
||||
HTMLElement::apply_presentational_hints(style);
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("align"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("align"sv)) {
|
||||
if (value == "bottom"sv)
|
||||
style.set_property(CSS::PropertyID::CaptionSide, CSS::IdentifierStyleValue::create(CSS::ValueID::Bottom));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& styl
|
|||
return;
|
||||
}
|
||||
if (name == HTML::AttributeNames::align) {
|
||||
if (value.equals_ignoring_case("center"sv) || value.equals_ignoring_case("middle"sv)) {
|
||||
if (value.equals_ignoring_ascii_case("center"sv) || value.equals_ignoring_ascii_case("middle"sv)) {
|
||||
style.set_property(CSS::PropertyID::TextAlign, CSS::IdentifierStyleValue::create(CSS::ValueID::LibwebCenter));
|
||||
} else {
|
||||
if (auto parsed_value = parse_css_value(CSS::Parser::ParsingContext { document() }, value.view(), CSS::PropertyID::TextAlign))
|
||||
|
|
|
@ -413,16 +413,16 @@ DOM::QuirksMode HTMLParser::which_quirks_mode(HTMLToken const& doctype_token) co
|
|||
auto const& public_identifier = doctype_token.doctype_data().public_identifier;
|
||||
auto const& system_identifier = doctype_token.doctype_data().system_identifier;
|
||||
|
||||
if (public_identifier.equals_ignoring_case("-//W3O//DTD W3 HTML Strict 3.0//EN//"sv))
|
||||
if (public_identifier.equals_ignoring_ascii_case("-//W3O//DTD W3 HTML Strict 3.0//EN//"sv))
|
||||
return DOM::QuirksMode::Yes;
|
||||
|
||||
if (public_identifier.equals_ignoring_case("-/W3C/DTD HTML 4.0 Transitional/EN"sv))
|
||||
if (public_identifier.equals_ignoring_ascii_case("-/W3C/DTD HTML 4.0 Transitional/EN"sv))
|
||||
return DOM::QuirksMode::Yes;
|
||||
|
||||
if (public_identifier.equals_ignoring_case("HTML"sv))
|
||||
if (public_identifier.equals_ignoring_ascii_case("HTML"sv))
|
||||
return DOM::QuirksMode::Yes;
|
||||
|
||||
if (system_identifier.equals_ignoring_case("http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"sv))
|
||||
if (system_identifier.equals_ignoring_ascii_case("http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"sv))
|
||||
return DOM::QuirksMode::Yes;
|
||||
|
||||
for (auto& public_id : s_quirks_public_ids) {
|
||||
|
@ -1922,7 +1922,7 @@ void HTMLParser::handle_in_body(HTMLToken& token)
|
|||
(void)m_stack_of_open_elements.pop();
|
||||
token.acknowledge_self_closing_flag_if_set();
|
||||
auto type_attribute = token.attribute(HTML::AttributeNames::type);
|
||||
if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden"sv)) {
|
||||
if (type_attribute.is_null() || !type_attribute.equals_ignoring_ascii_case("hidden"sv)) {
|
||||
m_frameset_ok = false;
|
||||
}
|
||||
return;
|
||||
|
@ -2698,7 +2698,7 @@ void HTMLParser::handle_in_table(HTMLToken& token)
|
|||
}
|
||||
if (token.is_start_tag() && token.tag_name() == HTML::TagNames::input) {
|
||||
auto type_attribute = token.attribute(HTML::AttributeNames::type);
|
||||
if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden"sv)) {
|
||||
if (type_attribute.is_null() || !type_attribute.equals_ignoring_ascii_case("hidden"sv)) {
|
||||
goto AnythingElse;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ void Resource::did_load(Badge<ResourceLoader>, ReadonlyBytes data, HashMap<Depre
|
|||
m_mime_type = url().data_mime_type();
|
||||
} else {
|
||||
auto content_type_options = headers.get("X-Content-Type-Options");
|
||||
if (content_type_options.value_or("").equals_ignoring_case("nosniff"sv)) {
|
||||
if (content_type_options.value_or("").equals_ignoring_ascii_case("nosniff"sv)) {
|
||||
m_mime_type = "text/plain";
|
||||
} else {
|
||||
m_mime_type = Core::guess_mime_type_based_on_filename(url().path());
|
||||
|
|
|
@ -30,18 +30,18 @@ void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style)
|
|||
{
|
||||
CSS::Parser::ParsingContext parsing_context { document() };
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name.equals_ignoring_case("fill"sv)) {
|
||||
if (name.equals_ignoring_ascii_case("fill"sv)) {
|
||||
// FIXME: The `fill` attribute and CSS `fill` property are not the same! But our support is limited enough that they are equivalent for now.
|
||||
if (auto fill_value = parse_css_value(parsing_context, value, CSS::PropertyID::Fill))
|
||||
style.set_property(CSS::PropertyID::Fill, fill_value.release_nonnull());
|
||||
} else if (name.equals_ignoring_case("stroke"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("stroke"sv)) {
|
||||
// FIXME: The `stroke` attribute and CSS `stroke` property are not the same! But our support is limited enough that they are equivalent for now.
|
||||
if (auto stroke_value = parse_css_value(parsing_context, value, CSS::PropertyID::Stroke))
|
||||
style.set_property(CSS::PropertyID::Stroke, stroke_value.release_nonnull());
|
||||
} else if (name.equals_ignoring_case("stroke-width"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("stroke-width"sv)) {
|
||||
if (auto stroke_width_value = parse_css_value(parsing_context, value, CSS::PropertyID::StrokeWidth))
|
||||
style.set_property(CSS::PropertyID::StrokeWidth, stroke_width_value.release_nonnull());
|
||||
} else if (name.equals_ignoring_case("transform"sv)) {
|
||||
} else if (name.equals_ignoring_ascii_case("transform"sv)) {
|
||||
if (auto transform = parse_css_value(parsing_context, value, CSS::PropertyID::Transform))
|
||||
style.set_property(CSS::PropertyID::Transform, transform.release_nonnull());
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ void SVGSVGElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedS
|
|||
{
|
||||
SVGGraphicsElement::parse_attribute(name, value);
|
||||
|
||||
if (name.equals_ignoring_case(SVG::AttributeNames::viewBox))
|
||||
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
|
||||
m_view_box = try_parse_view_box(value);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ ErrorOr<JsonValue, Client::WrappedError> Client::read_body_as_json()
|
|||
size_t content_length = 0;
|
||||
|
||||
for (auto const& header : m_request->headers()) {
|
||||
if (header.name.equals_ignoring_case("Content-Length"sv)) {
|
||||
if (header.name.equals_ignoring_ascii_case("Content-Length"sv)) {
|
||||
content_length = header.value.to_uint<size_t>(TrimWhitespace::Yes).value_or(0);
|
||||
break;
|
||||
}
|
||||
|
@ -287,8 +287,8 @@ ErrorOr<void, Client::WrappedError> Client::send_success_response(JsonValue resu
|
|||
}
|
||||
|
||||
bool keep_alive = false;
|
||||
if (auto it = m_request->headers().find_if([](auto& header) { return header.name.equals_ignoring_case("Connection"sv); }); !it.is_end())
|
||||
keep_alive = it->value.trim_whitespace().equals_ignoring_case("keep-alive"sv);
|
||||
if (auto it = m_request->headers().find_if([](auto& header) { return header.name.equals_ignoring_ascii_case("Connection"sv); }); !it.is_end())
|
||||
keep_alive = it->value.trim_whitespace().equals_ignoring_ascii_case("keep-alive"sv);
|
||||
|
||||
if (!keep_alive)
|
||||
die();
|
||||
|
|
|
@ -17,7 +17,7 @@ bool ConnectionInfo::is_secure() const
|
|||
{
|
||||
// RFC 6455 Section 3 :
|
||||
// The URI is called "secure" if the scheme component matches "wss" case-insensitively.
|
||||
return m_url.scheme().equals_ignoring_case("wss"sv);
|
||||
return m_url.scheme().equals_ignoring_ascii_case("wss"sv);
|
||||
}
|
||||
|
||||
DeprecatedString ConnectionInfo::resource_name() const
|
||||
|
|
|
@ -297,9 +297,9 @@ void WebSocket::read_server_handshake()
|
|||
|
||||
auto header_name = parts[0];
|
||||
|
||||
if (header_name.equals_ignoring_case("Upgrade"sv)) {
|
||||
if (header_name.equals_ignoring_ascii_case("Upgrade"sv)) {
|
||||
// 2. |Upgrade| should be case-insensitive "websocket"
|
||||
if (!parts[1].trim_whitespace().equals_ignoring_case("websocket"sv)) {
|
||||
if (!parts[1].trim_whitespace().equals_ignoring_ascii_case("websocket"sv)) {
|
||||
dbgln("WebSocket: Server HTTP Handshake Header |Upgrade| should be 'websocket', got '{}'. Failing connection.", parts[1]);
|
||||
fatal_error(WebSocket::Error::ConnectionUpgradeFailed);
|
||||
return;
|
||||
|
@ -309,9 +309,9 @@ void WebSocket::read_server_handshake()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (header_name.equals_ignoring_case("Connection"sv)) {
|
||||
if (header_name.equals_ignoring_ascii_case("Connection"sv)) {
|
||||
// 3. |Connection| should be case-insensitive "Upgrade"
|
||||
if (!parts[1].trim_whitespace().equals_ignoring_case("Upgrade"sv)) {
|
||||
if (!parts[1].trim_whitespace().equals_ignoring_ascii_case("Upgrade"sv)) {
|
||||
dbgln("WebSocket: Server HTTP Handshake Header |Connection| should be 'Upgrade', got '{}'. Failing connection.", parts[1]);
|
||||
return;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ void WebSocket::read_server_handshake()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (header_name.equals_ignoring_case("Sec-WebSocket-Accept"sv)) {
|
||||
if (header_name.equals_ignoring_ascii_case("Sec-WebSocket-Accept"sv)) {
|
||||
// 4. |Sec-WebSocket-Accept| should be base64(SHA1(|Sec-WebSocket-Key| + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"))
|
||||
auto expected_content = DeprecatedString::formatted("{}258EAFA5-E914-47DA-95CA-C5AB0DC85B11", m_websocket_key);
|
||||
|
||||
|
@ -330,7 +330,7 @@ void WebSocket::read_server_handshake()
|
|||
auto expected_sha1 = hash.digest();
|
||||
// FIXME: change to TRY() and make method fallible
|
||||
auto expected_sha1_string = MUST(encode_base64({ expected_sha1.immutable_data(), expected_sha1.data_length() }));
|
||||
if (!parts[1].trim_whitespace().equals_ignoring_case(expected_sha1_string)) {
|
||||
if (!parts[1].trim_whitespace().equals_ignoring_ascii_case(expected_sha1_string)) {
|
||||
dbgln("WebSocket: Server HTTP Handshake Header |Sec-Websocket-Accept| should be '{}', got '{}'. Failing connection.", expected_sha1_string, parts[1]);
|
||||
fatal_error(WebSocket::Error::ConnectionUpgradeFailed);
|
||||
return;
|
||||
|
@ -340,14 +340,14 @@ void WebSocket::read_server_handshake()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (header_name.equals_ignoring_case("Sec-WebSocket-Extensions"sv)) {
|
||||
if (header_name.equals_ignoring_ascii_case("Sec-WebSocket-Extensions"sv)) {
|
||||
// 5. |Sec-WebSocket-Extensions| should not contain an extension that doesn't appear in m_connection->extensions()
|
||||
auto server_extensions = parts[1].split(',');
|
||||
for (auto const& extension : server_extensions) {
|
||||
auto trimmed_extension = extension.trim_whitespace();
|
||||
bool found_extension = false;
|
||||
for (auto const& supported_extension : m_connection.extensions()) {
|
||||
if (trimmed_extension.equals_ignoring_case(supported_extension)) {
|
||||
if (trimmed_extension.equals_ignoring_ascii_case(supported_extension)) {
|
||||
found_extension = true;
|
||||
}
|
||||
}
|
||||
|
@ -360,13 +360,13 @@ void WebSocket::read_server_handshake()
|
|||
continue;
|
||||
}
|
||||
|
||||
if (header_name.equals_ignoring_case("Sec-WebSocket-Protocol"sv)) {
|
||||
if (header_name.equals_ignoring_ascii_case("Sec-WebSocket-Protocol"sv)) {
|
||||
// 6. If the response includes a |Sec-WebSocket-Protocol| header field and this header field indicates the use of a subprotocol that was not present in the client's handshake (the server has indicated a subprotocol not requested by the client), the client MUST _Fail the WebSocket Connection_.
|
||||
// Additionally, Section 4.2.2 says this is "Either a single value representing the subprotocol the server is ready to use or null."
|
||||
auto server_protocol = parts[1].trim_whitespace();
|
||||
bool found_protocol = false;
|
||||
for (auto const& supported_protocol : m_connection.protocols()) {
|
||||
if (server_protocol.equals_ignoring_case(supported_protocol)) {
|
||||
if (server_protocol.equals_ignoring_ascii_case(supported_protocol)) {
|
||||
found_protocol = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -515,7 +515,7 @@ ErrorOr<Name, ParseError> Parser::parse_processing_instruction_target()
|
|||
auto target = TRY(parse_name());
|
||||
auto accept = accept_rule();
|
||||
|
||||
if (target.equals_ignoring_case("xml"sv) && m_options.treat_errors_as_fatal) {
|
||||
if (target.equals_ignoring_ascii_case("xml"sv) && m_options.treat_errors_as_fatal) {
|
||||
return parse_error(
|
||||
m_lexer.tell() - target.length(),
|
||||
"Use of the reserved 'xml' name for processing instruction target name is disallowed");
|
||||
|
|
|
@ -278,7 +278,7 @@ ErrorOr<Vector<Answer>> LookupServer::lookup(Name const& name, DeprecatedString
|
|||
auto& response_question = response.questions()[i];
|
||||
bool match = request_question.class_code() == response_question.class_code()
|
||||
&& request_question.record_type() == response_question.record_type()
|
||||
&& request_question.name().as_string().equals_ignoring_case(response_question.name().as_string());
|
||||
&& request_question.name().as_string().equals_ignoring_ascii_case(response_question.name().as_string());
|
||||
if (!match) {
|
||||
dbgln("Request and response questions do not match");
|
||||
dbgln(" Request: name=_{}_, type={}, class={}", request_question.name().as_string(), response_question.record_type(), response_question.class_code());
|
||||
|
|
|
@ -71,21 +71,21 @@ OwnPtr<Request> start_request(TBadgedProtocol&& protocol, ConnectionFromClient&
|
|||
}
|
||||
|
||||
HTTP::HttpRequest request;
|
||||
if (method.equals_ignoring_case("post"sv))
|
||||
if (method.equals_ignoring_ascii_case("post"sv))
|
||||
request.set_method(HTTP::HttpRequest::Method::POST);
|
||||
else if (method.equals_ignoring_case("head"sv))
|
||||
else if (method.equals_ignoring_ascii_case("head"sv))
|
||||
request.set_method(HTTP::HttpRequest::Method::HEAD);
|
||||
else if (method.equals_ignoring_case("delete"sv))
|
||||
else if (method.equals_ignoring_ascii_case("delete"sv))
|
||||
request.set_method(HTTP::HttpRequest::Method::DELETE);
|
||||
else if (method.equals_ignoring_case("patch"sv))
|
||||
else if (method.equals_ignoring_ascii_case("patch"sv))
|
||||
request.set_method(HTTP::HttpRequest::Method::PATCH);
|
||||
else if (method.equals_ignoring_case("options"sv))
|
||||
else if (method.equals_ignoring_ascii_case("options"sv))
|
||||
request.set_method(HTTP::HttpRequest::Method::OPTIONS);
|
||||
else if (method.equals_ignoring_case("trace"sv))
|
||||
else if (method.equals_ignoring_ascii_case("trace"sv))
|
||||
request.set_method(HTTP::HttpRequest::Method::TRACE);
|
||||
else if (method.equals_ignoring_case("connect"sv))
|
||||
else if (method.equals_ignoring_ascii_case("connect"sv))
|
||||
request.set_method(HTTP::HttpRequest::Method::CONNECT);
|
||||
else if (method.equals_ignoring_case("put"sv))
|
||||
else if (method.equals_ignoring_ascii_case("put"sv))
|
||||
request.set_method(HTTP::HttpRequest::Method::PUT);
|
||||
else
|
||||
request.set_method(HTTP::HttpRequest::Method::GET);
|
||||
|
|
|
@ -214,8 +214,8 @@ ErrorOr<void> Client::send_response(Stream& response, HTTP::HttpRequest const& r
|
|||
} while (true);
|
||||
|
||||
auto keep_alive = false;
|
||||
if (auto it = request.headers().find_if([](auto& header) { return header.name.equals_ignoring_case("Connection"sv); }); !it.is_end()) {
|
||||
if (it->value.trim_whitespace().equals_ignoring_case("keep-alive"sv))
|
||||
if (auto it = request.headers().find_if([](auto& header) { return header.name.equals_ignoring_ascii_case("Connection"sv); }); !it.is_end()) {
|
||||
if (it->value.trim_whitespace().equals_ignoring_ascii_case("keep-alive"sv))
|
||||
keep_alive = true;
|
||||
}
|
||||
if (!keep_alive)
|
||||
|
@ -380,7 +380,7 @@ bool Client::verify_credentials(Vector<HTTP::HttpRequest::Header> const& headers
|
|||
VERIFY(Configuration::the().credentials().has_value());
|
||||
auto& configured_credentials = Configuration::the().credentials().value();
|
||||
for (auto& header : headers) {
|
||||
if (header.name.equals_ignoring_case("Authorization"sv)) {
|
||||
if (header.name.equals_ignoring_ascii_case("Authorization"sv)) {
|
||||
auto provided_credentials = HTTP::HttpRequest::parse_http_basic_authentication_header(header.value);
|
||||
if (provided_credentials.has_value() && configured_credentials.username == provided_credentials->username && configured_credentials.password == provided_credentials->password)
|
||||
return true;
|
||||
|
|
|
@ -44,7 +44,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
TRY(Core::System::unveil(nullptr, nullptr));
|
||||
TRY(Core::System::pledge("stdio rpath wpath recvfd thread"));
|
||||
|
||||
if (command.equals_ignoring_case("get"sv) || command == "g") {
|
||||
if (command.equals_ignoring_ascii_case("get"sv) || command == "g") {
|
||||
// Get variables
|
||||
Vector<AudioVariable> values_to_print;
|
||||
if (command_arguments.is_empty()) {
|
||||
|
@ -96,7 +96,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
}
|
||||
if (!human_mode)
|
||||
outln();
|
||||
} else if (command.equals_ignoring_case("set"sv) || command == "s") {
|
||||
} else if (command.equals_ignoring_ascii_case("set"sv) || command == "s") {
|
||||
// Set variables
|
||||
HashMap<AudioVariable, Variant<int, bool>> values_to_set;
|
||||
for (size_t i = 0; i < command_arguments.size(); ++i) {
|
||||
|
@ -119,9 +119,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
} else if (variable.is_one_of("m"sv, "mute"sv)) {
|
||||
auto& mute_text = command_arguments[++i];
|
||||
bool mute;
|
||||
if (mute_text.equals_ignoring_case("true"sv) || mute_text == "1") {
|
||||
if (mute_text.equals_ignoring_ascii_case("true"sv) || mute_text == "1") {
|
||||
mute = true;
|
||||
} else if (mute_text.equals_ignoring_case("false"sv) || mute_text == "0") {
|
||||
} else if (mute_text.equals_ignoring_ascii_case("false"sv) || mute_text == "0") {
|
||||
mute = false;
|
||||
} else {
|
||||
warnln("Error: {} is not one of {{0, 1, true, false}}", mute_text);
|
||||
|
|
|
@ -306,11 +306,11 @@ public:
|
|||
auto socket = TRY(Core::BufferedSocket<Core::TCPSocket>::create(move(underlying_socket)));
|
||||
|
||||
HTTP::HttpRequest request;
|
||||
if (method.equals_ignoring_case("head"sv))
|
||||
if (method.equals_ignoring_ascii_case("head"sv))
|
||||
request.set_method(HTTP::HttpRequest::HEAD);
|
||||
else if (method.equals_ignoring_case("get"sv))
|
||||
else if (method.equals_ignoring_ascii_case("get"sv))
|
||||
request.set_method(HTTP::HttpRequest::GET);
|
||||
else if (method.equals_ignoring_case("post"sv))
|
||||
else if (method.equals_ignoring_ascii_case("post"sv))
|
||||
request.set_method(HTTP::HttpRequest::POST);
|
||||
else
|
||||
request.set_method(HTTP::HttpRequest::Invalid);
|
||||
|
@ -385,11 +385,11 @@ public:
|
|||
auto socket = TRY(Core::BufferedSocket<TLS::TLSv12>::create(move(underlying_socket)));
|
||||
|
||||
HTTP::HttpRequest request;
|
||||
if (method.equals_ignoring_case("head"sv))
|
||||
if (method.equals_ignoring_ascii_case("head"sv))
|
||||
request.set_method(HTTP::HttpRequest::HEAD);
|
||||
else if (method.equals_ignoring_case("get"sv))
|
||||
else if (method.equals_ignoring_ascii_case("get"sv))
|
||||
request.set_method(HTTP::HttpRequest::GET);
|
||||
else if (method.equals_ignoring_case("post"sv))
|
||||
else if (method.equals_ignoring_ascii_case("post"sv))
|
||||
request.set_method(HTTP::HttpRequest::POST);
|
||||
else
|
||||
request.set_method(HTTP::HttpRequest::Invalid);
|
||||
|
@ -534,19 +534,19 @@ public:
|
|||
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(DeprecatedString const& method, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy) override
|
||||
{
|
||||
RefPtr<Web::ResourceLoaderConnectorRequest> request;
|
||||
if (url.scheme().equals_ignoring_case("http"sv)) {
|
||||
if (url.scheme().equals_ignoring_ascii_case("http"sv)) {
|
||||
auto request_or_error = HTTPHeadlessRequest::create(method, url, request_headers, request_body, proxy);
|
||||
if (request_or_error.is_error())
|
||||
return {};
|
||||
request = request_or_error.release_value();
|
||||
}
|
||||
if (url.scheme().equals_ignoring_case("https"sv)) {
|
||||
if (url.scheme().equals_ignoring_ascii_case("https"sv)) {
|
||||
auto request_or_error = HTTPSHeadlessRequest::create(method, url, request_headers, request_body, proxy);
|
||||
if (request_or_error.is_error())
|
||||
return {};
|
||||
request = request_or_error.release_value();
|
||||
}
|
||||
if (url.scheme().equals_ignoring_case("gemini"sv)) {
|
||||
if (url.scheme().equals_ignoring_ascii_case("gemini"sv)) {
|
||||
auto request_or_error = GeminiHeadlessRequest::create(method, url, request_headers, request_body, proxy);
|
||||
if (request_or_error.is_error())
|
||||
return {};
|
||||
|
|
|
@ -51,7 +51,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
|
||||
response = move(client->send_simple_command(IMAP::CommandType::Capability)->await().value().get<IMAP::SolidResponse>());
|
||||
outln("[CAPABILITY] First capability: {}", response.data().capabilities().first());
|
||||
bool idle_supported = !response.data().capabilities().find_if([](auto capability) { return capability.equals_ignoring_case("IDLE"sv); }).is_end();
|
||||
bool idle_supported = !response.data().capabilities().find_if([](auto capability) { return capability.equals_ignoring_ascii_case("IDLE"sv); }).is_end();
|
||||
|
||||
response = client->list(""sv, "*"sv)->await().release_value();
|
||||
outln("[LIST] First mailbox: {}", response.data().list_items().first().name);
|
||||
|
|
|
@ -96,7 +96,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
StringView current = TRY(infile->read_line(current_buf));
|
||||
|
||||
StringView current_to_compare = skip(current, skip_chars, skip_fields);
|
||||
bool lines_equal = ignore_case ? current_to_compare.equals_ignoring_case(previous_to_compare) : current_to_compare == previous_to_compare;
|
||||
bool lines_equal = ignore_case ? current_to_compare.equals_ignoring_ascii_case(previous_to_compare) : current_to_compare == previous_to_compare;
|
||||
if (!lines_equal) {
|
||||
TRY(write_line_content(previous, count, duplicates_only, print_count, *outfile));
|
||||
count = 1;
|
||||
|
|
Loading…
Reference in a new issue