diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Resolution.h')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Resolution.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Resolution.h b/Userland/Libraries/LibWeb/CSS/Resolution.h index 390f6b2aa8..6a693775d3 100644 --- a/Userland/Libraries/LibWeb/CSS/Resolution.h +++ b/Userland/Libraries/LibWeb/CSS/Resolution.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org> + * Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -32,6 +32,18 @@ public: return m_type == other.m_type && m_value == other.m_value; } + int operator<=>(Resolution const& other) const + { + auto this_dots_per_pixel = to_dots_per_pixel(); + auto other_dots_per_pixel = other.to_dots_per_pixel(); + + if (this_dots_per_pixel < other_dots_per_pixel) + return -1; + if (this_dots_per_pixel > other_dots_per_pixel) + return 1; + return 0; + } + private: StringView unit_name() const; |