LibWeb: Pass StringBuilder around during StyleValue serialization

Previously, some StyleValues created a large number of intermediate
strings during serialization. Passing a StringBUilder into the
serialization function allows us to avoid a large number of these
unnecessary allocations.
This commit is contained in:
Tim Ledbetter
2026-01-08 12:02:18 +00:00
committed by Jelle Raaijmakers
parent 4b556feecf
commit a27d269721
Notes: github-actions[bot] 2026-01-09 09:02:40 +00:00
136 changed files with 663 additions and 557 deletions

View File

@@ -12,16 +12,16 @@
namespace Web::CSS {
String TreeCountingFunctionStyleValue::to_string(SerializationMode) const
void TreeCountingFunctionStyleValue::serialize(StringBuilder& builder, SerializationMode) const
{
switch (m_function) {
case TreeCountingFunction::SiblingCount:
return "sibling-count()"_string;
builder.append("sibling-count()"sv);
break;
case TreeCountingFunction::SiblingIndex:
return "sibling-index()"_string;
builder.append("sibling-index()"sv);
break;
}
VERIFY_NOT_REACHED();
}
size_t TreeCountingFunctionStyleValue::resolve(DOM::AbstractElement const& abstract_element) const