From f4b9a9733744db1f0c1a6ba42c4a47798cdc0472 Mon Sep 17 00:00:00 2001 From: Ernstjan Freriks Date: Fri, 10 Mar 2017 10:43:47 +0100 Subject: [PATCH] Update CssLayoutEngineTable.cs thead elements where not being styled, because the Rect size was {0,0,0,0} --- .../Core/Dom/CssLayoutEngineTable.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs b/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs index 79627161a..5fcfd4ff3 100644 --- a/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs +++ b/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs @@ -611,6 +611,7 @@ private void LayoutCells(RGraphics g) double cury = starty; double maxRight = startx; double maxBottom = 0f; + double maxHeaderBottom = 0f; int currentrow = 0; // change start X by if the table should align to center or right @@ -634,6 +635,7 @@ private void LayoutCells(RGraphics g) for (int j = 0; j < row.Boxes.Count; j++) { CssBox cell = row.Boxes[j]; + var isHeader = cell.HtmlTag != null && cell.HtmlTag.Name == "th"; if (curCol >= _columnWidths.Length) break; @@ -660,6 +662,11 @@ private void LayoutCells(RGraphics g) maxRight = Math.Max(maxRight, cell.ActualRight); curCol++; curx = cell.ActualRight + GetHorizontalSpacing(); + + if (isHeader) + { + maxHeaderBottom = maxBottom; + } } foreach (CssBox cell in row.Boxes) @@ -708,6 +715,13 @@ private void LayoutCells(RGraphics g) maxRight = Math.Max(maxRight, _tableBox.Location.X + _tableBox.ActualWidth); _tableBox.ActualRight = maxRight + GetHorizontalSpacing() + _tableBox.ActualBorderRightWidth; _tableBox.ActualBottom = Math.Max(maxBottom, starty) + GetVerticalSpacing() + _tableBox.ActualBorderBottomWidth; + + if (_headerBox != null) + { + _headerBox.Location = _tableBox.Location; + _headerBox.ActualRight = maxRight + GetHorizontalSpacing() + _headerBox.ActualBorderRightWidth; + _headerBox.ActualBottom = Math.Max(maxHeaderBottom, starty) + GetVerticalSpacing() + _headerBox.ActualBorderBottomWidth; + } } /// @@ -1036,4 +1050,4 @@ private double GetVerticalSpacing() #endregion } -} \ No newline at end of file +}