mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
LibWeb: Start fleshing out support for relative CSS units
This patch introduces support for more than just "absolute px" units in our Length class. It now also supports "em" and "rem", which are units relative to the font-size of the current layout node and the <html> element's layout node respectively.
This commit is contained in:
parent
d93bf78346
commit
731685468a
16 changed files with 163 additions and 92 deletions
|
@ -212,7 +212,7 @@ public:
|
|||
|
||||
virtual String to_string() const override { return String::format("%g%%", m_percentage); }
|
||||
|
||||
Length to_length(float reference) const { return Length((m_percentage / 100.0f) * reference, Length::Type::Absolute); }
|
||||
Length to_length(float reference) const { return Length((m_percentage / 100.0f) * reference, Length::Type::Px); }
|
||||
|
||||
private:
|
||||
virtual Length to_length() const override { return {}; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue