mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibWeb: Fix divisions by zero in FFC and GFC
This is the preparation to use fixed-point to represent CSSPixels. Previously, it was acceptable to divide CSSPixels by zero, resulting in inf, but after migrating to fixed-point stored as an integer, it would lead to undefined behavior.
This commit is contained in:
committed by
Andreas Kling
parent
d216621d2a
commit
5cdd03fc53
@@ -1301,7 +1301,7 @@ void FlexFormattingContext::distribute_any_remaining_free_space()
|
||||
CSSPixels initial_offset = 0;
|
||||
auto number_of_items = flex_line.items.size();
|
||||
|
||||
if (auto_margins == 0) {
|
||||
if (auto_margins == 0 && number_of_items > 0) {
|
||||
switch (flex_container().computed_values().justify_content()) {
|
||||
case CSS::JustifyContent::Start:
|
||||
case CSS::JustifyContent::FlexStart:
|
||||
|
||||
Reference in New Issue
Block a user