diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2021-10-17 19:54:07 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-17 19:59:27 +0100 |
commit | 0588db5c30875d2b5087300a3b352cd4cd699ba5 (patch) | |
tree | 52f3d3e2537f276b00c901cb3b3f316566aba41b /Userland/Libraries/LibWeb/CSS | |
parent | 48687c3fbb3083d364b1257c3c000e4860b2fb48 (diff) | |
download | serenity-0588db5c30875d2b5087300a3b352cd4cd699ba5.zip |
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?
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Serialize.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Serialize.h | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Serialize.cpp b/Userland/Libraries/LibWeb/CSS/Serialize.cpp index 7e1d6f3a19..07e8eb7555 100644 --- a/Userland/Libraries/LibWeb/CSS/Serialize.cpp +++ b/Userland/Libraries/LibWeb/CSS/Serialize.cpp @@ -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 ")". diff --git a/Userland/Libraries/LibWeb/CSS/Serialize.h b/Userland/Libraries/LibWeb/CSS/Serialize.h index 8b0f240008..01281efbbb 100644 --- a/Userland/Libraries/LibWeb/CSS/Serialize.h +++ b/Userland/Libraries/LibWeb/CSS/Serialize.h @@ -12,11 +12,11 @@ namespace Web::CSS { -void escape_a_character(StringBuilder, u32 character); -void escape_a_character_as_code_point(StringBuilder, u32 character); -void serialize_an_identifier(StringBuilder, StringView const& ident); -void serialize_a_string(StringBuilder, StringView const& string); -void serialize_a_url(StringBuilder, StringView const& url); +void escape_a_character(StringBuilder&, u32 character); +void escape_a_character_as_code_point(StringBuilder&, u32 character); +void serialize_an_identifier(StringBuilder&, StringView const& ident); +void serialize_a_string(StringBuilder&, StringView const& string); +void serialize_a_url(StringBuilder&, StringView const& url); String escape_a_character(u32 character); String escape_a_character_as_code_point(u32 character); |