mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:47:35 +00:00
LibWeb: Make resolution calculable
No tests unfortunately, because no CSS property we currently support accepts `<resolution>`.
This commit is contained in:
parent
e907ad44c3
commit
30dcbc306c
7 changed files with 67 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <LibWeb/CSS/Frequency.h>
|
||||
#include <LibWeb/CSS/Length.h>
|
||||
#include <LibWeb/CSS/Percentage.h>
|
||||
#include <LibWeb/CSS/Resolution.h>
|
||||
#include <LibWeb/CSS/StyleValue.h>
|
||||
#include <LibWeb/CSS/Time.h>
|
||||
|
||||
|
@ -33,6 +34,7 @@ public:
|
|||
Length,
|
||||
Number,
|
||||
Percentage,
|
||||
Resolution,
|
||||
Time,
|
||||
};
|
||||
|
||||
|
@ -49,7 +51,7 @@ public:
|
|||
|
||||
class CalculationResult {
|
||||
public:
|
||||
using Value = Variant<Number, Angle, Flex, Frequency, Length, Percentage, Time>;
|
||||
using Value = Variant<Number, Angle, Flex, Frequency, Length, Percentage, Resolution, Time>;
|
||||
CalculationResult(Value value)
|
||||
: m_value(move(value))
|
||||
{
|
||||
|
@ -100,6 +102,9 @@ public:
|
|||
bool resolves_to_percentage() const { return m_resolved_type.matches_percentage(); }
|
||||
Optional<Percentage> resolve_percentage() const;
|
||||
|
||||
bool resolves_to_resolution() const { return m_resolved_type.matches_resolution(); }
|
||||
Optional<Resolution> resolve_resolution() const;
|
||||
|
||||
bool resolves_to_time() const { return m_resolved_type.matches_time(); }
|
||||
bool resolves_to_time_percentage() const { return m_resolved_type.matches_time_percentage(); }
|
||||
Optional<Time> resolve_time() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue