LibWeb: Use right offset for justify-content: flex-end

Offsets in this algorithm are relative to the starting position, so it
should be 0 whether its `flex-start` or `flex-end`.
This commit is contained in:
Andreas Kling 2022-07-19 23:30:52 +02:00
parent a6e1b9eed2
commit b7003194d2

View file

@ -1106,16 +1106,8 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
switch (flex_container().computed_values().justify_content()) {
case CSS::JustifyContent::FlexStart:
if (is_direction_reverse())
space_before_first_item = m_available_space->main.value_or(NumericLimits<float>::max());
else
space_before_first_item = 0;
break;
case CSS::JustifyContent::FlexEnd:
if (is_direction_reverse())
space_before_first_item = 0;
else
space_before_first_item = m_available_space->main.value_or(NumericLimits<float>::max());
space_before_first_item = 0;
break;
case CSS::JustifyContent::Center:
space_before_first_item = (m_available_space->main.value_or(NumericLimits<float>::max()) - used_main_space) / 2.0f;