mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +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
Notes:
sideshowbarker
2024-07-17 19:49:04 +09:00
Author: https://github.com/AtkinsSJ
Commit: ce0a516e59
Pull-request: https://github.com/SerenityOS/serenity/pull/12167
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