mirror of
https://github.com/RGBCube/serenity
synced 2025-06-29 03:22:06 +00:00
LibWeb: Resolve calc() FooPercentages that only contained percentages
Fixes #14697 Percentages inside `calc()` only got converted to the concrete type (eg, Length) when added or subtracted with one. So if the `calc ()` doesn't contain any of that type, it would resolve to a Percentage. Now, we catch that returned Percentage and convert it to the proper type. This fixes cases like `width: calc(100% / 2);`.
This commit is contained in:
parent
ef2469bfed
commit
3fce4f7c91
1 changed files with 9 additions and 0 deletions
|
@ -669,6 +669,9 @@ Optional<Angle> CalculatedStyleValue::resolve_angle_percentage(Angle const& perc
|
|||
[&](Angle const& angle) -> Optional<Angle> {
|
||||
return angle;
|
||||
},
|
||||
[&](Percentage const& percentage) -> Optional<Angle> {
|
||||
return percentage_basis.percentage_of(percentage);
|
||||
},
|
||||
[&](auto const&) -> Optional<Angle> {
|
||||
return {};
|
||||
});
|
||||
|
@ -691,6 +694,9 @@ Optional<Frequency> CalculatedStyleValue::resolve_frequency_percentage(Frequency
|
|||
[&](Frequency const& frequency) -> Optional<Frequency> {
|
||||
return frequency;
|
||||
},
|
||||
[&](Percentage const& percentage) -> Optional<Frequency> {
|
||||
return percentage_basis.percentage_of(percentage);
|
||||
},
|
||||
[&](auto const&) -> Optional<Frequency> {
|
||||
return {};
|
||||
});
|
||||
|
@ -713,6 +719,9 @@ Optional<Length> CalculatedStyleValue::resolve_length_percentage(Layout::Node co
|
|||
[&](Length const& length) -> Optional<Length> {
|
||||
return length;
|
||||
},
|
||||
[&](Percentage const& percentage) -> Optional<Length> {
|
||||
return percentage_basis.percentage_of(percentage);
|
||||
},
|
||||
[&](auto const&) -> Optional<Length> {
|
||||
return {};
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue