mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:17:44 +00:00
LibWeb: Add Formatters for Length, Percentage and LengthPercentage
This commit is contained in:
parent
bfcbab0dcf
commit
b34950a825
2 changed files with 24 additions and 0 deletions
|
@ -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());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -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());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue