mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:25:07 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -40,21 +40,21 @@ void HTMLHyperlinkElementUtils::set_the_url()
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-origin
|
||||
String HTMLHyperlinkElementUtils::origin() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::origin() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
||||
// 2. If this element's url is null, return the empty string.
|
||||
if (!m_url.has_value())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 3. Return the serialization of this element's url's origin.
|
||||
return m_url->serialize_origin();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-protocol
|
||||
String HTMLHyperlinkElementUtils::protocol() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::protocol() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -64,11 +64,11 @@ String HTMLHyperlinkElementUtils::protocol() const
|
|||
return ":"sv;
|
||||
|
||||
// 3. Return this element's url's scheme, followed by ":".
|
||||
return String::formatted("{}:", m_url->scheme());
|
||||
return DeprecatedString::formatted("{}:", m_url->scheme());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-protocol
|
||||
void HTMLHyperlinkElementUtils::set_protocol(String protocol)
|
||||
void HTMLHyperlinkElementUtils::set_protocol(DeprecatedString protocol)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -78,7 +78,7 @@ void HTMLHyperlinkElementUtils::set_protocol(String protocol)
|
|||
return;
|
||||
|
||||
// 3. Basic URL parse the given value, followed by ":", with this element's url as url and scheme start state as state override.
|
||||
auto result_url = URLParser::parse(String::formatted("{}:", protocol), nullptr, m_url, URLParser::State::SchemeStart);
|
||||
auto result_url = URLParser::parse(DeprecatedString::formatted("{}:", protocol), nullptr, m_url, URLParser::State::SchemeStart);
|
||||
if (result_url.is_valid())
|
||||
m_url = move(result_url);
|
||||
|
||||
|
@ -87,21 +87,21 @@ void HTMLHyperlinkElementUtils::set_protocol(String protocol)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-username
|
||||
String HTMLHyperlinkElementUtils::username() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::username() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
||||
// 2. If this element's url is null, return the empty string.
|
||||
if (!m_url.has_value())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 3. Return this element's url's username.
|
||||
return m_url->username();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-username
|
||||
void HTMLHyperlinkElementUtils::set_username(String username)
|
||||
void HTMLHyperlinkElementUtils::set_username(DeprecatedString username)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -121,7 +121,7 @@ void HTMLHyperlinkElementUtils::set_username(String username)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-password
|
||||
String HTMLHyperlinkElementUtils::password() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::password() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -131,14 +131,14 @@ String HTMLHyperlinkElementUtils::password() const
|
|||
|
||||
// 3. If url is null, then return the empty string.
|
||||
if (!url.has_value())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 4. Return url's password.
|
||||
return url->password();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-password
|
||||
void HTMLHyperlinkElementUtils::set_password(String password)
|
||||
void HTMLHyperlinkElementUtils::set_password(DeprecatedString password)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -158,7 +158,7 @@ void HTMLHyperlinkElementUtils::set_password(String password)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-host
|
||||
String HTMLHyperlinkElementUtils::host() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::host() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -168,18 +168,18 @@ String HTMLHyperlinkElementUtils::host() const
|
|||
|
||||
// 3. If url or url's host is null, return the empty string.
|
||||
if (!url.has_value() || url->host().is_null())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 4. If url's port is null, return url's host, serialized.
|
||||
if (!url->port().has_value())
|
||||
return url->host();
|
||||
|
||||
// 5. Return url's host, serialized, followed by ":" and url's port, serialized.
|
||||
return String::formatted("{}:{}", url->host(), url->port().value());
|
||||
return DeprecatedString::formatted("{}:{}", url->host(), url->port().value());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-host
|
||||
void HTMLHyperlinkElementUtils::set_host(String host)
|
||||
void HTMLHyperlinkElementUtils::set_host(DeprecatedString host)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -200,7 +200,7 @@ void HTMLHyperlinkElementUtils::set_host(String host)
|
|||
update_href();
|
||||
}
|
||||
|
||||
String HTMLHyperlinkElementUtils::hostname() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::hostname() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
//
|
||||
|
@ -212,7 +212,7 @@ String HTMLHyperlinkElementUtils::hostname() const
|
|||
return AK::URL(href()).host();
|
||||
}
|
||||
|
||||
void HTMLHyperlinkElementUtils::set_hostname(String hostname)
|
||||
void HTMLHyperlinkElementUtils::set_hostname(DeprecatedString hostname)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -234,7 +234,7 @@ void HTMLHyperlinkElementUtils::set_hostname(String hostname)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-port
|
||||
String HTMLHyperlinkElementUtils::port() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::port() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -244,14 +244,14 @@ String HTMLHyperlinkElementUtils::port() const
|
|||
|
||||
// 3. If url or url's port is null, return the empty string.
|
||||
if (!url.has_value() || !url->port().has_value())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 4. Return url's port, serialized.
|
||||
return String::number(url->port().value());
|
||||
return DeprecatedString::number(url->port().value());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-port
|
||||
void HTMLHyperlinkElementUtils::set_port(String port)
|
||||
void HTMLHyperlinkElementUtils::set_port(DeprecatedString port)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -277,7 +277,7 @@ void HTMLHyperlinkElementUtils::set_port(String port)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-pathname
|
||||
String HTMLHyperlinkElementUtils::pathname() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::pathname() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -286,7 +286,7 @@ String HTMLHyperlinkElementUtils::pathname() const
|
|||
|
||||
// 3. If url is null, return the empty string.
|
||||
if (!m_url.has_value())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 4. If url's cannot-be-a-base-URL is true, then return url's path[0].
|
||||
// 5. If url's path is empty, then return the empty string.
|
||||
|
@ -295,7 +295,7 @@ String HTMLHyperlinkElementUtils::pathname() const
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-pathname
|
||||
void HTMLHyperlinkElementUtils::set_pathname(String pathname)
|
||||
void HTMLHyperlinkElementUtils::set_pathname(DeprecatedString pathname)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -319,7 +319,7 @@ void HTMLHyperlinkElementUtils::set_pathname(String pathname)
|
|||
update_href();
|
||||
}
|
||||
|
||||
String HTMLHyperlinkElementUtils::search() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::search() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -328,13 +328,13 @@ String HTMLHyperlinkElementUtils::search() const
|
|||
|
||||
// 3. If url is null, or url's query is either null or the empty string, return the empty string.
|
||||
if (!m_url.has_value() || m_url->query().is_null() || m_url->query().is_empty())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 4. Return "?", followed by url's query.
|
||||
return String::formatted("?{}", m_url->query());
|
||||
return DeprecatedString::formatted("?{}", m_url->query());
|
||||
}
|
||||
|
||||
void HTMLHyperlinkElementUtils::set_search(String search)
|
||||
void HTMLHyperlinkElementUtils::set_search(DeprecatedString search)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -355,7 +355,7 @@ void HTMLHyperlinkElementUtils::set_search(String search)
|
|||
|
||||
// 2. Set url's query to the empty string.
|
||||
auto url_copy = m_url; // We copy the URL here to follow other browser's behaviour of reverting the search change if the parse failed.
|
||||
url_copy->set_query(String::empty());
|
||||
url_copy->set_query(DeprecatedString::empty());
|
||||
|
||||
// 3. Basic URL parse input, with null, this element's node document's document's character encoding, url as url, and query state as state override.
|
||||
auto result_url = URLParser::parse(input, nullptr, move(url_copy), URLParser::State::Query);
|
||||
|
@ -367,7 +367,7 @@ void HTMLHyperlinkElementUtils::set_search(String search)
|
|||
update_href();
|
||||
}
|
||||
|
||||
String HTMLHyperlinkElementUtils::hash() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::hash() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -376,13 +376,13 @@ String HTMLHyperlinkElementUtils::hash() const
|
|||
|
||||
// 3. If url is null, or url's fragment is either null or the empty string, return the empty string.
|
||||
if (!m_url.has_value() || m_url->fragment().is_null() || m_url->fragment().is_empty())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 4. Return "#", followed by url's fragment.
|
||||
return String::formatted("#{}", m_url->fragment());
|
||||
return DeprecatedString::formatted("#{}", m_url->fragment());
|
||||
}
|
||||
|
||||
void HTMLHyperlinkElementUtils::set_hash(String hash)
|
||||
void HTMLHyperlinkElementUtils::set_hash(DeprecatedString hash)
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -403,7 +403,7 @@ void HTMLHyperlinkElementUtils::set_hash(String hash)
|
|||
|
||||
// 2. Set url's fragment to the empty string.
|
||||
auto url_copy = m_url; // We copy the URL here to follow other browser's behaviour of reverting the hash change if the parse failed.
|
||||
url_copy->set_fragment(String::empty());
|
||||
url_copy->set_fragment(DeprecatedString::empty());
|
||||
|
||||
// 3. Basic URL parse input, with url as url and fragment state as state override.
|
||||
auto result_url = URLParser::parse(input, nullptr, move(url_copy), URLParser::State::Fragment);
|
||||
|
@ -416,7 +416,7 @@ void HTMLHyperlinkElementUtils::set_hash(String hash)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-href
|
||||
String HTMLHyperlinkElementUtils::href() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::href() const
|
||||
{
|
||||
// 1. Reinitialize url.
|
||||
reinitialize_url();
|
||||
|
@ -427,7 +427,7 @@ String HTMLHyperlinkElementUtils::href() const
|
|||
// 3. If url is null and this element has no href content attribute, return the empty string.
|
||||
auto href_content_attribute = hyperlink_element_utils_href();
|
||||
if (!url.has_value() && href_content_attribute.is_null())
|
||||
return String::empty();
|
||||
return DeprecatedString::empty();
|
||||
|
||||
// 4. Otherwise, if url is null, return this element's href content attribute's value.
|
||||
if (!url->is_valid())
|
||||
|
@ -438,7 +438,7 @@ String HTMLHyperlinkElementUtils::href() const
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-href
|
||||
void HTMLHyperlinkElementUtils::set_href(String href)
|
||||
void HTMLHyperlinkElementUtils::set_href(DeprecatedString href)
|
||||
{
|
||||
// The href attribute's setter must set this element's href content attribute's value to the given value.
|
||||
set_hyperlink_element_utils_href(move(href));
|
||||
|
@ -467,7 +467,7 @@ bool HTMLHyperlinkElementUtils::cannot_navigate() const
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks-2
|
||||
void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_suffix)
|
||||
void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<DeprecatedString> hyperlink_suffix)
|
||||
{
|
||||
// To follow the hyperlink created by an element subject, given an optional hyperlinkSuffix (default null):
|
||||
|
||||
|
@ -485,7 +485,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_
|
|||
// 4. Let targetAttributeValue be the empty string.
|
||||
// 5. If subject is an a or area element, then set targetAttributeValue to
|
||||
// the result of getting an element's target given subject.
|
||||
String target_attribute_value = get_an_elements_target();
|
||||
DeprecatedString target_attribute_value = get_an_elements_target();
|
||||
|
||||
// 6. Let noopener be the result of getting an element's noopener with subject and targetAttributeValue.
|
||||
bool noopener = get_an_elements_noopener(target_attribute_value);
|
||||
|
@ -539,7 +539,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_
|
|||
});
|
||||
}
|
||||
|
||||
String HTMLHyperlinkElementUtils::get_an_elements_target() const
|
||||
DeprecatedString HTMLHyperlinkElementUtils::get_an_elements_target() const
|
||||
{
|
||||
// To get an element's target, given an a, area, or form element element, run these steps:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue