diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-01-25 12:11:23 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-04 13:52:02 +0100 |
commit | ce0a516e59ad6bb40e4ef2f9314471004b571ac8 (patch) | |
tree | 09588ce7e85f3eeb897d7266dcbb344d5fc4ec47 /Userland/Libraries/LibWeb/CSS/StyleProperties.cpp | |
parent | db04b5687d4b15c4f51b3e30e386acb95c7221bd (diff) | |
download | serenity-ce0a516e59ad6bb40e4ef2f9314471004b571ac8.zip |
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. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleProperties.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleProperties.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index e53e9c5b85..5a76672d0c 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -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()) |