From b34950a8258ae88e039720cf85864c37236616c1 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 19 Jan 2022 17:30:29 +0000 Subject: LibWeb: Add Formatters for Length, Percentage and LengthPercentage --- Userland/Libraries/LibWeb/CSS/Length.h | 8 ++++++++ Userland/Libraries/LibWeb/CSS/Percentage.h | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'Userland/Libraries/LibWeb') diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index db84635bd3..ed7335c6a2 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -147,3 +147,11 @@ private: }; } + +template<> +struct AK::Formatter : Formatter { + ErrorOr format(FormatBuilder& builder, Web::CSS::Length const& length) + { + return Formatter::format(builder, length.to_string()); + } +}; diff --git a/Userland/Libraries/LibWeb/CSS/Percentage.h b/Userland/Libraries/LibWeb/CSS/Percentage.h index 86dce08e6d..74ad35989e 100644 --- a/Userland/Libraries/LibWeb/CSS/Percentage.h +++ b/Userland/Libraries/LibWeb/CSS/Percentage.h @@ -139,3 +139,19 @@ public: }; } + +template<> +struct AK::Formatter : Formatter { + ErrorOr format(FormatBuilder& builder, Web::CSS::Percentage const& percentage) + { + return Formatter::format(builder, percentage.to_string()); + } +}; + +template<> +struct AK::Formatter : Formatter { + ErrorOr format(FormatBuilder& builder, Web::CSS::LengthPercentage const& length_percentage) + { + return Formatter::format(builder, length_percentage.to_string()); + } +}; -- cgit v1.2.3