diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-01-27 14:47:39 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-04 13:52:02 +0100 |
commit | b54cd17c1ee7eb0a46af8feac66ca4180df8416d (patch) | |
tree | 63693efd5e0a7baae0e8d5e41880795ae538e032 /Userland/Libraries/LibWeb/CSS/StyleValue.cpp | |
parent | ce0de4b2b4cddf199011e4edf311580a117cc5cd (diff) | |
download | serenity-b54cd17c1ee7eb0a46af8feac66ca4180df8416d.zip |
LibWeb: Allow percentage tokens again when parsing calc()
I unintentionally broke this in my LengthPercentage PR, but it was not
convenient to fix until now.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleValue.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleValue.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp index c067a015ad..cd91c4ef4a 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp @@ -574,6 +574,7 @@ Optional<CalculatedStyleValue::ResolvedType> CalculatedStyleValue::CalcValue::re return value.visit( [](float) -> Optional<CalculatedStyleValue::ResolvedType> { return { ResolvedType::Number }; }, [](Length const&) -> Optional<CalculatedStyleValue::ResolvedType> { return { ResolvedType::Length }; }, + [](Percentage const&) -> Optional<CalculatedStyleValue::ResolvedType> { return { ResolvedType::Percentage }; }, [](NonnullOwnPtr<CalcSum> const& sum) { return sum->resolved_type(); }); } @@ -604,6 +605,9 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcValue::resolve [&](Length const& length) -> CalculatedStyleValue::CalculationResult { return CalculatedStyleValue::CalculationResult { length }; }, + [&](Percentage const& percentage) -> CalculatedStyleValue::CalculationResult { + return CalculatedStyleValue::CalculationResult { percentage }; + }, [&](NonnullOwnPtr<CalcSum> const& sum) -> CalculatedStyleValue::CalculationResult { return sum->resolve(layout_node, percentage_basis); }); |