mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +00:00
LibWeb: Expose type and raw values of basic CSS types
This makes it possible to do arithmetic on them without having to resolve to their canonical unit, which often requires context information that is not available until the last minute. For example, a Length cannot be resolved to px without knowing the font size, parent element's size, etc. Only Length currently requires such context, but treating all these types the same means that code that manipulates them does not need to know or care if a new unit gets added that does require contextual information.
This commit is contained in:
parent
89e55c5297
commit
5f2f780662
5 changed files with 11 additions and 0 deletions
|
@ -30,6 +30,9 @@ public:
|
|||
ErrorOr<String> to_string() const;
|
||||
float to_degrees() const;
|
||||
|
||||
Type type() const { return m_type; }
|
||||
float raw_value() const { return m_value; }
|
||||
|
||||
bool operator==(Angle const& other) const
|
||||
{
|
||||
return m_type == other.m_type && m_value == other.m_value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue