mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +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:
parent
d216621d2a
commit
5cdd03fc53
2 changed files with 7 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue