LibWeb/CSS: Extract SerializationMode into its own header

Prep for using this to serialize dimension types, and perhaps other
things in the future.
This commit is contained in:
Sam Atkins 2025-05-16 19:20:24 +01:00 committed by Tim Ledbetter
commit eec4365542
Notes: github-actions[bot] 2025-05-17 06:54:49 +00:00
26 changed files with 112 additions and 99 deletions

View file

@ -64,7 +64,7 @@ String CSSFontFaceRule::serialized() const
builder.append("font-family: "sv);
// 3. The result of performing serialize a string on the rules font family name.
builder.append(descriptors.descriptor(DescriptorID::FontFamily)->to_string(CSSStyleValue::SerializationMode::Normal));
builder.append(descriptors.descriptor(DescriptorID::FontFamily)->to_string(SerializationMode::Normal));
// 4. The string ";", i.e., SEMICOLON (U+003B).
builder.append(';');
@ -75,7 +75,7 @@ String CSSFontFaceRule::serialized() const
builder.append(" src: "sv);
// 2. The result of invoking serialize a comma-separated list on performing serialize a URL or serialize a LOCAL for each source on the source list.
builder.append(sources->to_string(CSSStyleValue::SerializationMode::Normal));
builder.append(sources->to_string(SerializationMode::Normal));
// 3. The string ";", i.e., SEMICOLON (U+003B).
builder.append(';');
@ -84,7 +84,7 @@ String CSSFontFaceRule::serialized() const
// 6. If rules associated unicode-range descriptor is present, a single SPACE (U+0020), followed by the string "unicode-range:", followed by a single SPACE (U+0020), followed by the result of performing serialize a <'unicode-range'>, followed by the string ";", i.e., SEMICOLON (U+003B).
if (auto unicode_range = descriptors.descriptor(DescriptorID::UnicodeRange)) {
builder.append(" unicode-range: "sv);
builder.append(unicode_range->to_string(CSSStyleValue::SerializationMode::Normal));
builder.append(unicode_range->to_string(SerializationMode::Normal));
builder.append(';');
}
@ -99,7 +99,7 @@ String CSSFontFaceRule::serialized() const
// followed by the string ";", i.e., SEMICOLON (U+003B).
if (auto font_feature_settings = descriptors.descriptor(DescriptorID::FontFeatureSettings)) {
builder.append(" font-feature-settings: "sv);
builder.append(font_feature_settings->to_string(CSSStyleValue::SerializationMode::Normal));
builder.append(font_feature_settings->to_string(SerializationMode::Normal));
builder.append(";"sv);
}
@ -110,7 +110,7 @@ String CSSFontFaceRule::serialized() const
// NOTE: font-stretch is now an alias for font-width, so we use that instead.
if (auto font_width = descriptors.descriptor(DescriptorID::FontWidth)) {
builder.append(" font-stretch: "sv);
builder.append(font_width->to_string(CSSStyleValue::SerializationMode::Normal));
builder.append(font_width->to_string(SerializationMode::Normal));
builder.append(";"sv);
}
@ -120,7 +120,7 @@ String CSSFontFaceRule::serialized() const
// followed by the string ";", i.e., SEMICOLON (U+003B).
if (auto font_weight = descriptors.descriptor(DescriptorID::FontWeight)) {
builder.append(" font-weight: "sv);
builder.append(font_weight->to_string(CSSStyleValue::SerializationMode::Normal));
builder.append(font_weight->to_string(SerializationMode::Normal));
builder.append(";"sv);
}
@ -130,7 +130,7 @@ String CSSFontFaceRule::serialized() const
// followed by the string ";", i.e., SEMICOLON (U+003B).
if (auto font_style = descriptors.descriptor(DescriptorID::FontStyle)) {
builder.append(" font-style: "sv);
builder.append(font_style->to_string(CSSStyleValue::SerializationMode::Normal));
builder.append(font_style->to_string(SerializationMode::Normal));
builder.append(";"sv);
}