summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-02-13 17:42:27 +0000
committerTim Flynn <trflynn89@pm.me>2023-02-15 12:48:26 -0500
commitabc01cc9fe45e7cfff195244773d1ddbeeea7c8d (patch)
tree83c9a6366d9a94d3bfb0fe982fbcb23f81fd4a2f
parent8af65108e4cff13993cd69d74b44acd5d3e9ee32 (diff)
downloadserenity-abc01cc9fe45e7cfff195244773d1ddbeeea7c8d.zip
AK+Tests+LibWeb: Make `URL::complete_url()` take a StringView
All it does is pass this to `URLParser::parse()` which takes a StringView, so we might as well take one here too.
-rw-r--r--AK/URL.cpp4
-rw-r--r--AK/URL.h2
-rw-r--r--Tests/AK/TestURL.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp4
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.h2
5 files changed, 7 insertions, 7 deletions
diff --git a/AK/URL.cpp b/AK/URL.cpp
index bf0acc0dfe..303b9a7356 100644
--- a/AK/URL.cpp
+++ b/AK/URL.cpp
@@ -39,12 +39,12 @@ DeprecatedString URL::path() const
return builder.to_deprecated_string();
}
-URL URL::complete_url(DeprecatedString const& string) const
+URL URL::complete_url(StringView relative_url) const
{
if (!is_valid())
return {};
- return URLParser::parse(string, this);
+ return URLParser::parse(relative_url, this);
}
void URL::set_scheme(DeprecatedString scheme)
diff --git a/AK/URL.h b/AK/URL.h
index ef98d869e4..c4fc76506b 100644
--- a/AK/URL.h
+++ b/AK/URL.h
@@ -88,7 +88,7 @@ public:
bool equals(URL const& other, ExcludeFragment = ExcludeFragment::No) const;
- URL complete_url(DeprecatedString const&) const;
+ URL complete_url(StringView) const;
bool data_payload_is_base64() const { return m_data_payload_is_base64; }
DeprecatedString const& data_mime_type() const { return m_data_mime_type; }
diff --git a/Tests/AK/TestURL.cpp b/Tests/AK/TestURL.cpp
index 8df7c7212d..4ec7e35283 100644
--- a/Tests/AK/TestURL.cpp
+++ b/Tests/AK/TestURL.cpp
@@ -403,7 +403,7 @@ TEST_CASE(complete_file_url_with_base)
EXPECT_EQ(url.paths()[0], "home");
EXPECT_EQ(url.paths()[1], "index.html");
- auto sub_url = url.complete_url("js/app.js");
+ auto sub_url = url.complete_url("js/app.js"sv);
EXPECT(sub_url.is_valid());
EXPECT_EQ(sub_url.path(), "/home/js/app.js");
}
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index b41441d9f0..f264d30c24 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -77,9 +77,9 @@ bool ParsingContext::in_quirks_mode() const
}
// https://www.w3.org/TR/css-values-4/#relative-urls
-AK::URL ParsingContext::complete_url(DeprecatedString const& addr) const
+AK::URL ParsingContext::complete_url(StringView relative_url) const
{
- return m_url.complete_url(addr);
+ return m_url.complete_url(relative_url);
}
Parser::Parser(ParsingContext const& context, StringView input, StringView encoding)
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
index d97f98f7ec..eabad979e6 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
@@ -43,7 +43,7 @@ public:
bool in_quirks_mode() const;
DOM::Document const* document() const { return m_document; }
- AK::URL complete_url(DeprecatedString const&) const;
+ AK::URL complete_url(StringView) const;
PropertyID current_property_id() const { return m_current_property_id; }
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }