1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:25:10 +00:00

LibWeb: Use getter and setter for Character type HTMLTokens

While storing the code point in a UTF-8 encoded String in horrendously
inefficient, this problem will be addressed at a later stage.
This commit is contained in:
Max Wipfli 2021-07-14 23:33:12 +02:00 committed by Ali Mohammad Pur
parent e8e9426b4f
commit 1aeafcc58b
2 changed files with 26 additions and 23 deletions

View file

@ -50,10 +50,7 @@ public:
{
HTMLToken token;
token.m_type = Type::Character;
StringBuilder builder;
// FIXME: This narrows code_point to char, should this be append_code_point() instead?
builder.append(code_point);
token.m_comment_or_character.data = builder.to_string();
token.set_code_point(code_point);
return token;
}
@ -97,6 +94,14 @@ public:
}
}
void set_code_point(u32 code_point)
{
VERIFY(is_character());
StringBuilder builder;
builder.append_code_point(code_point);
m_comment_or_character.data = builder.to_string();
}
String const& comment() const
{
VERIFY(is_comment());