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

LibWeb: Make StyleValue::to_string() infallible

This commit is contained in:
Sam Atkins 2023-08-22 14:08:15 +01:00 committed by Sam Atkins
parent ccfe197e5a
commit 7fe97ee6c5
112 changed files with 425 additions and 430 deletions

View file

@ -13,7 +13,7 @@
namespace Web::CSS {
ErrorOr<String> EasingStyleValue::to_string() const
String EasingStyleValue::to_string() const
{
if (m_properties.easing_function == EasingFunction::StepStart)
return "steps(1, start)"_string;
@ -21,20 +21,20 @@ ErrorOr<String> EasingStyleValue::to_string() const
return "steps(1, end)"_string;
StringBuilder builder;
TRY(builder.try_append(CSS::to_string(m_properties.easing_function)));
builder.append(CSS::to_string(m_properties.easing_function));
if (m_properties.values.is_empty())
return builder.to_string();
return MUST(builder.to_string());
TRY(builder.try_append('('));
builder.append('(');
for (size_t i = 0; i < m_properties.values.size(); ++i) {
TRY(builder.try_append(TRY(m_properties.values[i]->to_string())));
builder.append(m_properties.values[i]->to_string());
if (i != m_properties.values.size() - 1)
TRY(builder.try_append(", "sv));
builder.append(", "sv);
}
TRY(builder.try_append(')'));
builder.append(')');
return builder.to_string();
return MUST(builder.to_string());
}
bool EasingStyleValue::Properties::operator==(Properties const& other) const