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

LibWeb: Add Formatters for Length, Percentage and LengthPercentage

This commit is contained in:
Sam Atkins 2022-01-19 17:30:29 +00:00 committed by Andreas Kling
parent bfcbab0dcf
commit b34950a825
2 changed files with 24 additions and 0 deletions

View file

@ -147,3 +147,11 @@ private:
};
}
template<>
struct AK::Formatter<Web::CSS::Length> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Length const& length)
{
return Formatter<StringView>::format(builder, length.to_string());
}
};

View file

@ -139,3 +139,19 @@ public:
};
}
template<>
struct AK::Formatter<Web::CSS::Percentage> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Percentage const& percentage)
{
return Formatter<StringView>::format(builder, percentage.to_string());
}
};
template<>
struct AK::Formatter<Web::CSS::LengthPercentage> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::LengthPercentage const& length_percentage)
{
return Formatter<StringView>::format(builder, length_percentage.to_string());
}
};