1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:17:46 +00:00

LibWeb: Sort and group CSS Length units as they are in the spec

They previously weren't sorted at all. Alphabetical would be nice, but
then things like `em` and `rem` would be separated. So, let's copy the
spec's order. That way it's easier to keep track of which units we have
or haven't implemented. (Since there are so many...)
This commit is contained in:
Sam Atkins 2023-04-24 14:34:44 +01:00 committed by Andreas Kling
parent e54ee7de96
commit 6ea84a7c87
2 changed files with 81 additions and 74 deletions

View file

@ -17,24 +17,31 @@ namespace Web::CSS {
class Length {
public:
enum class Type {
Auto,
Cm,
In,
Mm,
Q,
Px,
Pt,
Pc,
Ex,
// Font-relative
Em,
Ch,
Rem,
Vh,
Vw,
Vmax,
Vmin,
Ex,
Ch,
Lh,
Rlh,
// Viewport-relative
Vw,
Vh,
Vmin,
Vmax,
// Absolute
Cm,
Mm,
Q,
In,
Pt,
Pc,
Px,
// FIXME: Remove auto somehow
Auto,
};
static Optional<Type> unit_from_name(StringView);