mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibWeb: Make StyleValue::to_string() infallible
This commit is contained in:
@@ -59,24 +59,23 @@ struct ColorStopListElement {
|
||||
using LinearColorStopListElement = ColorStopListElement<LengthPercentage>;
|
||||
using AngularColorStopListElement = ColorStopListElement<AnglePercentage>;
|
||||
|
||||
static ErrorOr<void> serialize_color_stop_list(StringBuilder& builder, auto const& color_stop_list)
|
||||
static void serialize_color_stop_list(StringBuilder& builder, auto const& color_stop_list)
|
||||
{
|
||||
bool first = true;
|
||||
for (auto const& element : color_stop_list) {
|
||||
if (!first)
|
||||
TRY(builder.try_append(", "sv));
|
||||
builder.append(", "sv);
|
||||
|
||||
if (element.transition_hint.has_value())
|
||||
TRY(builder.try_appendff("{}, "sv, element.transition_hint->value.to_string()));
|
||||
builder.appendff("{}, "sv, element.transition_hint->value.to_string());
|
||||
|
||||
TRY(builder.try_append(TRY(element.color_stop.color->to_string())));
|
||||
builder.append(element.color_stop.color->to_string());
|
||||
for (auto position : Array { &element.color_stop.position, &element.color_stop.second_position }) {
|
||||
if (position->has_value())
|
||||
TRY(builder.try_appendff(" {}"sv, (*position)->to_string()));
|
||||
builder.appendff(" {}"sv, (*position)->to_string());
|
||||
}
|
||||
first = false;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user