1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:07:35 +00:00

Everywhere: Rename to_{string => deprecated_string}() where applicable

This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
This commit is contained in:
Linus Groh 2022-12-06 01:12:49 +00:00 committed by Andreas Kling
parent 6e19ab2bbc
commit 57dc179b1f
597 changed files with 1973 additions and 1972 deletions

View file

@ -109,7 +109,7 @@ JS::GCPtr<DOM::Attr> prescan_get_attribute(DOM::Document& document, ByteBuffer c
} else if (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ')
goto spaces;
else if (input[position] == '/' || input[position] == '>')
return *DOM::Attr::create(document, attribute_name.to_string(), "");
return *DOM::Attr::create(document, attribute_name.to_deprecated_string(), "");
else
attribute_name.append_as_lowercase(input[position]);
++position;
@ -121,7 +121,7 @@ spaces:
if (!prescan_skip_whitespace_and_slashes(input, position))
return {};
if (input[position] != '=')
return DOM::Attr::create(document, attribute_name.to_string(), "");
return DOM::Attr::create(document, attribute_name.to_deprecated_string(), "");
++position;
value:
@ -134,13 +134,13 @@ value:
++position;
for (; !prescan_should_abort(input, position); ++position) {
if (input[position] == quote_character)
return DOM::Attr::create(document, attribute_name.to_string(), attribute_value.to_string());
return DOM::Attr::create(document, attribute_name.to_deprecated_string(), attribute_value.to_deprecated_string());
else
attribute_value.append_as_lowercase(input[position]);
}
return {};
} else if (input[position] == '>')
return DOM::Attr::create(document, attribute_name.to_string(), "");
return DOM::Attr::create(document, attribute_name.to_deprecated_string(), "");
else
attribute_value.append_as_lowercase(input[position]);
@ -150,7 +150,7 @@ value:
for (; !prescan_should_abort(input, position); ++position) {
if (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ' || input[position] == '>')
return DOM::Attr::create(document, attribute_name.to_string(), attribute_value.to_string());
return DOM::Attr::create(document, attribute_name.to_deprecated_string(), attribute_value.to_deprecated_string());
else
attribute_value.append_as_lowercase(input[position]);
}

View file

@ -170,7 +170,7 @@ void HTMLParser::run()
break;
auto& token = optional_token.value();
dbgln_if(HTML_PARSER_DEBUG, "[{}] {}", insertion_mode_name(), token.to_string());
dbgln_if(HTML_PARSER_DEBUG, "[{}] {}", insertion_mode_name(), token.to_deprecated_string());
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
// As each token is emitted from the tokenizer, the user agent must follow the appropriate steps from the following list, known as the tree construction dispatcher:
@ -954,7 +954,7 @@ void HTMLParser::flush_character_insertions()
{
if (m_character_insertion_builder.is_empty())
return;
m_character_insertion_node->set_data(m_character_insertion_builder.to_string());
m_character_insertion_node->set_data(m_character_insertion_builder.to_deprecated_string());
m_character_insertion_node->parent()->children_changed();
m_character_insertion_builder.clear();
}
@ -3604,7 +3604,7 @@ DeprecatedString HTMLParser::serialize_html_fragment(DOM::Node const& node)
else
builder.append(ch);
}
return builder.to_string();
return builder.to_deprecated_string();
};
// 2. Let s be a string, and initialize it to the empty string.
@ -3752,7 +3752,7 @@ DeprecatedString HTMLParser::serialize_html_fragment(DOM::Node const& node)
});
// 5. Return s.
return builder.to_string();
return builder.to_deprecated_string();
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#current-dimension-value

View file

@ -8,7 +8,7 @@
namespace Web::HTML {
DeprecatedString HTMLToken::to_string() const
DeprecatedString HTMLToken::to_deprecated_string() const
{
StringBuilder builder;
@ -70,7 +70,7 @@ DeprecatedString HTMLToken::to_string() const
builder.appendff("@{}:{}-{}:{}", m_start_position.line, m_start_position.column, m_end_position.line, m_end_position.column);
}
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -315,7 +315,7 @@ public:
Type type() const { return m_type; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Position const& start_position() const { return m_start_position; }
Position const& end_position() const { return m_end_position; }

View file

@ -2887,7 +2887,7 @@ void HTMLTokenizer::restore_to(Utf8CodePointIterator const& new_iterator)
DeprecatedString HTMLTokenizer::consume_current_builder()
{
auto string = m_current_builder.to_string();
auto string = m_current_builder.to_deprecated_string();
m_current_builder.clear();
return string;
}