mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
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:
parent
9559f0f123
commit
6a74b01644
Notes:
github-actions[bot]
2024-08-15 12:59:33 +00:00
Author: https://github.com/AtkinsSJ
Commit: 6a74b01644
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1076
48 changed files with 702 additions and 702 deletions
|
@ -25,7 +25,7 @@ NonnullRefPtr<MediaQuery> MediaQuery::create_not_all()
|
|||
String MediaFeatureValue::to_string() const
|
||||
{
|
||||
return m_value.visit(
|
||||
[](ValueID const& ident) { return MUST(String::from_utf8(string_from_value_id(ident))); },
|
||||
[](Keyword const& ident) { return MUST(String::from_utf8(string_from_keyword(ident))); },
|
||||
[](Length const& length) { return length.to_string(); },
|
||||
[](Ratio const& ratio) { return ratio.to_string(); },
|
||||
[](Resolution const& resolution) { return resolution.to_string(); },
|
||||
|
@ -35,7 +35,7 @@ String MediaFeatureValue::to_string() const
|
|||
bool MediaFeatureValue::is_same_type(MediaFeatureValue const& other) const
|
||||
{
|
||||
return m_value.visit(
|
||||
[&](ValueID const&) { return other.is_ident(); },
|
||||
[&](Keyword const&) { return other.is_ident(); },
|
||||
[&](Length const&) { return other.is_length(); },
|
||||
[&](Ratio const&) { return other.is_ratio(); },
|
||||
[&](Resolution const&) { return other.is_resolution(); },
|
||||
|
@ -100,10 +100,10 @@ bool MediaFeature::evaluate(HTML::Window const& window) const
|
|||
if (queried_value.is_ident()) {
|
||||
// NOTE: It is not technically correct to always treat `no-preference` as false, but every
|
||||
// media-feature that accepts it as a value treats it as false, so good enough. :^)
|
||||
// If other features gain this property for other identifiers in the future, we can
|
||||
// If other features gain this property for other keywords in the future, we can
|
||||
// add more robust handling for them then.
|
||||
return queried_value.ident() != ValueID::None
|
||||
&& queried_value.ident() != ValueID::NoPreference;
|
||||
return queried_value.ident() != Keyword::None
|
||||
&& queried_value.ident() != Keyword::NoPreference;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue