summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-07-14 12:52:01 +0200
committerAndreas Kling <kling@serenityos.org>2022-07-15 14:11:19 +0200
commit884b7fad484cd80fcebb14742bc9fac58c2b4a51 (patch)
tree05f5648ecd33aadaa7bf85cbedb0e167292ec87a
parent0636e1db61bb24bebef333307f1f30787ea0cce5 (diff)
downloadserenity-884b7fad484cd80fcebb14742bc9fac58c2b4a51.zip
LibWeb: Remove weird is_undefined_or_auto() helper in FFC
This was a leftover from when ComputedValues stored sizes in Optionals. Now that we've gotten rid of the "undefined" state, there's no need for this helper, we can just access the size values directly.
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp25
1 files changed, 8 insertions, 17 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 02f92d94c6..9b85dab7da 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -35,13 +35,6 @@ static float get_pixel_size(FormattingState const& state, Box const& box, Option
return length_percentage->resolved(box, inner_main_size).to_px(box);
}
-static bool is_undefined_or_auto(Optional<CSS::LengthPercentage> const& length_percentage)
-{
- if (!length_percentage.has_value())
- return true;
- return length_percentage->is_length() && length_percentage->length().is_auto();
-}
-
FlexFormattingContext::FlexFormattingContext(FormattingState& state, Box const& flex_container, FormattingContext* parent)
: FormattingContext(Type::Flex, state, flex_container, parent)
, m_flex_container_state(m_state.get_mutable(flex_container))
@@ -306,14 +299,14 @@ float FlexFormattingContext::resolved_definite_main_size(Box const& box) const
bool FlexFormattingContext::has_main_min_size(Box const& box) const
{
- auto value = is_row_layout() ? box.computed_values().min_width() : box.computed_values().min_height();
- return !is_undefined_or_auto(value);
+ auto const& value = is_row_layout() ? box.computed_values().min_width() : box.computed_values().min_height();
+ return !value.is_auto();
}
bool FlexFormattingContext::has_cross_min_size(Box const& box) const
{
- auto value = is_row_layout() ? box.computed_values().min_height() : box.computed_values().min_width();
- return !is_undefined_or_auto(value);
+ auto const& value = is_row_layout() ? box.computed_values().min_height() : box.computed_values().min_width();
+ return !value.is_auto();
}
bool FlexFormattingContext::has_definite_cross_size(Box const& box) const
@@ -344,16 +337,14 @@ float FlexFormattingContext::specified_cross_min_size(Box const& box) const
bool FlexFormattingContext::has_main_max_size(Box const& box) const
{
- return is_row_layout()
- ? !is_undefined_or_auto(box.computed_values().max_width())
- : !is_undefined_or_auto(box.computed_values().max_height());
+ auto const& value = is_row_layout() ? box.computed_values().max_width() : box.computed_values().max_height();
+ return !value.is_auto();
}
bool FlexFormattingContext::has_cross_max_size(Box const& box) const
{
- return is_row_layout()
- ? !is_undefined_or_auto(box.computed_values().max_height())
- : !is_undefined_or_auto(box.computed_values().max_width());
+ auto const& value = !is_row_layout() ? box.computed_values().max_width() : box.computed_values().max_height();
+ return !value.is_auto();
}
float FlexFormattingContext::specified_main_max_size(Box const& box) const