1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

AK: Port URL scheme from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-08-12 16:52:41 +12:00 committed by Andrew Kaster
parent 21fe86d235
commit c25485700a
16 changed files with 30 additions and 30 deletions

View file

@ -50,7 +50,7 @@ void LocationEdit::highlight_location()
QList<QInputMethodEvent::Attribute> attributes;
if (url.is_valid() && !hasFocus()) {
if (url.scheme() == "http" || url.scheme() == "https" || url.scheme() == "gemini") {
int host_start = (url.scheme().length() + 3) - cursorPosition();
int host_start = (url.scheme().bytes_as_string_view().length() + 3) - cursorPosition();
auto host_length = url.serialized_host().release_value_but_fixme_should_propagate_errors().bytes().size();
// FIXME: Maybe add a generator to use https://publicsuffix.org/list/public_suffix_list.dat
@ -79,7 +79,7 @@ void LocationEdit::highlight_location()
attributes.append({
QInputMethodEvent::TextFormat,
-cursorPosition(),
static_cast<int>(url.scheme().length() + 3),
static_cast<int>(url.scheme().bytes_as_string_view().length() + 3),
schemeFormat,
});
}

View file

@ -26,7 +26,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_ascii_case("http"sv, "https"sv)) {
if (!url.scheme().bytes_as_string_view().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);