mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
AK+Everywhere: Make Variant::visit() respect the Variant's constness
...and fix all the instances of visit() taking non-const arguments.
This commit is contained in:
parent
d55c130df5
commit
9de33629da
7 changed files with 44 additions and 31 deletions
|
@ -23,16 +23,16 @@ NonnullRefPtr<MediaQuery> MediaQuery::create_not_all()
|
|||
String MediaFeatureValue::to_string() const
|
||||
{
|
||||
return m_value.visit(
|
||||
[](String& ident) { return serialize_an_identifier(ident); },
|
||||
[](Length& length) { return length.to_string(); },
|
||||
[](String const& ident) { return serialize_an_identifier(ident); },
|
||||
[](Length const& length) { return length.to_string(); },
|
||||
[](double number) { return String::number(number); });
|
||||
}
|
||||
|
||||
bool MediaFeatureValue::is_same_type(MediaFeatureValue const& other) const
|
||||
{
|
||||
return m_value.visit(
|
||||
[&](String&) { return other.is_ident(); },
|
||||
[&](Length&) { return other.is_length(); },
|
||||
[&](String const&) { return other.is_ident(); },
|
||||
[&](Length const&) { return other.is_length(); },
|
||||
[&](double) { return other.is_number(); });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue