mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
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:
committed by
Jelle Raaijmakers
parent
4b556feecf
commit
a27d269721
Notes:
github-actions[bot]
2026-01-09 09:02:40 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a27d269721e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7381 Reviewed-by: https://github.com/gmta ✅
@@ -41,14 +41,20 @@ void serialize_color_stop_list(StringBuilder& builder, Vector<ColorStopListEleme
|
||||
if (!first)
|
||||
builder.append(", "sv);
|
||||
|
||||
if (element.transition_hint)
|
||||
builder.appendff("{}, "sv, element.transition_hint->to_string(mode));
|
||||
if (element.transition_hint) {
|
||||
element.transition_hint->serialize(builder, mode);
|
||||
builder.append(", "sv);
|
||||
}
|
||||
|
||||
builder.append(element.color_stop.color->to_string(mode));
|
||||
if (element.color_stop.position)
|
||||
builder.appendff(" {}"sv, element.color_stop.position->to_string(mode));
|
||||
if (element.color_stop.second_position)
|
||||
builder.appendff(" {}"sv, element.color_stop.second_position->to_string(mode));
|
||||
element.color_stop.color->serialize(builder, mode);
|
||||
if (element.color_stop.position) {
|
||||
builder.append(' ');
|
||||
element.color_stop.position->serialize(builder, mode);
|
||||
}
|
||||
if (element.color_stop.second_position) {
|
||||
builder.append(' ');
|
||||
element.color_stop.second_position->serialize(builder, mode);
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user