mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Allow LengthPercentage to hold a calculated value
Most of the time, we cannot resolve a `calc()` expression until we go to use it. Since any `<length-percentage>` can legally be a `calc ()`, let's store it in `LengthPercentage` rather than make every single user care about this distinction.
This commit is contained in:
parent
f0fb84dfcb
commit
ce0de4b2b4
Notes:
sideshowbarker
2024-07-17 19:48:44 +09:00
Author: https://github.com/AtkinsSJ
Commit: ce0de4b2b4
Pull-request: https://github.com/SerenityOS/serenity/pull/12167
11 changed files with 145 additions and 107 deletions
|
@ -70,10 +70,8 @@ LengthPercentage StyleProperties::length_percentage_or_fallback(CSS::PropertyID
|
|||
return fallback;
|
||||
auto& value = maybe_value.value();
|
||||
|
||||
if (value->is_calculated()) {
|
||||
// FIXME: Handle percentages here
|
||||
return Length::make_calculated(value->as_calculated());
|
||||
}
|
||||
if (value->is_calculated())
|
||||
return LengthPercentage { value->as_calculated() };
|
||||
|
||||
if (value->is_percentage())
|
||||
return value->as_percentage().percentage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue