mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibWeb: Make the CSS serialization functions actually output things :^)
Pro tip: If your function takes a StringBuilder by value, it doesn't actually append anything to the caller's StringBuilder. On the plus side, I probably won't make this mistake for a while? I hope?
This commit is contained in:
@@ -11,20 +11,20 @@
|
||||
namespace Web::CSS {
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#escape-a-character
|
||||
void escape_a_character(StringBuilder builder, u32 character)
|
||||
void escape_a_character(StringBuilder& builder, u32 character)
|
||||
{
|
||||
builder.append('\\');
|
||||
builder.append_code_point(character);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#escape-a-character-as-code-point
|
||||
void escape_a_character_as_code_point(StringBuilder builder, u32 character)
|
||||
void escape_a_character_as_code_point(StringBuilder& builder, u32 character)
|
||||
{
|
||||
builder.appendff("\\{:x} ", character);
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#serialize-an-identifier
|
||||
void serialize_an_identifier(StringBuilder builder, StringView const& ident)
|
||||
void serialize_an_identifier(StringBuilder& builder, StringView const& ident)
|
||||
{
|
||||
Utf8View characters { ident };
|
||||
auto first_character = characters.is_empty() ? 0 : *characters.begin();
|
||||
@@ -76,7 +76,7 @@ void serialize_an_identifier(StringBuilder builder, StringView const& ident)
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#serialize-a-string
|
||||
void serialize_a_string(StringBuilder builder, StringView const& string)
|
||||
void serialize_a_string(StringBuilder& builder, StringView const& string)
|
||||
{
|
||||
Utf8View characters { string };
|
||||
|
||||
@@ -108,7 +108,7 @@ void serialize_a_string(StringBuilder builder, StringView const& string)
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#serialize-a-url
|
||||
void serialize_a_url(StringBuilder builder, StringView const& url)
|
||||
void serialize_a_url(StringBuilder& builder, StringView const& url)
|
||||
{
|
||||
// To serialize a URL means to create a string represented by "url(",
|
||||
// followed by the serialization of the URL as a string, followed by ")".
|
||||
|
||||
Reference in New Issue
Block a user