1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibWeb: Support "pt" length units :^)

This commit is contained in:
Andreas Kling 2020-06-28 15:25:32 +02:00
parent 7fc988b919
commit 7d3c8d066f
3 changed files with 9 additions and 23 deletions

View file

@ -47,6 +47,8 @@ const char* Length::unit_name() const
switch (m_type) {
case Type::Px:
return "px";
case Type::Pt:
return "pt";
case Type::Em:
return "em";
case Type::Rem:

View file

@ -38,6 +38,7 @@ public:
Percentage,
Auto,
Px,
Pt,
Em,
Rem,
};
@ -82,7 +83,7 @@ public:
bool is_undefined() const { return m_type == Type::Undefined; }
bool is_percentage() const { return m_type == Type::Percentage; }
bool is_auto() const { return m_type == Type::Auto; }
bool is_absolute() const { return m_type == Type::Px; }
bool is_absolute() const { return m_type == Type::Px || m_type == Type::Pt; }
bool is_relative() const { return m_type == Type::Em || m_type == Type::Rem; }
float raw_value() const { return m_value; }
@ -95,6 +96,8 @@ public:
return 0;
case Type::Px:
return m_value;
case Type::Pt:
return m_value * 1.33333333f;
case Type::Undefined:
case Type::Percentage:
default: