mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 17:58:18 +03:00
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.
This commit is contained in:
parent
8c2b8fd001
commit
14640692b7
Notes:
sideshowbarker
2024-07-18 08:25:45 +09:00
Author: https://github.com/TobyAsE Commit: https://github.com/SerenityOS/serenity/commit/14640692b7a Pull-request: https://github.com/SerenityOS/serenity/pull/8043 Reviewed-by: https://github.com/alimpfard
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user