mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:07:46 +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
|
@ -123,10 +123,10 @@ static float resolve_calc_value(CalculatedStyleValue::CalcValue const& calc_valu
|
|||
{
|
||||
return calc_value.visit(
|
||||
[](float value) { return value; },
|
||||
[&](Length length) {
|
||||
[&](Length const& length) {
|
||||
return length.resolved_or_zero(layout_node, reference_for_percent).to_px(layout_node);
|
||||
},
|
||||
[&](NonnullOwnPtr<CalculatedStyleValue::CalcSum>& calc_sum) {
|
||||
[&](NonnullOwnPtr<CalculatedStyleValue::CalcSum> const& calc_sum) {
|
||||
return resolve_calc_sum(calc_sum, layout_node, reference_for_percent);
|
||||
},
|
||||
[](auto&) {
|
||||
|
@ -173,7 +173,7 @@ static float resolve_calc_number_value(CalculatedStyleValue::CalcNumberValue con
|
|||
{
|
||||
return number_value.visit(
|
||||
[](float number) { return number; },
|
||||
[](NonnullOwnPtr<CalculatedStyleValue::CalcNumberSum>& calc_number_sum) {
|
||||
[](NonnullOwnPtr<CalculatedStyleValue::CalcNumberSum> const& calc_number_sum) {
|
||||
return resolve_calc_number_sum(calc_number_sum);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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(); });
|
||||
}
|
||||
|
||||
|
|
|
@ -35,13 +35,13 @@ MatchResult Supports::Condition::evaluate() const
|
|||
MatchResult Supports::InParens::evaluate() const
|
||||
{
|
||||
return value.visit(
|
||||
[&](NonnullOwnPtr<Condition>& condition) {
|
||||
[&](NonnullOwnPtr<Condition> const& condition) {
|
||||
return condition->evaluate();
|
||||
},
|
||||
[&](Feature& feature) {
|
||||
[&](Feature const& feature) {
|
||||
return feature.evaluate();
|
||||
},
|
||||
[&](GeneralEnclosed& general_enclosed) {
|
||||
[&](GeneralEnclosed const& general_enclosed) {
|
||||
return general_enclosed.evaluate();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue