mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
LibWeb: Make serializing basic CSS types infallible
This commit is contained in:
parent
b5893ee115
commit
6bee81cfb6
38 changed files with 128 additions and 121 deletions
|
@ -70,11 +70,11 @@ public:
|
|||
return { Type::Number, m_value / other.m_value };
|
||||
}
|
||||
|
||||
ErrorOr<String> to_string() const
|
||||
String to_string() const
|
||||
{
|
||||
if (m_type == Type::IntegerWithExplicitSign)
|
||||
return String::formatted("{:+}", m_value);
|
||||
return String::number(m_value);
|
||||
return MUST(String::formatted("{:+}", m_value));
|
||||
return MUST(String::number(m_value));
|
||||
}
|
||||
|
||||
bool operator==(Number const& other) const
|
||||
|
@ -101,6 +101,6 @@ template<>
|
|||
struct AK::Formatter<Web::CSS::Number> : Formatter<StringView> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Number const& number)
|
||||
{
|
||||
return Formatter<StringView>::format(builder, TRY(number.to_string()));
|
||||
return Formatter<StringView>::format(builder, number.to_string());
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue