LibWeb: Rename "identifier" and "ValueID" to "Keyword" where correct

For a long time, we've used two terms, inconsistently:
- "Identifier" is a spec term, but refers to a sequence of alphanumeric
  characters, which may or may not be a keyword. (Keywords are a
  subset of all identifiers.)
- "ValueID" is entirely non-spec, and is directly called a "keyword" in
  the CSS specs.

So to avoid confusion as much as possible, let's align with the spec
terminology. I've attempted to change variable names as well, but
obviously we use Keywords in a lot of places in LibWeb and so I may
have missed some.

One exception is that I've not renamed "valid-identifiers" in
Properties.json... I'd like to combine that and the "valid-types" array
together eventually, so there's no benefit to doing an extra rename
now.
This commit is contained in:
Sam Atkins 2024-08-14 14:06:03 +01:00 committed by Sam Atkins
commit 6a74b01644
Notes: github-actions[bot] 2024-08-15 12:59:33 +00:00
48 changed files with 702 additions and 702 deletions

View file

@ -21,7 +21,7 @@ namespace Web::CSS {
// https://www.w3.org/TR/mediaqueries-4/#typedef-mf-value
class MediaFeatureValue {
public:
explicit MediaFeatureValue(ValueID ident)
explicit MediaFeatureValue(Keyword ident)
: m_value(move(ident))
{
}
@ -48,17 +48,17 @@ public:
String to_string() const;
bool is_ident() const { return m_value.has<ValueID>(); }
bool is_ident() const { return m_value.has<Keyword>(); }
bool is_length() const { return m_value.has<Length>(); }
bool is_number() const { return m_value.has<float>(); }
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;
ValueID const& ident() const
Keyword const& ident() const
{
VERIFY(is_ident());
return m_value.get<ValueID>();
return m_value.get<Keyword>();
}
Length const& length() const
@ -86,7 +86,7 @@ public:
}
private:
Variant<ValueID, Length, Ratio, Resolution, float> m_value;
Variant<Keyword, Length, Ratio, Resolution, float> m_value;
};
// https://www.w3.org/TR/mediaqueries-4/#mq-features