mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibWeb: Replace Length::set_calculated_style() with ::make_calculated()
There's no need to modify the Length's calculated-value after creating it, so let's make it immutable. :^)
This commit is contained in:
parent
db04b5687d
commit
ce0a516e59
4 changed files with 12 additions and 18 deletions
|
@ -54,11 +54,8 @@ Length StyleProperties::length_or_fallback(CSS::PropertyID id, Length const& fal
|
|||
return fallback;
|
||||
auto& value = maybe_value.value();
|
||||
|
||||
if (value->is_calculated()) {
|
||||
Length length = Length(0, Length::Type::Calculated);
|
||||
length.set_calculated_style(&value->as_calculated());
|
||||
return length;
|
||||
}
|
||||
if (value->is_calculated())
|
||||
return Length::make_calculated(value->as_calculated());
|
||||
|
||||
if (value->has_length())
|
||||
return value->to_length();
|
||||
|
@ -75,9 +72,7 @@ LengthPercentage StyleProperties::length_percentage_or_fallback(CSS::PropertyID
|
|||
|
||||
if (value->is_calculated()) {
|
||||
// FIXME: Handle percentages here
|
||||
Length length = Length(0, Length::Type::Calculated);
|
||||
length.set_calculated_style(&value->as_calculated());
|
||||
return length;
|
||||
return Length::make_calculated(value->as_calculated());
|
||||
}
|
||||
|
||||
if (value->is_percentage())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue