1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

LibWeb: Use ValueID for media-query identifiers

This commit is contained in:
Sam Atkins 2022-03-08 17:57:37 +00:00 committed by Andreas Kling
parent 0371d33132
commit fd47460141
4 changed files with 26 additions and 24 deletions

View file

@ -22,7 +22,7 @@ namespace Web::CSS {
// https://www.w3.org/TR/mediaqueries-4/#typedef-mf-value
class MediaFeatureValue {
public:
explicit MediaFeatureValue(String ident)
explicit MediaFeatureValue(ValueID ident)
: m_value(move(ident))
{
}
@ -49,17 +49,17 @@ public:
String to_string() const;
bool is_ident() const { return m_value.has<String>(); }
bool is_ident() const { return m_value.has<ValueID>(); }
bool is_length() const { return m_value.has<Length>(); }
bool is_number() const { return m_value.has<double>(); }
bool is_ratio() const { return m_value.has<Ratio>(); }
bool is_resolution() const { return m_value.has<Resolution>(); }
bool is_same_type(MediaFeatureValue const& other) const;
String const& ident() const
ValueID const& ident() const
{
VERIFY(is_ident());
return m_value.get<String>();
return m_value.get<ValueID>();
}
Length const& length() const
@ -87,7 +87,7 @@ public:
}
private:
Variant<String, Length, Ratio, Resolution, double> m_value;
Variant<ValueID, Length, Ratio, Resolution, double> m_value;
};
// https://www.w3.org/TR/mediaqueries-4/#mq-features