mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-01 21:59:11 +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
Notes:
sideshowbarker
2024-07-17 05:23:40 +09:00
Author: https://github.com/martinfalisse
Commit: 25f612f32b
Pull-request: https://github.com/SerenityOS/serenity/pull/16782
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)
|
||||
grid_max += column.max_width - column.min_width;
|
||||
|
||||
if (grid_max == 0)
|
||||
return;
|
||||
|
||||
for (auto& column : m_columns)
|
||||
column.used_width += ((column.max_width - column.min_width) / grid_max) * extra_width;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue