From 73edeb7ed729fdf15de3f637c03fbb2011a43789 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}. So I added some calculations in LayoutCells for this. --- .../HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs b/Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs index 79627161a..c0e4186af 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.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,11 @@ 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; + +#warning EFR : Added headerbox calculation + _headerBox.Location = _tableBox.Location; + _headerBox.ActualRight = maxRight + GetHorizontalSpacing() + _headerBox.ActualBorderRightWidth; + _headerBox.ActualBottom = Math.Max(maxHeaderBottom, starty) + GetVerticalSpacing() + _headerBox.ActualBorderBottomWidth; } /// @@ -1036,4 +1048,4 @@ private double GetVerticalSpacing() #endregion } -} \ No newline at end of file +}