summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Christiansen <tobi@tobyase.de>2021-06-11 23:45:55 +0200
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-07-24 03:02:07 +0430
commit14640692b7a7a425b4088b717f6a49f9fd0d5609 (patch)
treeed2d37501e90bf21295457beccf60b3258dd835f
parent8c2b8fd001033d557a4ca00cf7b2c6b38b172479 (diff)
downloadserenity-14640692b7a7a425b4088b717f6a49f9fd0d5609.zip
LibWeb: Use Length::resolved() in FlexFormattingContext
It brew it's own tea resolving undefined and percentages. Let's use the API already in place rather to keep it flexible.
-rw-r--r--Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
index 5ce95b2e06..3f9b5f51ef 100644
--- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp
@@ -58,14 +58,7 @@ void FlexFormattingContext::run(Box& box, LayoutMode)
auto is_row = (flex_direction == CSS::FlexDirection::Row || flex_direction == CSS::FlexDirection::RowReverse);
auto main_size_is_infinite = false;
auto get_pixel_size = [](Box& box, const CSS::Length& length) {
- if (length.is_undefined())
- return 0.0f;
-
- if (!length.is_percentage())
- return length.to_px(box);
-
- auto percent = length.raw_value() / 100.0f;
- return box.containing_block()->width() * percent;
+ return length.resolved(CSS::Length::make_px(0), box, box.containing_block()->width()).to_px(box);
};
auto layout_for_maximum_main_size = [&](Box& box) {
if (is_row)