LibWeb: Port HTMLToken::to_deprecated_string to new AK String

This commit is contained in:
Shannon Booth 2023-11-05 11:45:55 +13:00 committed by Andreas Kling
parent d00c030fce
commit 1f8d72da8e
Notes: sideshowbarker 2024-07-16 18:03:21 +09:00
5 changed files with 6 additions and 8 deletions

View file

@ -91,7 +91,7 @@ static u32 hash_tokens(Vector<Token> const& tokens)
{
StringBuilder builder;
for (auto& token : tokens)
builder.append(token.to_deprecated_string());
builder.append(token.to_string());
return (u32)builder.string_view().hash();
}

View file

@ -179,7 +179,7 @@ void HTMLParser::run()
break;
auto& token = optional_token.value();
dbgln_if(HTML_PARSER_DEBUG, "[{}] {}", insertion_mode_name(), token.to_deprecated_string());
dbgln_if(HTML_PARSER_DEBUG, "[{}] {}", insertion_mode_name(), token.to_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:

View file

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

View file

@ -7,8 +7,6 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/OwnPtr.h>
@ -322,7 +320,7 @@ public:
Type type() const { return m_type; }
DeprecatedString to_deprecated_string() const;
String to_string() const;
Position const& start_position() const { return m_start_position; }
Position const& end_position() const { return m_end_position; }

View file

@ -73,7 +73,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette)
auto token = tokenizer.next_token();
if (!token.has_value() || token.value().is_end_of_file())
break;
dbgln_if(SYNTAX_HIGHLIGHTING_DEBUG, "(HTML::SyntaxHighlighter) got token of type {}", token->to_deprecated_string());
dbgln_if(SYNTAX_HIGHLIGHTING_DEBUG, "(HTML::SyntaxHighlighter) got token of type {}", token->to_string());
if (token->is_start_tag()) {
if (token->tag_name() == "script"sv) {