mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
LibWeb: Prevent column sizing errors for html table
Previously when there was no difference between the sum of the max and min-widths of all columns of a table, it would result in a NaN value being set as the column's width as there was a division by 0. This would result in 2+ column tables being reduced to only 1 column.
This commit is contained in:
parent
c88aa21302
commit
25f612f32b
1 changed files with 3 additions and 0 deletions
|
@ -190,6 +190,9 @@ void TableFormattingContext::distribute_width_to_columns(float extra_width)
|
||||||
for (auto& column : m_columns)
|
for (auto& column : m_columns)
|
||||||
grid_max += column.max_width - column.min_width;
|
grid_max += column.max_width - column.min_width;
|
||||||
|
|
||||||
|
if (grid_max == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
for (auto& column : m_columns)
|
for (auto& column : m_columns)
|
||||||
column.used_width += ((column.max_width - column.min_width) / grid_max) * extra_width;
|
column.used_width += ((column.max_width - column.min_width) / grid_max) * extra_width;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue