Skip to content

Commit bb97a93

Browse files
author
ArthurHub
committed
* handle all table cell width is provided but smaller than table width
1 parent c95ae5f commit bb97a93

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎Source/HtmlRenderer/Dom/CssLayoutEngineTable.cs‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,20 @@ private void DetermineMissingColumnWidths(float availCellSpace)
426426

427427
if (numOfNans == 0 && occupedSpace < availCellSpace)
428428
{
429-
// spread extra width between all columns
430-
float extWidth = (availCellSpace - occupedSpace) / orgNumOfNans;
431-
for (int i = 0; i < _columnWidths.Length; i++)
432-
if (orgColWidths == null || float.IsNaN(orgColWidths[i]))
433-
_columnWidths[i] += extWidth;
429+
if (orgNumOfNans > 0)
430+
{
431+
// spread extra width between all non width specified columns
432+
float extWidth = (availCellSpace - occupedSpace) / orgNumOfNans;
433+
for (int i = 0; i < _columnWidths.Length; i++)
434+
if (orgColWidths == null || float.IsNaN(orgColWidths[i]))
435+
_columnWidths[i] += extWidth;
436+
}
437+
else
438+
{
439+
// spread extra width between all columns with respect to relative sizes
440+
for (int i = 0; i < _columnWidths.Length; i++)
441+
_columnWidths[i] += (availCellSpace - occupedSpace) * (_columnWidths[i] / occupedSpace);
442+
}
434443
}
435444
}
436445
else

0 commit comments

Comments
 (0)