1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

LibWeb: Add partial serialization for CSSFontFaceRule

This partially adds serialization code for
`CSSFontFaceRule::serialized()` to spec. This is only partially
implemented as some parts of the `@font-face` rule are not implemented
yet.
This commit is contained in:
electrikmilk 2022-09-11 12:20:16 -04:00 committed by Sam Atkins
parent b0f9ad0000
commit fdd202259d
3 changed files with 109 additions and 2 deletions

View file

@ -117,6 +117,24 @@ void serialize_a_url(StringBuilder& builder, StringView url)
builder.append(')');
}
// https://www.w3.org/TR/cssom-1/#serialize-a-local
void serialize_a_local(StringBuilder& builder, StringView path)
{
// To serialize a LOCAL means to create a string represented by "local(",
// followed by the serialization of the LOCAL as a string, followed by ")".
builder.append("local("sv);
serialize_a_string(builder, path.to_string());
builder.append(')');
}
// NOTE: No spec currently exists for serializing a <'unicode-range'>.
void serialize_unicode_ranges(StringBuilder& builder, Vector<UnicodeRange> const& unicode_ranges)
{
serialize_a_comma_separated_list(builder, unicode_ranges, [&](UnicodeRange unicode_range) {
serialize_a_string(builder, unicode_range.to_string());
});
}
// https://www.w3.org/TR/css-color-4/#serializing-sRGB-values
void serialize_a_srgb_value(StringBuilder& builder, Color color)
{