Skip to content

Commit f4b9a97

Browse files
EjaYFeXpl0it3r
authored andcommitted
Update CssLayoutEngineTable.cs
thead elements where not being styled, because the Rect size was {0,0,0,0}
1 parent 0b3cd8c commit f4b9a97

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ private void LayoutCells(RGraphics g)
611611
double cury = starty;
612612
double maxRight = startx;
613613
double maxBottom = 0f;
614+
double maxHeaderBottom = 0f;
614615
int currentrow = 0;
615616

616617
// change start X by if the table should align to center or right
@@ -634,6 +635,7 @@ private void LayoutCells(RGraphics g)
634635
for (int j = 0; j < row.Boxes.Count; j++)
635636
{
636637
CssBox cell = row.Boxes[j];
638+
var isHeader = cell.HtmlTag != null && cell.HtmlTag.Name == "th";
637639
if (curCol >= _columnWidths.Length)
638640
break;
639641

@@ -660,6 +662,11 @@ private void LayoutCells(RGraphics g)
660662
maxRight = Math.Max(maxRight, cell.ActualRight);
661663
curCol++;
662664
curx = cell.ActualRight + GetHorizontalSpacing();
665+
666+
if (isHeader)
667+
{
668+
maxHeaderBottom = maxBottom;
669+
}
663670
}
664671

665672
foreach (CssBox cell in row.Boxes)
@@ -708,6 +715,13 @@ private void LayoutCells(RGraphics g)
708715
maxRight = Math.Max(maxRight, _tableBox.Location.X + _tableBox.ActualWidth);
709716
_tableBox.ActualRight = maxRight + GetHorizontalSpacing() + _tableBox.ActualBorderRightWidth;
710717
_tableBox.ActualBottom = Math.Max(maxBottom, starty) + GetVerticalSpacing() + _tableBox.ActualBorderBottomWidth;
718+
719+
if (_headerBox != null)
720+
{
721+
_headerBox.Location = _tableBox.Location;
722+
_headerBox.ActualRight = maxRight + GetHorizontalSpacing() + _headerBox.ActualBorderRightWidth;
723+
_headerBox.ActualBottom = Math.Max(maxHeaderBottom, starty) + GetVerticalSpacing() + _headerBox.ActualBorderBottomWidth;
724+
}
711725
}
712726

713727
/// <summary>
@@ -1036,4 +1050,4 @@ private double GetVerticalSpacing()
10361050

10371051
#endregion
10381052
}
1039-
}
1053+
}

0 commit comments

Comments
 (0)