Skip to content

Commit c95ae5f

Browse files
author
ArthurHub
committed
* Fix table columns width incorrect unit handling
1 parent 24ef84a commit c95ae5f

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

‎Source/HtmlRenderer/Dom/CssLayoutEngineTable.cs‎

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -339,25 +339,14 @@ private float CalculateCountAndWidth()
339339
i < row.Boxes.Count && //And there's a box to check
340340
row.Boxes[i].Display == CssConstants.TableCell) //And the box is a table-cell
341341
{
342-
CssLength len = new CssLength(row.Boxes[i].Width); //Get specified width
343-
344-
if (len.Number > 0) //If some width specified
342+
float len = CssValueParser.ParseLength(row.Boxes[i].Width, availCellSpace, row.Boxes[i]); //Get width as an absolute-pixel value
343+
if (len > 0) //If some width specified
345344
{
346345
int colspan = GetColSpan(row.Boxes[i]);
347-
float flen = 0f;
348-
if (len.IsPercentage) //Get width as a percentage
349-
{
350-
flen = CssValueParser.ParseNumber(row.Boxes[i].Width, availCellSpace);
351-
}
352-
else if (len.Unit == CssUnit.Pixels || len.Unit == CssUnit.None)
353-
{
354-
flen = len.Number; //Get width as an absolute-pixel value
355-
}
356-
flen /= Convert.ToSingle(colspan);
357-
346+
len /= Convert.ToSingle(colspan);
358347
for (int j = i; j < i + colspan; j++)
359348
{
360-
_columnWidths[j] = flen;
349+
_columnWidths[j] = len;
361350
}
362351
}
363352
}

0 commit comments

Comments
 (0)