mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
LibWeb: Add support for viewport-relative length units (#3433)
We can now use vh, vw, vmax and vmin as length units in CSS.
This commit is contained in:
parent
d467a0ffef
commit
dcc2c8a125
3 changed files with 49 additions and 1 deletions
|
@ -42,6 +42,10 @@ public:
|
|||
Ex,
|
||||
Em,
|
||||
Rem,
|
||||
Vh,
|
||||
Vw,
|
||||
Vmax,
|
||||
Vmin,
|
||||
};
|
||||
|
||||
Length() { }
|
||||
|
@ -85,7 +89,16 @@ public:
|
|||
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 || m_type == Type::Pt; }
|
||||
bool is_relative() const { return m_type == Type::Ex || m_type == Type::Em || m_type == Type::Rem; }
|
||||
bool is_relative() const
|
||||
{
|
||||
return m_type == Type::Ex
|
||||
|| m_type == Type::Em
|
||||
|| m_type == Type::Rem
|
||||
|| m_type == Type::Vh
|
||||
|| m_type == Type::Vw
|
||||
|| m_type == Type::Vmax
|
||||
|| m_type == Type::Vmin;
|
||||
}
|
||||
|
||||
float raw_value() const { return m_value; }
|
||||
ALWAYS_INLINE float to_px(const LayoutNode& layout_node) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue