mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:28:11 +00:00
LibWeb: Plumb calculated StyleValues into CSS::Length
This is a bit hackish, but this way the existance of the calc() becomes transparent to the user who just wants a Length and doesn't care where it came from.
This commit is contained in:
parent
328afa32c6
commit
20667dfff5
4 changed files with 20 additions and 1 deletions
|
@ -55,6 +55,13 @@ Length StyleProperties::length_or_fallback(CSS::PropertyID id, const Length& fal
|
|||
auto value = property(id);
|
||||
if (!value.has_value())
|
||||
return fallback;
|
||||
|
||||
if (value.value()->is_calculated()) {
|
||||
Length length = Length(0, Length::Type::Calculated);
|
||||
length.set_calculated_style(verify_cast<CalculatedStyleValue>(value.value().ptr()));
|
||||
return length;
|
||||
}
|
||||
|
||||
return value.value()->to_length();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue