mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
LibWeb: Parse Angle/Frequency/Resolution/Time types
This commit is contained in:
parent
f76a541819
commit
5c8ea81d21
2 changed files with 152 additions and 9 deletions
|
@ -178,6 +178,16 @@ private:
|
|||
|
||||
class Dimension {
|
||||
public:
|
||||
Dimension(Angle&& value)
|
||||
: m_value(move(value))
|
||||
{
|
||||
}
|
||||
|
||||
Dimension(Frequency&& value)
|
||||
: m_value(move(value))
|
||||
{
|
||||
}
|
||||
|
||||
Dimension(Length&& value)
|
||||
: m_value(move(value))
|
||||
{
|
||||
|
@ -187,17 +197,48 @@ private:
|
|||
{
|
||||
}
|
||||
|
||||
Dimension(Resolution&& value)
|
||||
: m_value(move(value))
|
||||
{
|
||||
}
|
||||
|
||||
Dimension(Time&& value)
|
||||
: m_value(move(value))
|
||||
{
|
||||
}
|
||||
|
||||
bool is_angle() const;
|
||||
Angle angle() const;
|
||||
|
||||
bool is_angle_percentage() const;
|
||||
AnglePercentage angle_percentage() const;
|
||||
|
||||
bool is_frequency() const;
|
||||
Frequency frequency() const;
|
||||
|
||||
bool is_frequency_percentage() const;
|
||||
FrequencyPercentage frequency_percentage() const;
|
||||
|
||||
bool is_length() const;
|
||||
Length length() const;
|
||||
|
||||
bool is_percentage() const;
|
||||
Percentage percentage() const;
|
||||
|
||||
bool is_length_percentage() const;
|
||||
LengthPercentage length_percentage() const;
|
||||
|
||||
bool is_percentage() const;
|
||||
Percentage percentage() const;
|
||||
|
||||
bool is_resolution() const;
|
||||
Resolution resolution() const;
|
||||
|
||||
bool is_time() const;
|
||||
Time time() const;
|
||||
|
||||
bool is_time_percentage() const;
|
||||
TimePercentage time_percentage() const;
|
||||
|
||||
private:
|
||||
Variant<Length, Percentage> m_value;
|
||||
Variant<Angle, Frequency, Length, Percentage, Resolution, Time> m_value;
|
||||
};
|
||||
Optional<Dimension> parse_dimension(StyleComponentValueRule const&);
|
||||
Optional<Color> parse_color(StyleComponentValueRule const&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue