diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2022-01-13 17:31:00 +0330 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2022-01-14 11:35:40 +0330 |
commit | 9de33629daa95a0bb175824d189dc8ae1f65a77d (patch) | |
tree | 7ea32768430d167da75ea99858419b031e700c3e /Userland/Libraries/LibWeb | |
parent | d55c130df5a3137f044220a6ee18a9e4e246bddc (diff) | |
download | serenity-9de33629daa95a0bb175824d189dc8ae1f65a77d.zip |
AK+Everywhere: Make Variant::visit() respect the Variant's constness
...and fix all the instances of visit() taking non-const arguments.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Length.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/MediaQuery.cpp | 8 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Supports.cpp | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index 2cb999f7b1..9f51e56fc7 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -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); }); } diff --git a/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp b/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp index f25aa62fda..e872bf3b83 100644 --- a/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp +++ b/Userland/Libraries/LibWeb/CSS/MediaQuery.cpp @@ -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(); }); } diff --git a/Userland/Libraries/LibWeb/CSS/Supports.cpp b/Userland/Libraries/LibWeb/CSS/Supports.cpp index ed375d7a11..97e4d7d073 100644 --- a/Userland/Libraries/LibWeb/CSS/Supports.cpp +++ b/Userland/Libraries/LibWeb/CSS/Supports.cpp @@ -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(); }); } |