diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-06-09 17:52:59 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-06-11 15:09:10 +0100 |
commit | 409aa04d9de6bc570db3f4125405be6c44988700 (patch) | |
tree | 6259760d7a69e0a32b15d6a95b1ef7d432091878 /src/libserver/css | |
parent | 49584cd1a3e18c3d7fcc5a2fd261fc86efbcb802 (diff) | |
download | rspamd-409aa04d9de6bc570db3f4125405be6c44988700.tar.gz rspamd-409aa04d9de6bc570db3f4125405be6c44988700.zip |
[Rework] Html/Css: Start rework of the html blocks
Diffstat (limited to 'src/libserver/css')
-rw-r--r-- | src/libserver/css/css_value.hxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libserver/css/css_value.hxx b/src/libserver/css/css_value.hxx index 82f65e3e9..a7b9a9b47 100644 --- a/src/libserver/css/css_value.hxx +++ b/src/libserver/css/css_value.hxx @@ -49,6 +49,13 @@ struct alignas(int) css_color { friend bool operator==(const css_color& l, const css_color& r) { return (memcmp(&l, &r, sizeof(css_color)) == 0); } + + static auto white() -> css_color { + return css_color{255, 255, 255}; + } + static auto black() -> css_color { + return css_color{0, 0, 0}; + } }; struct css_dimension { @@ -59,7 +66,7 @@ struct css_dimension { /* * Simple enum class for display stuff */ -enum class css_display_value { +enum class css_display_value : std::uint8_t { DISPLAY_NORMAL, DISPLAY_HIDDEN }; @@ -70,7 +77,7 @@ enum class css_display_value { */ struct css_value { std::variant<css_color, - double, + float, css_display_value, css_dimension, std::monostate> value; @@ -78,7 +85,7 @@ struct css_value { css_value() {} css_value(const css_color &color) : value(color) {} - css_value(double num) : + css_value(float num) : value(num) {} css_value(css_dimension dim) : value(dim) {} @@ -89,8 +96,8 @@ struct css_value { return extract_value_maybe<css_color>(); } - auto to_number(void) const -> std::optional<double> { - return extract_value_maybe<double>(); + auto to_number(void) const -> std::optional<float> { + return extract_value_maybe<float>(); } auto to_dimension(void) const -> std::optional<css_dimension> { |